Chatlog, Message sending fixes

- Fix ChatLog not creating the folder containing log file
- Fix chat prompt not sending regular text messages
This commit is contained in:
ORelio 2014-06-16 14:23:56 +02:00
parent 87d4687394
commit c4c5e2efd9
2 changed files with 6 additions and 3 deletions

View file

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO;
namespace MinecraftClient.ChatBots namespace MinecraftClient.ChatBots
{ {
@ -104,9 +105,10 @@ namespace MinecraftClient.ChatBots
tosave = "" + D + '-' + M + '-' + Y + ' ' + h + ':' + m + ':' + s + ' ' + tosave; tosave = "" + D + '-' + M + '-' + Y + ' ' + h + ':' + m + ':' + s + ' ' + tosave;
} }
System.IO.FileStream stream = new System.IO.FileStream(logfile, System.IO.FileMode.OpenOrCreate); Directory.CreateDirectory(Path.GetDirectoryName(logfile));
System.IO.StreamWriter writer = new System.IO.StreamWriter(stream); FileStream stream = new FileStream(logfile, FileMode.OpenOrCreate);
stream.Seek(0, System.IO.SeekOrigin.End); StreamWriter writer = new StreamWriter(stream);
stream.Seek(0, SeekOrigin.End);
writer.WriteLine(tosave); writer.WriteLine(tosave);
writer.Dispose(); writer.Dispose();
stream.Close(); stream.Close();

View file

@ -186,6 +186,7 @@ namespace MinecraftClient
ConsoleIO.WriteLineFormatted("§8" + response_msg); ConsoleIO.WriteLineFormatted("§8" + response_msg);
} }
} }
else SendChatMessage(text);
} }
} }
} }