Skip to content

Commit c26a1c3

Browse files
authored
Merge pull request #88 from lilyremigia/master
Fix various issues
2 parents 759705c + 02caad2 commit c26a1c3

File tree

10 files changed

+372
-339
lines changed

10 files changed

+372
-339
lines changed
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
22
<s:Boolean x:Key="/Default/UserDictionary/Words/=Shinmera/@EntryIndexedValue">True</s:Boolean>
3-
<s:Boolean x:Key="/Default/UserDictionary/Words/=thcrap/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
3+
<s:Boolean x:Key="/Default/UserDictionary/Words/=tasofro/@EntryIndexedValue">True</s:Boolean>
4+
<s:Boolean x:Key="/Default/UserDictionary/Words/=thcrap/@EntryIndexedValue">True</s:Boolean>
5+
<s:Boolean x:Key="/Default/UserDictionary/Words/=thcrap_0027s/@EntryIndexedValue">True</s:Boolean>
6+
<s:Boolean x:Key="/Default/UserDictionary/Words/=Touhou/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

Universal THCRAP Launcher/I18N.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
using Newtonsoft.Json;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.IO;
5-
using System.Linq;
6-
using System.Text;
7-
using System.Threading.Tasks;
1+
using System.IO;
82
using System.Windows.Forms;
3+
using Newtonsoft.Json;
94

105
namespace Universal_THCRAP_Launcher
116
{

Universal THCRAP Launcher/Log.cs

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
62
using System.IO;
7-
using System.Security.Permissions;
83
using System.Security;
4+
using System.Security.Permissions;
95
using System.Windows.Forms;
106

117
namespace Universal_THCRAP_Launcher
128
{
13-
class Log
9+
internal class Log
1410
{
15-
private FileStream fs;
16-
private StreamWriter sw;
11+
private readonly FileStream _fs;
12+
private readonly StreamWriter _sw;
1713

1814
public Log(string logFile)
1915
{
@@ -29,48 +25,48 @@ public Log(string logFile)
2925
}
3026

3127
// Delete log file if larger than 1 MB
32-
if (File.Exists(logFile) && new System.IO.FileInfo(logFile).Length >= 0x100000)
28+
if (File.Exists(logFile) && new FileInfo(logFile).Length >= 0x100000)
3329
File.Delete(logFile);
3430

3531
string dirName = Path.GetDirectoryName(logFile);
3632
if (!Directory.Exists(dirName))
3733
Directory.CreateDirectory(dirName);
3834

39-
fs = new FileStream(logFile, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
40-
sw = new StreamWriter(fs);
35+
_fs = new FileStream(logFile, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
36+
_sw = new StreamWriter(_fs);
4137
}
4238

4339
public void WriteLine(object text)
4440
{
4541
Console.WriteLine($"[{DateTime.Now.ToLongTimeString()}] " + text);
46-
if (sw == null) return;
47-
sw.WriteLine($"[{DateTime.Now.ToLongTimeString()}] " + text);
48-
sw.Flush();
49-
fs.Flush();
42+
if (_sw == null) return;
43+
_sw.WriteLine($"[{DateTime.Now.ToLongTimeString()}] " + text);
44+
_sw.Flush();
45+
_fs.Flush();
5046
}
5147

5248
public void Write(object text)
5349
{
5450
Console.Write(text);
55-
if (sw == null) return;
56-
sw.Write(text);
57-
sw.Flush();
58-
fs.Flush();
51+
if (_sw == null) return;
52+
_sw.Write(text);
53+
_sw.Flush();
54+
_fs.Flush();
5955
}
6056

6157
~Log()
6258
{
63-
if (sw != null)
59+
if (_sw != null)
6460
{
65-
sw.Flush();
66-
sw.Close();
67-
sw.Dispose();
61+
_sw.Flush();
62+
_sw.Close();
63+
_sw.Dispose();
6864
}
69-
if (fs != null)
65+
if (_fs != null)
7066
{
71-
fs.Flush();
72-
fs.Close();
73-
fs.Dispose();
67+
_fs.Flush();
68+
_fs.Close();
69+
_fs.Dispose();
7470
}
7571
}
7672
}

0 commit comments

Comments
 (0)