track
This commit is contained in:
@@ -20,7 +20,16 @@ namespace NetWork
|
||||
}
|
||||
internal class NetworkInterface
|
||||
{
|
||||
//public
|
||||
public string Name { get; set; }
|
||||
public ListOfPrograms ListOfProgramsToStart { get; set; }
|
||||
public ListOfPrograms ListOfProgramsToStop { get; set; }
|
||||
public string[] ServicesToStart { get; set; }
|
||||
public string[] ServicesToStop { get;set; }
|
||||
public bool Mute { get; set; }=true;
|
||||
public NetworkInterface(string name, string url)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
internal class ListOfPrograms
|
||||
{
|
||||
@@ -29,14 +38,27 @@ namespace NetWork
|
||||
public ListOfPrograms(string url) {
|
||||
WebClient webClient = new();
|
||||
string[] data = Regex.Split(Regex.Replace(webClient.DownloadString(url),@"[\{\}]",""),",");
|
||||
//ProgramName = new string[data.Length];
|
||||
//ProgramPath = new string[data.Length];
|
||||
//for(int i = 0; i < data.Length; i++)
|
||||
//{
|
||||
// ProgramName[i] = Regex.
|
||||
//}
|
||||
string d = Regex.Replace(webClient.DownloadString(url), @"[\{\}]", "");
|
||||
ProgramName = Regex.Matches(d,@"(?<=\"")\w+(?=\"":)").Select(x => x.Value).ToArray();
|
||||
ProgramName = new string[data.Length];
|
||||
ProgramPath = new string[data.Length];
|
||||
for(int i = 0; i < data.Length; i++)
|
||||
{
|
||||
ProgramName[i] = Regex.Match(data[i], @"(?<="").+(?="":)").Value;
|
||||
ProgramPath[i] = Regex.Match(data[i], @"(?<=:\s?"")[^""]+").Value;
|
||||
}
|
||||
//string d = Regex.Replace(webClient.DownloadString(url), @"[\{\}]", "");
|
||||
//ProgramName = Regex.Matches(d,@"(?<=\"")\w+(?=\"":)").Select(x => x.Value).ToArray();
|
||||
}
|
||||
public ListOfPrograms(string registryHive, string registryName)
|
||||
{
|
||||
string location = Regex.IsMatch(registryHive, @"HKEY_") ? Regex.Replace(registryHive, @"^[^\\]+", "")[1..] : registryHive;
|
||||
RegistryKey key = Registry.CurrentUser.OpenSubKey($"{location}\\{registryName}") ;
|
||||
ProgramName = key.GetValueNames();
|
||||
ProgramPath = new string[ProgramName.Length];
|
||||
for (int i = 0; i < ProgramName.Length; i++)
|
||||
{
|
||||
ProgramPath[i] = Registry.GetValue($"HKEY_CURRENT_USER\\{location}\\{registryName}", ProgramName[i], "").ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user