Skip to content

Commit ebb8f83

Browse files
committed
new update 1.0.2
1 parent fcea8e6 commit ebb8f83

26 files changed

+513
-164
lines changed

ChatLogger/AccountLogin.cs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using ChatLogger.User2Json;
1+
using ChatLogger.Helpers;
2+
using ChatLogger.User2Json;
23
using ChatLogger.UserSettings;
34
using Newtonsoft.Json;
45
using SteamKit2;
@@ -16,6 +17,7 @@ namespace ChatLogger
1617
public class AccountLogin
1718
{
1819
public static string UserPersonaName, UserCountry, CurrentUsername;
20+
public static int CurrentPersonaState = 1;
1921

2022
public static SteamClient steamClient;
2123
public static SteamUser steamUser;
@@ -173,7 +175,7 @@ static void OnLoggedOn(SteamUser.LoggedOnCallback callback)
173175

174176
if (is2FA)
175177
{
176-
SteamGuard SteamGuard = new SteamGuard("Phone",user);
178+
SteamGuard SteamGuard = new SteamGuard("Phone", user);
177179
SteamGuard.ShowDialog();
178180

179181
bool UserInputCode = true;
@@ -251,15 +253,23 @@ static void OnLoggedOn(SteamUser.LoggedOnCallback callback)
251253
UserCountry = callback.IPCountryCode;
252254

253255
IsLoggedIn = true;
254-
255-
steamFriends.SetPersonaState(EPersonaState.Online);
256-
256+
var ListUserSettings = JsonConvert.DeserializeObject<RootObject>(File.ReadAllText(Program.AccountsJsonFile));
257+
foreach (var a in ListUserSettings.Accounts)
258+
{
259+
if (a.username == user)
260+
{
261+
steamFriends.SetPersonaState(Extensions.statesList[a.LoginState]);
262+
a.LastLoginTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString();
263+
CurrentPersonaState = a.LoginState;
264+
}
265+
}
266+
File.WriteAllText(Program.AccountsJsonFile, JsonConvert.SerializeObject(ListUserSettings, Formatting.Indented));
257267
}
258268

259269
static void OnDisconnected(SteamClient.DisconnectedCallback callback)
260270
{
261271
DisconnectedCounter++;
262-
272+
CurrentPersonaState = 0;
263273
if (isRunning)
264274
{
265275
if (DisconnectedCounter >= MaxDisconnects)
@@ -275,7 +285,7 @@ static void OnDisconnected(SteamClient.DisconnectedCallback callback)
275285

276286
steamClient.Connect();
277287
}
278-
288+
279289
static void OnLoginKey(SteamUser.LoginKeyCallback callback)
280290
{
281291
myUniqueId = callback.UniqueID.ToString();
@@ -304,6 +314,7 @@ static void OnLoginKey(SteamUser.LoginKeyCallback callback)
304314
static void OnLoggedOff(SteamUser.LoggedOffCallback callback)
305315
{
306316
IsLoggedIn = false;
317+
CurrentPersonaState = 0;
307318
Console.WriteLine("[" + Program.BOTNAME + "] - Logged off of Steam: {0}", callback.Result);
308319
InfoForm.InfoHelper.CustomMessageBox.Show("Error", "Logged off of Steam:" + callback.Result);
309320
}
@@ -325,7 +336,7 @@ static void OnAccountInfo(SteamUser.AccountInfoCallback callback)
325336
UserPersonaName = callback.PersonaName;
326337
UserCountry = callback.Country;
327338
}
328-
339+
329340
static void OnFriendMsg(SteamFriends.FriendMsgCallback callback)
330341
{
331342
if (callback.EntryType == EChatEntryType.ChatMsg)
@@ -335,7 +346,7 @@ static void OnFriendMsg(SteamFriends.FriendMsgCallback callback)
335346
string Message = callback.Message; Message = Regex.Replace(Message, @"\t|\n|\r", ""); //741iq
336347

337348
var Settingslist = JsonConvert.DeserializeObject<ChatLoggerSettings>(File.ReadAllText(Program.SettingsJsonFile));
338-
349+
339350
string pathLog = Settingslist.PathLogs + @"\ChatLogs\" + steamClient.SteamID.ConvertToUInt64() + @"\[" + FriendID + "] - " + steamFriends.GetFriendPersonaName(FriendID) + ".txt";
340351

341352

@@ -428,6 +439,7 @@ public static void Logout()
428439
IsLoggedIn = false;
429440
steamUser.LogOff();
430441
DisconnectedCounter = 0;
442+
CurrentPersonaState = 0;
431443
CurrentUsername = null;
432444
}
433445

ChatLogger/AddAcc.Designer.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ChatLogger/AddAcc.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using System.Windows.Forms;
1313
using System.IO;
1414
using ChatLogger.Helpers;
15+
using Win32Interop.Methods;
1516

1617
namespace ChatLogger
1718
{
@@ -22,7 +23,12 @@ public AddAcc()
2223
InitializeComponent(); this.Activate();
2324
this.components.SetStyle(this);
2425
this.FormBorderStyle = FormBorderStyle.None;
25-
Region = System.Drawing.Region.FromHrgn(Helpers.Extensions.CreateRoundRectRgn(0, 0, Width, Height, 5, 5));
26+
Region = System.Drawing.Region.FromHrgn(Gdi32.CreateRoundRectRgn(0, 0, Width, Height, 5, 5));
27+
28+
IntPtr ptr = Gdi32.CreateRoundRectRgn(1, 1, btn_addAcc.Width, btn_addAcc.Height, 5, 5);
29+
btn_addAcc.Region = Region.FromHrgn(ptr);
30+
Gdi32.DeleteObject(ptr);
31+
2632
}
2733
private void btn_addAcc_Click(object sender, EventArgs e)
2834
{
@@ -47,6 +53,7 @@ public void AddAccJson(string user, string password)
4753

4854
list.Accounts.Add(new UserAccounts
4955
{
56+
LoginState = 1,
5057
username = user,
5158
password = password,
5259
LoginKey = "0",

ChatLogger/ChatLogger.csproj

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<Private>True</Private>
7474
</Reference>
7575
<Reference Include="SteamKit2, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
76-
<HintPath>..\packages\SteamKit2.2.2.0-Beta.1\lib\netstandard2.0\SteamKit2.dll</HintPath>
76+
<HintPath>..\packages\SteamKit2.2.1.0\lib\netstandard2.0\SteamKit2.dll</HintPath>
7777
<Private>True</Private>
7878
</Reference>
7979
<Reference Include="System" />
@@ -97,6 +97,14 @@
9797
<Reference Include="System.Net.Http" />
9898
<Reference Include="System.Windows.Forms" />
9999
<Reference Include="System.Xml" />
100+
<Reference Include="Win32Interop.Gdi32, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
101+
<HintPath>..\packages\Win32Interop.Gdi32.1.0.1\lib\Win32Interop.Gdi32.dll</HintPath>
102+
<Private>True</Private>
103+
</Reference>
104+
<Reference Include="Win32Interop.User32, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
105+
<HintPath>..\packages\Win32Interop.User32.1.0.1\lib\Win32Interop.User32.dll</HintPath>
106+
<Private>True</Private>
107+
</Reference>
100108
</ItemGroup>
101109
<ItemGroup>
102110
<Compile Include="AccountLogin.cs" />
@@ -189,9 +197,6 @@
189197
<ItemGroup>
190198
<None Include="Resources\ChatLogger_Alert.wav" />
191199
</ItemGroup>
192-
<ItemGroup>
193-
<None Include="Resources\notloggedFlag.png" />
194-
</ItemGroup>
195200
<ItemGroup>
196201
<Content Include="ChatLogger_Logo.ico" />
197202
<None Include="Resources\ChatLogger_Success.wav" />

ChatLogger/EditAcc.Designer.cs

Lines changed: 86 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)