void exportData(Boolean showTxt)
        {
            try
            {
                checkFolderExist();
                String filename_prefix = path_saveFolder + @"\" + TheTool.getTime();

                if (list_data.Count > 0)
                {
                    String filename1 = filename_prefix + @"_D.csv";
                    TheTool.exportCSV_orTXT(filename1, convertData2(), false);
                }
                if (list_data_msg.Count > 0)
                {
                    String filename1 = filename_prefix + @"_M.csv";
                    TheTool.exportCSV_orTXT(filename1, convertDataMessage(), false);
                }
                if (showTxt)
                {
                    System.Windows.MessageBox.Show(@"Save to '" + path_saveFolder + "'", "Export CSV");
                }

                TheScoreBoard.SaveAll();
            }
            catch (Exception ex) { showError(ex); }
        }
        bool oneSide_nextDirection = true; // True: p2+, False: p1-



        public MainWindow()
        {
            TheScoreBoard.LoadAll();
            InitializeComponent();
            initialized = true;
            countP1     = 0;
            countP2     = 0;
            firstTime   = false;

            TheTool.Sys = this;
            bot         = new Bot(this);
            bot.createClient();
            string path1 = path_root + "/p1HP.txt";
            string path2 = path_root + "/p2HP.txt";
            int    h1    = TheTool.getInt(TheTool.read_File_get1String(path1));
            int    h2    = TheTool.getInt(TheTool.read_File_get1String(path2));

            hp_p1 = h1;
            hp_p2 = h2;
            applySetting();
            initThread();

            oneSideMode_setUp();

            this.Closing += new System.ComponentModel.CancelEventHandler(Window4_Closing);
        }
 void exportScoreBoard()
 {
     if (DateTime.Now > nextScoreSave_All)
     {
         TheScoreBoard.SaveAll();
         nextScoreSave_All = DateTime.Now.AddSeconds(scoreSaveInterval_All);
         TheTool.log("Saved ALL");
     }
     if (DateTime.Now > nextScoreUpdate_Top10)
     {
         TheScoreBoard.UpdateTop10();
         nextScoreUpdate_Top10 = DateTime.Now.AddSeconds(scoreUpdateInterval_Top10);
         TheTool.log("Updated TOP10");
     }
 }
Example #4
0
        public void addMsgVS(string user0, string m0)
        {
            string m = m0.Replace("p", "P");

            m = m.Replace(" ", "");
            string user = user0.Replace("@", "");

            Console.WriteLine(user + "  testtttttt  " + m0);
            if (m == "P1+")
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 1
                };
                list_msg.Add(tm);
                Console.WriteLine("test P1+++++++++++++++");
                //mainWin1.countExport();
                processMsg(tm, false);
                TheScoreBoard.UpdateUser(user, 1);
            }
            else if (m == "P2+")
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 2
                };
                list_msg.Add(tm);
                Console.WriteLine("test P2+++++++++++++++");
                processMsg(tm, false);
                TheScoreBoard.UpdateUser(user, 2);
            }
            else if (m == "P1-")
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 3
                };
                list_msg.Add(tm);
                Console.WriteLine("test P1---------------");
                processMsg(tm, false);
                TheScoreBoard.UpdateUser(user, -1);
            }
            else if (m == "P2-")
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 4
                };
                list_msg.Add(tm);
                Console.WriteLine("test P2---------------");
                //mainWin1.countExport();
                processMsg(tm, false);
                TheScoreBoard.UpdateUser(user, -2);
            }



            //if (m.Contains("P1+"))
            //{
            //    TMessage tm = new TMessage() { txt = m, type = 1 };
            //    list_msg.Add(tm);
            //    Console.WriteLine("test P1+++++++++++++++");
            //    //mainWin1.countExport();
            //    processMsg(tm, false);
            //    TheScoreBoard.UpdateUser(user, 1);

            //}
            //if ( m.Contains("P2+"))
            //{
            //    TMessage tm = new TMessage() { txt = m, type = 2 };
            //    list_msg.Add(tm);
            //    Console.WriteLine("test P2+++++++++++++++");
            //    processMsg(tm, false);
            //    TheScoreBoard.UpdateUser(user, 2);
            //}
            //if (m.Contains("P1-"))
            //{
            //    TMessage tm = new TMessage() { txt = m, type = 3 };
            //    list_msg.Add(tm);
            //    Console.WriteLine("test P1---------------");
            //    processMsg(tm, false);
            //    TheScoreBoard.UpdateUser(user, -1);
            //}
            //if (m.Contains("P2-"))
            //{
            //    TMessage tm = new TMessage() { txt = m, type = 4 };
            //    list_msg.Add(tm);
            //    Console.WriteLine("test P2---------------");
            //    //mainWin1.countExport();
            //    processMsg(tm, false);
            //    TheScoreBoard.UpdateUser(user, -2);
            //}
        }
