Esempio n. 1
0
        /// <summary>
        /// Attempts to begin sending stats to the server. Will throw an IllegalStateException if the syncher is already
        /// busy.
        /// </summary>
        public virtual void BeginSendStats(Dictionary <StatBase, int> par1Map)
        {
            if (IsBusy)
            {
                throw new InvalidOperationException("Can't save stats while StatsSyncher is busy!");
            }
            else
            {
                Field_27427_l = 100;
                IsBusy        = true;

                Action statSyncerSend = () =>
                {
                    try
                    {
                        StatsSyncher.Func_27412_a(this, par1Map, StatsSyncher.GetUnsentDataFile(this), StatsSyncher.GetUnsentTempFile(this), StatsSyncher.GetUnsentOldFile(this));
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception.ToString());
                        Console.Write(exception.StackTrace);
                    }
                    finally
                    {
                        StatsSyncher.SetBusy(this, false);
                    }
                };

                new Thread(new ThreadStart(statSyncerSend)).Start();
                return;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Attempts to begin receiving stats from the server. Will throw an IllegalStateException if the syncher is already
        /// busy.
        /// </summary>
        public virtual void BeginReceiveStats()
        {
            if (IsBusy)
            {
                throw new InvalidOperationException("Can't get stats from server while StatsSyncher is busy!");
            }
            else
            {
                Field_27427_l = 100;
                IsBusy        = true;

                Action statSyncherReceive = () =>
                {
                    try
                    {
                        if (StatsSyncher.Func_27422_a(this) != null)
                        {
                            StatsSyncher.Func_27412_a(this, StatsSyncher.Func_27422_a(this), StatsSyncher.Func_27423_b(this), StatsSyncher.Func_27411_c(this), StatsSyncher.Func_27413_d(this));
                        }
                        else if (File.Exists(StatsSyncher.Func_27423_b(this)))
                        {
                            StatsSyncher.Func_27421_a(this, StatsSyncher.Func_27409_a(this, StatsSyncher.Func_27423_b(this), StatsSyncher.Func_27411_c(this), StatsSyncher.Func_27413_d(this)));
                        }
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception.ToString());
                        Console.Write(exception.StackTrace);
                    }
                    finally
                    {
                        StatsSyncher.SetBusy(this, false);
                    }
                };

                new Thread(new ThreadStart(statSyncherReceive)).Start();
                return;
            }
        }
Esempio n. 3
0
        public StatFileWriter(Session par1Session, string par2File)
        {
            field_25102_a = new Dictionary <StatBase, int>();
            field_25101_b = new Dictionary <StatBase, int>();
            field_27189_c = false;
            DirectoryInfo directory = new DirectoryInfo(System.IO.Path.Combine(par2File, "stats"));

            if (!directory.Exists)
            {
                directory.Create();
            }

            FileInfo[] afile = directory.GetFiles();
            int        i     = afile.Length;

            for (int j = 0; j < i; j++)
            {
                FileInfo file1 = afile[j];

                if (!file1.Name.StartsWith("stats_") || !file1.Name.EndsWith(".dat"))
                {
                    continue;
                }

                /*
                 * FileInfo file2 = new FileInfo(file, file1.Name);
                 *
                 *              if (!file2.Exists)
                 *              {
                 *                      Console.WriteLine((new StringBuilder()).Append("Relocating ").Append(file1.Name).ToString());
                 *                      file1.Rename(file2);
                 *              }*/
            }

            statsSyncher = new StatsSyncher(par1Session, this, directory.FullName);
        }
Esempio n. 4
0
 static string GetUnsentOldFile(StatsSyncher par0StatsSyncher)
 {
     return(par0StatsSyncher.UnsentOldFile);
 }
Esempio n. 5
0
 static bool SetBusy(StatsSyncher par0StatsSyncher, bool par1)
 {
     return(par0StatsSyncher.IsBusy = par1);
 }
Esempio n. 6
0
 static Dictionary <StatBase, int> Func_27409_a(StatsSyncher par0StatsSyncher, string par1File, string par2File, string par3File)
 {
     return(par0StatsSyncher.Func_27415_a(par1File, par2File, par3File));
 }
Esempio n. 7
0
 static Dictionary <StatBase, int> Func_27421_a(StatsSyncher par0StatsSyncher, Dictionary <StatBase, int> par1Map)
 {
     return(par0StatsSyncher.Field_27437_b = par1Map);
 }
Esempio n. 8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: static void Func_27412_a(StatsSyncher par0StatsSyncher, java.util.Map par1Map, File par2File, File par3File, File par4File) throws IOException
        static void Func_27412_a(StatsSyncher par0StatsSyncher, Dictionary <StatBase, int> par1Map, string par2File, string par3File, string par4File)
        {
            par0StatsSyncher.Func_27410_a(par1Map, par2File, par3File, par4File);
        }
Esempio n. 9
0
 static string Func_27413_d(StatsSyncher par0StatsSyncher)
 {
     return(par0StatsSyncher.OldFile);
 }
Esempio n. 10
0
 static string Func_27411_c(StatsSyncher par0StatsSyncher)
 {
     return(par0StatsSyncher.TempFile);
 }
Esempio n. 11
0
 static string Func_27423_b(StatsSyncher par0StatsSyncher)
 {
     return(par0StatsSyncher.DataFile);
 }
Esempio n. 12
0
 static Dictionary <StatBase, int> Func_27422_a(StatsSyncher par0StatsSyncher)
 {
     return(par0StatsSyncher.Field_27437_b);
 }