Example #1
0
 private static void iniInit()
 {
     Myini.WriteIniData("First", "result", "0", path);
     Myini.WriteIniData("JianTing", "ReStart", "0", path);
     Myini.WriteIniData("JianTing", "Flash", "0", path);
     Myini.WriteIniData("JianTing", "Stop", "0", path);
     Myini.WriteIniData("JianTing", "Exit", "0", path);
     Myini.WriteIniData("JianTing", "DisAgree", "0", path);
     Myini.WriteIniData("JianTing", "Agree", "0", path);
 }
Example #2
0
        private static void Mythread()
        {
            while (isRun)
            {
                try {
                    client_socket = server_socket.Accept();

                    //接收来自客户端的消息
                    string name    = "";
                    byte[] recbyte = new byte[1024];
                    int    bytes   = client_socket.Receive(recbyte, recbyte.Length, 0); //字节流
                    name += Encoding.ASCII.GetString(recbyte, 0, bytes);                //--> 字符流
                    Console.WriteLine("====={0} 连接成功=====", name);
                    if (name.Substring(0, 1).Equals("1"))
                    {
                        Myini.ADDIniData("JianTing", "ReStart", 1, path);
                    }
                    if (name.Substring(0, 1).Equals("2"))
                    {
                        Myini.ADDIniData("JianTing", "Flash", 1, path);
                    }
                    if (name.Substring(0, 1).Equals("3"))
                    {
                        Myini.ADDIniData("JianTing", "Stop", 1, path);
                    }
                    if (name.Substring(0, 1).Equals("4"))
                    {
                        Myini.ADDIniData("JianTing", "Exit", 1, path);
                    }

                    if (name.Substring(0, 1).Equals("5"))
                    {
                        Myini.ADDIniData("JianTing", "DisAgree", 1, path);
                        string result = Myini.ReadIniData("First", "result", "0", path);
                        if (result.Equals("0"))
                        {
                            Myini.WriteIniData("First", "result", "-1", path);
                        }
                    }
                    if (name.Substring(0, 1).Equals("6"))
                    {
                        Myini.ADDIniData("JianTing", "Agree", 1, path);
                        string result = Myini.ReadIniData("First", "result", "0", path);
                        if (result.Equals("0"))
                        {
                            Myini.WriteIniData("First", "result", "1", path);
                        }
                    }
                } catch (Exception) {
                }
            }
        }