-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
85 changed files
with
2,654 additions
and
473 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" /> | ||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
{ | ||
"authConfig": "Configs/AuthConfig.json", | ||
"authConfig": "Configs/AuthConfig.json", | ||
"instanceManagerConfig": "Configs/InstanceManagerConfig.json", | ||
"fileRepositoryConfig": "Configs/FileRepositoryConfig.json", | ||
"updateManagerConfig": "Configs/UpdaterConifg.json" | ||
"updateManagerConfig": "Configs/UpdaterConifg.json", | ||
"javaSearchPaths": [ | ||
"C:\\Program Files\\Java\\", | ||
"C:\\Program Files (x86)\\Java\\", | ||
"D:\\Program Files\\Java\\", | ||
"D:\\Program Files (x86)\\Java\\", | ||
"Java\\" | ||
|
||
], | ||
"loginPerserveFilePath": "Login.bin" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 46 additions & 7 deletions
53
Core/Handlers/LoginHandlers/LoginWindowVisibilityChangedHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,66 @@ | ||
using System; | ||
using System.IO; | ||
using System.Text; | ||
using System.Windows; | ||
using TerminologyLauncher.Entities.Account; | ||
using TerminologyLauncher.Entities.SerializeUtils; | ||
using TerminologyLauncher.GUI; | ||
using TerminologyLauncher.Logging; | ||
using TerminologyLauncher.Utils; | ||
|
||
namespace TerminologyLauncher.Core.Handlers.LoginHandlers | ||
{ | ||
public class LoginWindowVisibilityChangedHandler : HandlerBase | ||
{ | ||
|
||
public LoginWindowVisibilityChangedHandler(Engine engine) | ||
: base(engine) | ||
{ | ||
this.Engine.UiControl.LoginWindow.IsVisibleChanged += this.HandleEvent; | ||
} | ||
public void HandleEvent(Object sender, DependencyPropertyChangedEventArgs e) | ||
{ | ||
var window = sender as Window; | ||
var window = sender as LoginWindow; | ||
Logger.GetLogger().InfoFormat("Login window is going to {0}!", window.Visibility); | ||
switch (window.Visibility) | ||
{ | ||
case Visibility.Hidden: | ||
{ | ||
if (window.IsPerservePassword) | ||
{ | ||
|
||
var bin = | ||
Encoding.ASCII.GetBytes( | ||
EncodeUtils.Base64Encode(JsonConverter.ConvertToJson(window.GetLogin()))); | ||
File.WriteAllBytes(this.Engine.CoreConfig.GetConfig("loginPerserveFilePath"), bin); | ||
|
||
} | ||
else | ||
{ | ||
if (File.Exists(this.Engine.CoreConfig.GetConfig("loginPerserveFilePath"))) | ||
{ | ||
File.Delete(this.Engine.CoreConfig.GetConfig("loginPerserveFilePath")); | ||
} | ||
} | ||
break; | ||
} | ||
case Visibility.Visible: | ||
{ | ||
if (File.Exists(this.Engine.CoreConfig.GetConfig("loginPerserveFilePath"))) | ||
{ | ||
|
||
var bin = File.ReadAllBytes(this.Engine.CoreConfig.GetConfig("loginPerserveFilePath")); | ||
var login = JsonConverter.Parse<LoginEntity>(EncodeUtils.Base64Decode(Encoding.ASCII.GetString(bin))); | ||
window.SetLogin(login); | ||
} | ||
break; | ||
} | ||
} | ||
} | ||
|
||
public override void HandleEvent(object sender, EventArgs e) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public LoginWindowVisibilityChangedHandler(Engine engine) | ||
: base(engine) | ||
{ | ||
this.Engine.UiControl.LoginWindow.IsVisibleChanged += this.HandleEvent; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.