From: John Runyon Date: Fri, 12 Apr 2013 13:17:28 +0000 (-0500) Subject: init repo X-Git-Url: https://jfr.im/git/z_archive/kelsier.git/commitdiff_plain/88ae06a4d2062e34b035f34e2cd9ddc29fd2170f init repo --- 88ae06a4d2062e34b035f34e2cd9ddc29fd2170f diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f827b66 --- /dev/null +++ b/.gitignore @@ -0,0 +1,68 @@ +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Rr]elease/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.vspscc +.builds +*.dotCover + +# Visual Studio profiler +*.psess +*.vsp + +# Installshield output folder +[Ee]xpress + +# Click-Once directory +publish + +# Others +[Bb]in +[Oo]bj +TestResults +*.Cache +ClientBin +stylecop.* +~$* +*.dbmdl + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML + + + +############ +## Windows +############ + +Thumbs.db +Desktop.ini \ No newline at end of file diff --git a/Kelsier.csproj b/Kelsier.csproj new file mode 100644 index 0000000..1afe0bf --- /dev/null +++ b/Kelsier.csproj @@ -0,0 +1,74 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {64010C48-6927-4DA5-AE7F-0AD0301DC851} + Exe + Properties + Kelsier + Kelsier + v4.0 + Client + 512 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + True + True + Settings.settings + + + + + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + \ No newline at end of file diff --git a/Kelsier.sln b/Kelsier.sln new file mode 100644 index 0000000..1abede5 --- /dev/null +++ b/Kelsier.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C# Express 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kelsier", "Kelsier.csproj", "{64010C48-6927-4DA5-AE7F-0AD0301DC851}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {64010C48-6927-4DA5-AE7F-0AD0301DC851}.Debug|x86.ActiveCfg = Debug|x86 + {64010C48-6927-4DA5-AE7F-0AD0301DC851}.Debug|x86.Build.0 = Debug|x86 + {64010C48-6927-4DA5-AE7F-0AD0301DC851}.Release|x86.ActiveCfg = Release|x86 + {64010C48-6927-4DA5-AE7F-0AD0301DC851}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Logger.cs b/Logger.cs new file mode 100644 index 0000000..753b063 --- /dev/null +++ b/Logger.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; + +namespace Kelsier +{ + class Logger + { + protected TextWriter[] debugs, infos, errors; + public Logger(TextWriter[] debugs, TextWriter[] infos, TextWriter[] errors) // constructor + { + this.debugs = debugs; + this.infos = infos; + this.errors = errors; + + this.debug("Starting logging (debug) here at {0}", DateTime.Now.ToString("F")); + this.info("Starting logging (info) here at {0}", DateTime.Now.ToString("F")); + this.error("Starting logging (error) here at {0}", DateTime.Now.ToString("F")); + } + + ~Logger() // destructor + { + this.debug("Stopping logging (debug) here at {0}", DateTime.Now.ToString("F")); + this.info("Stopping logging (info) here at {0}", DateTime.Now.ToString("F")); + this.error("Stopping logging (error) here at {0}", DateTime.Now.ToString("F")); + foreach (TextWriter[] group in new TextWriter[][]{this.debugs, this.infos, this.errors}) + { + foreach (TextWriter outw in group) + { + outw.Close(); + } + } + } + + public void debug(string msg, params object[] args) + { + foreach (TextWriter outw in this.debugs) + { + outw.WriteLine("(D@" + DateTime.Now.ToString("HH:mm:ss") + ")[MAIN] " + msg, args); + } + } + + public void info(string msg, params object[] args) + { + foreach (TextWriter outw in this.infos) + { + outw.WriteLine("(I@" + DateTime.Now.ToString("HH:mm:ss") + ")[MAIN] " + msg, args); + } + } + + public void error(string msg, params object[] args) + { + foreach (TextWriter outw in this.errors) + { + outw.WriteLine("(E@" + DateTime.Now.ToString("HH:mm:ss") + ")[MAIN] " + msg, args); + } + } + } +} diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..b716ab0 --- /dev/null +++ b/Program.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using MySql.Data.MySqlClient; + +namespace Kelsier +{ + class Program + { + static protected MySqlConnection _dbh = null; + static public MySqlConnection dbh + { + get { return _dbh; } + } + + static protected Logger _log; + static public Logger log + { + get { return _log; } + } + + static void Main(string[] args) + { + System.IO.StreamWriter fileout = new System.IO.StreamWriter("kelsier.log", false); + fileout.AutoFlush = true; + System.IO.TextWriter[] outputs = {Console.Out, fileout}; + _log = new Logger(outputs, outputs, outputs); + + _dbh = new MySqlConnection(Properties.Settings.Default.dbstr); + + try + { + dbh.Open(); + } + catch (MySqlException e) + { + log.error("Error: {0}", e.ToString()); + } + + MySqlCommand query = new MySqlCommand("SELECT 1+3", dbh); + log.debug("1 + 3 = {0}", query.ExecuteScalar().ToString()); + + _log = null; + Console.Write("Key to quit..."); + Console.ReadKey(); + } + } + + +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..977a7fe --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Kelsier")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Kelsier")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[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("686995da-2fd7-46c3-865c-a0af38fa1620")] + +// 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")] diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs new file mode 100644 index 0000000..4635f71 --- /dev/null +++ b/Properties/Settings.Designer.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18034 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Kelsier.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("server=localhost;userid=kelsier;password=mistborn;database=kelsier")] + public string dbstr { + get { + return ((string)(this["dbstr"])); + } + set { + this["dbstr"] = value; + } + } + } +} diff --git a/Properties/Settings.settings b/Properties/Settings.settings new file mode 100644 index 0000000..ab3e2f0 --- /dev/null +++ b/Properties/Settings.settings @@ -0,0 +1,9 @@ + + + + + + server=localhost;userid=kelsier;password=mistborn;database=kelsier + + + \ No newline at end of file diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..ccd0f03 --- /dev/null +++ b/README.txt @@ -0,0 +1,3 @@ +Kelsier: IRC multi-bot, C# + +Meant for ircu-style networks (specifically Quakenet). \ No newline at end of file diff --git a/app.config b/app.config new file mode 100644 index 0000000..ae81658 --- /dev/null +++ b/app.config @@ -0,0 +1,15 @@ + + + + +
+ + + + + + server=localhost;userid=kelsier;password=mistborn;database=kelsier + + + + \ No newline at end of file