示例#1
0
        static void Main(string[] args)
        {
            System.AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
            Bot  b       = new Bot();
            bool network = Settings.Instance.useNetwork;

            while (true)
            {
                System.Threading.Thread.Sleep(10);
                if (network)
                {
                    FishNet.Instance.checkConnection();
                    KeyValuePair <string, string> msg = FishNet.Instance.readMessage();
                    if (msg.Value == "")
                    {
                        continue;
                    }
                    switch (msg.Key)
                    {
                    case "crrntbrd.txt":
                        b.doData(msg.Value);
                        break;

                    case "curdeck.txt":
                        b.doDeckData(msg.Value);
                        break;
                    }
                    continue;
                }
                try
                {
                    string data = System.IO.File.ReadAllText("crrntbrd.txt");
                    //Helpfunctions.Instance.ErrorLog(data);
                    if (data != "" && data != "<EoF>")
                    {
                        data = data.Replace("<EoF>", "");
                        Helpfunctions.Instance.resetBuffer();
                        Helpfunctions.Instance.writeBufferToFile();
                        //readed = true;
                        b.doData(data);
                    }
                }
                catch
                {
                }
                try
                {
                    string data = System.IO.File.ReadAllText("curdeck.txt");
                    //Helpfunctions.Instance.ErrorLog(data);
                    if (data != "" && data != "<EoF>")
                    {
                        data = data.Replace("<EoF>", "");
                        Helpfunctions.Instance.resetBuffer();
                        Helpfunctions.Instance.writeBufferToDeckFile();
                        //readed = true;
                        b.doDeckData(data);
                    }
                }
                catch
                {
                }
            }
        }