cinvoke-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cinvoke-svn] r143 - trunk/skorpion


From: will
Subject: [cinvoke-svn] r143 - trunk/skorpion
Date: 16 Mar 2007 00:58:54 -0400

Author: vmy
Date: 2007-03-16 00:58:54 -0400 (Fri, 16 Mar 2007)
New Revision: 143

Modified:
   trunk/skorpion/Form1.cs
   trunk/skorpion/IrcConnection.cs
   trunk/skorpion/skorpion.cs
Log:
cleaned up IrcConnection class somewhat; disconnect from IRC server on exit

Modified: trunk/skorpion/Form1.cs
===================================================================
--- trunk/skorpion/Form1.cs     2007-03-14 06:07:49 UTC (rev 142)
+++ trunk/skorpion/Form1.cs     2007-03-16 04:58:54 UTC (rev 143)
@@ -35,6 +35,7 @@
                                        components.Dispose();
                                }
                        }
+                       GlobalState.Irc.Disconnect();
                        base.Dispose( disposing );
                }
 
@@ -60,6 +61,7 @@
                {
                        ServerState.Live = false;
                        cea.Cancel = true;
+                       GlobalState.IrcContinue = false;
                }
 
                void OnResize(object sender, System.EventArgs e)
@@ -176,6 +178,7 @@
                        {
                                // instantiate an IRC object, create its 
thread, kick it off
                                GlobalState.Irc = new IrcConnection();
+                               GlobalState.IrcContinue = true;
                                GlobalState.Irc.OnReadLine += new 
ReadLineEventHandler(OnReadLine);
                                GlobalState.Irc.Connect();
                                
GlobalState.Irc.WriteLine(Rfc2812.Nick(RegConfig.PlayerName), 
Priority.Critical);

Modified: trunk/skorpion/IrcConnection.cs
===================================================================
--- trunk/skorpion/IrcConnection.cs     2007-03-14 06:07:49 UTC (rev 142)
+++ trunk/skorpion/IrcConnection.cs     2007-03-16 04:58:54 UTC (rev 143)
@@ -10,58 +10,36 @@
 
 namespace skorpion
 {
-       public enum Priority
-       {
-               Low,
-               BelowMedium,
-               Medium,
-               AboveMedium,
-               High,
-               Critical
-       }
+       public enum Priority { Low, BelowMedium, Medium, AboveMedium, High, 
Critical }
 
        public delegate void ReadLineEventHandler(object sender, 
ReadLineEventArgs e);
        public delegate void WriteLineEventHandler(object sender, 
WriteLineEventArgs e);
 
-       /// <summary>
-       ///
-       /// </summary>
        public class ReadLineEventArgs : EventArgs
        {
-               private string _Line;
-
+               private string _line;
                public string Line
                {
-                       get 
-                       {
-                               return _Line;
-                       }
+                       get {return _line;}
                }
 
                internal ReadLineEventArgs(string line)
                {
-                       _Line = line;
+                       _line = line;
                }
        }
 
-       /// <summary>
-       ///
-       /// </summary>
        public class WriteLineEventArgs : EventArgs
        {
-               private string _Line;
-
+               private string _line;
                public string Line
                {
-                       get 
-                       {
-                               return _Line;
-                       }
+                       get {return _line;}
                }
 
                internal WriteLineEventArgs(string line)
                {
-                       _Line = line;
+                       _line = line;
                }
        }
     
@@ -69,17 +47,15 @@
     {
         public Socket Socket
         {
-            get {
-                return Client;
-            }
+            get {return Client;}
         }
     }
 
        public class IrcConnection
        {
-               private string _serverIP = "69.16.172.2";
-               private int _serverPort = 6667;
-               public string _channel = "#pleep";
+               private string _serverIP = ClientConfig.IrcServer;
+               private int _serverPort = ClientConfig.IrcPort;
+               public string _channel = ClientConfig.IrcChannel;
 
                private string          _VersionNumber;
                private string          _VersionString;
@@ -144,20 +120,8 @@
                /// </remarks
                protected bool IsConnectionError
                {
-                       get 
-                       {
-                               lock (this) 
-                               {
-                                       return _IsConnectionError;
-                               }
-                       }
-                       set 
-                       {
-                               lock (this) 
-                               {
-                                       _IsConnectionError = value;
-                               }
-                       }
+                       get {lock (this) {return _IsConnectionError;}}
+                       set {lock (this) {_IsConnectionError = value;}}
                }
 
                /// <summary>
@@ -165,10 +129,7 @@
                /// </summary>
                public string Address
                {
-                       get 
-                       {
-                               return _AddressList[_CurrentAddress];
-                       }
+                       get {return _AddressList[_CurrentAddress];}
                }
 
                /// <summary>
@@ -1767,9 +1728,6 @@
                }
        }
 
-       /// <summary>
-       ///
-       /// </summary>
        public enum ReplyCode: int
        {
                Null =                           000,
@@ -1911,4 +1869,4 @@
                ErrorUserModeUnknownFlag =       501,
                ErrorUsersDoNotMatch =           502
        }
-}
+}
\ No newline at end of file

Modified: trunk/skorpion/skorpion.cs
===================================================================
--- trunk/skorpion/skorpion.cs  2007-03-14 06:07:49 UTC (rev 142)
+++ trunk/skorpion/skorpion.cs  2007-03-16 04:58:54 UTC (rev 143)
@@ -27,7 +27,7 @@
 {
        public class RegConfig
        {
-               public static string        PlayerName          = "vmy";
+               public static string        PlayerName          = "du0d";
                public static int           FormWidth           = 800;
                public static int           FormHeight          = 600;
        }
@@ -45,10 +45,14 @@
                public static bool          TexturedField       = true;
 
                public static bool          ClientStart         = true;
-               public static string        ClientConnect       = "pleep.com";
+               public static string        ClientConnect       = "127.0.0.1";
                public static ushort        ClientPort          = 
ServerConfig.DEFAULTPORT;
+
+               public static string        IrcServer           = "69.16.172.2";
+               public static int           IrcPort             = 6667;
+               public static string        IrcChannel          = "#pleep";
                        
-               public static bool          ServerStart         = false;
+               public static bool          ServerStart         = true;
 
                public static bool                      IrcStart                
        = true;
 
@@ -81,6 +85,7 @@
                public static PlayerList          PlayerList          = null;
                public static Chat                Chat                = null;
                public static IrcConnection       Irc                 = null;
+               public static bool                IrcContinue         = false;
                public static Command             Command             = null;
                public static Bind                Bind                = null;
        }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]