Skip to content

Commit a708070

Browse files
committedFeb 4, 2015
Add FanFlow's source.
1 parent 1e960ad commit a708070

17 files changed

+985
-0
lines changed
 

‎.nuget/NuGet.Config

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<solution>
4+
<add key="disableSourceControlIntegration" value="true" />
5+
</solution>
6+
</configuration>

‎.nuget/NuGet.targets

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
5+
6+
<!-- Enable the restore command to run before builds -->
7+
<RestorePackages Condition=" '$(RestorePackages)' == '' ">true</RestorePackages>
8+
9+
<!-- Property that enables building a package from a project -->
10+
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
11+
12+
<!-- Determines if package restore consent is required to restore packages -->
13+
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
14+
15+
<!-- Download NuGet.exe if it does not already exist -->
16+
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">true</DownloadNuGetExe>
17+
</PropertyGroup>
18+
19+
<ItemGroup Condition=" '$(PackageSources)' == '' ">
20+
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
21+
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
22+
<!--
23+
<PackageSource Include="https://www.nuget.org/api/v2/" />
24+
<PackageSource Include="https://my-nuget-source/nuget/" />
25+
-->
26+
</ItemGroup>
27+
28+
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
29+
<!-- Windows specific commands -->
30+
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
31+
</PropertyGroup>
32+
33+
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
34+
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
35+
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
36+
</PropertyGroup>
37+
38+
<PropertyGroup>
39+
<PackagesProjectConfig Condition=" '$(OS)' == 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
40+
<PackagesProjectConfig Condition=" '$(OS)' != 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config</PackagesProjectConfig>
41+
</PropertyGroup>
42+
43+
<PropertyGroup>
44+
<PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig>
45+
<PackagesConfig Condition="Exists('$(PackagesProjectConfig)')">$(PackagesProjectConfig)</PackagesConfig>
46+
</PropertyGroup>
47+
48+
<PropertyGroup>
49+
<!-- NuGet command -->
50+
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
51+
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
52+
53+
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
54+
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 "$(NuGetExePath)"</NuGetCommand>
55+
56+
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
57+
58+
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
59+
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
60+
61+
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
62+
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
63+
64+
<!-- Commands -->
65+
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
66+
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
67+
68+
<!-- We need to ensure packages are restored prior to assembly resolve -->
69+
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
70+
RestorePackages;
71+
$(BuildDependsOn);
72+
</BuildDependsOn>
73+
74+
<!-- Make the build depend on restore packages -->
75+
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
76+
$(BuildDependsOn);
77+
BuildPackage;
78+
</BuildDependsOn>
79+
</PropertyGroup>
80+
81+
<Target Name="CheckPrerequisites">
82+
<!-- Raise an error if we're unable to locate nuget.exe -->
83+
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
84+
<!--
85+
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
86+
This effectively acts as a lock that makes sure that the download operation will only happen once and all
87+
parallel builds will have to wait for it to complete.
88+
-->
89+
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
90+
</Target>
91+
92+
<Target Name="_DownloadNuGet">
93+
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
94+
</Target>
95+
96+
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
97+
<Exec Command="$(RestoreCommand)"
98+
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
99+
100+
<Exec Command="$(RestoreCommand)"
101+
LogStandardErrorAsError="true"
102+
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
103+
</Target>
104+
105+
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
106+
<Exec Command="$(BuildCommand)"
107+
Condition=" '$(OS)' != 'Windows_NT' " />
108+
109+
<Exec Command="$(BuildCommand)"
110+
LogStandardErrorAsError="true"
111+
Condition=" '$(OS)' == 'Windows_NT' " />
112+
</Target>
113+
114+
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
115+
<ParameterGroup>
116+
<OutputFilename ParameterType="System.String" Required="true" />
117+
</ParameterGroup>
118+
<Task>
119+
<Reference Include="System.Core" />
120+
<Using Namespace="System" />
121+
<Using Namespace="System.IO" />
122+
<Using Namespace="System.Net" />
123+
<Using Namespace="Microsoft.Build.Framework" />
124+
<Using Namespace="Microsoft.Build.Utilities" />
125+
<Code Type="Fragment" Language="cs">
126+
<![CDATA[
127+
try {
128+
OutputFilename = Path.GetFullPath(OutputFilename);
129+
130+
Log.LogMessage("Downloading latest version of NuGet.exe...");
131+
WebClient webClient = new WebClient();
132+
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
133+
134+
return true;
135+
}
136+
catch (Exception ex) {
137+
Log.LogErrorFromException(ex);
138+
return false;
139+
}
140+
]]>
141+
</Code>
142+
</Task>
143+
</UsingTask>
144+
</Project>

