Add files

This commit is contained in:
Neil Brommer 2018-05-01 17:30:40 -07:00
parent 798ce95e0a
commit b478c8c77e
4 changed files with 153 additions and 0 deletions

25
AutoDark.sln Normal file
View file

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27428.2027
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoDark", "AutoDark\AutoDark.csproj", "{F24CB25A-C684-4CCB-9346-A0535AB405F9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F24CB25A-C684-4CCB-9346-A0535AB405F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F24CB25A-C684-4CCB-9346-A0535AB405F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F24CB25A-C684-4CCB-9346-A0535AB405F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F24CB25A-C684-4CCB-9346-A0535AB405F9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7B70677A-B307-485C-B2F3-186C5D5C8A9D}
EndGlobalSection
EndGlobal

40
AutoDark/AutoDark.cs Normal file
View file

@ -0,0 +1,40 @@
using System;
using Microsoft.Win32;
namespace AutoDark {
class AutoDark {
static int Main(string[] args) {
int mode = -1;
if (args.Length > 0 && args[0].Equals("dark", StringComparison.InvariantCultureIgnoreCase))
mode = 0;
else if (args.Length > 0 && args[0].Equals("light", StringComparison.InvariantCultureIgnoreCase))
mode = 1;
else if (args.Length > 0) // there is an argument, but it's invalid
return -1;
RegistryKey k = Registry.CurrentUser.OpenSubKey(
"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
true
);
// if no argument, then just toggle
if (mode == -1) {
string val = k.GetValue("AppsUseLightTheme", 1).ToString();
mode = int.Parse(val);
if (mode == 1)
mode = 0;
else
mode = 1;
}
if (k != null) {
k.SetValue("AppsUseLightTheme", mode, RegistryValueKind.DWord);
k.Close();
} else
return -2;
return 0;
}
}
}

52
AutoDark/AutoDark.csproj Normal file
View file

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F24CB25A-C684-4CCB-9346-A0535AB405F9}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>AutoDark</RootNamespace>
<AssemblyName>AutoDark</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AutoDark.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -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("AutoDark")]
[assembly: AssemblyDescription("Sets/toggles the Windows dark mode setting")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AutoDark")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[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("f24cb25a-c684-4ccb-9346-a0535ab405f9")]
// 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")]