Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Commit

Permalink
Merge pull request #26 from AlexaComp/client
Browse files Browse the repository at this point in the history
Very Big Client Update, Merge Client to Master
  • Loading branch information
Ari Madian committed Dec 10, 2018
2 parents 10ad1e0 + 4aa766f commit be79a36
Show file tree
Hide file tree
Showing 30 changed files with 1,014 additions and 633 deletions.
15 changes: 3 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,24 @@
AlexaComp/bin
AlexaComp/obj
AlexaComp/pathDir.xml
AlexaComp/AlexaCompTESTS.cs
AlexaComp/SavedMethods.cs
Deprecated/
AlexaComp/_SubProjects/CompatibilityTool/bin/Debug/Images
AlexaComp/_SubProjects/CompatibilityTool/bin/Debug/Layouts
AlexaComp/_SubProjects/CompatibilityTool/bin/Debug/x86
AlexaComp/_SubProjects/CompatibilityTool/bin/Debug/x64
AlexaComp/HardwareDevice.cs
AlexaComp/LightingController.cs
AlexaComp/Setup
*packages/
*node_modules/
*config.json
Setup1/
config.json
setup.exe
*package.zip
*Config.cs

# Visual Studio 2015/2017 cache/options directory
.vs/
.vscode/
*.code-workspace

# Config
AlexaComp/App.config
*.pfx
Lambda/Main_Lambda/Device_Linking_Email/config.py
AlexaComp/testCommands.txt
AlexaComp/CompatibilityTool/obj/Debug/CompatibilityTool.csprojAssemblyReference.cache
AlexaComp/CompatibilityTool/obj/Debug/CompatibilityTool.csprojAssemblyReference.cache
*.cache
AlexaComp/GlobalSuppressions.cs
126 changes: 57 additions & 69 deletions AlexaComp/AlexaComp.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System;
using System.Configuration;
using System.Threading;
using System.Net;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Windows.Forms;

using log4net;
using log4net.Config;

// TODO : Documentation
// TODO : Add region tags to files where appropriate.
using AlexaComp.Core;
using AlexaComp.Forms;
using AlexaComp.Core.Requests;
using AlexaComp.Core.Controllers;

/** Documentation format
* Description
* @param <paramname> <description>
Expand All @@ -17,85 +17,73 @@
*/

