[csmaild-cvs] csmaild/src/TestClient .cvsignore,NONE,1.1 App.ico,NONE,1.1 AssemblyInfo.cs,NONE,1.1 C
Brought to you by:
tamc
Update of /cvsroot/csmaild/csmaild/src/TestClient In directory sc8-pr-cvs1:/tmp/cvs-serv32149/src/TestClient Added Files: .cvsignore App.ico AssemblyInfo.cs ClientHelper.cs Main.cs Main.resx TestClient.csproj TestClient.csproj.user Log Message: Long time, no commit. Upgraded to VS.NET 2003 Lots of code changes, still pre-pre-pre-alpha, so who's keeping track --- NEW FILE: .cvsignore --- common.csproj.user bin obj --- NEW FILE: App.ico --- (This appears to be a binary file; contents omitted.) --- NEW FILE: AssemblyInfo.cs --- using System.Reflection; using System.Runtime.CompilerServices; // // 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("")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // // 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.*")] // // In order to sign your assembly you must specify a key to use. Refer to the // Microsoft .NET Framework documentation for more information on assembly signing. // // Use the attributes below to control which key is used for signing. // // Notes: // (*) If no key is specified, the assembly is not signed. // (*) KeyName refers to a key that has been installed in the Crypto Service // Provider (CSP) on your machine. KeyFile refers to a file which contains // a key. // (*) If the KeyFile and the KeyName values are both specified, the // following processing occurs: // (1) If the KeyName can be found in the CSP, that key is used. // (2) If the KeyName does not exist and the KeyFile does exist, the key // in the KeyFile is installed into the CSP and used. // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. // When specifying the KeyFile, the location of the KeyFile should be // relative to the project output directory which is // %Project Directory%\obj\<configuration>. For example, if your KeyFile is // located in the project directory, you would specify the AssemblyKeyFile // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework // documentation for more information on this. // [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")] --- NEW FILE: ClientHelper.cs --- using System; using System.Net.Sockets; namespace TestClient { /// <summary> /// Summary description for ClientHelper. /// </summary> public class ClientHelper { TcpClient client; NetworkStream stream; Random r = new Random(); public ClientHelper(string host, short port) { client = new TcpClient(host, port); stream = client.GetStream(); } public void Send(string msg) { bool split = (r.Next(1) == 0 ? false : true); int blocks = (split ? r.Next(msg.Length/2)+1 : 1); int blockSize = msg.Length / blocks; int sent = 0; byte[] buf = System.Text.Encoding.ASCII.GetBytes(msg); while(sent < msg.Length) { stream.Write(buf, sent, Math.Min(blockSize, msg.Length-sent)); sent += Math.Min(blockSize, msg.Length-sent); } } public string ReceiveLine() { string retval = string.Empty; bool read13 = false; bool done = false; while(!done) { if(stream.DataAvailable) { int chI = stream.ReadByte(); if(chI != -1) { char ch = Convert.ToChar(chI); if(read13 && ch == '\n') done = true; read13 = (ch == '\r'); retval += ch; } } else System.Threading.Thread.Sleep(10); } return retval.Substring(0, retval.Length-2); } } } --- NEW FILE: Main.cs --- using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; namespace TestClient { /// <summary> /// Summary description for Main. /// </summary> public class MainF : System.Windows.Forms.Form { private System.Windows.Forms.ListBox listBox1; int counter = 0; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.ListBox listBox2; private System.Windows.Forms.Button button3; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; public MainF() { // // Required for Windows Form Designer support // InitializeComponent(); } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } [STAThread] static void Main(string[] args) { new MainF().ShowDialog(); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.listBox1 = new System.Windows.Forms.ListBox(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.listBox2 = new System.Windows.Forms.ListBox(); this.button3 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // listBox1 // this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.listBox1.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.listBox1.ItemHeight = 16; this.listBox1.Location = new System.Drawing.Point(8, 40); this.listBox1.Name = "listBox1"; this.listBox1.Size = new System.Drawing.Size(352, 308); this.listBox1.TabIndex = 0; this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged); // // button1 // this.button1.Location = new System.Drawing.Point(16, 8); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(96, 23); this.button1.TabIndex = 1; this.button1.Text = "Test Localhost"; this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // this.button2.Location = new System.Drawing.Point(632, 8); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(88, 23); this.button2.TabIndex = 2; this.button2.Text = "Test Chegg"; this.button2.Click += new System.EventHandler(this.button2_Click); // // listBox2 // this.listBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.listBox2.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.listBox2.ItemHeight = 16; this.listBox2.Location = new System.Drawing.Point(368, 40); this.listBox2.Name = "listBox2"; this.listBox2.Size = new System.Drawing.Size(352, 308); this.listBox2.TabIndex = 3; this.listBox2.SelectedIndexChanged += new System.EventHandler(this.listBox2_SelectedIndexChanged); // // button3 // this.button3.Location = new System.Drawing.Point(328, 8); this.button3.Name = "button3"; this.button3.TabIndex = 4; this.button3.Text = "Test Both"; this.button3.Click += new System.EventHandler(this.button3_Click); // // MainF // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(728, 357); this.Controls.Add(this.button3); this.Controls.Add(this.listBox2); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.listBox1); this.Name = "MainF"; this.Text = "Main"; this.ResumeLayout(false); } #endregion private void SendLine(string msg, ClientHelper h, ListBox box) { h.Send(msg + "\r\n"); box.Items.Add(counter++.ToString().PadLeft(4, ' ') + " -> " + msg); } private string ReadLine(ClientHelper h, ListBox box) { string line = h.ReceiveLine(); box.Items.Add(counter++.ToString().PadLeft(4, ' ') + " <- " + line); return line; } private void button1_Click(object sender, System.EventArgs e) { ClientHelper localhost = new ClientHelper("localhost", 143); Go(localhost, listBox1); } private void button2_Click(object sender, System.EventArgs e) { ClientHelper chegg = new ClientHelper("chegg.com", 143); Go(chegg, listBox2); } private void button3_Click(object sender, System.EventArgs e) { ClientHelper localhost = new ClientHelper("localhost", 143); Go(localhost, listBox1); ClientHelper chegg = new ClientHelper("chegg.com", 143); Go(chegg, listBox2); } private void Go(ClientHelper h, ListBox box) { ReadLine(h, box); // read welcome msg string a1 = string.Empty; SendLine("a1 CAPABILITY", h, box); while(!a1.StartsWith("a1")) a1 = ReadLine(h, box); string a2 = string.Empty; SendLine("a2 LOGIN {12}", h, box); a2 = ReadLine(h, box); SendLine("csmaild_test {12}", h, box); a2 = ReadLine(h, box); SendLine("csmaild_test", h, box); while(!a2.StartsWith("a2")) a2 = ReadLine(h, box); /* string a2 = string.Empty; SendLine("a2 LOGIN \"csmaild_test\" \"csmaild_test\""); while(!a2.StartsWith("a2")) a2 = ReadLine();*/ string a3 = string.Empty; SendLine("a3 LIST \"\" \"*\"", h, box); while(!a3.StartsWith("a3")) a3 = ReadLine(h, box); } private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e) { listBox2.SelectedIndex = listBox1.SelectedIndex; } private void listBox2_SelectedIndexChanged(object sender, System.EventArgs e) { listBox1.SelectedIndex = listBox2.SelectedIndex; } } } --- NEW FILE: Main.resx --- <?xml version="1.0" encoding="utf-8"?> <root> <!-- Microsoft ResX Schema Version 1.3 The primary goals of this format is to allow a simple XML format that is mostly human readable. The generation and parsing of the various data types are done through the TypeConverter classes associated with the data types. Example: ... ado.net/XML headers & schema ... <resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="version">1.3</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <data name="Name1">this is my long string</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> [base64 mime encoded serialized .NET Framework object] </data> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> [base64 mime encoded string representing a byte array form of the .NET Framework object] </data> There are any number of "resheader" rows that contain simple name/value pairs. Each data row contains a name, and value. The row also contains a type or mimetype. Type corresponds to a .NET class that support text/value conversion through the TypeConverter architecture. Classes that don't support this are serialized and stored with the mimetype set. The mimetype is used forserialized objects, and tells the ResXResourceReader how to depersist the object. This is currently not extensible. For a given mimetype the value must be set accordingly: Note - application/x-microsoft.net.object.binary.base64 is the format that the ResXResourceWriter will generate, however the reader can read any of the formats listed below. mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with : System.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Soap.SoapFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.bytearray.base64 value : The object must be serialized into a byte array : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> <resheader name="resmimetype"> <value>text/microsoft-resx</value> </resheader> <resheader name="version"> <value>1.3</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <data name="listBox1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="listBox1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="listBox1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="button1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="button1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="button1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="button2.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="button2.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="button2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="listBox2.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="listBox2.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="listBox2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="button3.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="button3.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="button3.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>(Default)</value> </data> <data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="$this.Name"> <value>MainF</value> </data> <data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>8, 8</value> </data> <data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </data> <data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>80</value> </data> <data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </data> <data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> </root> --- NEW FILE: TestClient.csproj --- <VisualStudioProject> <CSHARP ProjectType = "Local" ProductVersion = "7.10.3077" SchemaVersion = "2.0" ProjectGuid = "{EDAA8235-6FC7-4B9F-AD38-A96A3AF99AFA}" > <Build> <Settings ApplicationIcon = "App.ico" AssemblyKeyContainerName = "" AssemblyName = "TestClient" AssemblyOriginatorKeyFile = "" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "WinExe" PreBuildEvent = "" PostBuildEvent = "" RootNamespace = "TestClient" RunPostBuildEvent = "OnBuildSuccess" StartupObject = "" > <Config Name = "Debug" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "DEBUG;TRACE" DocumentationFile = "" DebugSymbols = "true" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "false" OutputPath = "bin\Debug\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> <Config Name = "Release" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "TRACE" DocumentationFile = "" DebugSymbols = "false" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "true" OutputPath = "bin\Release\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll" /> <Reference Name = "System.Data" AssemblyName = "System.Data" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" /> <Reference Name = "System.Drawing" AssemblyName = "System.Drawing" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll" /> <Reference Name = "System.Windows.Forms" AssemblyName = "System.Windows.Forms" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll" /> <Reference Name = "System.XML" AssemblyName = "System.XML" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" /> </References> </Build> <Files> <Include> <File RelPath = "App.ico" BuildAction = "Content" /> <File RelPath = "AssemblyInfo.cs" BuildAction = "Compile" /> <File RelPath = "ClientHelper.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Main.cs" SubType = "Form" BuildAction = "Compile" /> <File RelPath = "Main.resx" DependentUpon = "Main.cs" BuildAction = "EmbeddedResource" /> </Include> </Files> </CSHARP> </VisualStudioProject> --- NEW FILE: TestClient.csproj.user --- <VisualStudioProject> <CSHARP LastOpenVersion = "7.10.3077" > <Build> <Settings ReferencePath = "" > <Config Name = "Debug" EnableASPDebugging = "false" EnableASPXDebugging = "false" EnableUnmanagedDebugging = "false" EnableSQLServerDebugging = "false" RemoteDebugEnabled = "false" RemoteDebugMachine = "" StartAction = "Project" StartArguments = "" StartPage = "" StartProgram = "" StartURL = "" StartWorkingDirectory = "" StartWithIE = "false" /> <Config Name = "Release" EnableASPDebugging = "false" EnableASPXDebugging = "false" EnableUnmanagedDebugging = "false" EnableSQLServerDebugging = "false" RemoteDebugEnabled = "false" RemoteDebugMachine = "" StartAction = "Project" StartArguments = "" StartPage = "" StartProgram = "" StartURL = "" StartWorkingDirectory = "" StartWithIE = "true" /> </Settings> </Build> <OtherProjectSettings CopyProjectDestinationFolder = "" CopyProjectUncPath = "" CopyProjectOption = "0" ProjectView = "ProjectFiles" ProjectTrust = "0" /> </CSHARP> </VisualStudioProject> |