|
|
|
@ -235,4 +235,59 @@ public partial class TabControlDemo : Window |
|
|
|
|
File.WriteAllText("./test.json", content); |
|
|
|
|
FileEncrypterDecrypter.EncryptFile("./test.json", filename, "000000"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void ImportButton_Click(object sender, RoutedEventArgs e) |
|
|
|
|
{ |
|
|
|
|
Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog(); |
|
|
|
|
openFileDialog.Filter = "Text files (*.enc)|*.enc|All files (*.*)|*.*"; |
|
|
|
|
string content = null; |
|
|
|
|
if (openFileDialog.ShowDialog() == true) |
|
|
|
|
{ |
|
|
|
|
string filename = openFileDialog.FileName; |
|
|
|
|
if (File.Exists(filename)) |
|
|
|
|
{ |
|
|
|
|
content = FileEncrypterDecrypter.DecryptFile(filename, "000000"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
JsonEntity info = JsonConvert.DeserializeObject<JsonEntity>(content); |
|
|
|
|
if (info != null) |
|
|
|
|
{ |
|
|
|
|
SHAPE_NAME.Text = info.SHAPE_NAME; |
|
|
|
|
SHAPE_EN_NAME.Text = info.SHAPE_EN_NAME; |
|
|
|
|
RULE_NAME.Text = info.RULE_NAME; |
|
|
|
|
RULE_EN_NAME.Text = info.RULE_EN_NAME; |
|
|
|
|
GradeContent.GradeList.ItemsSource = info.gradeInfos; |
|
|
|
|
GradeConfigContent.StandardList.ItemsSource = info.standardInfos; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void RULE_EN_NAME_TextChanged(object sender, TextChangedEventArgs e) |
|
|
|
|
{ |
|
|
|
|
string ShapeId = SHAPE_EN_NAME.Text.Replace(" ", "_").ToUpper(); |
|
|
|
|
string RuleId = RULE_EN_NAME.Text.Replace(" ", "_").ToUpper(); |
|
|
|
|
GradeIdP = ShapeId + RuleId; |
|
|
|
|
string oldGradeP = ""; |
|
|
|
|
List<GradeInfo> list = GradeContent.GradeList.ItemsSource as List<GradeInfo>; |
|
|
|
|
if (list != null) |
|
|
|
|
{ |
|
|
|
|
oldGradeP = list[0].GRADE_ID.Substring(0,list[0].GRADE_ID.Length-2); |
|
|
|
|
foreach (GradeInfo info in list) |
|
|
|
|
{ |
|
|
|
|
info.GRADE_ID = info.GRADE_ID.Replace(oldGradeP, GradeIdP); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
GradeContent.GradeList.ItemsSource = new List<GradeInfo>(); |
|
|
|
|
GradeContent.GradeList.ItemsSource = list; |
|
|
|
|
List<StandardInfo> standardInfoList = GradeConfigContent.StandardList.ItemsSource as List<StandardInfo>; |
|
|
|
|
if (standardInfoList != null) |
|
|
|
|
{ |
|
|
|
|
foreach (StandardInfo info in standardInfoList) |
|
|
|
|
{ |
|
|
|
|
info.GRADE_ID = info.GRADE_ID.Replace(oldGradeP, GradeIdP); |
|
|
|
|
info.STANDARD_ID = info.STANDARD_ID.Replace(oldGradeP, GradeIdP); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
GradeConfigContent.StandardList.ItemsSource = new List<StandardInfo>(); |
|
|
|
|
GradeConfigContent.StandardList.ItemsSource = standardInfoList; |
|
|
|
|
} |
|
|
|
|
} |