summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DiscoBot/Commands/FileHandler.cs43
-rw-r--r--DiscoBot/Commands/Voice.cs10
-rw-r--r--DiscoBot/DiscoBot.csproj3
-rw-r--r--UnitTestProject1/Properties/AssemblyInfo.cs20
-rw-r--r--UnitTestProject1/UnitTest1.cs14
-rw-r--r--UnitTestProject1/UnitTestProject1.csproj67
-rw-r--r--UnitTestProject1/packages.config5
-rw-r--r--Voice.cs4
8 files changed, 50 insertions, 116 deletions
diff --git a/DiscoBot/Commands/FileHandler.cs b/DiscoBot/Commands/FileHandler.cs
new file mode 100644
index 0000000..efebe3f
--- /dev/null
+++ b/DiscoBot/Commands/FileHandler.cs
@@ -0,0 +1,43 @@
+namespace DiscoBot.Commands
+{
+ using System;
+ using System.Linq;
+ using System.Net;
+
+ using DiscoBot.Auxiliary;
+ using DiscoBot.Characters;
+
+ using Discord.Commands;
+
+ public class FileHandler : ModuleBase
+ {
+ [Command("add"), Summary("fügt Helden hinzu")]
+ public void AddChar()
+ {
+ var msg = this.Context.Message;
+ if (msg.Attachments == null)
+ {
+ throw new ArgumentException("Es wurde keine Datei angehängt");
+ }
+
+ var attachments = msg.Attachments.ToList();
+
+ if (!attachments.Any(x => x.Filename.EndsWith(".xml")))
+ {
+ throw new ArgumentException("Es wurde kein xml Held mitgeschickt");
+ }
+
+ foreach (var attachment in attachments.Where(x => x.Filename.EndsWith(".xml")))
+ {
+ using (var client = new WebClient())
+ {
+ client.DownloadFile(attachment.Url, "helden\\" + attachment.Filename);
+ }
+
+ Dsa.Chars.Add(new Character("helden\\" + attachment.Filename));
+ (Dsa.Chars.Last() as Character)?.Talente.Select(x => new Talent(x.Name, x.Probe, 0))
+ .Where(c => !Dsa.Talente.Exists(v => v.Name.Equals(c.Name))).ToList().ForEach(v => Dsa.Talente.Add(v));
+ }
+ }
+ }
+}
diff --git a/DiscoBot/Commands/Voice.cs b/DiscoBot/Commands/Voice.cs
index 72988d4..02210e8 100644
--- a/DiscoBot/Commands/Voice.cs
+++ b/DiscoBot/Commands/Voice.cs
@@ -39,10 +39,10 @@
[Command("play")]
public Task PlayAudioAsync(string path)
{
- return this.SendAsync(Client, path);
+ return SendAsync(path);
}
- private Process CreateStream(string path)
+ private static Process CreateStream(string path)
{
var ffmpeg = new ProcessStartInfo
{
@@ -54,12 +54,12 @@
return Process.Start(ffmpeg);
}
- private async Task SendAsync(IAudioClient client, string path)
+ private static async Task SendAsync(string path)
{
// Create FFmpeg using the previous example
- var ffmpeg = this.CreateStream(path);
+ var ffmpeg = CreateStream(path);
var output = ffmpeg.StandardOutput.BaseStream;
- var discord = client.CreatePCMStream(AudioApplication.Music);
+ var discord = Client.CreatePCMStream(AudioApplication.Music);
await output.CopyToAsync(discord);
await discord.FlushAsync();
}
diff --git a/DiscoBot/DiscoBot.csproj b/DiscoBot/DiscoBot.csproj
index 2bf17e5..3955ef6 100644
--- a/DiscoBot/DiscoBot.csproj
+++ b/DiscoBot/DiscoBot.csproj
@@ -148,16 +148,17 @@
<Compile Include="Characters\Character.cs" />
<Compile Include="Auxiliary\CommandExtension.cs" />
<Compile Include="Commands\CommandTypes.cs" />
+ <Compile Include="Commands\FileHandler.cs" />
<Compile Include="Commands\Gm.cs" />
<Compile Include="Commands\List.cs" />
<Compile Include="Commands\NpcCommands.cs" />
<Compile Include="Commands\Test.cs" />
<Compile Include="Commands\Utility.cs" />
<Compile Include="Commands\Voice.cs" />
- <Compile Include="DSA.cs" />
<Compile Include="Characters\ICharacter.cs" />
<Compile Include="Auxiliary\Misc.cs" />
<Compile Include="Characters\NPC.cs" />
+ <Compile Include="Dsa.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
diff --git a/UnitTestProject1/Properties/AssemblyInfo.cs b/UnitTestProject1/Properties/AssemblyInfo.cs
deleted file mode 100644
index 9dbb2a9..0000000
--- a/UnitTestProject1/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("UnitTestProject1")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("UnitTestProject1")]
-[assembly: AssemblyCopyright("Copyright © 2018")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: ComVisible(false)]
-
-[assembly: Guid("75b56398-a683-4b85-9ba3-b445d2b55527")]
-
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/UnitTestProject1/UnitTest1.cs b/UnitTestProject1/UnitTest1.cs
deleted file mode 100644
index dbc289d..0000000
--- a/UnitTestProject1/UnitTest1.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace UnitTestProject1
-{
- [TestClass]
- public class UnitTest1
- {
- [TestMethod]
- public void TestMethod1()
- {
- }
- }
-}
diff --git a/UnitTestProject1/UnitTestProject1.csproj b/UnitTestProject1/UnitTestProject1.csproj
deleted file mode 100644
index e887a0e..0000000
--- a/UnitTestProject1/UnitTestProject1.csproj
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{75B56398-A683-4B85-9BA3-B445D2B55527}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>UnitTestProject1</RootNamespace>
- <AssemblyName>UnitTestProject1</AssemblyName>
- <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
- <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
- <IsCodedUITest>False</IsCodedUITest>
- <TestProjectType>UnitTest</TestProjectType>
- <NuGetPackageImportStamp>
- </NuGetPackageImportStamp>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <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' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
- <HintPath>..\packages\MSTest.TestFramework.1.2.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
- <HintPath>..\packages\MSTest.TestFramework.1.2.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="UnitTest1.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
- <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
- <PropertyGroup>
- <ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
- </PropertyGroup>
- <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.props'))" />
- <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.targets'))" />
- </Target>
- <Import Project="..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.targets')" />
-</Project> \ No newline at end of file
diff --git a/UnitTestProject1/packages.config b/UnitTestProject1/packages.config
deleted file mode 100644
index 8819694..0000000
--- a/UnitTestProject1/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="MSTest.TestAdapter" version="1.2.0" targetFramework="net471" />
- <package id="MSTest.TestFramework" version="1.2.0" targetFramework="net471" />
-</packages> \ No newline at end of file
diff --git a/Voice.cs b/Voice.cs
deleted file mode 100644
index 031c49e..0000000
--- a/Voice.cs
+++ /dev/null
@@ -1,4 +0,0 @@
-using System;
-using Discord;
-
-