mirror of
https://github.com/ckaczor/SystemTemperatureStatusWindow.git
synced 2026-01-13 17:23:03 -05:00
Split into service and UI
This commit is contained in:
31
Service/App.config
Normal file
31
Service/App.config
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<system.serviceModel>
|
||||
<behaviors>
|
||||
<serviceBehaviors>
|
||||
<behavior name="">
|
||||
<serviceMetadata httpGetEnabled="true"/>
|
||||
<serviceDebug includeExceptionDetailInFaults="false"/>
|
||||
</behavior>
|
||||
</serviceBehaviors>
|
||||
</behaviors>
|
||||
<services>
|
||||
<service name="SystemTemperatureService.SystemTemperatureService">
|
||||
<endpoint address="" binding="wsHttpBinding" contract="SystemTemperatureService.ISystemTemperatureService">
|
||||
<identity>
|
||||
<dns value="localhost"/>
|
||||
</identity>
|
||||
</endpoint>
|
||||
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
|
||||
<host>
|
||||
<baseAddresses>
|
||||
<add baseAddress="http://localhost/SystemTemperatureService/SystemTemperatureService.svc"/>
|
||||
</baseAddresses>
|
||||
</host>
|
||||
</service>
|
||||
</services>
|
||||
</system.serviceModel>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
30
Service/Device.cs
Normal file
30
Service/Device.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace SystemTemperatureService
|
||||
{
|
||||
[DataContract]
|
||||
public enum DeviceType
|
||||
{
|
||||
[EnumMember]
|
||||
Cpu,
|
||||
|
||||
[EnumMember]
|
||||
Gpu,
|
||||
|
||||
[EnumMember]
|
||||
Hdd
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class Device
|
||||
{
|
||||
[DataMember]
|
||||
public string Id { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public DeviceType Type { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public double Temperature { get; set; }
|
||||
}
|
||||
}
|
||||
70
Service/Framework/ConsoleHarness.cs
Normal file
70
Service/Framework/ConsoleHarness.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
|
||||
namespace SystemTemperatureService.Framework
|
||||
{
|
||||
public static class ConsoleHarness
|
||||
{
|
||||
// Run a service from the console given a service implementation
|
||||
public static void Run(string[] args, IWindowsService service)
|
||||
{
|
||||
bool isRunning = true;
|
||||
|
||||
// simulate starting the windows service
|
||||
service.OnStart(args);
|
||||
|
||||
// let it run as long as Q is not pressed
|
||||
while (isRunning)
|
||||
{
|
||||
WriteToConsole(ConsoleColor.Yellow, "Enter either [Q]uit, [P]ause, [R]esume : ");
|
||||
isRunning = HandleConsoleInput(service, Console.ReadLine());
|
||||
}
|
||||
|
||||
// stop and shutdown
|
||||
service.OnStop();
|
||||
service.OnShutdown();
|
||||
}
|
||||
|
||||
// Private input handler for console commands.
|
||||
private static bool HandleConsoleInput(IWindowsService service, string line)
|
||||
{
|
||||
bool canContinue = true;
|
||||
|
||||
// check input
|
||||
if (line != null)
|
||||
{
|
||||
switch (line.ToUpper())
|
||||
{
|
||||
case "Q":
|
||||
canContinue = false;
|
||||
break;
|
||||
|
||||
case "P":
|
||||
service.OnPause();
|
||||
break;
|
||||
|
||||
case "R":
|
||||
service.OnContinue();
|
||||
break;
|
||||
|
||||
default:
|
||||
WriteToConsole(ConsoleColor.Red, "Did not understand that input, try again.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return canContinue;
|
||||
}
|
||||
|
||||
// Helper method to write a message to the console at the given foreground color.
|
||||
internal static void WriteToConsole(ConsoleColor foregroundColor, string format, params object[] formatArguments)
|
||||
{
|
||||
ConsoleColor originalColor = Console.ForegroundColor;
|
||||
Console.ForegroundColor = foregroundColor;
|
||||
|
||||
Console.WriteLine(format, formatArguments);
|
||||
Console.Out.Flush();
|
||||
|
||||
Console.ForegroundColor = originalColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
46
Service/Framework/IWindowsService.cs
Normal file
46
Service/Framework/IWindowsService.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
|
||||
namespace SystemTemperatureService.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// The interface that any windows service should implement to be used
|
||||
/// with the GenericWindowsService executable.
|
||||
/// </summary>
|
||||
public interface IWindowsService : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// This method is called when the service gets a request to start.
|
||||
/// </summary>
|
||||
/// <param name="args">Any command line arguments</param>
|
||||
void OnStart(string[] args);
|
||||
|
||||
/// <summary>
|
||||
/// This method is called when the service gets a request to stop.
|
||||
/// </summary>
|
||||
void OnStop();
|
||||
|
||||
/// <summary>
|
||||
/// This method is called when a service gets a request to pause,
|
||||
/// but not stop completely.
|
||||
/// </summary>
|
||||
void OnPause();
|
||||
|
||||
/// <summary>
|
||||
/// This method is called when a service gets a request to resume
|
||||
/// after a pause is issued.
|
||||
/// </summary>
|
||||
void OnContinue();
|
||||
|
||||
/// <summary>
|
||||
/// This method is called when the machine the service is running on
|
||||
/// is being shutdown.
|
||||
/// </summary>
|
||||
void OnShutdown();
|
||||
|
||||
/// <summary>
|
||||
/// This method is called when a custom command is issued to the service.
|
||||
/// </summary>
|
||||
/// <param name="command">The command identifier to execute.</param >
|
||||
void OnCustomCommand(int command);
|
||||
}
|
||||
}
|
||||
47
Service/Framework/TypeExtensions.cs
Normal file
47
Service/Framework/TypeExtensions.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace SystemTemperatureService.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods for the Type class
|
||||
/// </summary>
|
||||
public static class TypeExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Loads the configuration from assembly attributes
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the custom attribute to find.</typeparam>
|
||||
/// <param name="typeWithAttributes">The calling assembly to search.</param>
|
||||
/// <returns>The custom attribute of type T, if found.</returns>
|
||||
public static T GetAttribute<T>(this Type typeWithAttributes)
|
||||
where T : Attribute
|
||||
{
|
||||
return GetAttributes<T>(typeWithAttributes).FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads the configuration from assembly attributes
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the custom attribute to find.</typeparam>
|
||||
/// <param name="typeWithAttributes">The calling assembly to search.</param>
|
||||
/// <returns>An enumeration of attributes of type T that were found.</returns>
|
||||
public static IEnumerable<T> GetAttributes<T>(this Type typeWithAttributes)
|
||||
where T : Attribute
|
||||
{
|
||||
// Try to find the configuration attribute for the default logger if it exists
|
||||
object[] configAttributes = Attribute.GetCustomAttributes(typeWithAttributes,
|
||||
typeof(T), false);
|
||||
|
||||
// get just the first one
|
||||
if (configAttributes != null && configAttributes.Length > 0)
|
||||
{
|
||||
foreach (T attribute in configAttributes)
|
||||
{
|
||||
yield return attribute;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
90
Service/Framework/WindowsServiceAttribute.cs
Normal file
90
Service/Framework/WindowsServiceAttribute.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.ServiceProcess;
|
||||
|
||||
namespace SystemTemperatureService.Framework
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
|
||||
public class WindowsServiceAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the service.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The displayable name that shows in service manager (defaults to Name).
|
||||
/// </summary>
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A textural description of the service name (defaults to Name).
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The user to run the service under (defaults to null). A null or empty
|
||||
/// UserName field causes the service to run as ServiceAccount.LocalService.
|
||||
/// </summary>
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The password to run the service under (defaults to null). Ignored
|
||||
/// if the UserName is empty or null, this property is ignored.
|
||||
/// </summary>
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the event log source to set the service's EventLog to. If this is
|
||||
/// empty or null (the default) no event log source is set. If set, will auto-log
|
||||
/// start and stop events.
|
||||
/// </summary>
|
||||
public string EventLogSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The method to start the service when the machine reboots (defaults to Manual).
|
||||
/// </summary>
|
||||
public ServiceStartMode StartMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if service supports pause and continue (defaults to true).
|
||||
/// </summary>
|
||||
public bool CanPauseAndContinue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if service supports shutdown event (defaults to true).
|
||||
/// </summary>
|
||||
public bool CanShutdown { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if service supports stop event (defaults to true).
|
||||
/// </summary>
|
||||
public bool CanStop { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The service account to use if the UserName is not specified.
|
||||
/// </summary>
|
||||
public ServiceAccount ServiceAccount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Marks an IWindowsService with configuration and installation attributes.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the windows service.</param>
|
||||
public WindowsServiceAttribute(string name)
|
||||
{
|
||||
// set name and default description and display name to name.
|
||||
Name = name;
|
||||
Description = name;
|
||||
DisplayName = name;
|
||||
|
||||
// default all other attributes.
|
||||
CanStop = true;
|
||||
CanShutdown = true;
|
||||
CanPauseAndContinue = true;
|
||||
StartMode = ServiceStartMode.Manual;
|
||||
EventLogSource = null;
|
||||
Password = null;
|
||||
UserName = null;
|
||||
ServiceAccount = ServiceAccount.LocalService;
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Service/Framework/WindowsServiceHarness.Designer.cs
generated
Normal file
37
Service/Framework/WindowsServiceHarness.Designer.cs
generated
Normal file
@@ -0,0 +1,37 @@
|
||||
namespace SystemTemperatureService.Framework
|
||||
{
|
||||
public partial class WindowsServiceHarness
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
this.ServiceName = "UsageService";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
129
Service/Framework/WindowsServiceHarness.cs
Normal file
129
Service/Framework/WindowsServiceHarness.cs
Normal file
@@ -0,0 +1,129 @@
|
||||
using System;
|
||||
using System.ServiceProcess;
|
||||
|
||||
namespace SystemTemperatureService.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// A generic Windows Service that can handle any assembly that
|
||||
/// implements IWindowsService (including AbstractWindowsService)
|
||||
/// </summary>
|
||||
public partial class WindowsServiceHarness : ServiceBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the class implementing the windows service
|
||||
/// </summary>
|
||||
public IWindowsService ServiceImplementation { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor a generic windows service from the given class
|
||||
/// </summary>
|
||||
/// <param name="serviceImplementation">Service implementation.</param>
|
||||
public WindowsServiceHarness(IWindowsService serviceImplementation)
|
||||
{
|
||||
// make sure service passed in is valid
|
||||
if (serviceImplementation == null)
|
||||
{
|
||||
throw new ArgumentNullException("serviceImplementation",
|
||||
"IWindowsService cannot be null in call to GenericWindowsService");
|
||||
}
|
||||
|
||||
// set instance and backward instance
|
||||
ServiceImplementation = serviceImplementation;
|
||||
|
||||
// configure our service
|
||||
ConfigureServiceFromAttributes(serviceImplementation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override service control on continue
|
||||
/// </summary>
|
||||
protected override void OnContinue()
|
||||
{
|
||||
// perform class specific behavior
|
||||
ServiceImplementation.OnContinue();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when service is paused
|
||||
/// </summary>
|
||||
protected override void OnPause()
|
||||
{
|
||||
// perform class specific behavior
|
||||
ServiceImplementation.OnPause();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when a custom command is requested
|
||||
/// </summary>
|
||||
/// <param name="command">Id of custom command</param>
|
||||
protected override void OnCustomCommand(int command)
|
||||
{
|
||||
// perform class specific behavior
|
||||
ServiceImplementation.OnCustomCommand(command);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the Operating System is shutting down
|
||||
/// </summary>
|
||||
protected override void OnShutdown()
|
||||
{
|
||||
// perform class specific behavior
|
||||
ServiceImplementation.OnShutdown();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when service is requested to start
|
||||
/// </summary>
|
||||
/// <param name="args">The startup arguments array.</param>
|
||||
protected override void OnStart(string[] args)
|
||||
{
|
||||
ServiceImplementation.OnStart(args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when service is requested to stop
|
||||
/// </summary>
|
||||
protected override void OnStop()
|
||||
{
|
||||
ServiceImplementation.OnStop();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set configuration data
|
||||
/// </summary>
|
||||
/// <param name="serviceImplementation">The service with configuration settings.</param>
|
||||
private void ConfigureServiceFromAttributes(IWindowsService serviceImplementation)
|
||||
{
|
||||
var attribute = serviceImplementation.GetType().GetAttribute<WindowsServiceAttribute>();
|
||||
|
||||
if (attribute != null)
|
||||
{
|
||||
// wire up the event log source, if provided
|
||||
if (!string.IsNullOrWhiteSpace(attribute.EventLogSource))
|
||||
{
|
||||
// assign to the base service's EventLog property for auto-log events.
|
||||
EventLog.Source = attribute.EventLogSource;
|
||||
}
|
||||
|
||||
CanStop = attribute.CanStop;
|
||||
CanPauseAndContinue = attribute.CanPauseAndContinue;
|
||||
CanShutdown = attribute.CanShutdown;
|
||||
|
||||
// we don't handle: laptop power change event
|
||||
CanHandlePowerEvent = false;
|
||||
|
||||
// we don't handle: Term Services session event
|
||||
CanHandleSessionChangeEvent = false;
|
||||
|
||||
// always auto-event-log
|
||||
AutoLog = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
string.Format("IWindowsService implementer {0} must have a WindowsServiceAttribute.",
|
||||
serviceImplementation.GetType().FullName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Service/Framework/WindowsServiceInstaller.Designer.cs
generated
Normal file
36
Service/Framework/WindowsServiceInstaller.Designer.cs
generated
Normal file
@@ -0,0 +1,36 @@
|
||||
namespace SystemTemperatureService.Framework
|
||||
{
|
||||
public partial class WindowsServiceInstaller
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
212
Service/Framework/WindowsServiceInstaller.cs
Normal file
212
Service/Framework/WindowsServiceInstaller.cs
Normal file
@@ -0,0 +1,212 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Configuration.Install;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.ServiceProcess;
|
||||
|
||||
namespace SystemTemperatureService.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// A generic windows service installer
|
||||
/// </summary>
|
||||
[RunInstaller(true)]
|
||||
public partial class WindowsServiceInstaller : Installer
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the windows service to install.
|
||||
/// </summary>
|
||||
public WindowsServiceAttribute Configuration { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a blank windows service installer with configuration in ServiceImplementation
|
||||
/// </summary>
|
||||
public WindowsServiceInstaller()
|
||||
: this(typeof(ServiceImplementation))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a windows service installer using the type specified.
|
||||
/// </summary>
|
||||
/// <param name="windowsServiceType">The type of the windows service to install.</param>
|
||||
public WindowsServiceInstaller(Type windowsServiceType)
|
||||
{
|
||||
if (!windowsServiceType.GetInterfaces().Contains(typeof(IWindowsService)))
|
||||
{
|
||||
throw new ArgumentException("Type to install must implement IWindowsService.",
|
||||
"windowsServiceType");
|
||||
}
|
||||
|
||||
var attribute = windowsServiceType.GetAttribute<WindowsServiceAttribute>();
|
||||
|
||||
if (attribute == null)
|
||||
{
|
||||
throw new ArgumentException("Type to install must be marked with a WindowsServiceAttribute.",
|
||||
"windowsServiceType");
|
||||
}
|
||||
|
||||
Configuration = attribute;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Performs a transacted installation at run-time of the AutoCounterInstaller and any other listed installers.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The IWindowsService implementer to install.</typeparam>
|
||||
public static void RuntimeInstall<T>()
|
||||
where T : IWindowsService
|
||||
{
|
||||
string path = "/assemblypath=" + Assembly.GetEntryAssembly().Location;
|
||||
|
||||
using (var ti = new TransactedInstaller())
|
||||
{
|
||||
ti.Installers.Add(new WindowsServiceInstaller(typeof(T)));
|
||||
ti.Context = new InstallContext(null, new[] { path });
|
||||
ti.Install(new Hashtable());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Performs a transacted un-installation at run-time of the AutoCounterInstaller and any other listed installers.
|
||||
/// </summary>
|
||||
/// <param name="otherInstallers">The other installers to include in the transaction</param>
|
||||
/// <typeparam name="T">The IWindowsService implementer to install.</typeparam>
|
||||
public static void RuntimeUnInstall<T>(params Installer[] otherInstallers)
|
||||
where T : IWindowsService
|
||||
{
|
||||
string path = "/assemblypath=" + Assembly.GetEntryAssembly().Location;
|
||||
|
||||
using (var ti = new TransactedInstaller())
|
||||
{
|
||||
ti.Installers.Add(new WindowsServiceInstaller(typeof(T)));
|
||||
ti.Context = new InstallContext(null, new[] { path });
|
||||
ti.Uninstall(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Installer class, to use run InstallUtil against this .exe
|
||||
/// </summary>
|
||||
/// <param name="savedState">The saved state for the installation.</param>
|
||||
public override void Install(IDictionary savedState)
|
||||
{
|
||||
ConsoleHarness.WriteToConsole(ConsoleColor.White, "Installing service {0}.", Configuration.Name);
|
||||
|
||||
// install the service
|
||||
ConfigureInstallers();
|
||||
base.Install(savedState);
|
||||
|
||||
// wire up the event log source, if provided
|
||||
if (!string.IsNullOrWhiteSpace(Configuration.EventLogSource))
|
||||
{
|
||||
// create the source if it doesn't exist
|
||||
if (!EventLog.SourceExists(Configuration.EventLogSource))
|
||||
{
|
||||
EventLog.CreateEventSource(Configuration.EventLogSource, "Application");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Removes the counters, then calls the base uninstall.
|
||||
/// </summary>
|
||||
/// <param name="savedState">The saved state for the installation.</param>
|
||||
public override void Uninstall(IDictionary savedState)
|
||||
{
|
||||
ConsoleHarness.WriteToConsole(ConsoleColor.White, "Un-Installing service {0}.", Configuration.Name);
|
||||
|
||||
// load the assembly file name and the config
|
||||
ConfigureInstallers();
|
||||
base.Uninstall(savedState);
|
||||
|
||||
// wire up the event log source, if provided
|
||||
if (!string.IsNullOrWhiteSpace(Configuration.EventLogSource))
|
||||
{
|
||||
// create the source if it doesn't exist
|
||||
if (EventLog.SourceExists(Configuration.EventLogSource))
|
||||
{
|
||||
EventLog.DeleteEventSource(Configuration.EventLogSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Rolls back to the state of the counter, and performs the normal rollback.
|
||||
/// </summary>
|
||||
/// <param name="savedState">The saved state for the installation.</param>
|
||||
public override void Rollback(IDictionary savedState)
|
||||
{
|
||||
ConsoleHarness.WriteToConsole(ConsoleColor.White, "Rolling back service {0}.", Configuration.Name);
|
||||
|
||||
// load the assembly file name and the config
|
||||
ConfigureInstallers();
|
||||
base.Rollback(savedState);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Method to configure the installers
|
||||
/// </summary>
|
||||
private void ConfigureInstallers()
|
||||
{
|
||||
// load the assembly file name and the config
|
||||
Installers.Add(ConfigureProcessInstaller());
|
||||
Installers.Add(ConfigureServiceInstaller());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to configure a process installer for this windows service
|
||||
/// </summary>
|
||||
/// <returns>Process installer for this service</returns>
|
||||
private ServiceProcessInstaller ConfigureProcessInstaller()
|
||||
{
|
||||
var result = new ServiceProcessInstaller();
|
||||
|
||||
// if a user name is not provided, will run under local service acct
|
||||
if (string.IsNullOrEmpty(Configuration.UserName))
|
||||
{
|
||||
result.Account = Configuration.ServiceAccount;
|
||||
result.Username = null;
|
||||
result.Password = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise, runs under the specified user authority
|
||||
result.Account = ServiceAccount.User;
|
||||
result.Username = Configuration.UserName;
|
||||
result.Password = Configuration.Password;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to configure a service installer for this windows service
|
||||
/// </summary>
|
||||
/// <returns>Process installer for this service</returns>
|
||||
private ServiceInstaller ConfigureServiceInstaller()
|
||||
{
|
||||
// create and config a service installer
|
||||
var result = new ServiceInstaller
|
||||
{
|
||||
ServiceName = Configuration.Name,
|
||||
DisplayName = Configuration.DisplayName,
|
||||
Description = Configuration.Description,
|
||||
StartType = Configuration.StartMode,
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Service/ISystemTemperatureService.cs
Normal file
12
Service/ISystemTemperatureService.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceModel;
|
||||
|
||||
namespace SystemTemperatureService
|
||||
{
|
||||
[ServiceContract]
|
||||
interface ISystemTemperatureService
|
||||
{
|
||||
[OperationContract]
|
||||
List<Device> GetDeviceList();
|
||||
}
|
||||
}
|
||||
61
Service/Program.cs
Normal file
61
Service/Program.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using Common.Debug;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.ServiceProcess;
|
||||
using SystemTemperatureService.Framework;
|
||||
|
||||
namespace SystemTemperatureService
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Tracer.Initialize(null, null, Process.GetCurrentProcess().Id.ToString(CultureInfo.InvariantCulture), Environment.UserInteractive);
|
||||
|
||||
if (args.Contains("-install", StringComparer.InvariantCultureIgnoreCase))
|
||||
{
|
||||
Tracer.WriteLine("Starting install...");
|
||||
|
||||
try
|
||||
{
|
||||
WindowsServiceInstaller.RuntimeInstall<ServiceImplementation>();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Tracer.WriteException("Service install", exception);
|
||||
}
|
||||
|
||||
Tracer.WriteLine("Install complete");
|
||||
}
|
||||
else if (args.Contains("-uninstall", StringComparer.InvariantCultureIgnoreCase))
|
||||
{
|
||||
Tracer.WriteLine("Starting uninstall...");
|
||||
|
||||
try
|
||||
{
|
||||
WindowsServiceInstaller.RuntimeUnInstall<ServiceImplementation>();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Tracer.WriteException("Service uninstall", exception);
|
||||
}
|
||||
|
||||
Tracer.WriteLine("Uninstall complete");
|
||||
}
|
||||
else
|
||||
{
|
||||
Tracer.WriteLine("Starting service");
|
||||
|
||||
var implementation = new ServiceImplementation();
|
||||
|
||||
if (Environment.UserInteractive)
|
||||
ConsoleHarness.Run(args, implementation);
|
||||
else
|
||||
ServiceBase.Run(new WindowsServiceHarness(implementation));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
35
Service/Properties/AssemblyInfo.cs
Normal file
35
Service/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
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("Service")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Service")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[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("9cf103fa-d59f-4abd-b1bd-797119b4843e")]
|
||||
|
||||
// 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")]
|
||||
57
Service/ServiceImplementation.cs
Normal file
57
Service/ServiceImplementation.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using Common.Debug;
|
||||
using System;
|
||||
using System.ServiceModel;
|
||||
using System.ServiceProcess;
|
||||
using SystemTemperatureService.Framework;
|
||||
|
||||
namespace SystemTemperatureService
|
||||
{
|
||||
[WindowsService("SystemTemperatureStatus", DisplayName = "System Temperature Status", Description = "", StartMode = ServiceStartMode.Automatic, ServiceAccount = ServiceAccount.LocalSystem)]
|
||||
public class ServiceImplementation : IWindowsService
|
||||
{
|
||||
private ServiceHost _serviceHost;
|
||||
|
||||
public void OnStart(string[] args)
|
||||
{
|
||||
using (new BeginEndTracer(GetType().Name))
|
||||
{
|
||||
try
|
||||
{
|
||||
_serviceHost = new ServiceHost(typeof(SystemTemperatureService));
|
||||
_serviceHost.Open();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Tracer.WriteException("ServiceImplementation.OnStart", exception);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnStop()
|
||||
{
|
||||
using (new BeginEndTracer(GetType().Name))
|
||||
{
|
||||
try
|
||||
{
|
||||
_serviceHost.Close();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Tracer.WriteException("ServiceImplementation.OnStop", exception);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPause() { }
|
||||
|
||||
public void OnContinue() { }
|
||||
|
||||
public void OnShutdown() { }
|
||||
|
||||
public void Dispose() { }
|
||||
|
||||
public void OnCustomCommand(int command) { }
|
||||
}
|
||||
}
|
||||
60
Service/SystemTemperatureService.cs
Normal file
60
Service/SystemTemperatureService.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using OpenHardwareMonitor.Hardware;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace SystemTemperatureService
|
||||
{
|
||||
public class SystemTemperatureService : ISystemTemperatureService
|
||||
{
|
||||
private static Computer _computer;
|
||||
|
||||
public List<Device> GetDeviceList()
|
||||
{
|
||||
if (_computer == null)
|
||||
{
|
||||
_computer = new Computer { HDDEnabled = true, FanControllerEnabled = false, GPUEnabled = true, MainboardEnabled = true, CPUEnabled = true };
|
||||
_computer.Open();
|
||||
}
|
||||
|
||||
var deviceList = new List<Device>();
|
||||
|
||||
foreach (var hardware in _computer.Hardware)
|
||||
{
|
||||
hardware.Update();
|
||||
|
||||
var averageValue = hardware.Sensors.Where(sensor => sensor.SensorType == SensorType.Temperature).Average(sensor => sensor.Value);
|
||||
|
||||
if (averageValue.HasValue)
|
||||
{
|
||||
Device device = null;
|
||||
|
||||
switch (hardware.HardwareType)
|
||||
{
|
||||
case HardwareType.CPU:
|
||||
device = new Device { Type = DeviceType.Cpu };
|
||||
break;
|
||||
|
||||
case HardwareType.GpuAti:
|
||||
case HardwareType.GpuNvidia:
|
||||
device = new Device { Type = DeviceType.Gpu };
|
||||
break;
|
||||
|
||||
case HardwareType.HDD:
|
||||
device = new Device { Type = DeviceType.Hdd };
|
||||
break;
|
||||
}
|
||||
|
||||
if (device != null)
|
||||
{
|
||||
device.Id = hardware.Identifier.ToString();
|
||||
device.Temperature = averageValue.Value;
|
||||
}
|
||||
|
||||
deviceList.Add(device);
|
||||
}
|
||||
}
|
||||
|
||||
return deviceList;
|
||||
}
|
||||
}
|
||||
}
|
||||
98
Service/SystemTemperatureService.csproj
Normal file
98
Service/SystemTemperatureService.csproj
Normal file
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" 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>{94DE06A9-4F37-487B-96E9-663B9A98F05D}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SystemTemperatureService</RootNamespace>
|
||||
<AssemblyName>SystemTemperatureService</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</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>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Device.cs" />
|
||||
<Compile Include="Framework\ConsoleHarness.cs" />
|
||||
<Compile Include="Framework\IWindowsService.cs" />
|
||||
<Compile Include="Framework\TypeExtensions.cs" />
|
||||
<Compile Include="Framework\WindowsServiceAttribute.cs" />
|
||||
<Compile Include="Framework\WindowsServiceHarness.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Framework\WindowsServiceHarness.Designer.cs">
|
||||
<DependentUpon>WindowsServiceHarness.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Framework\WindowsServiceInstaller.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Framework\WindowsServiceInstaller.Designer.cs">
|
||||
<DependentUpon>WindowsServiceInstaller.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ISystemTemperatureService.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SystemTemperatureService.cs" />
|
||||
<Compile Include="ServiceImplementation.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="app.manifest" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Public\OpenHardwareMonitor\OpenHardwareMonitorLib.csproj">
|
||||
<Project>{b0397530-545a-471d-bb74-027ae456df1a}</Project>
|
||||
<Name>OpenHardwareMonitorLib</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Common\Common.csproj">
|
||||
<Project>{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}</Project>
|
||||
<Name>Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
|
||||
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="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=317567." HelpKeyword="BCLBUILD2001" />
|
||||
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
5
Service/packages.config
Normal file
5
Service/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
|
||||
</packages>
|
||||
@@ -1,26 +1,62 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.30324.0
|
||||
VisualStudioVersion = 12.0.30501.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SystemTemperatureStatusWindow", "SystemTemperatureStatusWindow.csproj", "{E45425FD-4302-4555-8F24-18F2373DE1CE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenHardwareMonitorLib", "..\..\Public\OpenHardwareMonitor\OpenHardwareMonitorLib.csproj", "{B0397530-545A-471D-BB74-027AE456DF1A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SystemTemperatureStatusWindow", "Window\SystemTemperatureStatusWindow.csproj", "{E45425FD-4302-4555-8F24-18F2373DE1CE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SystemTemperatureService", "Service\SystemTemperatureService.csproj", "{94DE06A9-4F37-487B-96E9-663B9A98F05D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "..\Common\Common.csproj", "{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E45425FD-4302-4555-8F24-18F2373DE1CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E45425FD-4302-4555-8F24-18F2373DE1CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E45425FD-4302-4555-8F24-18F2373DE1CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E45425FD-4302-4555-8F24-18F2373DE1CE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B0397530-545A-471D-BB74-027AE456DF1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B0397530-545A-471D-BB74-027AE456DF1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B0397530-545A-471D-BB74-027AE456DF1A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{B0397530-545A-471D-BB74-027AE456DF1A}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{B0397530-545A-471D-BB74-027AE456DF1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B0397530-545A-471D-BB74-027AE456DF1A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B0397530-545A-471D-BB74-027AE456DF1A}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{B0397530-545A-471D-BB74-027AE456DF1A}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E45425FD-4302-4555-8F24-18F2373DE1CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E45425FD-4302-4555-8F24-18F2373DE1CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E45425FD-4302-4555-8F24-18F2373DE1CE}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{E45425FD-4302-4555-8F24-18F2373DE1CE}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{E45425FD-4302-4555-8F24-18F2373DE1CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E45425FD-4302-4555-8F24-18F2373DE1CE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E45425FD-4302-4555-8F24-18F2373DE1CE}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{E45425FD-4302-4555-8F24-18F2373DE1CE}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{94DE06A9-4F37-487B-96E9-663B9A98F05D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{94DE06A9-4F37-487B-96E9-663B9A98F05D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{94DE06A9-4F37-487B-96E9-663B9A98F05D}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{94DE06A9-4F37-487B-96E9-663B9A98F05D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{94DE06A9-4F37-487B-96E9-663B9A98F05D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{94DE06A9-4F37-487B-96E9-663B9A98F05D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{94DE06A9-4F37-487B-96E9-663B9A98F05D}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{94DE06A9-4F37-487B-96E9-663B9A98F05D}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|x64.Build.0 = Debug|x64
|
||||
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|x86.Build.0 = Debug|x86
|
||||
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|x64.ActiveCfg = Release|x64
|
||||
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|x64.Build.0 = Release|x64
|
||||
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|x86.ActiveCfg = Release|x86
|
||||
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<section name="SystemTemperatureStatusWindow.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
@@ -30,4 +30,21 @@
|
||||
</setting>
|
||||
</SystemTemperatureStatusWindow.Properties.Settings>
|
||||
</userSettings>
|
||||
<system.serviceModel>
|
||||
<bindings>
|
||||
<wsHttpBinding>
|
||||
<binding name="WSHttpBinding_ISystemTemperatureService" />
|
||||
</wsHttpBinding>
|
||||
</bindings>
|
||||
<client>
|
||||
<endpoint address="http://localhost/SystemTemperatureService/SystemTemperatureService.svc"
|
||||
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ISystemTemperatureService"
|
||||
contract="SystemTemperatureService.ISystemTemperatureService"
|
||||
name="WSHttpBinding_ISystemTemperatureService">
|
||||
<identity>
|
||||
<dns value="localhost" />
|
||||
</identity>
|
||||
</endpoint>
|
||||
</client>
|
||||
</system.serviceModel>
|
||||
</configuration>
|
||||
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
153
Window/Service References/SystemTemperatureService/Reference.cs
Normal file
153
Window/Service References/SystemTemperatureService/Reference.cs
Normal file
@@ -0,0 +1,153 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34209
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace SystemTemperatureStatusWindow.SystemTemperatureService {
|
||||
using System.Runtime.Serialization;
|
||||
using System;
|
||||
|
||||
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
|
||||
[System.Runtime.Serialization.DataContractAttribute(Name="Device", Namespace="http://schemas.datacontract.org/2004/07/SystemTemperatureService")]
|
||||
[System.SerializableAttribute()]
|
||||
public partial class Device : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {
|
||||
|
||||
[System.NonSerializedAttribute()]
|
||||
private System.Runtime.Serialization.ExtensionDataObject extensionDataField;
|
||||
|
||||
[System.Runtime.Serialization.OptionalFieldAttribute()]
|
||||
private string IdField;
|
||||
|
||||
[System.Runtime.Serialization.OptionalFieldAttribute()]
|
||||
private double TemperatureField;
|
||||
|
||||
[System.Runtime.Serialization.OptionalFieldAttribute()]
|
||||
private SystemTemperatureStatusWindow.SystemTemperatureService.DeviceType TypeField;
|
||||
|
||||
[global::System.ComponentModel.BrowsableAttribute(false)]
|
||||
public System.Runtime.Serialization.ExtensionDataObject ExtensionData {
|
||||
get {
|
||||
return this.extensionDataField;
|
||||
}
|
||||
set {
|
||||
this.extensionDataField = value;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Runtime.Serialization.DataMemberAttribute()]
|
||||
public string Id {
|
||||
get {
|
||||
return this.IdField;
|
||||
}
|
||||
set {
|
||||
if ((object.ReferenceEquals(this.IdField, value) != true)) {
|
||||
this.IdField = value;
|
||||
this.RaisePropertyChanged("Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Runtime.Serialization.DataMemberAttribute()]
|
||||
public double Temperature {
|
||||
get {
|
||||
return this.TemperatureField;
|
||||
}
|
||||
set {
|
||||
if ((this.TemperatureField.Equals(value) != true)) {
|
||||
this.TemperatureField = value;
|
||||
this.RaisePropertyChanged("Temperature");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Runtime.Serialization.DataMemberAttribute()]
|
||||
public SystemTemperatureStatusWindow.SystemTemperatureService.DeviceType Type {
|
||||
get {
|
||||
return this.TypeField;
|
||||
}
|
||||
set {
|
||||
if ((this.TypeField.Equals(value) != true)) {
|
||||
this.TypeField = value;
|
||||
this.RaisePropertyChanged("Type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected void RaisePropertyChanged(string propertyName) {
|
||||
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
|
||||
if ((propertyChanged != null)) {
|
||||
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
|
||||
[System.Runtime.Serialization.DataContractAttribute(Name="DeviceType", Namespace="http://schemas.datacontract.org/2004/07/SystemTemperatureService")]
|
||||
public enum DeviceType : int {
|
||||
|
||||
[System.Runtime.Serialization.EnumMemberAttribute()]
|
||||
Cpu = 0,
|
||||
|
||||
[System.Runtime.Serialization.EnumMemberAttribute()]
|
||||
Gpu = 1,
|
||||
|
||||
[System.Runtime.Serialization.EnumMemberAttribute()]
|
||||
Hdd = 2,
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
|
||||
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="SystemTemperatureService.ISystemTemperatureService")]
|
||||
public interface ISystemTemperatureService {
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ISystemTemperatureService/GetDeviceList", ReplyAction="http://tempuri.org/ISystemTemperatureService/GetDeviceListResponse")]
|
||||
System.Collections.Generic.List<SystemTemperatureStatusWindow.SystemTemperatureService.Device> GetDeviceList();
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ISystemTemperatureService/GetDeviceList", ReplyAction="http://tempuri.org/ISystemTemperatureService/GetDeviceListResponse")]
|
||||
System.Threading.Tasks.Task<System.Collections.Generic.List<SystemTemperatureStatusWindow.SystemTemperatureService.Device>> GetDeviceListAsync();
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
|
||||
public interface ISystemTemperatureServiceChannel : SystemTemperatureStatusWindow.SystemTemperatureService.ISystemTemperatureService, System.ServiceModel.IClientChannel {
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
|
||||
public partial class SystemTemperatureServiceClient : System.ServiceModel.ClientBase<SystemTemperatureStatusWindow.SystemTemperatureService.ISystemTemperatureService>, SystemTemperatureStatusWindow.SystemTemperatureService.ISystemTemperatureService {
|
||||
|
||||
public SystemTemperatureServiceClient() {
|
||||
}
|
||||
|
||||
public SystemTemperatureServiceClient(string endpointConfigurationName) :
|
||||
base(endpointConfigurationName) {
|
||||
}
|
||||
|
||||
public SystemTemperatureServiceClient(string endpointConfigurationName, string remoteAddress) :
|
||||
base(endpointConfigurationName, remoteAddress) {
|
||||
}
|
||||
|
||||
public SystemTemperatureServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
|
||||
base(endpointConfigurationName, remoteAddress) {
|
||||
}
|
||||
|
||||
public SystemTemperatureServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
|
||||
base(binding, remoteAddress) {
|
||||
}
|
||||
|
||||
public System.Collections.Generic.List<SystemTemperatureStatusWindow.SystemTemperatureService.Device> GetDeviceList() {
|
||||
return base.Channel.GetDeviceList();
|
||||
}
|
||||
|
||||
public System.Threading.Tasks.Task<System.Collections.Generic.List<SystemTemperatureStatusWindow.SystemTemperatureService.Device>> GetDeviceListAsync() {
|
||||
return base.Channel.GetDeviceListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="795ebf78-b7c3-431f-a1be-37b4d70994a7" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap">
|
||||
<ClientOptions>
|
||||
<GenerateAsynchronousMethods>false</GenerateAsynchronousMethods>
|
||||
<GenerateTaskBasedAsynchronousMethod>true</GenerateTaskBasedAsynchronousMethod>
|
||||
<EnableDataBinding>true</EnableDataBinding>
|
||||
<ExcludedTypes />
|
||||
<ImportXmlTypes>false</ImportXmlTypes>
|
||||
<GenerateInternalTypes>false</GenerateInternalTypes>
|
||||
<GenerateMessageContracts>false</GenerateMessageContracts>
|
||||
<NamespaceMappings />
|
||||
<CollectionMappings>
|
||||
<CollectionMapping TypeName="System.Collections.Generic.List`1" Category="List" />
|
||||
</CollectionMappings>
|
||||
<GenerateSerializableTypes>true</GenerateSerializableTypes>
|
||||
<Serializer>Auto</Serializer>
|
||||
<UseSerializerForFaults>true</UseSerializerForFaults>
|
||||
<ReferenceAllAssemblies>true</ReferenceAllAssemblies>
|
||||
<ReferencedAssemblies />
|
||||
<ReferencedDataContractTypes />
|
||||
<ServiceContractMappings />
|
||||
</ClientOptions>
|
||||
<MetadataSources>
|
||||
<MetadataSource Address="http://localhost/SystemTemperatureService/SystemTemperatureService.svc" Protocol="http" SourceId="1" />
|
||||
</MetadataSources>
|
||||
<Metadata>
|
||||
<MetadataFile FileName="SystemTemperatureService3.xsd" MetadataType="Schema" ID="1233946c-2169-4ac3-856d-25056a59ecb2" SourceId="1" SourceUrl="http://localhost/SystemTemperatureService/SystemTemperatureService.svc?xsd=xsd2" />
|
||||
<MetadataFile FileName="SystemTemperatureService31.xsd" MetadataType="Schema" ID="0403fb22-2d2c-4e17-959a-8935584045b3" SourceId="1" SourceUrl="http://localhost/SystemTemperatureService/SystemTemperatureService.svc?xsd=xsd0" />
|
||||
<MetadataFile FileName="SystemTemperatureService32.xsd" MetadataType="Schema" ID="70ca46c8-4b5f-45a3-adff-539955e393c4" SourceId="1" SourceUrl="http://localhost/SystemTemperatureService/SystemTemperatureService.svc?xsd=xsd1" />
|
||||
<MetadataFile FileName="SystemTemperatureService1.disco" MetadataType="Disco" ID="dc54fd62-fb43-46b7-bdac-fe641c59d96c" SourceId="1" SourceUrl="http://localhost/SystemTemperatureService/SystemTemperatureService.svc?disco" />
|
||||
<MetadataFile FileName="SystemTemperatureService1.wsdl" MetadataType="Wsdl" ID="64a24197-0881-4c46-8431-99e53feddc90" SourceId="1" SourceUrl="http://localhost/SystemTemperatureService/SystemTemperatureService.svc?wsdl" />
|
||||
</Metadata>
|
||||
<Extensions>
|
||||
<ExtensionFile FileName="configuration91.svcinfo" Name="configuration91.svcinfo" />
|
||||
<ExtensionFile FileName="configuration.svcinfo" Name="configuration.svcinfo" />
|
||||
</Extensions>
|
||||
</ReferenceGroup>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
|
||||
<contractRef ref="http://localhost/SystemTemperatureService/SystemTemperatureService.svc?wsdl" docRef="http://localhost/SystemTemperatureService/SystemTemperatureService.svc" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
|
||||
</discovery>
|
||||
@@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<wsdl:definitions xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://tempuri.org/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="SystemTemperatureService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
|
||||
<wsp:Policy wsu:Id="WSHttpBinding_ISystemTemperatureService_policy">
|
||||
<wsp:ExactlyOne>
|
||||
<wsp:All>
|
||||
<sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
|
||||
<wsp:Policy>
|
||||
<sp:ProtectionToken>
|
||||
<wsp:Policy>
|
||||
<sp:SecureConversationToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
|
||||
<wsp:Policy>
|
||||
<sp:RequireDerivedKeys />
|
||||
<sp:BootstrapPolicy>
|
||||
<wsp:Policy>
|
||||
<sp:SignedParts>
|
||||
<sp:Body />
|
||||
<sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
</sp:SignedParts>
|
||||
<sp:EncryptedParts>
|
||||
<sp:Body />
|
||||
</sp:EncryptedParts>
|
||||
<sp:SymmetricBinding>
|
||||
<wsp:Policy>
|
||||
<sp:ProtectionToken>
|
||||
<wsp:Policy>
|
||||
<sp:SpnegoContextToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
|
||||
<wsp:Policy>
|
||||
<sp:RequireDerivedKeys />
|
||||
</wsp:Policy>
|
||||
</sp:SpnegoContextToken>
|
||||
</wsp:Policy>
|
||||
</sp:ProtectionToken>
|
||||
<sp:AlgorithmSuite>
|
||||
<wsp:Policy>
|
||||
<sp:Basic256 />
|
||||
</wsp:Policy>
|
||||
</sp:AlgorithmSuite>
|
||||
<sp:Layout>
|
||||
<wsp:Policy>
|
||||
<sp:Strict />
|
||||
</wsp:Policy>
|
||||
</sp:Layout>
|
||||
<sp:IncludeTimestamp />
|
||||
<sp:EncryptSignature />
|
||||
<sp:OnlySignEntireHeadersAndBody />
|
||||
</wsp:Policy>
|
||||
</sp:SymmetricBinding>
|
||||
<sp:Wss11>
|
||||
<wsp:Policy />
|
||||
</sp:Wss11>
|
||||
<sp:Trust10>
|
||||
<wsp:Policy>
|
||||
<sp:MustSupportIssuedTokens />
|
||||
<sp:RequireClientEntropy />
|
||||
<sp:RequireServerEntropy />
|
||||
</wsp:Policy>
|
||||
</sp:Trust10>
|
||||
</wsp:Policy>
|
||||
</sp:BootstrapPolicy>
|
||||
</wsp:Policy>
|
||||
</sp:SecureConversationToken>
|
||||
</wsp:Policy>
|
||||
</sp:ProtectionToken>
|
||||
<sp:AlgorithmSuite>
|
||||
<wsp:Policy>
|
||||
<sp:Basic256 />
|
||||
</wsp:Policy>
|
||||
</sp:AlgorithmSuite>
|
||||
<sp:Layout>
|
||||
<wsp:Policy>
|
||||
<sp:Strict />
|
||||
</wsp:Policy>
|
||||
</sp:Layout>
|
||||
<sp:IncludeTimestamp />
|
||||
<sp:EncryptSignature />
|
||||
<sp:OnlySignEntireHeadersAndBody />
|
||||
</wsp:Policy>
|
||||
</sp:SymmetricBinding>
|
||||
<sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
|
||||
<wsp:Policy />
|
||||
</sp:Wss11>
|
||||
<sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
|
||||
<wsp:Policy>
|
||||
<sp:MustSupportIssuedTokens />
|
||||
<sp:RequireClientEntropy />
|
||||
<sp:RequireServerEntropy />
|
||||
</wsp:Policy>
|
||||
</sp:Trust10>
|
||||
<wsaw:UsingAddressing />
|
||||
</wsp:All>
|
||||
</wsp:ExactlyOne>
|
||||
</wsp:Policy>
|
||||
<wsp:Policy wsu:Id="WSHttpBinding_ISystemTemperatureService_GetDeviceList_Input_policy">
|
||||
<wsp:ExactlyOne>
|
||||
<wsp:All>
|
||||
<sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
|
||||
<sp:Body />
|
||||
<sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
</sp:SignedParts>
|
||||
<sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
|
||||
<sp:Body />
|
||||
</sp:EncryptedParts>
|
||||
</wsp:All>
|
||||
</wsp:ExactlyOne>
|
||||
</wsp:Policy>
|
||||
<wsp:Policy wsu:Id="WSHttpBinding_ISystemTemperatureService_GetDeviceList_output_policy">
|
||||
<wsp:ExactlyOne>
|
||||
<wsp:All>
|
||||
<sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
|
||||
<sp:Body />
|
||||
<sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
<sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
|
||||
</sp:SignedParts>
|
||||
<sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
|
||||
<sp:Body />
|
||||
</sp:EncryptedParts>
|
||||
</wsp:All>
|
||||
</wsp:ExactlyOne>
|
||||
</wsp:Policy>
|
||||
<wsdl:types>
|
||||
<xsd:schema targetNamespace="http://tempuri.org/Imports">
|
||||
<xsd:import schemaLocation="http://localhost/SystemTemperatureService/SystemTemperatureService.svc?xsd=xsd0" namespace="http://tempuri.org/" />
|
||||
<xsd:import schemaLocation="http://localhost/SystemTemperatureService/SystemTemperatureService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
|
||||
<xsd:import schemaLocation="http://localhost/SystemTemperatureService/SystemTemperatureService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/SystemTemperatureService" />
|
||||
</xsd:schema>
|
||||
</wsdl:types>
|
||||
<wsdl:message name="ISystemTemperatureService_GetDeviceList_InputMessage">
|
||||
<wsdl:part name="parameters" element="tns:GetDeviceList" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="ISystemTemperatureService_GetDeviceList_OutputMessage">
|
||||
<wsdl:part name="parameters" element="tns:GetDeviceListResponse" />
|
||||
</wsdl:message>
|
||||
<wsdl:portType name="ISystemTemperatureService">
|
||||
<wsdl:operation name="GetDeviceList">
|
||||
<wsdl:input wsaw:Action="http://tempuri.org/ISystemTemperatureService/GetDeviceList" message="tns:ISystemTemperatureService_GetDeviceList_InputMessage" />
|
||||
<wsdl:output wsaw:Action="http://tempuri.org/ISystemTemperatureService/GetDeviceListResponse" message="tns:ISystemTemperatureService_GetDeviceList_OutputMessage" />
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
<wsdl:binding name="WSHttpBinding_ISystemTemperatureService" type="tns:ISystemTemperatureService">
|
||||
<wsp:PolicyReference URI="#WSHttpBinding_ISystemTemperatureService_policy" />
|
||||
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
|
||||
<wsdl:operation name="GetDeviceList">
|
||||
<soap12:operation soapAction="http://tempuri.org/ISystemTemperatureService/GetDeviceList" style="document" />
|
||||
<wsdl:input>
|
||||
<wsp:PolicyReference URI="#WSHttpBinding_ISystemTemperatureService_GetDeviceList_Input_policy" />
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<wsp:PolicyReference URI="#WSHttpBinding_ISystemTemperatureService_GetDeviceList_output_policy" />
|
||||
<soap12:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
<wsdl:service name="SystemTemperatureService">
|
||||
<wsdl:port name="WSHttpBinding_ISystemTemperatureService" binding="tns:WSHttpBinding_ISystemTemperatureService">
|
||||
<soap12:address location="http://localhost/SystemTemperatureService/SystemTemperatureService.svc" />
|
||||
<wsa10:EndpointReference>
|
||||
<wsa10:Address>http://localhost/SystemTemperatureService/SystemTemperatureService.svc</wsa10:Address>
|
||||
<Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
|
||||
<Dns>localhost</Dns>
|
||||
</Identity>
|
||||
</wsa10:EndpointReference>
|
||||
</wsdl:port>
|
||||
</wsdl:service>
|
||||
</wsdl:definitions>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:tns="http://schemas.datacontract.org/2004/07/SystemTemperatureService" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/SystemTemperatureService" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:complexType name="ArrayOfDevice">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" name="Device" nillable="true" type="tns:Device" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="ArrayOfDevice" nillable="true" type="tns:ArrayOfDevice" />
|
||||
<xs:complexType name="Device">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" name="Id" nillable="true" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="Temperature" type="xs:double" />
|
||||
<xs:element minOccurs="0" name="Type" type="tns:DeviceType" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="Device" nillable="true" type="tns:Device" />
|
||||
<xs:simpleType name="DeviceType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="Cpu" />
|
||||
<xs:enumeration value="Gpu" />
|
||||
<xs:enumeration value="Hdd" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:element name="DeviceType" nillable="true" type="tns:DeviceType" />
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:tns="http://tempuri.org/" elementFormDefault="qualified" targetNamespace="http://tempuri.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:import schemaLocation="http://localhost/SystemTemperatureService/SystemTemperatureService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/SystemTemperatureService" />
|
||||
<xs:element name="GetDeviceList">
|
||||
<xs:complexType>
|
||||
<xs:sequence />
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="GetDeviceListResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element xmlns:q1="http://schemas.datacontract.org/2004/07/SystemTemperatureService" minOccurs="0" name="GetDeviceListResult" nillable="true" type="q1:ArrayOfDevice" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="anyType" nillable="true" type="xs:anyType" />
|
||||
<xs:element name="anyURI" nillable="true" type="xs:anyURI" />
|
||||
<xs:element name="base64Binary" nillable="true" type="xs:base64Binary" />
|
||||
<xs:element name="boolean" nillable="true" type="xs:boolean" />
|
||||
<xs:element name="byte" nillable="true" type="xs:byte" />
|
||||
<xs:element name="dateTime" nillable="true" type="xs:dateTime" />
|
||||
<xs:element name="decimal" nillable="true" type="xs:decimal" />
|
||||
<xs:element name="double" nillable="true" type="xs:double" />
|
||||
<xs:element name="float" nillable="true" type="xs:float" />
|
||||
<xs:element name="int" nillable="true" type="xs:int" />
|
||||
<xs:element name="long" nillable="true" type="xs:long" />
|
||||
<xs:element name="QName" nillable="true" type="xs:QName" />
|
||||
<xs:element name="short" nillable="true" type="xs:short" />
|
||||
<xs:element name="string" nillable="true" type="xs:string" />
|
||||
<xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" />
|
||||
<xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" />
|
||||
<xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" />
|
||||
<xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" />
|
||||
<xs:element name="char" nillable="true" type="tns:char" />
|
||||
<xs:simpleType name="char">
|
||||
<xs:restriction base="xs:int" />
|
||||
</xs:simpleType>
|
||||
<xs:element name="duration" nillable="true" type="tns:duration" />
|
||||
<xs:simpleType name="duration">
|
||||
<xs:restriction base="xs:duration">
|
||||
<xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?" />
|
||||
<xs:minInclusive value="-P10675199DT2H48M5.4775808S" />
|
||||
<xs:maxInclusive value="P10675199DT2H48M5.4775807S" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:element name="guid" nillable="true" type="tns:guid" />
|
||||
<xs:simpleType name="guid">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:attribute name="FactoryType" type="xs:QName" />
|
||||
<xs:attribute name="Id" type="xs:ID" />
|
||||
<xs:attribute name="Ref" type="xs:IDREF" />
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is automatically generated by Visual Studio .Net. It is
|
||||
used to store generic object data source configuration information.
|
||||
Renaming the file extension or editing the content of this file may
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="Device" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>SystemTemperatureStatusWindow.SystemTemperatureService.Device, Service References.SystemTemperatureService.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
</GenericObjectDataSource>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot">
|
||||
<behaviors />
|
||||
<bindings>
|
||||
<binding digest="System.ServiceModel.Configuration.WSHttpBindingElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:<?xml version="1.0" encoding="utf-16"?><Data name="WSHttpBinding_ISystemTemperatureService" />" bindingType="wsHttpBinding" name="WSHttpBinding_ISystemTemperatureService" />
|
||||
</bindings>
|
||||
<endpoints>
|
||||
<endpoint normalizedDigest="<?xml version="1.0" encoding="utf-16"?><Data address="http://localhost/SystemTemperatureService/SystemTemperatureService.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ISystemTemperatureService" contract="SystemTemperatureService.ISystemTemperatureService" name="WSHttpBinding_ISystemTemperatureService"><identity><dns value="localhost" /></identity></Data>" digest="<?xml version="1.0" encoding="utf-16"?><Data address="http://localhost/SystemTemperatureService/SystemTemperatureService.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ISystemTemperatureService" contract="SystemTemperatureService.ISystemTemperatureService" name="WSHttpBinding_ISystemTemperatureService"><identity><dns value="localhost" /></identity></Data>" contractName="SystemTemperatureService.ISystemTemperatureService" name="WSHttpBinding_ISystemTemperatureService" />
|
||||
</endpoints>
|
||||
</configurationSnapshot>
|
||||
@@ -0,0 +1,216 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="0gKhALgx54gGdSmyo2R018R9qbI=">
|
||||
<bindingConfigurations>
|
||||
<bindingConfiguration bindingType="wsHttpBinding" name="WSHttpBinding_ISystemTemperatureService">
|
||||
<properties>
|
||||
<property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>WSHttpBinding_ISystemTemperatureService</serializedValue>
|
||||
</property>
|
||||
<property path="/closeTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/openTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/receiveTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/sendTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/bypassProxyOnLocal" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/transactionFlow" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>False</serializedValue>
|
||||
</property>
|
||||
<property path="/hostNameComparisonMode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HostNameComparisonMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>StrongWildcard</serializedValue>
|
||||
</property>
|
||||
<property path="/maxBufferPoolSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/maxReceivedMessageSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/messageEncoding" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.WSMessageEncoding, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>Text</serializedValue>
|
||||
</property>
|
||||
<property path="/proxyAddress" isComplexType="false" isExplicitlyDefined="false" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/readerQuotas" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement</serializedValue>
|
||||
</property>
|
||||
<property path="/readerQuotas/maxDepth" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>0</serializedValue>
|
||||
</property>
|
||||
<property path="/readerQuotas/maxStringContentLength" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>0</serializedValue>
|
||||
</property>
|
||||
<property path="/readerQuotas/maxArrayLength" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>0</serializedValue>
|
||||
</property>
|
||||
<property path="/readerQuotas/maxBytesPerRead" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>0</serializedValue>
|
||||
</property>
|
||||
<property path="/readerQuotas/maxNameTableCharCount" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>0</serializedValue>
|
||||
</property>
|
||||
<property path="/reliableSession" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.StandardBindingOptionalReliableSessionElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.StandardBindingOptionalReliableSessionElement</serializedValue>
|
||||
</property>
|
||||
<property path="/reliableSession/ordered" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>True</serializedValue>
|
||||
</property>
|
||||
<property path="/reliableSession/inactivityTimeout" isComplexType="false" isExplicitlyDefined="false" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>00:10:00</serializedValue>
|
||||
</property>
|
||||
<property path="/reliableSession/enabled" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>False</serializedValue>
|
||||
</property>
|
||||
<property path="/textEncoding" isComplexType="false" isExplicitlyDefined="false" clrType="System.Text.Encoding, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.Text.UTF8Encoding</serializedValue>
|
||||
</property>
|
||||
<property path="/useDefaultWebProxy" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/allowCookies" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/security" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.WSHttpSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.WSHttpSecurityElement</serializedValue>
|
||||
</property>
|
||||
<property path="/security/mode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.SecurityMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>Message</serializedValue>
|
||||
</property>
|
||||
<property path="/security/transport" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.WSHttpTransportSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.WSHttpTransportSecurityElement</serializedValue>
|
||||
</property>
|
||||
<property path="/security/transport/clientCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HttpClientCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>Windows</serializedValue>
|
||||
</property>
|
||||
<property path="/security/transport/proxyCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HttpProxyCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>None</serializedValue>
|
||||
</property>
|
||||
<property path="/security/transport/extendedProtectionPolicy" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement</serializedValue>
|
||||
</property>
|
||||
<property path="/security/transport/extendedProtectionPolicy/policyEnforcement" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.PolicyEnforcement, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>Never</serializedValue>
|
||||
</property>
|
||||
<property path="/security/transport/extendedProtectionPolicy/protectionScenario" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.ProtectionScenario, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>TransportSelected</serializedValue>
|
||||
</property>
|
||||
<property path="/security/transport/extendedProtectionPolicy/customServiceNames" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ServiceNameElementCollection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>(Collection)</serializedValue>
|
||||
</property>
|
||||
<property path="/security/transport/realm" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/security/message" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.NonDualMessageSecurityOverHttpElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.NonDualMessageSecurityOverHttpElement</serializedValue>
|
||||
</property>
|
||||
<property path="/security/message/clientCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.MessageCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>Windows</serializedValue>
|
||||
</property>
|
||||
<property path="/security/message/negotiateServiceCredential" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>True</serializedValue>
|
||||
</property>
|
||||
<property path="/security/message/algorithmSuite" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.Security.SecurityAlgorithmSuite, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>Default</serializedValue>
|
||||
</property>
|
||||
<property path="/security/message/establishSecurityContext" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>True</serializedValue>
|
||||
</property>
|
||||
</properties>
|
||||
</bindingConfiguration>
|
||||
</bindingConfigurations>
|
||||
<endpoints>
|
||||
<endpoint name="WSHttpBinding_ISystemTemperatureService" contract="SystemTemperatureService.ISystemTemperatureService" bindingType="wsHttpBinding" address="http://localhost/SystemTemperatureService/SystemTemperatureService.svc" bindingConfiguration="WSHttpBinding_ISystemTemperatureService">
|
||||
<properties>
|
||||
<property path="/address" isComplexType="false" isExplicitlyDefined="true" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>http://localhost/SystemTemperatureService/SystemTemperatureService.svc</serializedValue>
|
||||
</property>
|
||||
<property path="/behaviorConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/binding" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>wsHttpBinding</serializedValue>
|
||||
</property>
|
||||
<property path="/bindingConfiguration" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>WSHttpBinding_ISystemTemperatureService</serializedValue>
|
||||
</property>
|
||||
<property path="/contract" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>SystemTemperatureService.ISystemTemperatureService</serializedValue>
|
||||
</property>
|
||||
<property path="/headers" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.AddressHeaderCollectionElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.AddressHeaderCollectionElement</serializedValue>
|
||||
</property>
|
||||
<property path="/headers/headers" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.Channels.AddressHeaderCollection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue><Header /></serializedValue>
|
||||
</property>
|
||||
<property path="/identity" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.IdentityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.IdentityElement</serializedValue>
|
||||
</property>
|
||||
<property path="/identity/userPrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.UserPrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.UserPrincipalNameElement</serializedValue>
|
||||
</property>
|
||||
<property path="/identity/userPrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/identity/servicePrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.ServicePrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.ServicePrincipalNameElement</serializedValue>
|
||||
</property>
|
||||
<property path="/identity/servicePrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/identity/dns" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.DnsElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.DnsElement</serializedValue>
|
||||
</property>
|
||||
<property path="/identity/dns/value" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>localhost</serializedValue>
|
||||
</property>
|
||||
<property path="/identity/rsa" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.RsaElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.RsaElement</serializedValue>
|
||||
</property>
|
||||
<property path="/identity/rsa/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/identity/certificate" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.CertificateElement</serializedValue>
|
||||
</property>
|
||||
<property path="/identity/certificate/encodedValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/identity/certificateReference" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateReferenceElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.CertificateReferenceElement</serializedValue>
|
||||
</property>
|
||||
<property path="/identity/certificateReference/storeName" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreName, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>My</serializedValue>
|
||||
</property>
|
||||
<property path="/identity/certificateReference/storeLocation" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreLocation, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>LocalMachine</serializedValue>
|
||||
</property>
|
||||
<property path="/identity/certificateReference/x509FindType" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.X509FindType, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>FindBySubjectDistinguishedName</serializedValue>
|
||||
</property>
|
||||
<property path="/identity/certificateReference/findValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/identity/certificateReference/isChainIncluded" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>False</serializedValue>
|
||||
</property>
|
||||
<property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>WSHttpBinding_ISystemTemperatureService</serializedValue>
|
||||
</property>
|
||||
<property path="/kind" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/endpointConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
</properties>
|
||||
</endpoint>
|
||||
</endpoints>
|
||||
</SavedWcfConfigurationInformation>
|
||||
@@ -33,15 +33,15 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<ItemGroup>
|
||||
<Reference Include="FloatingStatusWindowLibrary">
|
||||
<HintPath>..\FloatingStatusWindowLibrary\FloatingStatusWindowLibrary\bin\Debug\FloatingStatusWindowLibrary.dll</HintPath>
|
||||
<HintPath>..\..\FloatingStatusWindowLibrary\FloatingStatusWindowLibrary\bin\Debug\FloatingStatusWindowLibrary.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xaml">
|
||||
@@ -60,6 +60,11 @@
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Service References\SystemTemperatureService\Reference.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindowSource.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -80,12 +85,24 @@
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="app.manifest" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
<None Include="Service References\SystemTemperatureService\SystemTemperatureService1.wsdl" />
|
||||
<None Include="Service References\SystemTemperatureService\SystemTemperatureService3.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Service References\SystemTemperatureService\SystemTemperatureService31.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Service References\SystemTemperatureService\SystemTemperatureService32.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Service References\SystemTemperatureService\SystemTemperatureStatusWindow.SystemTemperatureService.Device.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
@@ -94,10 +111,25 @@
|
||||
<None Include="Resources\ApplicationIcon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Public\OpenHardwareMonitor\OpenHardwareMonitorLib.csproj">
|
||||
<Project>{b0397530-545a-471d-bb74-027ae456df1a}</Project>
|
||||
<Name>OpenHardwareMonitorLib</Name>
|
||||
</ProjectReference>
|
||||
<WCFMetadata Include="Service References\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadataStorage Include="Service References\SystemTemperatureService\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Service References\SystemTemperatureService\configuration91.svcinfo" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Service References\SystemTemperatureService\configuration.svcinfo" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Service References\SystemTemperatureService\Reference.svcmap">
|
||||
<Generator>WCF Proxy Generator</Generator>
|
||||
<LastGenOutput>Reference.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Service References\SystemTemperatureService\SystemTemperatureService1.disco" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
@@ -1,39 +1,117 @@
|
||||
using FloatingStatusWindowLibrary;
|
||||
using OpenHardwareMonitor.Hardware;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Timers;
|
||||
using System.Windows.Threading;
|
||||
using SystemTemperatureStatusWindow.Properties;
|
||||
using SystemTemperatureStatusWindow.SystemTemperatureService;
|
||||
|
||||
namespace SystemTemperatureStatusWindow
|
||||
{
|
||||
public class WindowSource : IWindowSource, IDisposable
|
||||
{
|
||||
private readonly FloatingStatusWindow _floatingStatusWindow;
|
||||
private readonly BackgroundWorker _backgroundWorker;
|
||||
private readonly Timer _refreshTimer;
|
||||
private readonly Dispatcher _dispatcher;
|
||||
|
||||
internal WindowSource()
|
||||
{
|
||||
_dispatcher = Dispatcher.CurrentDispatcher;
|
||||
|
||||
_floatingStatusWindow = new FloatingStatusWindow(this);
|
||||
_floatingStatusWindow.SetText(Resources.Loading);
|
||||
|
||||
_backgroundWorker = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true };
|
||||
_backgroundWorker.ProgressChanged += HandleBackgroundWorkerProgressChanged;
|
||||
_backgroundWorker.DoWork += HandleBackgroundWorkerDoWork;
|
||||
_backgroundWorker.RunWorkerCompleted += HandleBackgroundWorkerRunWorkerCompleted;
|
||||
_backgroundWorker.RunWorkerAsync();
|
||||
_refreshTimer = new Timer(Settings.Default.UpdateInterval);
|
||||
_refreshTimer.Elapsed += HandleTimerElapsed;
|
||||
_refreshTimer.Start();
|
||||
}
|
||||
|
||||
private void HandleTimerElapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var client = new SystemTemperatureServiceClient())
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
|
||||
var deviceList = client.GetDeviceList();
|
||||
|
||||
foreach (var device in deviceList)
|
||||
{
|
||||
string hardwareTag = string.Empty;
|
||||
|
||||
switch (device.Type)
|
||||
{
|
||||
case DeviceType.Cpu:
|
||||
hardwareTag = Resources.CPU;
|
||||
break;
|
||||
|
||||
case DeviceType.Gpu:
|
||||
hardwareTag = Resources.GPU;
|
||||
break;
|
||||
|
||||
case DeviceType.Hdd:
|
||||
string id = device.Id;
|
||||
|
||||
hardwareTag = string.Format(Resources.HD, id.Substring(id.LastIndexOf("/", StringComparison.Ordinal) + 1));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(hardwareTag))
|
||||
{
|
||||
var averageValue = device.Temperature;
|
||||
|
||||
string color = "green";
|
||||
|
||||
if (averageValue > Settings.Default.AlertLevel)
|
||||
color = "red";
|
||||
else if (averageValue > Settings.Default.WarningLevel)
|
||||
color = "yellow";
|
||||
|
||||
double averageDisplay;
|
||||
string suffix;
|
||||
|
||||
if (Settings.Default.DisplayF)
|
||||
{
|
||||
averageDisplay = ((9.0 / 5.0) * averageValue) + 32;
|
||||
suffix = Resources.SuffixF;
|
||||
}
|
||||
else
|
||||
{
|
||||
averageDisplay = averageValue;
|
||||
suffix = Resources.SuffixC;
|
||||
}
|
||||
|
||||
if (builder.Length > 0)
|
||||
builder.AppendLine();
|
||||
|
||||
builder.AppendFormat(Resources.DisplayLineTemplate, hardwareTag, averageDisplay, color, suffix);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateText(builder.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
UpdateText(exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_backgroundWorker.CancelAsync();
|
||||
_refreshTimer.Dispose();
|
||||
|
||||
_floatingStatusWindow.Save();
|
||||
_floatingStatusWindow.Dispose();
|
||||
}
|
||||
|
||||
private void UpdateText(string text)
|
||||
{
|
||||
_dispatcher.InvokeAsync(() => _floatingStatusWindow.SetText(text));
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "System Temperature"; }
|
||||
@@ -56,91 +134,5 @@ namespace SystemTemperatureStatusWindow
|
||||
Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
void HandleBackgroundWorkerDoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
var backgroundWorker = (BackgroundWorker) sender;
|
||||
|
||||
var computer = new Computer { HDDEnabled = true, FanControllerEnabled = false, GPUEnabled = true, MainboardEnabled = true, CPUEnabled = true };
|
||||
computer.Open();
|
||||
|
||||
while (!backgroundWorker.CancellationPending)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
|
||||
foreach (var hardware in computer.Hardware)
|
||||
{
|
||||
hardware.Update();
|
||||
|
||||
var averageValue = hardware.Sensors.Where(sensor => sensor.SensorType == SensorType.Temperature).Average(sensor => sensor.Value);
|
||||
|
||||
if (averageValue.HasValue)
|
||||
{
|
||||
string hardwareTag = string.Empty;
|
||||
|
||||
switch (hardware.HardwareType)
|
||||
{
|
||||
case HardwareType.CPU:
|
||||
hardwareTag = Resources.CPU;
|
||||
break;
|
||||
|
||||
case HardwareType.GpuAti:
|
||||
case HardwareType.GpuNvidia:
|
||||
hardwareTag = Resources.GPU;
|
||||
break;
|
||||
|
||||
case HardwareType.HDD:
|
||||
string id = hardware.Identifier.ToString();
|
||||
hardwareTag = string.Format(Resources.HD, id.Substring(id.LastIndexOf("/", StringComparison.Ordinal) + 1));
|
||||
break;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(hardwareTag))
|
||||
{
|
||||
string color = "green";
|
||||
|
||||
if (averageValue > Settings.Default.AlertLevel)
|
||||
color = "red";
|
||||
else if (averageValue.Value > Settings.Default.WarningLevel)
|
||||
color = "yellow";
|
||||
|
||||
double averageDisplay;
|
||||
string suffix;
|
||||
|
||||
if (Settings.Default.DisplayF)
|
||||
{
|
||||
averageDisplay = ((9.0 / 5.0) * averageValue.Value) + 32;
|
||||
suffix = Resources.SuffixF;
|
||||
}
|
||||
else
|
||||
{
|
||||
averageDisplay = averageValue.Value;
|
||||
suffix = Resources.SuffixC;
|
||||
}
|
||||
|
||||
if (builder.Length > 0)
|
||||
builder.AppendLine();
|
||||
|
||||
builder.AppendFormat(Resources.DisplayLineTemplate, hardwareTag, averageDisplay, color, suffix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
backgroundWorker.ReportProgress(0, builder.ToString());
|
||||
|
||||
Thread.Sleep(Settings.Default.UpdateInterval);
|
||||
}
|
||||
|
||||
computer.Close();
|
||||
}
|
||||
|
||||
void HandleBackgroundWorkerProgressChanged(object sender, ProgressChangedEventArgs e)
|
||||
{
|
||||
_floatingStatusWindow.SetText((string) e.UserState);
|
||||
}
|
||||
|
||||
void HandleBackgroundWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user