Skip to content

Commit 03af9a0

Browse files
committed
+ Small Fixes
1 parent dd737a8 commit 03af9a0

5 files changed

Lines changed: 116 additions & 54 deletions

File tree

ChatLogger/AccountLogin.cs

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -338,22 +338,27 @@ static void OnFriendMsg(SteamFriends.FriendMsgCallback callback)
338338
{
339339
if (callback.EntryType == EChatEntryType.ChatMsg)
340340
{
341-
342-
ulong FriendID = callback.Sender;
343-
string Message = callback.Message; Message = Regex.Replace(Message, @"\t|\n|\r", ""); //741iq
344-
345341
var Settingslist = JsonConvert.DeserializeObject<ChatLoggerSettings>(File.ReadAllText(Program.SettingsJsonFile));
346342

347-
string pathLog = Settingslist.PathLogs + @"\ChatLogs\" + steamClient.SteamID.ConvertToUInt64() + @"\[" + FriendID + "] - " + steamFriends.GetFriendPersonaName(FriendID) + ".txt";
343+
344+
ulong FriendID = callback.Sender;
345+
string Message = callback.Message; Message = Regex.Replace(Message, @"\t|\n|\r", "");
348346

347+
string FriendName = steamFriends.GetFriendPersonaName(FriendID);
348+
string nameClean = Regex.Replace(FriendName, "[^A-Za-z0-9 _]", "");
349349

350-
string FinalMsg = "[" + DateTime.Now + "] " + steamFriends.GetFriendPersonaName(FriendID) + ": " + Message;
350+
string FriendIDName = @"\[" + FriendID + "] - " + nameClean + ".txt";
351+
string pathLog = Settingslist.PathLogs + @"\" + steamClient.SteamID.ConvertToUInt64() + FriendIDName;
352+
353+
string FinalMsg = "[" + DateTime.Now + "] " + FriendName + ": " + Message;
354+
355+
string[] files = Directory.GetFiles(Settingslist.PathLogs + @"\" + steamClient.SteamID.ConvertToUInt64(), "[" + FriendID + "]*.txt");
351356

352-
if (File.Exists(pathLog))
357+
if (files.Length > 0)//file exist
353358
{
354-
string[] LastDate = File.ReadLines(pathLog).Last().Split(' '); LastDate[0] = LastDate[0].Substring(1);
359+
string[] LastDate = File.ReadLines(files[0]).Last().Split(' '); LastDate[0] = LastDate[0].Substring(1);
355360

356-
using (var tw = new StreamWriter(pathLog, true))
361+
using (var tw = new StreamWriter(files[0], true))
357362
if (LastDate[0] != DateTime.Now.Date.ToShortDateString())
358363
{
359364
tw.WriteLine(Settingslist.Separator + "\n" + FinalMsg);
@@ -376,20 +381,26 @@ static void OnFriendEchoMsg(SteamFriends.FriendMsgEchoCallback callback)
376381
{
377382
if (callback.EntryType == EChatEntryType.ChatMsg)
378383
{
384+
var Settingslist = JsonConvert.DeserializeObject<ChatLoggerSettings>(File.ReadAllText(Program.SettingsJsonFile));
385+
379386
ulong FriendID = callback.Recipient;
380387
string Message = callback.Message; Message = Regex.Replace(Message, @"\t|\n|\r", "");
381-
var Settingslist = JsonConvert.DeserializeObject<ChatLoggerSettings>(File.ReadAllText(Program.SettingsJsonFile));
382388

389+
string FriendName = steamFriends.GetFriendPersonaName(FriendID);
390+
string nameClean = Regex.Replace(FriendName, "[^A-Za-z0-9 _]", "");
391+
392+
string FriendIDName = @"\[" + FriendID + "] - " + nameClean + ".txt";
393+
string pathLog = Settingslist.PathLogs + @"\" + steamClient.SteamID.ConvertToUInt64() + FriendIDName;
394+
383395

384-
string pathLog = Settingslist.PathLogs + @"\ChatLogs\" + steamClient.SteamID.ConvertToUInt64() + @"\[" + FriendID + "] - " + steamFriends.GetFriendPersonaName(FriendID) + ".txt";
385396
string FinalMsg = "[" + DateTime.Now + "] " + steamFriends.GetPersonaName() + ": " + Message;
397+
string[] files = Directory.GetFiles(Settingslist.PathLogs + @"\" + steamClient.SteamID.ConvertToUInt64(), "["+FriendID+"]*.txt");
386398

387-
if (File.Exists(pathLog))
399+
if (files.Length > 0)//file exist
388400
{
389-
string[] LastDate = File.ReadLines(pathLog).Last().Split(' '); LastDate[0] = LastDate[0].Substring(1);
390-
using (var tw = new StreamWriter(pathLog, true))
401+
string[] LastDate = File.ReadLines(files[0]).Last().Split(' '); LastDate[0] = LastDate[0].Substring(1);
402+
using (var tw = new StreamWriter(files[0], true))
391403
{
392-
393404
if (LastDate[0] != DateTime.Now.Date.ToShortDateString())
394405
{
395406
tw.WriteLine(Settingslist.Separator + "\n" + FinalMsg);

ChatLogger/App.config

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,33 @@
77
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
88
<dependentAssembly>
99
<assemblyIdentity name="protobuf-net" publicKeyToken="257b51d87d2e4d67" culture="neutral" />
10-
<bindingRedirect oldVersion="0.0.0.0-2.4.0.0" newVersion="2.4.0.0" />
10+
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
1111
</dependentAssembly>
1212
<dependentAssembly>
1313
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
1414
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
1515
</dependentAssembly>
1616
<probing privatePath="lib;libs" xmlns="" />
17+
<dependentAssembly>
18+
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
19+
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
20+
</dependentAssembly>
21+
<dependentAssembly>
22+
<assemblyIdentity name="Microsoft.Win32.Registry" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
23+
<bindingRedirect oldVersion="0.0.0.0-4.1.3.0" newVersion="4.1.3.0" />
24+
</dependentAssembly>
25+
<dependentAssembly>
26+
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
27+
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
28+
</dependentAssembly>
29+
<dependentAssembly>
30+
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
31+
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
32+
</dependentAssembly>
33+
<dependentAssembly>
34+
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
35+
<bindingRedirect oldVersion="0.0.0.0-1.2.5.0" newVersion="1.2.5.0" />
36+
</dependentAssembly>
1737
</assemblyBinding>
1838
</runtime>
1939
</configuration>

ChatLogger/ChatLogger.csproj

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,32 +60,57 @@
6060
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Fonts.dll</HintPath>
6161
<Private>True</Private>
6262
</Reference>
63-
<Reference Include="Microsoft.Win32.Registry, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
64-
<HintPath>..\packages\Microsoft.Win32.Registry.4.4.0\lib\net461\Microsoft.Win32.Registry.dll</HintPath>
63+
<Reference Include="Microsoft.Win32.Registry, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
64+
<HintPath>..\packages\Microsoft.Win32.Registry.4.7.0\lib\net461\Microsoft.Win32.Registry.dll</HintPath>
6565
<Private>True</Private>
6666
</Reference>
6767
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
68-
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
68+
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
6969
<Private>True</Private>
7070
</Reference>
71-
<Reference Include="protobuf-net, Version=2.4.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL">
72-
<HintPath>..\packages\protobuf-net.2.4.0\lib\net40\protobuf-net.dll</HintPath>
71+
<Reference Include="protobuf-net, Version=3.0.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL">
72+
<HintPath>..\packages\protobuf-net.3.0.0-alpha.133\lib\net461\protobuf-net.dll</HintPath>
7373
<Private>True</Private>
7474
</Reference>
75-
<Reference Include="SteamKit2, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
76-
<HintPath>..\packages\SteamKit2.2.1.0\lib\netstandard2.0\SteamKit2.dll</HintPath>
75+
<Reference Include="protobuf-net.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL">
76+
<HintPath>..\packages\protobuf-net.Core.3.0.0-alpha.133\lib\net461\protobuf-net.Core.dll</HintPath>
77+
<Private>True</Private>
78+
</Reference>
79+
<Reference Include="SteamKit2, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
80+
<HintPath>..\packages\SteamKit2.2.2.0\lib\netstandard2.0\SteamKit2.dll</HintPath>
7781
<Private>True</Private>
7882
</Reference>
7983
<Reference Include="System" />
84+
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
85+
<HintPath>..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
86+
<Private>True</Private>
87+
</Reference>
88+
<Reference Include="System.Collections.Immutable, Version=1.2.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
89+
<HintPath>..\packages\System.Collections.Immutable.1.7.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath>
90+
<Private>True</Private>
91+
</Reference>
8092
<Reference Include="System.Configuration" />
8193
<Reference Include="System.Core" />
94+
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
95+
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
96+
<Private>True</Private>
97+
</Reference>
98+
<Reference Include="System.Numerics" />
99+
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
100+
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
101+
<Private>True</Private>
102+
</Reference>
103+
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
104+
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.7.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
105+
<Private>True</Private>
106+
</Reference>
82107
<Reference Include="System.Runtime.Serialization" />
83-
<Reference Include="System.Security.AccessControl, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
84-
<HintPath>..\packages\System.Security.AccessControl.4.4.0\lib\net461\System.Security.AccessControl.dll</HintPath>
108+
<Reference Include="System.Security.AccessControl, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
109+
<HintPath>..\packages\System.Security.AccessControl.4.7.0\lib\net461\System.Security.AccessControl.dll</HintPath>
85110
<Private>True</Private>
86111
</Reference>
87-
<Reference Include="System.Security.Principal.Windows, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
88-
<HintPath>..\packages\System.Security.Principal.Windows.4.4.0\lib\net461\System.Security.Principal.Windows.dll</HintPath>
112+
<Reference Include="System.Security.Principal.Windows, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
113+
<HintPath>..\packages\System.Security.Principal.Windows.4.7.0\lib\net461\System.Security.Principal.Windows.dll</HintPath>
89114
<Private>True</Private>
90115
</Reference>
91116
<Reference Include="System.ServiceModel" />

ChatLogger/Main.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,6 @@ private void RafadexAutoUpdate600IQ()
5151
else
5252
{
5353
this.Enabled = true;
54-
var Settingslist = JsonConvert.DeserializeObject<ChatLoggerSettings>(File.ReadAllText(Program.SettingsJsonFile));
55-
56-
if (Settingslist.startupAcc != 0)
57-
{
58-
var list = JsonConvert.DeserializeObject<RootObject>(File.ReadAllText(Program.AccountsJsonFile));
59-
60-
foreach (var a in list.Accounts)
61-
{
62-
if (a.SteamID == Settingslist.startupAcc)
63-
{
64-
usernameJSON = a.username;
65-
passwordJSON = a.password;
66-
}
67-
}
68-
// Start Login
69-
Thread doLogin = new Thread(() => AccountLogin.UserSettingsGather(usernameJSON, passwordJSON));
70-
doLogin.Start();
71-
}
7254
}
7355
}
7456
}
@@ -116,10 +98,9 @@ public Main()
11698
private void Main_Shown(object sender, EventArgs e)
11799
{
118100
var Settingslist = JsonConvert.DeserializeObject<ChatLoggerSettings>(File.ReadAllText(Program.SettingsJsonFile));
119-
120-
101+
121102
DateTime now = DateTime.Now;
122-
var aa = Settingslist.LastTimeCheckedUpdate.Length == 0;
103+
123104
if (Settingslist.LastTimeCheckedUpdate == null || Settingslist.LastTimeCheckedUpdate.Length == 0)
124105
{
125106
Settingslist.LastTimeCheckedUpdate = now.ToString();
@@ -132,6 +113,25 @@ private void Main_Shown(object sender, EventArgs e)
132113
}
133114
File.WriteAllText(Program.SettingsJsonFile, JsonConvert.SerializeObject(Settingslist, Formatting.Indented));
134115

116+
117+
if (Settingslist.startupAcc != 0)
118+
{
119+
var list = JsonConvert.DeserializeObject<RootObject>(File.ReadAllText(Program.AccountsJsonFile));
120+
121+
foreach (var a in list.Accounts)
122+
{
123+
if (a.SteamID == Settingslist.startupAcc)
124+
{
125+
usernameJSON = a.username;
126+
passwordJSON = a.password;
127+
}
128+
}
129+
// Start Login
130+
Thread doLogin = new Thread(() => AccountLogin.UserSettingsGather(usernameJSON, passwordJSON));
131+
doLogin.Start();
132+
}
133+
134+
135135
System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
136136
t.Tick += new EventHandler(Trolha_Tick);
137137
t.Interval = 2000;

ChatLogger/packages.config

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@
33
<package id="Gameloop.Vdf" version="0.5.0" targetFramework="net461" />
44
<package id="Gameloop.Vdf.JsonConverter" version="0.2.0" targetFramework="net461" />
55
<package id="MetroModernUI" version="1.4.0.0" targetFramework="net45" />
6-
<package id="Microsoft.Win32.Registry" version="4.4.0" targetFramework="net461" />
7-
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net461" />
6+
<package id="Microsoft.Win32.Registry" version="4.7.0" targetFramework="net461" />
7+
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
88
<package id="PrettyBin" version="1.1.0" targetFramework="net461" />
9-
<package id="protobuf-net" version="2.4.0" targetFramework="net461" />
10-
<package id="SteamKit2" version="2.1.0" targetFramework="net461" />
11-
<package id="System.Security.AccessControl" version="4.4.0" targetFramework="net461" />
12-
<package id="System.Security.Principal.Windows" version="4.4.0" targetFramework="net461" />
9+
<package id="protobuf-net" version="3.0.0-alpha.133" targetFramework="net461" />
10+
<package id="protobuf-net.Core" version="3.0.0-alpha.133" targetFramework="net461" />
11+
<package id="SteamKit2" version="2.2.0" targetFramework="net461" />
12+
<package id="System.Buffers" version="4.5.0" targetFramework="net461" />
13+
<package id="System.Collections.Immutable" version="1.7.0" targetFramework="net461" />
14+
<package id="System.Memory" version="4.5.3" targetFramework="net461" />
15+
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
16+
<package id="System.Runtime.CompilerServices.Unsafe" version="4.7.0" targetFramework="net461" />
17+
<package id="System.Security.AccessControl" version="4.7.0" targetFramework="net461" />
18+
<package id="System.Security.Principal.Windows" version="4.7.0" targetFramework="net461" />
1319
<package id="Win32Interop.Gdi32" version="1.0.1" targetFramework="net461" />
1420
<package id="Win32Interop.User32" version="1.0.1" targetFramework="net461" />
1521
</packages>

0 commit comments

Comments
 (0)