private void SaveRecord() { if (this.record == null) { this.record = new IOS_APNSRecord(); } this.record.CertificateFilePath = this.certFilePathTextBox.Text; this.record.CertificatePassword = this.certPwdTextBox.Text; this.record.ServerMode = this.productionRadioButton.IsChecked ?? false; List <string> tokens = new List <string>(); foreach (var obj in this.tokenListView.Items) { TokenItem item = (TokenItem)obj; tokens.Add(item.Token); } this.record.DeviceTokens = tokens; string json = this.record.SerializeToJson(); string path = System.IO.Path.Combine(AppProperties.AppPath, RECORD_NAME); File.WriteAllText(path, json); }
public IOS_APNSWindow() { InitializeComponent(); string path = System.IO.Path.Combine(AppProperties.AppPath, RECORD_NAME); if (File.Exists(path)) { // load last record try { this.record = Xattacker.Utility.Json.JsonUtility.DeserializeFromJson <IOS_APNSRecord>(File.ReadAllText(path)); this.certFilePathTextBox.Text = this.record.CertificateFilePath; this.certPwdTextBox.Text = this.record.CertificatePassword; if (this.record.ServerMode) { this.productionRadioButton.IsChecked = true; } else { this.sandboxRadioButton.IsChecked = true; } if (this.record.DeviceTokens != null) { foreach (string token in this.record.DeviceTokens) { TokenItem item = new TokenItem(); item.Token = token; this.tokenListView.Items.Add(item); } } } catch { } } }