Example #5
0
        //public static double getRescale(double v,
        //double min, double max, double newmin, double newmax)
        //{
        //    double rnew = newmax - newmin;
        //    double n = getNormalized(v, min, max);
        //    return 1 * rnew - newmin ;
        //}


        //public static double getNormalized(double v, double min, double max)
        //{
        //    double r = max - min;
        //    if (r > 0)
        //    {
        //        v = v - min;
        //        v = v / r; return v;
        //    }
        //    else { return 0; }
        //}



        //------------

        public void addMsg(string user0, string m0, Boolean skipP2)
        {
            string m = m0.Replace("p", "P");

            m = m.Replace(" ", "");
            string user = user0.Replace("@", "");

            Console.WriteLine(" >>" + m + "<<");
            if (m == "P1+")
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 1
                };
                list_msg.Add(tm);
                Console.WriteLine("test P1+++++++++++++++");
                //mainWin1.countExport();
                processMsg(tm, false);
                TheScoreBoard.UpdateUser(user, 1);
            }
            else if (!skipP2 && m == "AutoCheer")
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 2
                };
                list_msg.Add(tm);
                //Console.WriteLine("test P2+++++++++++++++");
                processMsg(tm, false);
            }
            else if (!skipP2 && m == "AutoJeer")
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 3
                };
                list_msg.Add(tm);
                //Console.WriteLine("test P1---------------");
                processMsg(tm, false);
            }
            else if (m == "P2-")
            {
                TMessage tm = new TMessage()
                {
                    txt = m, type = 4
                };
                list_msg.Add(tm);
                Console.WriteLine("test P2---------------");
                //mainWin1.countExport();
                processMsg(tm, false);
                TheScoreBoard.UpdateUser(user, -2);
            }



            //if (m.Contains("1"))
            //{
            //    TMessage tm = new TMessage() { txt = m, type = 1};
            //    list_msg.Add(tm);
            //    Console.WriteLine("test P1+++++++++++++++");
            //    //mainWin1.countExport();
            //    processMsg(tm, false);
            //    TheScoreBoard.UpdateUser(user,1);

            //}
            //if (!skipP2 && m.Contains("AutoCheer"))
            //{
            //    TMessage tm = new TMessage() { txt = m, type = 2 };
            //    list_msg.Add(tm);
            //    //Console.WriteLine("test P2+++++++++++++++");
            //    processMsg(tm, false);
            //}
            //if (!skipP2 && m.Contains("AutoJeer"))
            //{
            //    TMessage tm = new TMessage() { txt = m, type = 3 };
            //    list_msg.Add(tm);
            //    //Console.WriteLine("test P1---------------");
            //    processMsg(tm, false);
            //}
            //if (m.Contains("2"))
            //{
            //    TMessage tm = new TMessage() { txt = m, type = 4 };
            //    list_msg.Add(tm);
            //    Console.WriteLine("test P2---------------");
            //    //mainWin1.countExport();
            //    processMsg(tm, false);
            //    TheScoreBoard.UpdateUser(user, -2);
            //}

            /*string m = m0.Replace("p", "P");
             * if (m.Contains("P1+"))
             * {
             *  TMessage tm = new TMessage() { txt = m, type = 1 };
             *  list_msg.Add(tm);
             *  Console.WriteLine("test P1+++++++++++++++");
             *  //mainWin1.countExport();
             *  processMsg(tm, false);
             *
             * }
             * if (!skipP2 && m.Contains("P2+"))
             * {
             *  TMessage tm = new TMessage() { txt = m, type = 2 };
             *  list_msg.Add(tm);
             *  //Console.WriteLine("test P2+++++++++++++++");
             *  processMsg(tm, false);
             * }
             * if (!skipP2 && m.Contains("P1-"))
             * {
             *  TMessage tm = new TMessage() { txt = m, type = 3 };
             *  list_msg.Add(tm);
             *  //Console.WriteLine("test P1---------------");
             *  processMsg(tm, false);
             * }
             * if (m.Contains("P2-"))
             * {
             *  TMessage tm = new TMessage() { txt = m, type = 4 };
             *  list_msg.Add(tm);
             *  Console.WriteLine("test P2---------------");
             *  //mainWin1.countExport();
             *  processMsg(tm, false);
             * }*/
        }