Skip to content

Commit

Permalink
removed the form completely and added error handling if the executabl…
Browse files Browse the repository at this point in the history
…e for Razer Chroma Visualizer cannot be found
  • Loading branch information
JannesStroehlein committed Oct 8, 2021
1 parent 0bba901 commit baee07e
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 498 deletions.
10 changes: 5 additions & 5 deletions ToggleChromaVisualiser.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29324.140
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToggleChromaVisualiser", "ToggleChromaVisualiser\ToggleChromaVisualiser.csproj", "{DE858A4A-5B5F-4BDD-AAE9-960EE5BF370E}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToggleChromaVisualiser", "ToggleChromaVisualiser\ToggleChromaVisualiser.csproj", "{536DFDCF-AEA7-4990-B861-941F6A15445F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DE858A4A-5B5F-4BDD-AAE9-960EE5BF370E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE858A4A-5B5F-4BDD-AAE9-960EE5BF370E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE858A4A-5B5F-4BDD-AAE9-960EE5BF370E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE858A4A-5B5F-4BDD-AAE9-960EE5BF370E}.Release|Any CPU.Build.0 = Release|Any CPU
{536DFDCF-AEA7-4990-B861-941F6A15445F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{536DFDCF-AEA7-4990-B861-941F6A15445F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{536DFDCF-AEA7-4990-B861-941F6A15445F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{536DFDCF-AEA7-4990-B861-941F6A15445F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion ToggleChromaVisualiser/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>
51 changes: 0 additions & 51 deletions ToggleChromaVisualiser/Form1.Designer.cs

This file was deleted.

45 changes: 0 additions & 45 deletions ToggleChromaVisualiser/Form1.cs

This file was deleted.

120 changes: 0 additions & 120 deletions ToggleChromaVisualiser/Form1.resx

This file was deleted.

43 changes: 29 additions & 14 deletions ToggleChromaVisualiser/Program.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;
using System.Windows;

namespace ToggleChromaVisualiser
{
static class Program
class Program
{
/// <summary>
/// Der Haupteinstiegspunkt für die Anwendung.
/// </summary>
[STAThread]
static void Main()
static string ChromaVisualizerExec = @"C:\Program Files (x86)\Razer\Synapse3\AudioVisualizer\ChromaVisualizer.exe";
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
if (!File.Exists(ChromaVisualizerExec))
MessageBox.Show("The Razer Chroma Visualizer executable cannot be found.");
else
{
bool isrunning = false;

Process[] allprocesses = Process.GetProcesses();
for (int i = 0; i < allprocesses.Length; i++)
{
if (allprocesses[i].ProcessName.Contains("ChromaVisualizer"))
{
isrunning = true;
allprocesses[i].Kill();
break;
}
}
if (isrunning == false)
{
Process startit = new Process();
startit.StartInfo.FileName = ChromaVisualizerExec;
startit.Start();
}
}
}
}
}
12 changes: 7 additions & 5 deletions ToggleChromaVisualiser/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

Expand All @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ToggleChromaVisualiser")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -20,7 +20,7 @@
[assembly: ComVisible(false)]

// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("de858a4a-5b5f-4bdd-aae9-960ee5bf370e")]
[assembly: Guid("536dfdcf-aea7-4990-b861-941f6a15445f")]

// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
Expand All @@ -32,5 +32,7 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("21.10.8.0")]
[assembly: AssemblyFileVersion("21.10.8.0")]

[assembly: AssemblyInformationalVersion("21.10.0")]
Loading

0 comments on commit baee07e

Please sign in to comment.