mirror of
https://github.com/furyfire/LEDNotifier.git
synced 2025-01-15 17:37:39 +00:00
Add project files.
This commit is contained in:
22
LEDNotifier.csproj
Normal file
22
LEDNotifier.csproj
Normal file
@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<DebugType>none</DebugType>
|
||||
<Configurations>Release</Configurations>
|
||||
<EnableNETAnalyzers>False</EnableNETAnalyzers>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<Deterministic>False</Deterministic>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HidSharp" Version="2.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
22
LEDNotifier.sln
Normal file
22
LEDNotifier.sln
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31919.166
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LEDNotifier", "LEDNotifier.csproj", "{108A185D-35DB-4319-A2A7-39E5CB5D133B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{108A185D-35DB-4319-A2A7-39E5CB5D133B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{108A185D-35DB-4319-A2A7-39E5CB5D133B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {3B8A9864-C644-4081-A4E7-750E3B46E4BF}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
70
Program.cs
Normal file
70
Program.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using HidSharp;
|
||||
using System;
|
||||
|
||||
byte color_code = 0x0;
|
||||
|
||||
if (args.Length != 1)
|
||||
{
|
||||
Console.WriteLine("No or too many arguments");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Random rnd = new Random();
|
||||
switch (args[0])
|
||||
{
|
||||
case "off":
|
||||
color_code = 0;
|
||||
break;
|
||||
case "blue":
|
||||
color_code = 1;
|
||||
break;
|
||||
case "red":
|
||||
color_code = 2;
|
||||
break;
|
||||
case "green":
|
||||
color_code = 3;
|
||||
break;
|
||||
case "aqua":
|
||||
color_code = 4;
|
||||
break;
|
||||
case "purple":
|
||||
color_code = 5;
|
||||
break;
|
||||
case "yellow":
|
||||
color_code = 6;
|
||||
break;
|
||||
case "white":
|
||||
color_code = 7;
|
||||
break;
|
||||
case "random":
|
||||
color_code = (byte)rnd.Next(1, 7);
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine("Invalid argument");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
HidDevice hidDevice;
|
||||
var ret = DeviceList.Local.TryGetHidDevice(out hidDevice, vendorID: 0x1294, productID: 0x1320);
|
||||
|
||||
if(ret == false)
|
||||
{
|
||||
Console.WriteLine("Device not found");
|
||||
return 1;
|
||||
}
|
||||
|
||||
DeviceStream deviceStream;
|
||||
ret = hidDevice.TryOpen(out deviceStream);
|
||||
|
||||
if (ret == false)
|
||||
{
|
||||
Console.WriteLine("Failed to open stream");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
byte[] data = { 0xff, color_code };
|
||||
deviceStream.Write(data, 0, data.Length);
|
||||
|
||||
return 0;
|
8
Properties/launchSettings.json
Normal file
8
Properties/launchSettings.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"profiles": {
|
||||
"LEDNotifier": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "random"
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user