Exemplo n.º 1
0
 /// <summary>
 /// Update File
 /// </summary>
 public void UpdateFile()
 {
     try
     {
         if (Enableios)
         {
             var m = new FileMod();
             if (m.ModFile(true, i_time))
             {
                 i_dataversion  = m._data;
                 i_excel_output = m._excel;
                 i_setting      = m._setting;
                 i_time         = m.time;
             }
             m = null;
         }
         if (Enableandroid)
         {
             var c = new FileMod();
             if (c.ModFile(false, a_time))
             {
                 a_dataversion  = c._data;
                 a_excel_output = c._excel;
                 a_setting      = c._setting;
                 a_time         = c.time;
             }
             c = null;
         }
         GC.Collect();
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message + "\n" + e.StackTrace);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// start
        /// </summary>
        /// <param name="iport">proxy port</param>
        /// <param name="Bh3Only">is only response *.bh3.com and *.mihoyo.com</param>
        /// <param name="Enableandroid">Enable android</param>
        /// <param name="Enableios">Enable IOS</param>
        public void Start(int iport, bool Bh3Only, bool Enableandroid, bool Enableios)
        {
            this.Enableandroid = Enableandroid;
            this.Enableios     = Enableios;
            Console.WriteLine("init server info");

            Console.WriteLine("start Fiddler,port:" + iport);
            FiddlerTool.bh3only = Bh3Only;

            port = iport;
            Fiddlertool.Start(port, this);

            Console.WriteLine("Get server info");
            string[] severlist = mod_servers.Keys.ToArray();

            foreach (string se in severlist)
            {
                mod_servers[se].Enabletouch = Enableandroid;
            }

            mod_servers["ios01"].Enabletouch = Enableios;
            //get all server info
            foreach (var se in severlist)
            {
                if (mod_servers[se].Enabletouch)
                {
                    if (!Getseverinfo(se))
                    {
                        Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " Get " + se + " info fail");
                        return;
                    }

                    if (string.IsNullOrEmpty(mod_servers[se].mod_gameserver_rsp))
                    {
                        Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " Get " + se + " info fail");
                    }
                    else
                    {
                        Console.WriteLine(se + " " + mod_servers[se].server_ip + " " + mod_servers[se].oa_ip);
                    }
                }
            }

            var ios     = mod_servers["ios01"];
            var android = mod_servers["android01"];

            Console.WriteLine("process file");
            //Get File
            try
            {
                if (Enableios)
                {
                    var m = new FileMod();
                    if (m.ModFile(true, i_time))
                    {
                        i_dataversion  = m._data;
                        i_excel_output = m._excel;
                        i_setting      = m._setting;
                        i_time         = m.time;
                    }
                    m = null;
                }
                if (Enableandroid)
                {
                    var c = new FileMod();
                    if (c.ModFile(false, a_time))
                    {
                        a_dataversion  = c._data;
                        a_excel_output = c._excel;
                        a_setting      = c._setting;
                        a_time         = c.time;
                    }
                    c = null;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n" + e.StackTrace);
            }
            //start fiddler
            if (!Fiddler.FiddlerApplication.IsStarted())
            {
                port = iport;
                Fiddlertool.Start(port, this);
            }
            FiddlerTool.modinfos = mod_servers.Values.ToList();
        }