From: <br...@us...> - 2009-02-13 23:14:23
|
Revision: 503 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=503&view=rev Author: brus07 Date: 2009-02-13 23:14:18 +0000 (Fri, 13 Feb 2009) Log Message: ----------- Added mew concrete web connector. ExtendedWebConnector for connector to website with authorization. (now this is copy of SampleWebConnector) Modified Paths: -------------- ACMServer/trunk/ACMServer/ACMMediator.sln Added Paths: ----------- ACMServer/trunk/ACMServer/Library/ConcreteConnector/ExtendedWebConnector/ ACMServer/trunk/ACMServer/Library/ConcreteConnector/ExtendedWebConnector/ExtendedWebConnector.csproj ACMServer/trunk/ACMServer/Library/ConcreteConnector/ExtendedWebConnector/Properties/ ACMServer/trunk/ACMServer/Library/ConcreteConnector/ExtendedWebConnector/Properties/AssemblyInfo.cs ACMServer/trunk/ACMServer/Library/ConcreteConnector/ExtendedWebConnector/SampleWebConnector.cs Modified: ACMServer/trunk/ACMServer/ACMMediator.sln =================================================================== --- ACMServer/trunk/ACMServer/ACMMediator.sln 2009-02-12 16:55:36 UTC (rev 502) +++ ACMServer/trunk/ACMServer/ACMMediator.sln 2009-02-13 23:14:18 UTC (rev 503) @@ -45,6 +45,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IoiSubmitGuiPlugin", "Plugins\IoiPlugin\IoiSubmitGuiPlugin\IoiSubmitGuiPlugin.csproj", "{96664041-18B2-42BD-941F-117B54E2AE64}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExtendedWebConnector", "Library\ConcreteConnector\ExtendedWebConnector\ExtendedWebConnector.csproj", "{28A3AAA0-0938-48CF-B66E-B056C0F865B9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -115,6 +117,10 @@ {96664041-18B2-42BD-941F-117B54E2AE64}.Debug|Any CPU.Build.0 = Debug|Any CPU {96664041-18B2-42BD-941F-117B54E2AE64}.Release|Any CPU.ActiveCfg = Release|Any CPU {96664041-18B2-42BD-941F-117B54E2AE64}.Release|Any CPU.Build.0 = Release|Any CPU + {28A3AAA0-0938-48CF-B66E-B056C0F865B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28A3AAA0-0938-48CF-B66E-B056C0F865B9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28A3AAA0-0938-48CF-B66E-B056C0F865B9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28A3AAA0-0938-48CF-B66E-B056C0F865B9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -136,6 +142,7 @@ {79EB24DD-AF0D-40D0-974E-198F4D8C92BC} = {D67E1C70-DFE6-4C3E-BCA9-DD3DB9CB4B30} {E255910C-499D-48E2-9846-7EB24DE32C4A} = {D67E1C70-DFE6-4C3E-BCA9-DD3DB9CB4B30} {45B4D72E-CD81-42A7-AD46-3471380A290F} = {4E42F296-7321-4193-9E35-9B7202005229} + {28A3AAA0-0938-48CF-B66E-B056C0F865B9} = {4E42F296-7321-4193-9E35-9B7202005229} {F36370C3-E1EB-47E8-AFAC-F4840953D60B} = {4BEB97A7-7AAB-42A3-B30A-B6CCF75AAD64} {96664041-18B2-42BD-941F-117B54E2AE64} = {4BEB97A7-7AAB-42A3-B30A-B6CCF75AAD64} EndGlobalSection Property changes on: ACMServer/trunk/ACMServer/Library/ConcreteConnector/ExtendedWebConnector ___________________________________________________________________ Added: svn:ignore + bin obj ExtendedWebConnector.csproj.user Added: tsvn:logminsize + 5 Added: ACMServer/trunk/ACMServer/Library/ConcreteConnector/ExtendedWebConnector/ExtendedWebConnector.csproj =================================================================== --- ACMServer/trunk/ACMServer/Library/ConcreteConnector/ExtendedWebConnector/ExtendedWebConnector.csproj (rev 0) +++ ACMServer/trunk/ACMServer/Library/ConcreteConnector/ExtendedWebConnector/ExtendedWebConnector.csproj 2009-02-13 23:14:18 UTC (rev 503) @@ -0,0 +1,61 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{28A3AAA0-0938-48CF-B66E-B056C0F865B9}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>AcmContester.Library.ConcreateConnector.SampleWebConnector</RootNamespace> + <AssemblyName>SampleWebConnector</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="SampleWebConnector.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Connector\Connector.csproj"> + <Project>{211DD6A5-2D73-439E-8722-ED2C89ED1DDB}</Project> + <Name>Connector</Name> + </ProjectReference> + <ProjectReference Include="..\..\Data\Data.csproj"> + <Project>{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}</Project> + <Name>Data</Name> + </ProjectReference> + <ProjectReference Include="..\..\LibraryExtention\LibraryExtention.csproj"> + <Project>{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}</Project> + <Name>LibraryExtention</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file Property changes on: ACMServer/trunk/ACMServer/Library/ConcreteConnector/ExtendedWebConnector/Properties ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: ACMServer/trunk/ACMServer/Library/ConcreteConnector/ExtendedWebConnector/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/ConcreteConnector/ExtendedWebConnector/Properties/AssemblyInfo.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/ConcreteConnector/ExtendedWebConnector/Properties/AssemblyInfo.cs 2009-02-13 23:14:18 UTC (rev 503) @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ExtendedWebConnector")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("AcmContester")] +[assembly: AssemblyProduct("ExtendedWebConnector")] +[assembly: AssemblyCopyright("Copyright © Home 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("1f472191-9057-4161-bcb1-d5c0000fc10d")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyFileVersion("1.0.0.0")] Added: ACMServer/trunk/ACMServer/Library/ConcreteConnector/ExtendedWebConnector/SampleWebConnector.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/ConcreteConnector/ExtendedWebConnector/SampleWebConnector.cs (rev 0) +++ ACMServer/trunk/ACMServer/Library/ConcreteConnector/ExtendedWebConnector/SampleWebConnector.cs 2009-02-13 23:14:18 UTC (rev 503) @@ -0,0 +1,98 @@ +using System; +using AcmContester.Library.Connector.Getter; +using AcmContester.Library.LibraryExtention; +using AcmContester.Library.LibraryExtention.Data; +using System.Net; +using System.IO; + +namespace AcmContester.Library.ConcreateConnector.SampleWebConnector +{ + public class SampleWebConnector : IGetter + { + //"http://127.0.0.1/d"; + string fullPathToWebPages = ""; + + #region IGetter Members + + public string PathToSource + { + get + { + return fullPathToWebPages; + } + set + { + fullPathToWebPages = value; + } + } + + public SystemMessage GetData() + { + return new SystemMessage(GetFullInfoFromSite()); + } + + public void Send(SystemMessage message) + { + if (message.IsType("TestingResult") == true) + { + SendTestingResultToSite(message.Message); + } + } + + #endregion + + + void SendTestingResultToSite(string message) + { + string res = ""; + string id = ""; + string usedMemory = ""; + string usedTime = ""; + + //TODO: + Result result = Result.CreateFromXml(message); + res = result.res; + id = result.Submit.id.ToString(); + usedMemory = result.usedMemory.ToString(); + usedTime = result.usedTime.ToString(); + + string fullURL = fullPathToWebPages + "/set.php?"; + fullURL += "res=" + res; + fullURL += "&id=" + id; + fullURL += "&usedMemory=" + usedMemory; + fullURL += "&usedTime=" + usedTime; + HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(fullURL); + myRequest.Method = "GET"; + WebResponse myResponse = myRequest.GetResponse(); + myResponse.Close(); + } + + + + string GetFullInfoFromSite() + { + string result = null; + try + { + HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(fullPathToWebPages + "/get.php"); + myRequest.Method = "GET"; + //myRequest.Timeout = 100000; + WebResponse myResponse = myRequest.GetResponse(); + StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8); + result = sr.ReadToEnd(); + sr.Close(); + myResponse.Close(); + if (result.Length == 0) + return null; + } + catch (WebException wex) + { + if (wex.Status == WebExceptionStatus.Timeout) + { + return "SystemResult: Timeout"; + } + } + return result; + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |