-
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
Henry Tran
authored and
Henry Tran
committed
Sep 27, 2022
1 parent
3287b06
commit 9680eb4
Showing
34 changed files
with
692 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"CurrentProjectSetting": null | ||
} |
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,6 @@ | ||
{ | ||
"ExpandedNodes": [ | ||
"" | ||
], | ||
"PreviewInSolutionExplorer": false | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+34.1 MB
WinVerse/.vs/WinVerse/v16/ipch/AutoPCH/16886e4c815140b8/AMP_RUNNER.ipch
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30406.217 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "amp_runner", "amp_runner\amp_runner.csproj", "{31CF5A61-1355-4B8A-AF68-B5806B720475}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{31CF5A61-1355-4B8A-AF68-B5806B720475}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{31CF5A61-1355-4B8A-AF68-B5806B720475}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{31CF5A61-1355-4B8A-AF68-B5806B720475}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{31CF5A61-1355-4B8A-AF68-B5806B720475}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {DEE55A2F-70D9-4859-B83B-0A7A238AFED9} | ||
EndGlobalSection | ||
EndGlobal |
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | ||
</startup> | ||
</configuration> |
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,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace amp_runner | ||
{ | ||
public partial class Context | ||
{ | ||
} | ||
} |
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,67 @@ | ||
using amp_runner.Runners; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.ServiceProcess; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace amp_runner.Factories | ||
{ | ||
public class ServiceFactory | ||
{ | ||
private ServiceBase[] Services; | ||
|
||
internal ConfigRunner Config { get; } | ||
internal UdpRunner Udp { get; } | ||
|
||
public ServiceFactory () | ||
{ | ||
Services = new ServiceBase[] | ||
{ | ||
Config = new ConfigRunner(), | ||
Udp = new UdpRunner(), | ||
}; | ||
} | ||
|
||
public void Start () | ||
{ | ||
ServiceBase.Run(Services); | ||
} | ||
|
||
public void Debug(params string[] args) | ||
{ | ||
MethodInfo SB_OnStart = typeof(ServiceBase).GetMethod("OnStart", BindingFlags.Instance | BindingFlags.NonPublic); | ||
MethodInfo SB_OnStop = typeof(ServiceBase).GetMethod("OnStop", BindingFlags.Instance | BindingFlags.NonPublic); | ||
|
||
var servRuns = new ServiceBase[] { | ||
new Runners.ConfigRunner(), | ||
new Runners.UdpRunner(), | ||
}; | ||
servRuns.Select( | ||
s => Task.Run(new Action(() => | ||
{ | ||
SB_OnStart.Invoke(s, new object[] { args }); | ||
})) | ||
); | ||
Console.Write("DEBUG-MODE: Press any key to stop debugging . . . "); | ||
Console.ReadKey(); | ||
servRuns.Select( | ||
s => Task.Run(new Action(() => | ||
{ | ||
SB_OnStop.Invoke(s, new object[] { }); | ||
})) | ||
); | ||
} | ||
|
||
} | ||
} | ||
namespace amp_runner | ||
{ | ||
partial class Context | ||
{ | ||
public static Factories.ServiceFactory Service { get; } = new Factories.ServiceFactory(); | ||
} | ||
} |
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,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace amp_runner.Models | ||
{ | ||
internal class MyPC | ||
{ | ||
public string Name { get; set; } | ||
public string Identity { get; set; } | ||
|
||
public MyPC NearTop { get; set; } | ||
public MyPC NearBottom { get; set; } | ||
public MyPC NearLeft { get; set; } | ||
public MyPC NearRight { get; set; } | ||
|
||
public override string ToString() | ||
{ | ||
return $"{Name} <{Identity}>"; | ||
} | ||
} | ||
} |
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,54 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.ServiceProcess; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace amp_runner | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
if (Environment.UserInteractive) | ||
{ | ||
if (args.Length > 0) | ||
{ | ||
switch (args[0]) | ||
{ | ||
case "-install": | ||
{ | ||
// TODO: Installing service | ||
break; | ||
} | ||
case "-uninstall": | ||
{ | ||
// TODO: Uninstalling service | ||
break; | ||
} | ||
default: | ||
{ | ||
Console.WriteLine("Please run me with argument [-install] or [-uninstall]."); | ||
break; | ||
} | ||
} | ||
} | ||
#if DEBUG | ||
else | ||
{ | ||
// TODO: Run service in debug-mode | ||
Console.WriteLine(State.ThisMyPC); | ||
Context.Service.Debug(); | ||
} | ||
#endif | ||
} | ||
else | ||
{ | ||
// TODO: Run service in service-mode | ||
Context.Service.Start(); | ||
} | ||
} | ||
} | ||
} |
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,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("amp_runner")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("amp_runner")] | ||
[assembly: AssemblyCopyright("Copyright © 2020")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("31cf5a61-1355-4b8a-af68-b5806b720475")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Data; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.ServiceProcess; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace amp_runner.Runners | ||
{ | ||
partial class ConfigRunner : ServiceBase | ||
{ | ||
public ConfigRunner() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
protected override void OnStart(string[] args) | ||
{ | ||
// TODO: Add code here to start your service. | ||
} | ||
|
||
protected override void OnStop() | ||
{ | ||
// TODO: Add code here to perform any tear-down necessary to stop your service. | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.