track
This commit is contained in:
@@ -20,7 +20,16 @@ namespace NetWork
|
|||||||
}
|
}
|
||||||
internal class NetworkInterface
|
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
|
internal class ListOfPrograms
|
||||||
{
|
{
|
||||||
@@ -29,14 +38,27 @@ namespace NetWork
|
|||||||
public ListOfPrograms(string url) {
|
public ListOfPrograms(string url) {
|
||||||
WebClient webClient = new();
|
WebClient webClient = new();
|
||||||
string[] data = Regex.Split(Regex.Replace(webClient.DownloadString(url),@"[\{\}]",""),",");
|
string[] data = Regex.Split(Regex.Replace(webClient.DownloadString(url),@"[\{\}]",""),",");
|
||||||
//ProgramName = new string[data.Length];
|
ProgramName = new string[data.Length];
|
||||||
//ProgramPath = new string[data.Length];
|
ProgramPath = new string[data.Length];
|
||||||
//for(int i = 0; i < data.Length; i++)
|
for(int i = 0; i < data.Length; i++)
|
||||||
//{
|
{
|
||||||
// ProgramName[i] = Regex.
|
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();
|
//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