From 113749536839d4315b9c6aaae1c2e4613a2072d6 Mon Sep 17 00:00:00 2001 From: 1kamma Date: Wed, 24 May 2023 14:36:03 +0300 Subject: [PATCH] registry value --- NetWork/Program.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/NetWork/Program.cs b/NetWork/Program.cs index 18af48b..5ed1128 100644 --- a/NetWork/Program.cs +++ b/NetWork/Program.cs @@ -8,6 +8,8 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using SQLitePCL; +using LiteDB; using System.Net.NetworkInformation; using System.ServiceProcess; using System.Text.RegularExpressions; @@ -15,6 +17,7 @@ using System.Threading; using Serilog.Core; using Serilog.Sinks.File; using Serilog.Events; +using Microsoft.Win32; namespace NetWork { @@ -29,7 +32,7 @@ namespace NetWork foreach (string s in service) { Servicer(s, stop); } - } + } private static ServiceController[] GetServices(string service) { Regex regex = new(service, RegexOptions.IgnoreCase); @@ -442,13 +445,14 @@ namespace NetWork task.FindTask("StartUp and Run").Run(); } public static bool IniData() { - return System.IO.File.ReadAllText("Other\\Data.ini").Equals("RunNetwork"); + return Registry.CurrentUser.GetValue("Software\\SaretNetwork\\Run") is null? true: false; + //return System.IO.File.ReadAllText("Other\\Data.ini").Equals("RunNetwork"); } static void Main(string[] args) { Log.Logger = new LoggerConfiguration().WriteTo.File("Logs/NetworkLog.log", LogEventLevel.Debug, "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}[{Level: u3}] {Message:lj}{NewLine}", rollingInterval: RollingInterval.Minute).CreateLogger(); - + //IgnoreFile.M(); DoTheSchtik(IniData());