@@ -29,12 +29,70 @@ public partial class Main : MetroFramework.Forms.MetroForm
2929 public static string SelectedUser = "" ;
3030 private static List < SteamLoginUsers > _users ;
3131
32+ [ Obsolete ]
33+ private void RafadexAutoUpdate601IQ ( )
34+ {
35+ try
36+ {
37+ ServicePointManager . SecurityProtocol = SecurityProtocolType . Tls12 ;
38+ using ( WebClient client = new WebClient ( ) )
39+ {
40+ client . Headers . Add ( "User-Agent" , "Steam ChatLog" ) ;
41+
42+
43+ Uri uri = new Uri ( Program . GITHUB_PROJECT ) ;
44+ string releases = client . DownloadString ( uri ) ;
45+ var git = JsonConvert . DeserializeObject < List < GitHubApi . GithubRelease > > ( releases ) ;
46+ foreach ( var g in git )
47+ {
48+ if ( g . tag_name != Program . Version )
49+ {
50+ this . Hide ( ) ;
51+ this . Enabled = false ;
52+ Console . WriteLine ( "New update: " + g . tag_name ) ;
53+ Form Update = new Update ( g . tag_name ) ;
54+ Update . Show ( ) ;
55+
56+ }
57+ else
58+ {
59+ this . Enabled = true ;
60+ var Settingslist = JsonConvert . DeserializeObject < ChatLoggerSettings > ( File . ReadAllText ( Program . SettingsJsonFile ) ) ;
61+
62+ if ( Settingslist . startupAcc != 0 )
63+ {
64+ var list = JsonConvert . DeserializeObject < RootObject > ( File . ReadAllText ( Program . AccountsJsonFile ) ) ;
65+
66+ foreach ( var a in list . Accounts )
67+ {
68+ if ( a . SteamID == Settingslist . startupAcc )
69+ {
70+ usernameJSON = a . username ;
71+ passwordJSON = a . password ;
72+ }
73+ }
74+ // Start Login
75+ Thread doLogin = new Thread ( ( ) => AccountLogin . UserSettingsGather ( usernameJSON , passwordJSON ) ) ;
76+ doLogin . Start ( ) ;
77+ }
78+ }
79+ }
80+ }
81+ }
82+ catch ( Exception tete )
83+ {
84+ InfoForm . InfoHelper . CustomMessageBox . Show ( "Alert" , "Try https://github.com/sp0ok3r/ChatLogger" ) ;
85+ }
86+ }
87+
88+
89+
90+
3291 public Main ( )
3392 {
3493 InitializeComponent ( ) ;
3594 metroTabControl . SelectedTab = metroTab_AddAcc ;
3695 this . components . SetStyle ( this ) ;
37-
3896 Region = System . Drawing . Region . FromHrgn ( Helpers . Extensions . CreateRoundRectRgn ( 0 , 0 , Width , Height , 5 , 5 ) ) ;
3997
4098 lbl_connecting . Visible = false ;
@@ -48,13 +106,14 @@ public Main()
48106
49107 private void Main_Shown ( object sender , EventArgs e )
50108 {
109+ RafadexAutoUpdate601IQ ( ) ;
51110 System . Windows . Forms . Timer t = new System . Windows . Forms . Timer ( ) ;
52111 t . Tick += new EventHandler ( Trolha_Tick ) ;
53112 t . Interval = 2000 ;
54113 t . Start ( ) ;
55114
56115 var Settingslist = JsonConvert . DeserializeObject < ChatLoggerSettings > ( File . ReadAllText ( Program . SettingsJsonFile ) ) ;
57-
116+
58117 combox_Colors . SelectedIndex = Settingslist . startupColor ;
59118
60119 if ( Settingslist . Separator . Length > 0 )
@@ -65,7 +124,8 @@ private void Main_Shown(object sender, EventArgs e)
65124 if ( Settingslist . PathLogs . Length > 0 )
66125 {
67126 txtBox_logDir . Text = Settingslist . PathLogs . Replace ( @"\\" , @"\" ) ;
68- } else
127+ }
128+ else
69129 {
70130 Settingslist . PathLogs = Program . ChatLogsFolder ;
71131 txtBox_logDir . Text = Program . ChatLogsFolder ;
@@ -76,15 +136,19 @@ private void Main_Shown(object sender, EventArgs e)
76136 if ( Settingslist . startup )
77137 {
78138 toggle_startWindows . Checked = true ;
79- } else {
139+ }
140+ else
141+ {
80142 toggle_startWindows . Checked = false ;
81143 }
82144
83145 if ( Settingslist . startMinimized )
84146 {
85147 chck_Minimized . Checked = true ;
86148 this . WindowState = FormWindowState . Minimized ;
87- } else {
149+ }
150+ else
151+ {
88152 chck_Minimized . Checked = false ;
89153 this . WindowState = FormWindowState . Normal ;
90154 }
@@ -94,7 +158,7 @@ private void Main_Shown(object sender, EventArgs e)
94158 toggle_playSound . Checked = true ;
95159 Stream str = Properties . Resources . ChatLogger_Success ;
96160 SoundPlayer snd = new SoundPlayer ( str ) ;
97- snd . Play ( ) ;
161+ snd . Play ( ) ;
98162 }
99163 else { toggle_playSound . Checked = false ; }
100164 }
@@ -300,14 +364,19 @@ private void Trolha_Tick(object sender, EventArgs e)
300364 panel_steamStates . Visible = true ;
301365 picBox_SteamAvatar . Visible = true ;
302366
303- byte [ ] data = new WebClient ( ) . DownloadData ( "https://www.countryflags.io/" + AccountLogin . UserCountry + "/flat/16.png" ) ;
304- MemoryStream ms = new MemoryStream ( data ) ;
305- btnLabel_PersonaAndFlag . Image = Image . FromStream ( ms ) ;
367+ if ( picBox_SteamAvatar . Image == null && btnLabel_PersonaAndFlag . Image == null )
368+ {
369+ picBox_SteamAvatar . ImageLocation = AccountLogin . GetAvatarLink ( AccountLogin . CurrentSteamID ) ;
370+
371+ byte [ ] data = new WebClient ( ) . DownloadData ( "https://www.countryflags.io/" + AccountLogin . UserCountry + "/flat/16.png" ) ;
372+
373+ MemoryStream ms = new MemoryStream ( data ) ;
374+ btnLabel_PersonaAndFlag . Image = Image . FromStream ( ms ) ;
375+ }
306376
307377 btnLabel_PersonaAndFlag . Invoke ( new Action ( ( ) => btnLabel_PersonaAndFlag . Text = AccountLogin . UserPersonaName ) ) ;
308378
309379 panel_steamStates . BackColor = Color . LightSkyBlue ;
310- picBox_SteamAvatar . ImageLocation = AccountLogin . GetAvatarLink ( AccountLogin . CurrentSteamID ) ;
311380 lbl_currentUsername . Invoke ( new Action ( ( ) => lbl_currentUsername . Text = AccountLogin . CurrentUsername ) ) ;
312381 }
313382 else
@@ -321,7 +390,7 @@ private void Trolha_Tick(object sender, EventArgs e)
321390
322391
323392 btn_login2selected . Enabled = true ;
324- btnLabel_PersonaAndFlag . Image = Properties . Resources . notloggedFlag ;
393+ // btnLabel_PersonaAndFlag.Image = Properties.Resources.notloggedFlag;
325394 btnLabel_PersonaAndFlag . Invoke ( new Action ( ( ) => btnLabel_PersonaAndFlag . Text = "None" ) ) ;
326395
327396
@@ -451,8 +520,8 @@ private void btn_setpathLogs_Click(object sender, EventArgs e)
451520 if ( result == DialogResult . OK && ! string . IsNullOrWhiteSpace ( fbd . SelectedPath ) )
452521 {
453522 var Settingslist = JsonConvert . DeserializeObject < ChatLoggerSettings > ( File . ReadAllText ( Program . SettingsJsonFile ) ) ;
454-
455- Settingslist . PathLogs = fbd . SelectedPath ;
523+
524+ Settingslist . PathLogs = fbd . SelectedPath ;
456525 txtBox_logDir . Text = fbd . SelectedPath ;
457526 File . WriteAllText ( Program . SettingsJsonFile , JsonConvert . SerializeObject ( Settingslist , new JsonSerializerSettings { Formatting = Formatting . Indented } ) ) ;
458527 }
@@ -483,7 +552,4 @@ private void pictureBox1_Click(object sender, EventArgs e)
483552 Process . Start ( "https://github.com/sp0ok3r/ChatLogger" ) ;
484553 }
485554 }
486- }
487-
488-
489- //.Replace(@"\\", @"\");
555+ }
0 commit comments