namespace AlexaComp {
class AlexaComp : AlexaCompCore{
class AlexaComp : AlexaCompCore {

[STAThread]
static void Main(string[] args) {
Stopwatch timer = new Stopwatch();
timer.Start();
XmlConfigurator.Configure();
AppDomain.CurrentDomain.UnhandledException += (s, e) => {
var exception = (Exception)e.ExceptionObject;
clog(exception.ToString(), "FATAL");
Clog(exception.ToString(), "FATAL");
throw exception;
};
clog("Exception Handler Registered");

Clog("Exception Handler Registered");

_log.Info("Start Program");

// Parse cli args
foreach (string arg in args) {
if ("-LogSensors".Contains(arg)) {
Thread LogSensorsThread = new Thread(new ParameterizedThreadStart(AlexaCompHARDWARE.getAllSensors));
LogSensorsThread.Start(false);
}
if ("-GetPrograms".Contains(arg)) {

}
if ("-AddProgram".Contains(arg)) {
if ("--AddProgramLiteral".Contains(arg)) {

}
}
}

// Log Assembly and Environment Information
System.Reflection.Assembly Assembly = System.Reflection.Assembly.GetEntryAssembly();
clog("Assembly.GetName()");
clog(" GetName - " + Assembly.GetName().ToString());
clog(" Name - " + Assembly.GetName().Name);
clog(" Version - " + Assembly.GetName().Version);
clog(" VersionCompatibility - " + Assembly.GetName().VersionCompatibility);
clog(" FullName - " + Assembly.FullName);
clog(" HostContext - " + Assembly.HostContext.ToString());
clog(" IsFullyTrusted - " + Assembly.IsFullyTrusted.ToString());
clog("System.Environment");
clog(" OSVersion - " + Environment.OSVersion);
clog(" Version - " + Environment.Version);
clog(" CurrentManagedThreadID - " + Environment.CurrentManagedThreadId.ToString());
clog(" Is64BitOS - " + Environment.Is64BitOperatingSystem.ToString());
clog(" Is64BitProcess - " + Environment.Is64BitProcess.ToString());
clog(" WorkingSet - " + Environment.WorkingSet.ToString());
clog("Target Framework - " + AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName);
clog("Executable Path - " + exePath.ToString());
clog("PathToDebug - " + pathToDebug);
clog("PathToProject - " + pathToProject);
Clog("Assembly.GetName()");
Clog(" GetName - " + Assembly.GetName().ToString());
Clog(" Name - " + Assembly.GetName().Name);
Clog(" Version - " + Assembly.GetName().Version);
Clog(" VersionCompatibility - " + Assembly.GetName().VersionCompatibility);
Clog(" FullName - " + Assembly.FullName);
Clog(" HostContext - " + Assembly.HostContext.ToString());
Clog(" IsFullyTrusted - " + Assembly.IsFullyTrusted.ToString());
Clog("System.Environment");
Clog(" OSVersion - " + Environment.OSVersion);
Clog(" Version - " + Environment.Version);
Clog(" CurrentManagedThreadID - " + Environment.CurrentManagedThreadId.ToString());
Clog(" Is64BitOS - " + Environment.Is64BitOperatingSystem.ToString());
Clog(" Is64BitProcess - " + Environment.Is64BitProcess.ToString());
Clog(" WorkingSet - " + Environment.WorkingSet.ToString());
Clog("Target Framework - " + AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName);
Clog("Executable Path - " + exePath.ToString());
Clog("PathToDebug - " + pathToDebug);
Clog("PathToProject - " + pathToProject);

getExternalIP();

LoadingScreenThread.Start();
}


/*
* Reads all user configured values into the settingsDict.
*/
public static void readConfig(){
foreach (string key in ConfigurationManager.AppSettings.AllKeys){
settingsDict[key] = GetConfigValue(key);
if (!IsConnectedToInternet()) {
Clog("No Internet Connection Detected... Quitting...", "FATAL");
MessageBox.Show("No Internet Connection Detected, Stopping AlexaComp...",
"AlexaComp",
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
StopApplication();
}
}

/*
* Gets the user's public IP address.
*/
public static void getExternalIP() {
string data = new WebClient().DownloadString("http://checkip.dyndns.org/");
Match match = Regex.Match(data, @"\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b"); // Regex match for IP
if (match.Success) {
clog("Public IP - " + match);
} else {
clog("IP Regex Match Unsuccessful.", "ERROR");
// Set Internal IP for port mapping and server
try {
string host = GetInternalIP();
Clog("Internal IP Found - " + host);
ServerConfig.HOST = host;
} catch (Exception) {
Clog("No Network Adapters With IPv4 Addresses Detected, Cannot Start Server... Quitting...", "FATAL");
MessageBox.Show("No Network Adapters With IPv4 Addresses Detected, Cannot Start Server. Stopping AlexaComp...",
"AlexaComp",
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
StopApplication();
}

GetExternalIP();

Clog("Initializing Hardware Sensors");

loadingScreenThread.Start(timer);
}
}
}

20 changes: 14 additions & 6 deletions AlexaComp/AlexaComp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<PublisherName>Ari Madian</PublisherName>
<AutorunEnabled>true</AutorunEnabled>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.2.0</ApplicationVersion>
<ApplicationVersion>1.0.3.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
Expand Down Expand Up @@ -170,9 +170,20 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AlexaCompCore.cs" />
<Compile Include="Core\Config.cs" />
<Compile Include="Core\Controllers\HardwareController.cs" />
<Compile Include="Core\Controllers\MDBController.cs" />
<Compile Include="Core\Extensions.cs" />
<Compile Include="Core\Hardware.cs" />
<Compile Include="Core\Request.cs" />
<Compile Include="Core\RequestTypes\AudioCommand.cs" />
<Compile Include="Core\RequestTypes\CompStat.cs" />
<Compile Include="Core\RequestTypes\Launch.cs" />
<Compile Include="Core\RequestTypes\OpenDevTools.cs" />
<Compile Include="Core\RequestTypes\RGBCommand.cs" />
<Compile Include="Core\RequestTypes\SystemCommand.cs" />
<Compile Include="Core\Response.cs" />
<Compile Include="Core\Sensor_.cs" />
<Compile Include="Forms\AdvancedSettingsForm.cs">
<SubType>Form</SubType>
</Compile>
Expand All @@ -187,8 +198,6 @@
</Compile>
<Compile Include="AlexaComp.cs" />
<Compile Include="AlexaCompSERVER.cs" />
<Compile Include="AlexaCompREQUEST.cs" />
<Compile Include="AlexaCompHARDWARE.cs" />
<Compile Include="Core\Controllers\AudioController.cs" />
<Compile Include="Core\Controllers\LightingController.cs" />
<Compile Include="Forms\LoadingScreenForm.cs">
Expand All @@ -197,6 +206,7 @@
<Compile Include="Forms\LoadingScreenForm.Designer.cs">
<DependentUpon>LoadingScreenForm.cs</DependentUpon>
</Compile>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Tests\TestFunctions.cs" />
<Compile Include="Core\ProgramInventory.cs" />
Expand Down Expand Up @@ -269,9 +279,7 @@
<FileType>File</FileType>
</PublishFile>
</ItemGroup>
<ItemGroup>
<Folder Include="SubProjects\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="packages\RGB.NET.Resources.Asus.0.1.0\build\RGB.NET.Resources.Asus.targets" Condition="Exists('packages\RGB.NET.Resources.Asus.0.1.0\build\RGB.NET.Resources.Asus.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
Loading

0 comments on commit be79a36

Please sign in to comment.