Dont save nonexisting fields in json-files
This commit is contained in:
@ -215,6 +215,8 @@ namespace CobXmlSupport
|
|||||||
Cc = new codeCompleter(cmbLastFile.Text, txtPrefix.Text);
|
Cc = new codeCompleter(cmbLastFile.Text, txtPrefix.Text);
|
||||||
Cc.TryFill_In_Dic();
|
Cc.TryFill_In_Dic();
|
||||||
Cc.TryFill_Out_Dic();
|
Cc.TryFill_Out_Dic();
|
||||||
|
Dictionary<string, int> FieldList = new Dictionary<string, int>();
|
||||||
|
int objNr = 0;
|
||||||
string fieldInCompl = "", fieldOutCompl = "";
|
string fieldInCompl = "", fieldOutCompl = "";
|
||||||
|
|
||||||
foreach (CobRow rw in rowList)
|
foreach (CobRow rw in rowList)
|
||||||
@ -258,6 +260,7 @@ namespace CobXmlSupport
|
|||||||
}
|
}
|
||||||
if (rw.Move_FromCode == null) { rw.MoveFromCode = " "; }
|
if (rw.Move_FromCode == null) { rw.MoveFromCode = " "; }
|
||||||
Cc.WorkDicOut[rw.FieldName] = rw.Move_FromCode;
|
Cc.WorkDicOut[rw.FieldName] = rw.Move_FromCode;
|
||||||
|
FieldList.Add(rw.FieldName,objNr++);
|
||||||
}
|
}
|
||||||
// Prefill with possibly filled out code
|
// Prefill with possibly filled out code
|
||||||
if (chkWrap.Checked)
|
if (chkWrap.Checked)
|
||||||
@ -272,7 +275,35 @@ namespace CobXmlSupport
|
|||||||
//Debug.WriteLine(rw.TagName);
|
//Debug.WriteLine(rw.TagName);
|
||||||
//Debug.WriteLine(rw.Hirarchy);
|
//Debug.WriteLine(rw.Hirarchy);
|
||||||
}
|
}
|
||||||
|
string[] jkeys = Cc.WorkDicIn.Keys.ToArray();
|
||||||
|
foreach (string jkey in jkeys)
|
||||||
|
{
|
||||||
|
int item;
|
||||||
|
if (!FieldList.TryGetValue(jkey,out item))
|
||||||
|
{
|
||||||
|
string checktxt = "";
|
||||||
|
Cc.WorkDicIn.TryGetValue(jkey, out checktxt);
|
||||||
|
if (checktxt.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
Cc.WorkDicIn.Remove(jkey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Cc.Save_In_Dic();
|
Cc.Save_In_Dic();
|
||||||
|
string[] jkeysOut = Cc.WorkDicOut.Keys.ToArray();
|
||||||
|
foreach (string jkey in jkeysOut)
|
||||||
|
{
|
||||||
|
int item;
|
||||||
|
if (!FieldList.TryGetValue(jkey, out item))
|
||||||
|
{
|
||||||
|
string checktxt = "";
|
||||||
|
Cc.WorkDicOut.TryGetValue(jkey, out checktxt);
|
||||||
|
if (checktxt.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
Cc.WorkDicOut.Remove(jkey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Cc.Save_Out_Dic();
|
Cc.Save_Out_Dic();
|
||||||
|
|
||||||
if (rowList.Count > 0)
|
if (rowList.Count > 0)
|
||||||
|
|||||||
@ -24,6 +24,8 @@ namespace CobXmlSupport
|
|||||||
|
|
||||||
public codeCompleter()
|
public codeCompleter()
|
||||||
{
|
{
|
||||||
|
__wrkDicIn = null;
|
||||||
|
__wrkDicOut = null;
|
||||||
__FieldPrefix = "";
|
__FieldPrefix = "";
|
||||||
__filePathId = "";
|
__filePathId = "";
|
||||||
__fileId = "";
|
__fileId = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user