/// <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; } }
/// <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; } }
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); }
static string GetUnsentOldFile(StatsSyncher par0StatsSyncher) { return(par0StatsSyncher.UnsentOldFile); }
static bool SetBusy(StatsSyncher par0StatsSyncher, bool par1) { return(par0StatsSyncher.IsBusy = par1); }
static Dictionary <StatBase, int> Func_27409_a(StatsSyncher par0StatsSyncher, string par1File, string par2File, string par3File) { return(par0StatsSyncher.Func_27415_a(par1File, par2File, par3File)); }
static Dictionary <StatBase, int> Func_27421_a(StatsSyncher par0StatsSyncher, Dictionary <StatBase, int> par1Map) { return(par0StatsSyncher.Field_27437_b = par1Map); }
//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); }
static string Func_27413_d(StatsSyncher par0StatsSyncher) { return(par0StatsSyncher.OldFile); }
static string Func_27411_c(StatsSyncher par0StatsSyncher) { return(par0StatsSyncher.TempFile); }
static string Func_27423_b(StatsSyncher par0StatsSyncher) { return(par0StatsSyncher.DataFile); }
static Dictionary <StatBase, int> Func_27422_a(StatsSyncher par0StatsSyncher) { return(par0StatsSyncher.Field_27437_b); }