]> jfr.im git - z_archive/kelsier.git/commitdiff
init repo
authorJohn Runyon <redacted>
Fri, 12 Apr 2013 13:17:28 +0000 (08:17 -0500)
committerJohn Runyon <redacted>
Fri, 12 Apr 2013 13:17:28 +0000 (08:17 -0500)
.gitattributes [new file with mode: 0644]
.gitignore [new file with mode: 0644]
Kelsier.csproj [new file with mode: 0644]
Kelsier.sln [new file with mode: 0644]
Logger.cs [new file with mode: 0644]
Program.cs [new file with mode: 0644]
Properties/AssemblyInfo.cs [new file with mode: 0644]
Properties/Settings.Designer.cs [new file with mode: 0644]
Properties/Settings.settings [new file with mode: 0644]
README.txt [new file with mode: 0644]
app.config [new file with mode: 0644]

diff --git a/.gitattributes b/.gitattributes
new file mode 100644 (file)
index 0000000..412eeda
--- /dev/null
@@ -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 (file)
index 0000000..f827b66
--- /dev/null
@@ -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 (file)
index 0000000..1afe0bf
--- /dev/null
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{64010C48-6927-4DA5-AE7F-0AD0301DC851}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Kelsier</RootNamespace>
+    <AssemblyName>Kelsier</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <PlatformTarget>x86</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|x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="MySql.Data, Version=6.6.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL" />
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Logger.cs" />
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+      <DependentUpon>Settings.settings</DependentUpon>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <WCFMetadata Include="Service References\" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config" />
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- 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>
\ No newline at end of file
diff --git a/Kelsier.sln b/Kelsier.sln
new file mode 100644 (file)
index 0000000..1abede5
--- /dev/null
@@ -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 (file)
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 (file)
index 0000000..b716ab0
--- /dev/null
@@ -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 (file)
index 0000000..977a7fe
--- /dev/null
@@ -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 (file)
index 0000000..4635f71
--- /dev/null
@@ -0,0 +1,38 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     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.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+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 (file)
index 0000000..ab3e2f0
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Kelsier.Properties" GeneratedClassName="Settings">
+  <Profiles />
+  <Settings>
+    <Setting Name="dbstr" Type="System.String" Scope="User">
+      <Value Profile="(Default)">server=localhost;userid=kelsier;password=mistborn;database=kelsier</Value>
+    </Setting>
+  </Settings>
+</SettingsFile>
\ No newline at end of file
diff --git a/README.txt b/README.txt
new file mode 100644 (file)
index 0000000..ccd0f03
--- /dev/null
@@ -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 (file)
index 0000000..ae81658
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <configSections>
+        <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
+            <section name="Kelsier.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
+        </sectionGroup>
+    </configSections>
+    <userSettings>
+        <Kelsier.Properties.Settings>
+            <setting name="dbstr" serializeAs="String">
+                <value>server=localhost;userid=kelsier;password=mistborn;database=kelsier</value>
+            </setting>
+        </Kelsier.Properties.Settings>
+    </userSettings>
+</configuration>
\ No newline at end of file