‎FanFlow.sln

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2013
4+
VisualStudioVersion = 12.0.31101.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FanFlow.Service", "src\FanFlow.Service\FanFlow.Service.csproj", "{850890F1-C09C-4A7D-A634-1C05438C73D0}"
7+
EndProject
8+
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "FanFlow.Installer", "src\FanFlow.Installer\FanFlow.Installer.wixproj", "{EC14EE3A-5C0C-4FEB-A91C-08D508D8D462}"
9+
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{AFC8DD94-CE32-47C4-888D-E025D49400A2}"
11+
ProjectSection(SolutionItems) = preProject
12+
.nuget\NuGet.Config = .nuget\NuGet.Config
13+
.nuget\NuGet.exe = .nuget\NuGet.exe
14+
.nuget\NuGet.targets = .nuget\NuGet.targets
15+
EndProjectSection
16+
EndProject
17+
Global
18+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
19+
Debug|Any CPU = Debug|Any CPU
20+
Debug|Mixed Platforms = Debug|Mixed Platforms
21+
Debug|x86 = Debug|x86
22+
Release|Any CPU = Release|Any CPU
23+
Release|Mixed Platforms = Release|Mixed Platforms
24+
Release|x86 = Release|x86
25+
EndGlobalSection
26+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
27+
{850890F1-C09C-4A7D-A634-1C05438C73D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
28+
{850890F1-C09C-4A7D-A634-1C05438C73D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
29+
{850890F1-C09C-4A7D-A634-1C05438C73D0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
30+
{850890F1-C09C-4A7D-A634-1C05438C73D0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
31+
{850890F1-C09C-4A7D-A634-1C05438C73D0}.Debug|x86.ActiveCfg = Debug|Any CPU
32+
{850890F1-C09C-4A7D-A634-1C05438C73D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
33+
{850890F1-C09C-4A7D-A634-1C05438C73D0}.Release|Any CPU.Build.0 = Release|Any CPU
34+
{850890F1-C09C-4A7D-A634-1C05438C73D0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
35+
{850890F1-C09C-4A7D-A634-1C05438C73D0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
36+
{850890F1-C09C-4A7D-A634-1C05438C73D0}.Release|x86.ActiveCfg = Release|Any CPU
37+
{EC14EE3A-5C0C-4FEB-A91C-08D508D8D462}.Debug|Any CPU.ActiveCfg = Debug|x86
38+
{EC14EE3A-5C0C-4FEB-A91C-08D508D8D462}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
39+
{EC14EE3A-5C0C-4FEB-A91C-08D508D8D462}.Debug|Mixed Platforms.Build.0 = Debug|x86
40+
{EC14EE3A-5C0C-4FEB-A91C-08D508D8D462}.Debug|x86.ActiveCfg = Debug|x86
41+
{EC14EE3A-5C0C-4FEB-A91C-08D508D8D462}.Debug|x86.Build.0 = Debug|x86
42+
{EC14EE3A-5C0C-4FEB-A91C-08D508D8D462}.Release|Any CPU.ActiveCfg = Release|x86
43+
{EC14EE3A-5C0C-4FEB-A91C-08D508D8D462}.Release|Mixed Platforms.ActiveCfg = Release|x86
44+
{EC14EE3A-5C0C-4FEB-A91C-08D508D8D462}.Release|Mixed Platforms.Build.0 = Release|x86
45+
{EC14EE3A-5C0C-4FEB-A91C-08D508D8D462}.Release|x86.ActiveCfg = Release|x86
46+
{EC14EE3A-5C0C-4FEB-A91C-08D508D8D462}.Release|x86.Build.0 = Release|x86
47+
EndGlobalSection
48+
GlobalSection(SolutionProperties) = preSolution
49+
HideSolutionNode = FALSE
50+
EndGlobalSection
51+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6+
<ProductVersion>3.9</ProductVersion>
7+
<ProjectGuid>ec14ee3a-5c0c-4feb-a91c-08d508d8d462</ProjectGuid>
8+
<SchemaVersion>2.0</SchemaVersion>
9+
<OutputName>FanFlow.Installer</OutputName>
10+
<OutputType>Package</OutputType>
11+
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
12+
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
13+
</PropertyGroup>
14+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
15+
<OutputPath>bin\$(Configuration)\</OutputPath>
16+
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
17+
<DefineConstants>Debug</DefineConstants>
18+
</PropertyGroup>
19+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
20+
<OutputPath>bin\$(Configuration)\</OutputPath>
21+
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
22+
</PropertyGroup>
23+
<ItemGroup>
24+
<Compile Include="Product.wxs" />
25+
</ItemGroup>
26+
<ItemGroup>
27+
<ProjectReference Include="..\FanFlow.Service\FanFlow.Service.csproj">
28+
<Name>FanFlow.Service</Name>
29+
<Project>{850890f1-c09c-4a7d-a634-1c05438c73d0}</Project>
30+
<Private>True</Private>
31+
<DoNotHarvest>True</DoNotHarvest>
32+
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
33+
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
34+
</ProjectReference>
35+
</ItemGroup>
36+
<Import Project="$(WixTargetsPath)" />
37+
<!--
38+
To modify your build process, add your task inside one of the targets below and uncomment it.
39+
Other similar extension points exist, see Wix.targets.
40+
<Target Name="BeforeBuild">
41+
</Target>
42+
<Target Name="AfterBuild">
43+
</Target>
44+
-->
45+
</Project>

‎src/FanFlow.Installer/Product.wxs

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!-- The name of the product -->
4+
<?define Name = "FanFlow" ?>
5+
<!-- The manufacturer, for setup package publisher and folder info -->
6+
<?define Manufacturer = "Marek Suscak" ?>
7+
<!-- The version number of this setup package-->
8+
<?define Version = "1.0.0" ?>
9+
<!-- UpgradeCode must be unique and not changed once the first version of the program is installed. -->
10+
<?define UpgradeCode = "{3c3703a1-ccae-4d9a-b3b1-0828f91b0b24}" ?>
11+
12+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
13+
<Product Id="*" Name="$(var.Name)" Version="$(var.Version)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)" Language="1033">
14+
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
15+
16+
<!-- Allow upgrades and prevent downgrades -->
17+
<MajorUpgrade AllowDowngrades="no" DowngradeErrorMessage="A newer version of $(var.Name) is already installed." />
18+
<MediaTemplate />
19+
20+
<Feature Id="ProductFeature" Title="$(var.Name)" Level="1">
21+
<ComponentGroupRef Id="ProductComponents" />
22+
</Feature>
23+
</Product>
24+
25+
<Fragment>
26+
<!-- Define the directory structure -->
27+
<Directory Id="TARGETDIR" Name="SourceDir">
28+
<Directory Id="ProgramFilesFolder">
29+
<Directory Id="INSTALLFOLDER" Name="$(var.Name)" />
30+
</Directory>
31+
</Directory>
32+
</Fragment>
33+
34+
<Fragment>
35+
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
36+
<Component Id="$(var.FanFlow.Service.TargetFileName)" Guid="b0d67f1e-f56a-4aa2-97cd-825d58fe0fd7">
37+
<!-- Copies the TestService.exe file using the project reference preprocessor variables -->
38+
<File Id="$(var.FanFlow.Service.TargetFileName)" Source="$(var.FanFlow.Service.TargetPath)" KeyPath="yes" />
39+
<File Id="$(var.FanFlow.Service.TargetFileName).config" Source="$(var.FanFlow.Service.TargetPath).config" />
40+
<File Id="NLog.dll" Source="$(var.FanFlow.Service.TargetDir)\NLog.dll" />
41+
42+
<!-- Remove all files from the INSTALLFOLDER on uninstall -->
43+
<RemoveFile Id="ALLFILES" Name="*.*" On="both" />
44+
45+
<!-- Tell WiX to install the Service -->
46+
<ServiceInstall Id="ServiceInstaller"
47+
Type="ownProcess"
48+
Name="$(var.Name)"
49+
DisplayName="$(var.Name)"
50+
Description="$(var.Name) fixes Gigabytes System Information Viewer fan control behavior."
51+
Start="auto"
52+
ErrorControl="normal">
53+
</ServiceInstall>
54+
55+
<!-- Tell WiX to start the Service -->
56+
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="$(var.Name)" Wait="yes" />
57+
</Component>
58+
</ComponentGroup>
59+
</Fragment>
60+
</Wix>

‎src/FanFlow.Service/App.config

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<configSections>
4+
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
5+
</configSections>
6+
7+
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
8+
<targets>
9+
<target name="eventlog" xsi:type="EventLog" source="FanFlow Starter" layout="${message}${newline}${exception:format=ToString}"/>
10+
</targets>
11+
12+
<rules>
13+
<logger name="*" minlevel="Info" writeTo="eventlog" />
14+
</rules>
15+
</nlog>
16+
17+
<startup>
18+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
19+
</startup>
20+
</configuration>
+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{850890F1-C09C-4A7D-A634-1C05438C73D0}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>FanFlow.Service</RootNamespace>
11+
<AssemblyName>FanFlow.Service</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
15+
<RestorePackages>true</RestorePackages>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<PlatformTarget>AnyCPU</PlatformTarget>
19+
<DebugSymbols>true</DebugSymbols>
20+
<DebugType>full</DebugType>
21+
<Optimize>false</Optimize>
22+
<OutputPath>bin\Debug\</OutputPath>
23+
<DefineConstants>DEBUG;TRACE</DefineConstants>
24+
<ErrorReport>prompt</ErrorReport>
25+
<WarningLevel>4</WarningLevel>
26+
</PropertyGroup>
27+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
28+
<PlatformTarget>AnyCPU</PlatformTarget>
29+
<DebugType>pdbonly</DebugType>
30+
<Optimize>true</Optimize>
31+
<OutputPath>bin\Release\</OutputPath>
32+
<DefineConstants>TRACE</DefineConstants>
33+
<ErrorReport>prompt</ErrorReport>
34+
<WarningLevel>4</WarningLevel>
35+
</PropertyGroup>
36+
<PropertyGroup>
37+
<StartupObject />
38+
</PropertyGroup>
39+
<ItemGroup>
40+
<Reference Include="NLog">
41+
<HintPath>..\..\packages\NLog.3.2.0.0\lib\net45\NLog.dll</HintPath>
42+
</Reference>
43+
<Reference Include="System" />
44+
<Reference Include="System.Configuration.Install" />
45+
<Reference Include="System.Core" />
46+
<Reference Include="System.Management" />
47+
<Reference Include="System.Xml.Linq" />
48+
<Reference Include="System.Data.DataSetExtensions" />
49+
<Reference Include="Microsoft.CSharp" />
50+
<Reference Include="System.Data" />
51+
<Reference Include="System.ServiceProcess" />
52+
<Reference Include="System.Xml" />
53+
</ItemGroup>
54+
<ItemGroup>
55+
<Compile Include="ProjectInstaller.cs">
56+
<SubType>Component</SubType>
57+
</Compile>
58+
<Compile Include="ProjectInstaller.Designer.cs">
59+
<DependentUpon>ProjectInstaller.cs</DependentUpon>
60+
</Compile>
61+
<Compile Include="Service.cs">
62+
<SubType>Component</SubType>
63+
</Compile>
64+
<Compile Include="Service.Designer.cs">
65+
<DependentUpon>Service.cs</DependentUpon>
66+
</Compile>
67+
<Compile Include="Program.cs" />
68+
<Compile Include="Properties\AssemblyInfo.cs" />
69+
<Compile Include="ThermalDaemonStarter.cs" />
70+
</ItemGroup>
71+
<ItemGroup>
72+
<None Include="App.config">
73+
<SubType>Designer</SubType>
74+
</None>
75+
<None Include="packages.config" />
76+
</ItemGroup>
77+
<ItemGroup>
78+
<EmbeddedResource Include="ProjectInstaller.resx">
79+
<DependentUpon>ProjectInstaller.cs</DependentUpon>
80+
</EmbeddedResource>
81+
<EmbeddedResource Include="Service.resx">
82+
<DependentUpon>Service.cs</DependentUpon>
83+
</EmbeddedResource>
84+
</ItemGroup>
85+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
86+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
87+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
88+
<PropertyGroup>
89+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
90+
</PropertyGroup>
91+
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
92+
</Target>
93+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
94+
Other similar extension points exist, see Microsoft.Common.targets.
95+
<Target Name="BeforeBuild">
96+
</Target>
97+
<Target Name="AfterBuild">
98+
</Target>
99+
-->
100+
</Project>

‎src/FanFlow.Service/Program.cs

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.ServiceProcess;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace FanFlow.Service
10+
{
11+
static class Program
12+
{
13+
/// <summary>
14+
/// The main entry point for the application.
15+
/// </summary>
16+
static void Main(string[] args)
17+
{
18+
// Set working directory to the app domains base directory
19+
// http://stackoverflow.com/questions/858597/why-wont-my-windows-service-write-to-my-log-file
20+
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
21+
22+
if (Environment.UserInteractive)
23+
{
24+
ThermalDaemonStarter thermalDaemonStarter = new ThermalDaemonStarter();
25+
thermalDaemonStarter.Start();
26+
}
27+
else
28+
{
29+
ServiceBase[] ServicesToRun = new ServiceBase[]
30+
{
31+
new Service()
32+
};
33+
ServiceBase.Run(ServicesToRun);
34+
}
35+
36+
}
37+
}
38+
}

‎src/FanFlow.Service/ProjectInstaller.Designer.cs

+60
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Collections;
3+
using System.Collections.Generic;
4+
using System.ComponentModel;
5+
using System.Configuration.Install;
6+
using System.Linq;
7+
using System.Threading.Tasks;
8+
9+
namespace FanFlow.Service
10+
{
11+
[RunInstaller(true)]
12+
public partial class ProjectInstaller : System.Configuration.Install.Installer
13+
{
14+
public ProjectInstaller()
15+
{
16+
InitializeComponent();
17+
}
18+
}
19+
}
+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 2.0
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">2.0</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
<value>[base64 mime encoded serialized .NET Framework object]</value>
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27+
<comment>This is a comment</comment>
28+
</data>
29+
30+
There are any number of "resheader" rows that contain simple
31+
name/value pairs.
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
37+
mimetype set.
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
41+
extensible. For a given mimetype the value must be set accordingly:
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
45+
read any of the formats listed below.
46+
47+
mimetype: application/x-microsoft.net.object.binary.base64
48+
value : The object must be serialized with
49+
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50+
: and then encoded with base64 encoding.
51+
52+
mimetype: application/x-microsoft.net.object.soap.base64
53+
value : The object must be serialized with
54+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55+
: and then encoded with base64 encoding.
56+
57+
mimetype: application/x-microsoft.net.object.bytearray.base64
58+
value : The object must be serialized into a byte array
59+
: using a System.ComponentModel.TypeConverter
60+
: and then encoded with base64 encoding.
61+
-->
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64+
<xsd:element name="root" msdata:IsDataSet="true">
65+
<xsd:complexType>
66+
<xsd:choice maxOccurs="unbounded">
67+
<xsd:element name="metadata">
68+
<xsd:complexType>
69+
<xsd:sequence>
70+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
71+
</xsd:sequence>
72+
<xsd:attribute name="name" use="required" type="xsd:string" />
73+
<xsd:attribute name="type" type="xsd:string" />
74+
<xsd:attribute name="mimetype" type="xsd:string" />
75+
<xsd:attribute ref="xml:space" />
76+
</xsd:complexType>
77+
</xsd:element>
78+
<xsd:element name="assembly">
79+
<xsd:complexType>
80+
<xsd:attribute name="alias" type="xsd:string" />
81+
<xsd:attribute name="name" type="xsd:string" />
82+
</xsd:complexType>
83+
</xsd:element>
84+
<xsd:element name="data">
85+
<xsd:complexType>
86+
<xsd:sequence>
87+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89+
</xsd:sequence>
90+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93+
<xsd:attribute ref="xml:space" />
94+
</xsd:complexType>
95+
</xsd:element>
96+
<xsd:element name="resheader">
97+
<xsd:complexType>
98+
<xsd:sequence>
99+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100+
</xsd:sequence>
101+
<xsd:attribute name="name" type="xsd:string" use="required" />
102+
</xsd:complexType>
103+
</xsd:element>
104+
</xsd:choice>
105+
</xsd:complexType>
106+
</xsd:element>
107+
</xsd:schema>
108+
<resheader name="resmimetype">
109+
<value>text/microsoft-resx</value>
110+
</resheader>
111+
<resheader name="version">
112+
<value>2.0</value>
113+
</resheader>
114+
<resheader name="reader">
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116+
</resheader>
117+
<resheader name="writer">
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119+
</resheader>
120+
<metadata name="serviceProcessInstaller.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121+
<value>17, 56</value>
122+
</metadata>
123+
<metadata name="serviceInstaller.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
124+
<value>196, 17</value>
125+
</metadata>
126+
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
127+
<value>False</value>
128+
</metadata>
129+
</root>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("FanFlow.Service")]
9+
[assembly: AssemblyDescription("FanFlow fixes Gigabytes System Information Viewer fan control behavior.")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("Marek Suscak")]
12+
[assembly: AssemblyProduct("FanFlow.Service")]
13+
[assembly: AssemblyCopyright("Copyright © 2015")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("c9ce6582-91b6-49ea-aedc-172b07a40339")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

‎src/FanFlow.Service/Service.Designer.cs

+40
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/FanFlow.Service/Service.cs

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Data;
5+
using System.Diagnostics;
6+
using System.Linq;
7+
using System.ServiceProcess;
8+
using System.Text;
9+
using System.Threading.Tasks;
10+
11+
namespace FanFlow.Service
12+
{
13+
public partial class Service : ServiceBase
14+
{
15+
private ThermalDaemonStarter thermalDaemonStarter;
16+
17+
public Service()
18+
{
19+
InitializeComponent();
20+
this.thermalDaemonStarter = new ThermalDaemonStarter();
21+
}
22+
23+
protected override void OnStart(string[] args)
24+
{
25+
thermalDaemonStarter.Start();
26+
}
27+
28+
protected override void OnStop()
29+
{
30+
// Do nothing
31+
}
32+
}
33+
}

‎src/FanFlow.Service/Service.resx

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 2.0
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">2.0</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
<value>[base64 mime encoded serialized .NET Framework object]</value>
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27+
<comment>This is a comment</comment>
28+
</data>
29+
30+
There are any number of "resheader" rows that contain simple
31+
name/value pairs.
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
37+
mimetype set.
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
41+
extensible. For a given mimetype the value must be set accordingly:
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
45+
read any of the formats listed below.
46+
47+
mimetype: application/x-microsoft.net.object.binary.base64
48+
value : The object must be serialized with
49+
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50+
: and then encoded with base64 encoding.
51+
52+
mimetype: application/x-microsoft.net.object.soap.base64
53+
value : The object must be serialized with
54+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55+
: and then encoded with base64 encoding.
56+
57+
mimetype: application/x-microsoft.net.object.bytearray.base64
58+
value : The object must be serialized into a byte array
59+
: using a System.ComponentModel.TypeConverter
60+
: and then encoded with base64 encoding.
61+
-->
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64+
<xsd:element name="root" msdata:IsDataSet="true">
65+
<xsd:complexType>
66+
<xsd:choice maxOccurs="unbounded">
67+
<xsd:element name="metadata">
68+
<xsd:complexType>
69+
<xsd:sequence>
70+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
71+
</xsd:sequence>
72+
<xsd:attribute name="name" use="required" type="xsd:string" />
73+
<xsd:attribute name="type" type="xsd:string" />
74+
<xsd:attribute name="mimetype" type="xsd:string" />
75+
<xsd:attribute ref="xml:space" />
76+
</xsd:complexType>
77+
</xsd:element>
78+
<xsd:element name="assembly">
79+
<xsd:complexType>
80+
<xsd:attribute name="alias" type="xsd:string" />
81+
<xsd:attribute name="name" type="xsd:string" />
82+
</xsd:complexType>
83+
</xsd:element>
84+
<xsd:element name="data">
85+
<xsd:complexType>
86+
<xsd:sequence>
87+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89+
</xsd:sequence>
90+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93+
<xsd:attribute ref="xml:space" />
94+
</xsd:complexType>
95+
</xsd:element>
96+
<xsd:element name="resheader">
97+
<xsd:complexType>
98+
<xsd:sequence>
99+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100+
</xsd:sequence>
101+
<xsd:attribute name="name" type="xsd:string" use="required" />
102+
</xsd:complexType>
103+
</xsd:element>
104+
</xsd:choice>
105+
</xsd:complexType>
106+
</xsd:element>
107+
</xsd:schema>
108+
<resheader name="resmimetype">
109+
<value>text/microsoft-resx</value>
110+
</resheader>
111+
<resheader name="version">
112+
<value>2.0</value>
113+
</resheader>
114+
<resheader name="reader">
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116+
</resheader>
117+
<resheader name="writer">
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119+
</resheader>
120+
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
121+
<value>False</value>
122+
</metadata>
123+
</root>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
using Microsoft.Win32;
2+
using NLog;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Diagnostics;
6+
using System.IO;
7+
using System.Linq;
8+
using System.Text;
9+
using System.Threading.Tasks;
10+
11+
namespace FanFlow.Service
12+
{
13+
class ThermalDaemonStarter
14+
{
15+
private static Logger logger = LogManager.GetCurrentClassLogger();
16+
private const string ThermalDaemonExecutable = "thermald.exe";
17+
18+
private string FindPath()
19+
{
20+
var programFiles = Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFilesX86);
21+
var exePath = Path.Combine(programFiles, "Gigabyte", "SIV", ThermalDaemonExecutable);
22+
23+
if (!File.Exists(exePath))
24+
{
25+
throw new Exception(String.Format("Can't find thermald.exe at path: {0}", exePath));
26+
}
27+
28+
return exePath;
29+
}
30+
31+
private bool ProcessExists(string name)
32+
{
33+
bool result = false;
34+
Process[] processes = Process.GetProcesses();
35+
if (name.Length == 0)
36+
return result;
37+
foreach (Process process in processes)
38+
{
39+
if (string.Compare(process.ProcessName, name, true) == 0)
40+
{
41+
result = true;
42+
break;
43+
}
44+
}
45+
return result;
46+
}
47+
48+
private void RunProcess(string path)
49+
{
50+
ProcessStartInfo startInfo = new ProcessStartInfo();
51+
startInfo.FileName = path;
52+
startInfo.Verb = "runas";
53+
Process.Start(startInfo);
54+
}
55+
56+
public void Start()
57+
{
58+
try
59+
{
60+
if (ProcessExists(Path.GetFileNameWithoutExtension(ThermalDaemonExecutable)))
61+
{
62+
logger.Info("Thermal daemon is already running.");
63+
return;
64+
}
65+
66+
var path = FindPath();
67+
logger.Info(String.Format("File path for thermald.exe is: {0}", path));
68+
RunProcess(path);
69+
logger.Info("Thermal daemon started successfully");
70+
}
71+
catch (Exception ex)
72+
{
73+
logger.Error("Thermal daemon startup failed.", ex);
74+
}
75+
}
76+
}
77+
}

‎src/FanFlow.Service/packages.config

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="NLog" version="3.2.0.0" targetFramework="net45" />
4+
</packages>

0 commit comments

Comments
 (0)
Please sign in to comment.