|
|
@@ -25,7 +25,6 @@ namespace OTSPartA_STDEditor
|
|
|
public Language lan;
|
|
|
Hashtable table;
|
|
|
//是否做出过更改
|
|
|
- public bool IsModified { set; get; }
|
|
|
public static readonly string[] ColorGroup = { "#FFB6C1", "#FFC0CB", "#DC143C", "#FFF0F5", "#DB7093", "#FF69B4", "#FF1493", "#C71585", "#DA70D6", "#D8BFD8", "#DDA0DD", "#EE82EE", "#FF00FF", "#8B008B", "#800080", "#BA55D3", "#9400D3", "#9932CC", "#4B0082", "#8A2BE2", "#9370DB","#7B68EE", "#6A5ACD", "#483D8B", "#E6E6FA", "#F8F8FF", "#0000FF", "#0000CD", "#191970", "#00008B", "#000080", "#4169E1" , "#6495ED", "#B0C4DE", "#778899", "#708090", "#1E90FF", "#F0F8FF", "#00FFFF" };
|
|
|
public Form_Main()
|
|
|
{
|
|
|
@@ -54,18 +53,6 @@ namespace OTSPartA_STDEditor
|
|
|
{
|
|
|
InitForms(STDDBAddress);
|
|
|
this.Text = this.Text.Split(' ')[0] + " " + STDDBAddress;
|
|
|
- IsModified = false;
|
|
|
-
|
|
|
- //if (ImportArgs.Count > 1)
|
|
|
- //{
|
|
|
- // ImportStandardLibraryTypeSelection m_importStandardLibraryTypeSelection = new ImportStandardLibraryTypeSelection();
|
|
|
- // var result = m_importStandardLibraryTypeSelection.ShowDialog();
|
|
|
- // if (m_importStandardLibraryTypeSelection.SelectEvent == "expression")
|
|
|
- // {
|
|
|
- // int STDId = _sTDEditor.AddSTDDictionaryItem();
|
|
|
- // m_STDRuleslist.AddNewRow(STDId, "NewClassify", Attributes.colorHx16toRGB(ddata.Color));
|
|
|
- // }
|
|
|
- //}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -74,18 +61,6 @@ namespace OTSPartA_STDEditor
|
|
|
m_SubMidWindow.ChangeText_textbox_STDEditor(ddata);
|
|
|
m_Attributes.SetDatatoGrid_Attributes(ddata);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
private void rbBackup_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
if (m_STDRuleslist.treeView_G.SelectedNode != null && m_STDRuleslist.treeView_G.SelectedNode.Level == 1)
|
|
|
@@ -106,6 +81,13 @@ namespace OTSPartA_STDEditor
|
|
|
saveFile.OverwritePrompt = false; //是否覆盖当前文件
|
|
|
if (saveFile.ShowDialog() == DialogResult.OK)
|
|
|
{
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if (STDDBAddress == saveFile.FileName)
|
|
|
{
|
|
|
MessageBox.Show("Cannot save as same name!", "Tip");
|
|
|
@@ -114,16 +96,23 @@ namespace OTSPartA_STDEditor
|
|
|
FormForWaiting forWaiting = new FormForWaiting();
|
|
|
forWaiting.Show();
|
|
|
this.Refresh();
|
|
|
- System.IO.File.Copy(STDDBAddress, saveFile.FileName, true);
|
|
|
- bool result = _sTDEditor.SaveAsDictionaryToClassify(saveFile.FileName);
|
|
|
- if (result)
|
|
|
+ if (Ruleformatcheck())
|
|
|
{
|
|
|
- _sTDEditor.UpdateSTDDictionaryInitial();
|
|
|
- STDDBAddress = saveFile.FileName;
|
|
|
- this.Text = this.Text.Split(' ')[0] + " " + saveFile.FileName;
|
|
|
- IsModified = false;
|
|
|
- forWaiting.Close();
|
|
|
- MessageBox.Show("Save successful!", "Tip");
|
|
|
+ System.IO.File.Copy(STDDBAddress, saveFile.FileName, true);
|
|
|
+ bool result = _sTDEditor.SaveAsDictionaryToClassify(saveFile.FileName);
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ _sTDEditor.UpdateSTDDictionaryInitial();
|
|
|
+ STDDBAddress = saveFile.FileName;
|
|
|
+ this.Text = this.Text.Split(' ')[0] + " " + saveFile.FileName;
|
|
|
+ forWaiting.Close();
|
|
|
+ MessageBox.Show("Save successful!", "Tip");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ forWaiting.Close();
|
|
|
+ MessageBox.Show("Save failed!", "Tip");
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -142,10 +131,6 @@ namespace OTSPartA_STDEditor
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
private void rbSave_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
if (m_STDRuleslist.treeView_G.SelectedNode != null && m_STDRuleslist.treeView_G.SelectedNode.Level == 1)
|
|
|
@@ -157,30 +142,7 @@ namespace OTSPartA_STDEditor
|
|
|
}
|
|
|
}
|
|
|
m_STDRuleslist.ConvertToRuleViewDic();
|
|
|
- if (Ruleformatcheck())
|
|
|
- {
|
|
|
- FormForWaiting forWaiting = new FormForWaiting();
|
|
|
- forWaiting.Show();
|
|
|
-
|
|
|
- this.Refresh();
|
|
|
- bool result = _sTDEditor.SaveDictionaryToClassify();
|
|
|
- if (result)
|
|
|
- {
|
|
|
- _sTDEditor.UpdateSTDDictionaryInitial();
|
|
|
- forWaiting.Close();
|
|
|
- IsModified = false;
|
|
|
- MessageBox.Show("Save successful!", "Tip");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- forWaiting.Close();
|
|
|
- MessageBox.Show("Save failed!", "Tip");
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
+ Save();
|
|
|
}
|
|
|
bool Ruleformatcheck()
|
|
|
{
|
|
|
@@ -210,6 +172,48 @@ namespace OTSPartA_STDEditor
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public bool Save()
|
|
|
+ {
|
|
|
+ if (Ruleformatcheck())
|
|
|
+ {
|
|
|
+ FormForWaiting forWaiting = new FormForWaiting();
|
|
|
+ forWaiting.Show();
|
|
|
+ this.Refresh();
|
|
|
+ bool result = _sTDEditor.SaveDictionaryToClassify();
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ _sTDEditor.UpdateSTDDictionaryInitial();
|
|
|
+ MessageBox.Show("Save successful!", "Tip");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MessageBox.Show("Save failed!", "Tip");
|
|
|
+ }
|
|
|
+ forWaiting.Close();
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
/// <summary>
|
|
|
/// [颜色:RGB转成16进制]
|
|
|
/// </summary>
|
|
|
@@ -469,6 +473,7 @@ namespace OTSPartA_STDEditor
|
|
|
ddata.SubElementList = sSubElements;
|
|
|
|
|
|
//ddata.ListNum = "0";
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -610,48 +615,30 @@ namespace OTSPartA_STDEditor
|
|
|
}
|
|
|
private void rbClose_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
+ bool expressionright = true;
|
|
|
if (!_sTDEditor.Isoldversion)
|
|
|
{
|
|
|
- if (!EqualsBetweenDictionary() || IsModified)
|
|
|
+ if (!EqualsBetweenDictionary())
|
|
|
{
|
|
|
DialogResult dr = MessageBox.Show("Whether to save the current modification?", "Tip", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
|
|
if (dr == DialogResult.Yes)
|
|
|
{
|
|
|
- if (m_STDRuleslist.Predata != null)
|
|
|
- {
|
|
|
- int id = m_STDRuleslist.Predata.STDId;
|
|
|
- SaveDataOfSelRule(id);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- FormForWaiting forWaiting = new FormForWaiting();
|
|
|
- forWaiting.Show();
|
|
|
-
|
|
|
-
|
|
|
- bool result = _sTDEditor.SaveDictionaryToClassify();
|
|
|
- if (result)
|
|
|
- {
|
|
|
- forWaiting.Close();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- forWaiting.Close();
|
|
|
- MessageBox.Show("Save failed!", "Tip");
|
|
|
+ expressionright = Save();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- m_Attributes.Close();
|
|
|
- m_STDRuleslist.Close();
|
|
|
- m_SubMidWindow.m_STDEditor.Close();
|
|
|
- m_SubMidWindow.m_ComparativeLibrary.Close();
|
|
|
- m_SubMidWindow.Close();
|
|
|
- ButtonStatusClose();
|
|
|
- if (this.Text.Split(' ').Count() != 0)
|
|
|
+ if (expressionright)
|
|
|
{
|
|
|
- this.Text = this.Text.Split(' ')[0];
|
|
|
+ m_Attributes.Close();
|
|
|
+ m_STDRuleslist.Close();
|
|
|
+ m_SubMidWindow.m_STDEditor.Close();
|
|
|
+ m_SubMidWindow.m_ComparativeLibrary.Close();
|
|
|
+ m_SubMidWindow.Close();
|
|
|
+ ButtonStatusClose();
|
|
|
+ if (this.Text.Split(' ').Count() != 0)
|
|
|
+ {
|
|
|
+ this.Text = this.Text.Split(' ')[0];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -669,7 +656,6 @@ namespace OTSPartA_STDEditor
|
|
|
STDDBAddress = openFileDialog.FileName;
|
|
|
InitForms(STDDBAddress);
|
|
|
this.Text = this.Text.Split(' ')[0] + " " + STDDBAddress;
|
|
|
- IsModified = false;
|
|
|
CheckAccuracyofZeroRules();
|
|
|
}
|
|
|
catch(Exception ex)
|
|
|
@@ -744,37 +730,34 @@ namespace OTSPartA_STDEditor
|
|
|
}
|
|
|
if (m_STDRuleslist.Text != "")
|
|
|
{
|
|
|
- if (!EqualsBetweenDictionary() || IsModified)
|
|
|
+ bool expressionright = true;
|
|
|
+ if (!EqualsBetweenDictionary())
|
|
|
{
|
|
|
DialogResult dr = MessageBox.Show("Whether to save the current modification", "Tip", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
|
|
if (dr == DialogResult.Yes)
|
|
|
{
|
|
|
- if (m_STDRuleslist.Predata!=null)
|
|
|
- {
|
|
|
- int id = m_STDRuleslist.Predata.STDId;
|
|
|
- SaveDataOfSelRule(id);
|
|
|
- }
|
|
|
- FormForWaiting forWaiting = new FormForWaiting();
|
|
|
- forWaiting.Show();
|
|
|
- bool result = _sTDEditor.SaveDictionaryToClassify();
|
|
|
- if (result)
|
|
|
- {
|
|
|
- forWaiting.Close();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- forWaiting.Close();
|
|
|
- MessageBox.Show("Save failed!", "Tip");
|
|
|
- }
|
|
|
+ expressionright = Save();
|
|
|
+
|
|
|
+
|
|
|
+ if (!expressionright)
|
|
|
+ { e.Cancel = true; return; }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
bool EqualsBetweenDictionary()
|
|
|
{
|
|
|
+ if (m_STDRuleslist.treeView_G.SelectedNode != null && m_STDRuleslist.treeView_G.SelectedNode.Level == 1)
|
|
|
+ {
|
|
|
+ STDdata sTDdata = (STDdata)m_STDRuleslist.treeView_G.SelectedNode.Tag;
|
|
|
+ if (sTDdata != null)
|
|
|
+ {
|
|
|
+ SaveDataOfSelRule(sTDdata.STDId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ m_STDRuleslist.ConvertToRuleViewDic();
|
|
|
return _sTDEditor.EqualsBetweenDictionary();
|
|
|
}
|
|
|
-
|
|
|
private void rbNew_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
SaveFileDialog saveFile = new SaveFileDialog();
|
|
|
@@ -814,7 +797,6 @@ namespace OTSPartA_STDEditor
|
|
|
STDDBAddress = saveFile.FileName;
|
|
|
InitForms(STDDBAddress);
|
|
|
this.Text = this.Text.Split(' ')[0] + " " + STDDBAddress;
|
|
|
- IsModified = false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -840,6 +822,8 @@ namespace OTSPartA_STDEditor
|
|
|
|
|
|
cmm.CommandText = "CREATE TABLE sqlitestudio_temp_table AS SELECT * FROM ZeroElementRules";
|
|
|
cmm.ExecuteNonQuery();
|
|
|
+
|
|
|
+
|
|
|
cmm.CommandText = "DROP TABLE ZeroElementRules";
|
|
|
cmm.ExecuteNonQuery();
|
|
|
cmm.CommandText = "CREATE TABLE ZeroElementRules (ZeroElement TEXT,UsingElementList TEXT,UsingImgPropertyList TEXT,UsingOtherPropertyList TEXT,Expression TEXT)";
|