Skip to content

Commit

Permalink
tada
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Tran authored and Henry Tran committed Sep 27, 2022
1 parent 3287b06 commit 9680eb4
Show file tree
Hide file tree
Showing 34 changed files with 692 additions and 0 deletions.
Binary file added .vs/AllMyPC/v16/.suo
Binary file not shown.
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
6 changes: 6 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ExpandedNodes": [
""
],
"PreviewInSolutionExplorer": false
}
Binary file added .vs/slnx.sqlite
Binary file not shown.
Binary file added WinVerse/.vs/WinVerse/v16/.suo
Binary file not shown.
Binary file added WinVerse/.vs/WinVerse/v16/Browse.VC.db
Binary file not shown.
Binary file not shown.
25 changes: 25 additions & 0 deletions WinVerse/WinVerse.sln
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
6 changes: 6 additions & 0 deletions WinVerse/amp_runner/App.config
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>
12 changes: 12 additions & 0 deletions WinVerse/amp_runner/Context.cs
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
{
}
}
67 changes: 67 additions & 0 deletions WinVerse/amp_runner/Factories/ServiceFactory.cs
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();
}
}
24 changes: 24 additions & 0 deletions WinVerse/amp_runner/Models/MyPC.cs
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}>";
}
}
}
54 changes: 54 additions & 0 deletions WinVerse/amp_runner/Program.cs
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();
}
}
}
}
36 changes: 36 additions & 0 deletions WinVerse/amp_runner/Properties/AssemblyInfo.cs
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")]
37 changes: 37 additions & 0 deletions WinVerse/amp_runner/Runners/ConfigRunner.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions WinVerse/amp_runner/Runners/ConfigRunner.cs
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.
}
}
}
53 changes: 53 additions & 0 deletions WinVerse/amp_runner/Runners/UdpRunner.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9680eb4

Please sign in to comment.