actual Exception instead e.Message

Also removed the IRCClient project from this PR
This commit is contained in:
Andrej 2017-01-04 11:38:00 +07:00
parent 36b03fd4c2
commit d11905962f
7 changed files with 3 additions and 179 deletions

View File

@ -5,8 +5,6 @@ VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatSharp", "ChatSharp\ChatSharp.csproj", "{4033AFFA-BEA3-4BDF-84EA-59A23360FD36}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IRCClient", "IRCClient\IRCClient.csproj", "{939CC9EC-EE9F-47DC-BC5B-D016B6B6E561}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -27,18 +25,6 @@ Global
{4033AFFA-BEA3-4BDF-84EA-59A23360FD36}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{4033AFFA-BEA3-4BDF-84EA-59A23360FD36}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{4033AFFA-BEA3-4BDF-84EA-59A23360FD36}.Release|x86.ActiveCfg = Release|Any CPU
{939CC9EC-EE9F-47DC-BC5B-D016B6B6E561}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{939CC9EC-EE9F-47DC-BC5B-D016B6B6E561}.Debug|Any CPU.Build.0 = Debug|Any CPU
{939CC9EC-EE9F-47DC-BC5B-D016B6B6E561}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{939CC9EC-EE9F-47DC-BC5B-D016B6B6E561}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{939CC9EC-EE9F-47DC-BC5B-D016B6B6E561}.Debug|x86.ActiveCfg = Debug|Any CPU
{939CC9EC-EE9F-47DC-BC5B-D016B6B6E561}.Debug|x86.Build.0 = Debug|Any CPU
{939CC9EC-EE9F-47DC-BC5B-D016B6B6E561}.Release|Any CPU.ActiveCfg = Release|Any CPU
{939CC9EC-EE9F-47DC-BC5B-D016B6B6E561}.Release|Any CPU.Build.0 = Release|Any CPU
{939CC9EC-EE9F-47DC-BC5B-D016B6B6E561}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{939CC9EC-EE9F-47DC-BC5B-D016B6B6E561}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{939CC9EC-EE9F-47DC-BC5B-D016B6B6E561}.Release|x86.ActiveCfg = Release|Any CPU
{939CC9EC-EE9F-47DC-BC5B-D016B6B6E561}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -11,9 +11,9 @@ namespace ChatSharp.Events
/// <summary>
/// The error that has occured.
/// </summary>
public string Error { get; set; }
public Exception Error { get; set; }
internal ErrorEventArgs(string error)
internal ErrorEventArgs(Exception error)
{
Error = error;
}

View File

@ -239,7 +239,7 @@ namespace ChatSharp
}
catch (Exception e)
{
OnError(new Events.ErrorEventArgs(e.Message));
OnError(new Events.ErrorEventArgs(e));
}
}

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>

View File

@ -1,66 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.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>{939CC9EC-EE9F-47DC-BC5B-D016B6B6E561}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>IRCClient</RootNamespace>
<AssemblyName>IRCClient</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</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>
<ItemGroup>
<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.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ChatSharp\ChatSharp.csproj">
<Project>{4033affa-bea3-4bdf-84ea-59a23360fd36}</Project>
<Name>ChatSharp</Name>
</ProjectReference>
</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>

View File

@ -1,54 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using ChatSharp;
namespace IRCClient
{
class Program
{
static void Main(string[] args)
{
//https://github.com/SirCmpwn/ChatSharp
var client = new IrcClient("InvalidAddress", new IrcUser("ChatSharp", "ChatSharp"));
// var client = new IrcClient("irc.freenode.net", new IrcUser("ChatSharp", "ChatSharp"));
// var client = new IrcClient("localhost", new IrcUser("ChatSharp", "ChatSharp"));
Console.WriteLine("IRC client. " + client.ServerAddress);
client.ConnectionComplete += (s, e) => {
Console.WriteLine("ConnectionComplete.");
client.JoinChannel("#botwar");
};
client.UserJoinedChannel += (s, e) => {
Console.WriteLine("The " + e.User.Nick + " user has joined to the " + e.Channel.Name + " channel.");
};
client.NetworkError += (s, e) => Console.WriteLine("NetworkError: " + new Win32Exception((int)e.SocketError).Message);
client.Error += (s, e) => Console.WriteLine("Error: " + e.Error);
client.ChannelMessageRecieved += (s, e) =>
{
var channel = client.Channels[e.PrivateMessage.Source];
if (e.PrivateMessage.Message == ".list")
channel.SendMessage(string.Join(", ", channel.Users.Select(u => u.Nick)));
else if (e.PrivateMessage.Message.StartsWith(".ban "))
{
if (!channel.UsersByMode['@'].Contains(client.User))
{
channel.SendMessage("I'm not an op here!");
return;
}
var target = e.PrivateMessage.Message.Substring(5);
client.WhoIs(target, whois => channel.ChangeMode("+b *!*@" + whois.User.Hostname));
}
};
client.ConnectAsync();
while (true) ; // Waste CPU cycles
}
}
}

View File

@ -1,36 +0,0 @@
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("IRCClient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("IRCClient")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[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("939cc9ec-ee9f-47dc-bc5b-d016b6b6e561")]
// 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")]