Skip to content

Commit

Permalink
Monakeyの保存機能の実装 #6
Browse files Browse the repository at this point in the history
  • Loading branch information
onihusube committed Apr 24, 2022
1 parent b7d2e2a commit 2e49b6b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions 2chAPIProxy/AppSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class AppSetting
String _WANPW = "testpw";
String _CESrcfilePath = "";
private string postFieldOrder = "FROM&mail&MESSAGE&bbs&key&time&submit";
private string monaKey = "00000000-0000-0000-0000-000000000000";

public bool change = false;

Expand Down Expand Up @@ -372,6 +373,11 @@ public bool AssumeReqBodyIsUTF8
set { assumeReqBodyIsUTF8 = value; change = true; }
}

public string Monakey
{
get => monaKey;
set { monaKey = value; change = true; }
}

public String CryptData(String data, bool encrypt = true)
{
Expand Down
2 changes: 1 addition & 1 deletion 2chAPIProxy/DatProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ private void ResPost(Session oSession, bool is2ch)
}

private string monakey = "00000000-0000-0000-0000-000000000000";
private string Monakey
public string Monakey
{
get => monakey;
set
Expand Down
7 changes: 7 additions & 0 deletions 2chAPIProxy/ViewModels/ViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ public void Init()
DatProxy.AddX2chUAHeader = AddX2chUAHeader;
DatProxy.AddMsToNonce = AddMsToNonce;
DatProxy.AssumeReqBodyIsUTF8 = AssumeReqBodyIsUTF8;
DatProxy.Monakey = Setting.Monakey;

//設定の適用、APIアクセスクラス
DatProxy.APIMediator.AppKey = this.Appkey;
Expand Down Expand Up @@ -366,6 +367,10 @@ public void BeforeShutdown()
}
catch (ArgumentException) { }
}

// Monakeyが更新されてたら保存
if (Setting.Monakey != DatProxy.Monakey) Setting.Monakey = DatProxy.Monakey;

if (Setting.change)
{
XmlSerializer xser = new XmlSerializer(typeof(AppSetting));
Expand Down Expand Up @@ -1313,6 +1318,8 @@ public RelayCommand<String> OnClick
}
}));
});
// Monakeyをリセット
DatProxy.ResetMonakey();
break;
case "UpdateSID":
DatProxy.UpdateAsync()
Expand Down

0 comments on commit 2e49b6b

Please sign in to comment.