Import TechBot

svn path=/trunk/; revision=13064
This commit is contained in:
Casper Hornstrup 2005-01-15 19:27:25 +00:00
parent 568b27baeb
commit 9dab4509fa
94 changed files with 24386 additions and 0 deletions

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="IRCServerHostName" value="irc.eu.freenode.net" />
<add key="IRCServerHostPort" value="6667" />
<add key="IRCChannelName" value="channel" />
<add key="IRCBotName" value="MyBot" />
<add key="ChmPath" value="C:\IRC\TechBot\CHM" />
<add key="MainChm" value="kmarch.chm" />
<add key="NtstatusXml" value="C:\IRC\TechBot\ntstatus.xml" />
<add key="WinerrorXml" value="C:\IRC\TechBot\winerror.xml" />
<add key="HresultXml" value="C:\IRC\TechBot\hresult.xml" />
<add key="SvnCommand" value="svn co svn://svn.reactos.com/trunk/reactos" />
</appSettings>
</configuration>

View file

@ -0,0 +1,32 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.0.*")]
// The following attributes specify the key for the sign of your assembly. See the
// .NET Framework documentation for more information about signing.
// This is not required, if you don't want signing let these attributes like they're.
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]

View file

@ -0,0 +1,23 @@
<?xml version="1.0"?>
<project name="TechBot" default="build">
<property name="output.dir" value="..\bin" />
<target name="build" description="Build component">
<mkdir dir="${output.dir}" />
<csc target="winexe"
output="${output.dir}\TechBot.exe"
optimize="true"
debug="true"
doc="${output.dir}\TechBot.xml"
warninglevel="0">
<sources>
<include name="*.cs" />
</sources>
<references>
<include name="${output.dir}\TechBot.Library.dll" />
</references>
</csc>
</target>
</project>

View file

@ -0,0 +1,71 @@
using System;
using System.Configuration;
using System.Diagnostics;
using TechBot.Library;
namespace TechBot
{
public class ServiceThread
{
private string IRCServerHostName;
private int IRCServerHostPort;
private string IRCChannelName;
private string IRCBotName;
private string ChmPath;
private string MainChm;
private string NtstatusXml;
private string HresultXml;
private string WinerrorXml;
private string SvnCommand;
private EventLog eventLog;
public ServiceThread(EventLog eventLog)
{
this.eventLog = eventLog;
}
private void SetupConfiguration()
{
IRCServerHostName = ConfigurationSettings.AppSettings["IRCServerHostName"];
IRCServerHostPort = Int32.Parse(ConfigurationSettings.AppSettings["IRCServerHostPort"]);
IRCChannelName = ConfigurationSettings.AppSettings["IRCChannelName"];
IRCBotName = ConfigurationSettings.AppSettings["IRCBotName"];
ChmPath = ConfigurationSettings.AppSettings["ChmPath"];
MainChm = ConfigurationSettings.AppSettings["MainChm"];
NtstatusXml = ConfigurationSettings.AppSettings["NtstatusXml"];
HresultXml = ConfigurationSettings.AppSettings["HresultXml"];
WinerrorXml = ConfigurationSettings.AppSettings["WinerrorXml"];
SvnCommand = ConfigurationSettings.AppSettings["SvnCommand"];
}
public void Run()
{
SetupConfiguration();
System.Console.WriteLine("TechBot irc service...");
IrcService ircService = new IrcService(IRCServerHostName,
IRCServerHostPort,
IRCChannelName,
IRCBotName,
ChmPath,
MainChm,
NtstatusXml,
WinerrorXml,
HresultXml,
SvnCommand);
ircService.Run();
}
public void Start()
{
try
{
Run();
}
catch (Exception ex)
{
eventLog.WriteEntry(String.Format("Ex. {0}", ex));
}
}
}
}

View file

@ -0,0 +1,30 @@
<Project name="TechBot" standardNamespace="TechBot" description="" newfilesearch="None" enableviewstate="True" version="1.1" projecttype="C#">
<Contents>
<File name=".\TechBotService.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\AssemblyInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\Default.build" subtype="Code" buildaction="Nothing" dependson="" data="" />
<File name=".\App.config" subtype="Code" buildaction="Nothing" dependson="" data="" />
<File name=".\ServiceThread.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
</Contents>
<References>
<Reference type="Project" refto="TechBot.Library" localcopy="True" />
</References>
<DeploymentInformation target="" script="" strategy="File" />
<Configuration runwithwarnings="True" name="Debug">
<CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" />
<Execution commandlineparameters="" consolepause="False" />
<Output directory="..\bin\Debug" assembly="TechBot" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" />
</Configuration>
<Configurations active="Debug">
<Configuration runwithwarnings="True" name="Debug">
<CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" />
<Execution commandlineparameters="" consolepause="False" />
<Output directory="..\bin\Debug" assembly="TechBot" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" />
</Configuration>
<Configuration runwithwarnings="True" name="Release">
<CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" />
<Execution commandlineparameters="" consolepause="False" />
<Output directory="..\bin\Release" assembly="TechBot" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" />
</Configuration>
</Configurations>
</Project>

View file

@ -0,0 +1,97 @@
using System;
using System.Threading;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Configuration.Install;
namespace TechBot
{
public class TechBotService : System.ServiceProcess.ServiceBase
{
private Thread thread;
private ServiceThread threadWorker;
public TechBotService()
{
InitializeComponents();
}
private void InitializeComponents()
{
this.ServiceName = "TechBot";
}
/// <summary>
/// This method starts the service.
/// </summary>
public static void Main()
{
System.ServiceProcess.ServiceBase.Run(new System.ServiceProcess.ServiceBase[] {
new TechBotService() // To run more than one service you have to add them here
});
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
/// <summary>
/// Start this service.
/// </summary>
protected override void OnStart(string[] args)
{
try
{
threadWorker = new ServiceThread(EventLog);
thread = new Thread(new ThreadStart(threadWorker.Start));
thread.Start();
EventLog.WriteEntry(String.Format("TechBot service is running."));
}
catch (Exception ex)
{
EventLog.WriteEntry(String.Format("Ex. {0}", ex));
}
}
/// <summary>
/// Stop this service.
/// </summary>
protected override void OnStop()
{
try
{
thread.Abort();
thread.Join();
thread = null;
threadWorker = null;
EventLog.WriteEntry(String.Format("TechBot service is stopped."));
}
catch (Exception ex)
{
EventLog.WriteEntry(String.Format("Ex. {0}", ex));
}
}
}
}
[RunInstaller(true)]
public class ProjectInstaller : Installer
{
public ProjectInstaller()
{
ServiceProcessInstaller spi = new ServiceProcessInstaller();
spi.Account = ServiceAccount.LocalSystem;
ServiceInstaller si = new ServiceInstaller();
si.ServiceName = "TechBot";
si.StartType = ServiceStartMode.Automatic;
Installers.AddRange(new Installer[] {spi, si});
}
}