mirror of
https://github.com/ckaczor/SystemTemperatureStatusWindow.git
synced 2026-01-13 17:23:03 -05:00
Change from service to application so GPU temperature works
This commit is contained in:
@@ -1,70 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
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
37
Service/Framework/WindowsServiceHarness.Designer.cs
generated
@@ -1,37 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,212 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,5 +8,8 @@ namespace SystemTemperatureService
|
|||||||
{
|
{
|
||||||
[OperationContract]
|
[OperationContract]
|
||||||
List<Device> GetDeviceList();
|
List<Device> GetDeviceList();
|
||||||
|
|
||||||
|
[OperationContract]
|
||||||
|
void Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,28 @@
|
|||||||
using Common.Debug;
|
using System.ServiceModel;
|
||||||
|
using Common.Debug;
|
||||||
|
using Microsoft.Win32.TaskScheduler;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.ServiceProcess;
|
using System.Reflection;
|
||||||
using SystemTemperatureService.Framework;
|
using System.Windows;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace SystemTemperatureService
|
namespace SystemTemperatureService
|
||||||
{
|
{
|
||||||
class Program
|
public class Program
|
||||||
{
|
{
|
||||||
|
private const string ScheduledTaskName = "SystemTemperatureService";
|
||||||
|
|
||||||
|
public static Dispatcher MainDispatcher { get; set; }
|
||||||
|
|
||||||
|
private static ServiceHost _serviceHost;
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
MainDispatcher = Dispatcher.CurrentDispatcher;
|
||||||
|
|
||||||
Tracer.Initialize(null, null, Process.GetCurrentProcess().Id.ToString(CultureInfo.InvariantCulture), Environment.UserInteractive);
|
Tracer.Initialize(null, null, Process.GetCurrentProcess().Id.ToString(CultureInfo.InvariantCulture), Environment.UserInteractive);
|
||||||
|
|
||||||
if (args.Contains("-install", StringComparer.InvariantCultureIgnoreCase))
|
if (args.Contains("-install", StringComparer.InvariantCultureIgnoreCase))
|
||||||
@@ -20,11 +31,28 @@ namespace SystemTemperatureService
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
WindowsServiceInstaller.RuntimeInstall<ServiceImplementation>();
|
using (var taskService = new TaskService())
|
||||||
|
{
|
||||||
|
var existingTask = taskService.FindTask(ScheduledTaskName);
|
||||||
|
|
||||||
|
if (existingTask == null)
|
||||||
|
{
|
||||||
|
var taskDefinition = taskService.NewTask();
|
||||||
|
taskDefinition.Principal.RunLevel = TaskRunLevel.Highest;
|
||||||
|
|
||||||
|
taskDefinition.Triggers.Add(new LogonTrigger());
|
||||||
|
taskDefinition.Actions.Add(new ExecAction(Assembly.GetExecutingAssembly().Location));
|
||||||
|
|
||||||
|
taskService.RootFolder.RegisterTaskDefinition(ScheduledTaskName, taskDefinition);
|
||||||
|
}
|
||||||
|
|
||||||
|
existingTask = taskService.FindTask(ScheduledTaskName);
|
||||||
|
existingTask.Run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
Tracer.WriteException("Service install", exception);
|
Tracer.WriteException("Install", exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
Tracer.WriteLine("Install complete");
|
Tracer.WriteLine("Install complete");
|
||||||
@@ -35,27 +63,30 @@ namespace SystemTemperatureService
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
WindowsServiceInstaller.RuntimeUnInstall<ServiceImplementation>();
|
using (var taskService = new TaskService())
|
||||||
|
taskService.RootFolder.DeleteTask(ScheduledTaskName, false);
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
Tracer.WriteException("Service uninstall", exception);
|
Tracer.WriteException("Uninstall", exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
Tracer.WriteLine("Uninstall complete");
|
Tracer.WriteLine("Uninstall complete");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Tracer.WriteLine("Starting service");
|
Tracer.WriteLine("Starting");
|
||||||
|
|
||||||
var implementation = new ServiceImplementation();
|
using (_serviceHost = new ServiceHost(typeof(SystemTemperatureService)))
|
||||||
|
{
|
||||||
|
_serviceHost.Open();
|
||||||
|
|
||||||
if (Environment.UserInteractive)
|
var application = new Application();
|
||||||
ConsoleHarness.Run(args, implementation);
|
application.Run();
|
||||||
else
|
|
||||||
ServiceBase.Run(new WindowsServiceHarness(implementation));
|
_serviceHost.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
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) { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using OpenHardwareMonitor.Hardware;
|
using OpenHardwareMonitor.Hardware;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
namespace SystemTemperatureService
|
namespace SystemTemperatureService
|
||||||
{
|
{
|
||||||
@@ -56,5 +57,10 @@ namespace SystemTemperatureService
|
|||||||
|
|
||||||
return deviceList;
|
return deviceList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Shutdown()
|
||||||
|
{
|
||||||
|
Program.MainDispatcher.Invoke(Application.Current.Shutdown);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{94DE06A9-4F37-487B-96E9-663B9A98F05D}</ProjectGuid>
|
<ProjectGuid>{94DE06A9-4F37-487B-96E9-663B9A98F05D}</ProjectGuid>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>SystemTemperatureService</RootNamespace>
|
<RootNamespace>SystemTemperatureService</RootNamespace>
|
||||||
<AssemblyName>SystemTemperatureService</AssemblyName>
|
<AssemblyName>SystemTemperatureService</AssemblyName>
|
||||||
@@ -34,42 +34,34 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<StartupObject />
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Microsoft.Win32.TaskScheduler">
|
||||||
|
<HintPath>..\packages\TaskScheduler.2.2.0\lib\4\Microsoft.Win32.TaskScheduler.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration.Install" />
|
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Runtime.Serialization" />
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
<Reference Include="System.ServiceModel" />
|
<Reference Include="System.ServiceModel" />
|
||||||
<Reference Include="System.ServiceProcess" />
|
<Reference Include="System.Xaml" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="WindowsBase" />
|
<Reference Include="WindowsBase" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Device.cs" />
|
<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="ISystemTemperatureService.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="SystemTemperatureService.cs" />
|
<Compile Include="SystemTemperatureService.cs" />
|
||||||
<Compile Include="ServiceImplementation.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
<None Include="app.manifest" />
|
<None Include="app.manifest">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</None>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -2,4 +2,5 @@
|
|||||||
<packages>
|
<packages>
|
||||||
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
|
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
|
||||||
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
|
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
|
||||||
|
<package id="TaskScheduler" version="2.2.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -113,6 +113,12 @@ namespace SystemTemperatureStatusWindow.SystemTemperatureService {
|
|||||||
|
|
||||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ISystemTemperatureService/GetDeviceList", ReplyAction="http://tempuri.org/ISystemTemperatureService/GetDeviceListResponse")]
|
[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.Threading.Tasks.Task<System.Collections.Generic.List<SystemTemperatureStatusWindow.SystemTemperatureService.Device>> GetDeviceListAsync();
|
||||||
|
|
||||||
|
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ISystemTemperatureService/Shutdown", ReplyAction="http://tempuri.org/ISystemTemperatureService/ShutdownResponse")]
|
||||||
|
void Shutdown();
|
||||||
|
|
||||||
|
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ISystemTemperatureService/Shutdown", ReplyAction="http://tempuri.org/ISystemTemperatureService/ShutdownResponse")]
|
||||||
|
System.Threading.Tasks.Task ShutdownAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
|
||||||
@@ -149,5 +155,13 @@ namespace SystemTemperatureStatusWindow.SystemTemperatureService {
|
|||||||
public System.Threading.Tasks.Task<System.Collections.Generic.List<SystemTemperatureStatusWindow.SystemTemperatureService.Device>> GetDeviceListAsync() {
|
public System.Threading.Tasks.Task<System.Collections.Generic.List<SystemTemperatureStatusWindow.SystemTemperatureService.Device>> GetDeviceListAsync() {
|
||||||
return base.Channel.GetDeviceListAsync();
|
return base.Channel.GetDeviceListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Shutdown() {
|
||||||
|
base.Channel.Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
public System.Threading.Tasks.Task ShutdownAsync() {
|
||||||
|
return base.Channel.ShutdownAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,6 +134,44 @@
|
|||||||
</wsp:All>
|
</wsp:All>
|
||||||
</wsp:ExactlyOne>
|
</wsp:ExactlyOne>
|
||||||
</wsp:Policy>
|
</wsp:Policy>
|
||||||
|
<wsp:Policy wsu:Id="WSHttpBinding_ISystemTemperatureService_Shutdown_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_Shutdown_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>
|
<wsdl:types>
|
||||||
<xsd:schema targetNamespace="http://tempuri.org/Imports">
|
<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=xsd0" namespace="http://tempuri.org/" />
|
||||||
@@ -147,11 +185,21 @@
|
|||||||
<wsdl:message name="ISystemTemperatureService_GetDeviceList_OutputMessage">
|
<wsdl:message name="ISystemTemperatureService_GetDeviceList_OutputMessage">
|
||||||
<wsdl:part name="parameters" element="tns:GetDeviceListResponse" />
|
<wsdl:part name="parameters" element="tns:GetDeviceListResponse" />
|
||||||
</wsdl:message>
|
</wsdl:message>
|
||||||
|
<wsdl:message name="ISystemTemperatureService_Shutdown_InputMessage">
|
||||||
|
<wsdl:part name="parameters" element="tns:Shutdown" />
|
||||||
|
</wsdl:message>
|
||||||
|
<wsdl:message name="ISystemTemperatureService_Shutdown_OutputMessage">
|
||||||
|
<wsdl:part name="parameters" element="tns:ShutdownResponse" />
|
||||||
|
</wsdl:message>
|
||||||
<wsdl:portType name="ISystemTemperatureService">
|
<wsdl:portType name="ISystemTemperatureService">
|
||||||
<wsdl:operation name="GetDeviceList">
|
<wsdl:operation name="GetDeviceList">
|
||||||
<wsdl:input wsaw:Action="http://tempuri.org/ISystemTemperatureService/GetDeviceList" message="tns:ISystemTemperatureService_GetDeviceList_InputMessage" />
|
<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:output wsaw:Action="http://tempuri.org/ISystemTemperatureService/GetDeviceListResponse" message="tns:ISystemTemperatureService_GetDeviceList_OutputMessage" />
|
||||||
</wsdl:operation>
|
</wsdl:operation>
|
||||||
|
<wsdl:operation name="Shutdown">
|
||||||
|
<wsdl:input wsaw:Action="http://tempuri.org/ISystemTemperatureService/Shutdown" message="tns:ISystemTemperatureService_Shutdown_InputMessage" />
|
||||||
|
<wsdl:output wsaw:Action="http://tempuri.org/ISystemTemperatureService/ShutdownResponse" message="tns:ISystemTemperatureService_Shutdown_OutputMessage" />
|
||||||
|
</wsdl:operation>
|
||||||
</wsdl:portType>
|
</wsdl:portType>
|
||||||
<wsdl:binding name="WSHttpBinding_ISystemTemperatureService" type="tns:ISystemTemperatureService">
|
<wsdl:binding name="WSHttpBinding_ISystemTemperatureService" type="tns:ISystemTemperatureService">
|
||||||
<wsp:PolicyReference URI="#WSHttpBinding_ISystemTemperatureService_policy" />
|
<wsp:PolicyReference URI="#WSHttpBinding_ISystemTemperatureService_policy" />
|
||||||
@@ -167,6 +215,17 @@
|
|||||||
<soap12:body use="literal" />
|
<soap12:body use="literal" />
|
||||||
</wsdl:output>
|
</wsdl:output>
|
||||||
</wsdl:operation>
|
</wsdl:operation>
|
||||||
|
<wsdl:operation name="Shutdown">
|
||||||
|
<soap12:operation soapAction="http://tempuri.org/ISystemTemperatureService/Shutdown" style="document" />
|
||||||
|
<wsdl:input>
|
||||||
|
<wsp:PolicyReference URI="#WSHttpBinding_ISystemTemperatureService_Shutdown_Input_policy" />
|
||||||
|
<soap12:body use="literal" />
|
||||||
|
</wsdl:input>
|
||||||
|
<wsdl:output>
|
||||||
|
<wsp:PolicyReference URI="#WSHttpBinding_ISystemTemperatureService_Shutdown_output_policy" />
|
||||||
|
<soap12:body use="literal" />
|
||||||
|
</wsdl:output>
|
||||||
|
</wsdl:operation>
|
||||||
</wsdl:binding>
|
</wsdl:binding>
|
||||||
<wsdl:service name="SystemTemperatureService">
|
<wsdl:service name="SystemTemperatureService">
|
||||||
<wsdl:port name="WSHttpBinding_ISystemTemperatureService" binding="tns:WSHttpBinding_ISystemTemperatureService">
|
<wsdl:port name="WSHttpBinding_ISystemTemperatureService" binding="tns:WSHttpBinding_ISystemTemperatureService">
|
||||||
|
|||||||
@@ -13,4 +13,14 @@
|
|||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
<xs:element name="Shutdown">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence />
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="ShutdownResponse">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence />
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
</xs:schema>
|
</xs:schema>
|
||||||
Reference in New Issue
Block a user