Ejemplo n.º 1
0
 public App()
 {
     Logger.Disable();
     Write.Disable();
     VirtualRoot.SetOut(NotiCenterWindowViewModel.Instance);
     AppUtil.Init(this);
     InitializeComponent();
 }
Ejemplo n.º 2
0
 public App()
 {
     EntryAssemblyInfo.SetHomeDirFullName(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "NTMiner"));
     Write.Disable();
     VirtualRoot.SetOut(NotiCenterWindowViewModel.Instance);
     Logger.SetDir(SpecialPath.HomeLogsDirFullName);
     AppUtil.Init(this);
     InitializeComponent();
 }
Ejemplo n.º 3
0
 public App()
 {
     Logger.Disable();
     Write.Disable();
     Write.UIThreadId = Dispatcher.Thread.ManagedThreadId;
     VirtualRoot.SetOut(NotiCenterWindowViewModel.Instance);
     AppUtil.Init(this);
     InitializeComponent();
 }
Ejemplo n.º 4
0
 public App()
 {
     HomePath.SetHomeDirFullName(AppDomain.CurrentDomain.BaseDirectory);
     Logger.Disable();
     Write.Disable();
     VirtualRoot.SetOut(NotiCenterWindowViewModel.Instance);
     WpfUtil.Init();
     AppUtil.Init(this);
     InitializeComponent();
 }
Ejemplo n.º 5
0
 static void Main(string[] args)
 {
     HomePath.SetHomeDirFullName(AppDomain.CurrentDomain.BaseDirectory);
     if (args.Length != 0)
     {
         if (args.Contains("--sha1"))
         {
             File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "sha1"), Sha1);
             return;
         }
     }
     try {
         if (DevMode.IsDevMode)
         {
             NTMinerConsole.GetOrAlloc();
         }
         SystemEvents.SessionEnding += SessionEndingEventHandler;
         StartTimer();
         _waitHandle = new AutoResetEvent(false);
         bool mutexCreated;
         try {
             _sMutexApp = new Mutex(true, "NTMinerNoDevFeeAppMutex", out mutexCreated);
         }
         catch {
             mutexCreated = false;
         }
         if (mutexCreated)
         {
             if (!DevMode.IsDevMode)
             {
                 Write.Disable();
             }
             NTMinerRegistry.SetNoDevFeeVersion(Sha1);
             NTMinerRegistry.SetAutoBoot("NTMinerNoDevFee", true);
             Run();
         }
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
     }
 }
Ejemplo n.º 6
0
 static void Main(string[] args)
 {
     HomePath.SetHomeDirFullName(AppDomain.CurrentDomain.BaseDirectory);
     SetOut(new ConsoleOut());
     if (args.Length != 0)
     {
         if (args.Contains("--sha1"))
         {
             File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "sha1"), Sha1);
             return;
         }
     }
     try {
         SystemEvents.SessionEnding += SessionEndingEventHandler;
         StartTimer();
         _waitHandle = new AutoResetEvent(false);
         bool mutexCreated;
         try {
             _sMutexApp = new Mutex(true, "NTMinerDaemonAppMutex", out mutexCreated);
         }
         catch {
             mutexCreated = false;
         }
         if (mutexCreated)
         {
             if (!DevMode.IsDevMode)
             {
                 Write.Disable();
             }
             NTMinerRegistry.SetDaemonVersion(Sha1);
             NTMinerRegistry.SetAutoBoot("NTMinerDaemon", true);
             #region 是否自动启动挖矿端
             bool isAutoBoot = MinerProfileUtil.GetIsAutoBoot();
             if (isAutoBoot)
             {
                 string location = NTMinerRegistry.GetLocation(NTMinerAppType.MinerClient);
                 if (!string.IsNullOrEmpty(location) && File.Exists(location))
                 {
                     string    processName = Path.GetFileName(location);
                     Process[] processes   = Process.GetProcessesByName(processName);
                     if (processes.Length == 0)
                     {
                         string arguments = NTMinerRegistry.GetArguments(NTMinerAppType.MinerClient);
                         if (NTMinerRegistry.GetIsLastIsWork())
                         {
                             arguments = "--work " + arguments;
                         }
                         try {
                             Process.Start(location, arguments);
                             Write.DevOk(() => $"启动挖矿端 {location} {arguments}");
                         }
                         catch (Exception e) {
                             Logger.ErrorDebugLine($"启动挖矿端失败因为异常 {location} {arguments}", e);
                         }
                     }
                     else
                     {
                         Write.DevDebug($"挖矿端已经在运行中无需启动");
                     }
                 }
             }
             #endregion
             Run();
         }
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
     }
 }