static void Main(string[] args) { SetOut(new ConsoleOut()); NTMinerConsole.MainUiOk(); if (args.Length != 0) { if (args.Contains("--sha1", StringComparer.OrdinalIgnoreCase)) { 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) { NTMinerConsole.Disable(); } NTMinerRegistry.SetDaemonVersion(Sha1); NTMinerRegistry.SetAutoBoot("NTMinerDaemon", true); if (!CommandLineArgs.Args.Contains("--bootByMinerClient")) { #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.GetMinerClientArguments(NTMinerAppType.MinerClient); try { Process.Start(location, arguments); NTMinerConsole.DevOk(() => $"启动挖矿端 {location} {arguments}"); } catch (Exception e) { Logger.ErrorDebugLine($"启动挖矿端失败因为异常 {location} {arguments}", e); } } else { NTMinerConsole.DevDebug($"挖矿端已经在运行中无需启动"); } } } #endregion } Run(); } } catch (Exception e) { Logger.ErrorDebugLine(e); } }
public App() { Logger.Disable(); NTMinerConsole.Disable(); VirtualRoot.SetOut(NotiCenterWindowViewModel.Instance); WpfUtil.Init(); AppUtil.Init(this); InitializeComponent(); }
public App() { if ((NTMinerRegistry.GetIsAutoStart() || CommandLineArgs.IsAutoStart) && NTMinerRegistry.GetIsNoUi()) { NTMinerConsole.Disable(); } VirtualRoot.SetOut(NotiCenterWindowViewModel.Instance); Logger.SetDir(MinerClientTempPath.TempLogsDirFullName); WpfUtil.Init(); AppUtil.Init(this); AppUtil.IsHotKeyEnabled = true; InitializeComponent(); }
public App() { Hub.MessagePathHub.SetNotifyProperty(); if (NTMinerRegistry.GetIsNoUi()) { NTMinerConsole.Disable(); } VirtualRoot.SetOut(NotiCenterWindowViewModel.Instance); Logger.SetDir(TempPath.TempLogsDirFullName); WpfUtil.Init(); AppUtil.Init(this); AppUtil.IsHotKeyEnabled = true; InitializeComponent(); }
static void Main(string[] args) { if (args.Length != 0) { if (args.Contains("--sha1", StringComparer.OrdinalIgnoreCase)) { File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "sha1"), Sha1); return; } else if (args.Contains("--ExtractCosturaCompressedDlls", StringComparer.OrdinalIgnoreCase)) { CosturaUtil.ExtractCosturaCompressedDlls(); return; } } try { NTMinerConsole.MainUiOk(); 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) { NTMinerConsole.Disable(); } NTMinerRegistry.SetNoDevFeeVersion(Sha1); NTMinerRegistry.SetAutoBoot("NTMinerNoDevFee", true); Run(); } } catch (Exception e) { Logger.ErrorDebugLine(e); } }