-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
664 additions
and
24 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/> | ||
</startup> | ||
</configuration> | ||
</configuration> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Management; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Startup.Extensions | ||
{ | ||
public static class ProcessExtensions | ||
{ | ||
public static IEnumerable<Process> GetChildProcesses(this Process process) | ||
{ | ||
List<Process> children = new List<Process>(); | ||
ManagementObjectSearcher mos = new ManagementObjectSearcher(String.Format("Select * From Win32_Process Where ParentProcessID={0}", process.Id)); | ||
|
||
foreach (ManagementObject mo in mos.Get()) | ||
{ | ||
children.Add(Process.GetProcessById(Convert.ToInt32(mo["ProcessID"]))); | ||
} | ||
|
||
return children; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Startup.Handler | ||
{ | ||
class ErrorInfo | ||
{ | ||
public enum ErrorType | ||
{ | ||
UnKnown, | ||
ConfigFolderNotFound, | ||
UnabelToMoveWindow | ||
} | ||
|
||
public ErrorType Type { get; private set; } | ||
|
||
public String Message { get; private set; } | ||
|
||
public ErrorInfo(ErrorType type, String message) | ||
{ | ||
this.Type = type; | ||
this.Message = message; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Text.RegularExpressions; | ||
using System.Threading.Tasks; | ||
|
||
namespace Startup.Handler | ||
{ | ||
class StartupElement | ||
{ | ||
public enum StartupStatus | ||
{ | ||
Disabled, | ||
Queue, | ||
Delay, | ||
Starting, | ||
Done | ||
} | ||
|
||
public const string FileNameFormatRegex = @"(?<disabled>!?)?(?<index>\d+)\.(?<group>\d+) - (?<name>.+)(?:\.lnk)"; | ||
|
||
public FileInfo File { get; private set; } | ||
|
||
public StartupStatus Status { get; internal set; } | ||
|
||
public double Delay { get; internal set; } | ||
public double TimeLeft { get; internal set; } | ||
|
||
public bool Result { get; internal set; } | ||
public ErrorInfo Error { get; internal set; } | ||
|
||
public string ServiceName { get; internal set; } | ||
public int StartIndex { get; internal set; } | ||
public int GroupID { get; internal set; } | ||
|
||
public StartupElement(string fileStr) | ||
{ | ||
this.Delay = 5; | ||
this.File = new FileInfo(fileStr); | ||
this.Status = StartupStatus.Queue; | ||
|
||
processFile(); | ||
} | ||
|
||
private void processFile() | ||
{ | ||
Regex r = new Regex(FileNameFormatRegex); | ||
Match m = r.Match(File.Name); | ||
|
||
if (m.Success) | ||
{ | ||
var d = m.Groups["disabled"]; | ||
var i = m.Groups["index"]; | ||
var g = m.Groups["group"]; | ||
var n = m.Groups["name"]; | ||
if (d.Length > 0) this.Status = StartupStatus.Disabled; | ||
StartIndex = int.Parse (i.Value); | ||
GroupID = int.Parse(g.Value); | ||
ServiceName = n.Value; | ||
} | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.