Separate codecompl dep on fieldprefix

This commit is contained in:
2015-03-31 16:50:15 +02:00
parent 369a7a638e
commit 5b90d12efd
3 changed files with 42 additions and 13 deletions

View File

@ -51,6 +51,14 @@ namespace CobXmlSupport
public readonly string NOMOVE = "NoMove";
private readonly bool MOVEFROM = true;
public string FldPref
{
get
{
return txtPrefix.Text;
}
}
public List<CobRow> RowList
{
get { return rowList; }
@ -165,7 +173,7 @@ namespace CobXmlSupport
private void showRows()
{
codeCompleter Cc = new codeCompleter(cmbLastFile.Text);
codeCompleter Cc = new codeCompleter(cmbLastFile.Text,txtPrefix.Text);
Cc.TryFill_In_Dic();
Cc.TryFill_Out_Dic();
string fieldInCompl="", fieldOutCompl="";
@ -1475,6 +1483,12 @@ namespace CobXmlSupport
fromMoves.CodeShower.Text += "( " + occParRows + " )";
}
fromMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "TO ";
if (cr.MoveFromCode.Length > 0)
{
fromMoves.CodeShower.Text += cr.MoveFromCode;
}
else
{
if (cr.FieldDef.ToUpper().IndexOf("X") > -1)
{
fromMoves.CodeShower.Text += "MoveToStringVar ";
@ -1483,6 +1497,7 @@ namespace CobXmlSupport
{
fromMoves.CodeShower.Text += "MoveToNumVar ";
}
}
fromMoves.CodeShower.Text += " *> #" + cr.FieldName + "#";
if (chkDisplays.Checked)
{

View File

@ -92,7 +92,7 @@ namespace CobXmlSupport
private void btnSynch_Click(object sender, EventArgs e)
{
codeCompleter Cc = new codeCompleter(parentWindow.CmbLastFile.Text);
codeCompleter Cc = new codeCompleter(parentWindow.CmbLastFile.Text,parentWindow.FldPref);
string fieldCompl = "";
this.CodeShower.Text = " InPath = " + Cc.PathId + "\r\n InFile = " + Cc.FileId + "\r\n codeFile = " + Cc.CcFileInId + "\r\n codePath = " + Cc.PathId+Cc.CcFileInId + "\r\n -------------- \r\n" + this.CodeShower.Text;
Cc.TryFill_In_Dic();
@ -299,7 +299,7 @@ namespace CobXmlSupport
private void btnSynchOut_Click(object sender, EventArgs e)
{
codeCompleter Cc = new codeCompleter(parentWindow.CmbLastFile.Text);
codeCompleter Cc = new codeCompleter(parentWindow.CmbLastFile.Text,parentWindow.FldPref);
string fieldCompl = "";
this.CodeShower.Text = " InPath = " + Cc.PathId + "\r\n InFile = " + Cc.FileId + "\r\n codeFile = " + Cc.CcFileOutId + "\r\n codePath = " + Cc.PathId + Cc.CcFileOutId + "\r\n -------------- \r\n" + this.CodeShower.Text;
Cc.TryFill_Out_Dic();

View File

@ -11,6 +11,7 @@ namespace CobXmlSupport
{
private Dictionary<string, string> __wrkDicIn = null;
private Dictionary<string, string> __wrkDicOut = null;
private string __FieldPrefix;
private string __filePathId;
private string __fileId;
private string __pathId;
@ -22,6 +23,7 @@ namespace CobXmlSupport
public codeCompleter()
{
__FieldPrefix = "";
__filePathId = "";
__fileId = "";
__pathId = "";
@ -31,8 +33,9 @@ namespace CobXmlSupport
__ccFileOutIdNoSuff = "";
}
public codeCompleter(string pathFileId)
public codeCompleter(string pathFileId,string fpref)
{
__FieldPrefix = fpref;
__filePathId = pathFileId;
nameCreator(__filePathId);
__wrkDicIn = new Dictionary<string, string>();
@ -81,12 +84,13 @@ namespace CobXmlSupport
private void nameCreator(string inPathFname)
{
string gPrefix = "." + __FieldPrefix.Replace("_", "").Trim();
__fileId = inPathFname.Substring(inPathFname.LastIndexOf("\\") + 1);
__pathId = inPathFname.Substring(0, inPathFname.LastIndexOf("\\") + 1);
__ccFileInId = __fileId.Substring(0, __fileId.LastIndexOf(".")) + ".In" + JSON;
__ccFileOutId = __fileId.Substring(0, __fileId.LastIndexOf(".")) + ".Out" + JSON;
__ccFileInIdNoSuff = __fileId.Substring(0, __fileId.LastIndexOf(".")) + ".In";
__ccFileOutIdNoSuff = __fileId.Substring(0, __fileId.LastIndexOf(".")) + ".Out";
__ccFileInId = __fileId.Substring(0, __fileId.LastIndexOf(".")) + ".In" + gPrefix + JSON;
__ccFileOutId = __fileId.Substring(0, __fileId.LastIndexOf(".")) + ".Out" + gPrefix + JSON;
__ccFileInIdNoSuff = __fileId.Substring(0, __fileId.LastIndexOf(".")) + ".In" + gPrefix;
__ccFileOutIdNoSuff = __fileId.Substring(0, __fileId.LastIndexOf(".")) + ".Out" + gPrefix;
}
private string backupSuffix()
@ -149,7 +153,12 @@ namespace CobXmlSupport
public void Save_In_Dic()
{
string ccFileInId = __pathId + __ccFileInId;
string ccFileInBackup = __pathId + __ccFileInIdNoSuff + backupSuffix();
if (Directory.Exists(__pathId + @"\JsonBackup\")) { }
else
{
Directory.CreateDirectory(__pathId + @"\JsonBackup\");
}
string ccFileInBackup = __pathId +@"\JsonBackup\"+ __ccFileInIdNoSuff + backupSuffix();
if (__filePathId.Trim() == "") { }
else
@ -169,7 +178,12 @@ namespace CobXmlSupport
public void Save_Out_Dic()
{
string ccFileOutId = __pathId + __ccFileOutId;
string ccFileOutBackup = __pathId + __ccFileOutIdNoSuff + backupSuffix();
if (Directory.Exists(__pathId + @"\JsonBackup\")) { }
else
{
Directory.CreateDirectory(__pathId + @"\JsonBackup\");
}
string ccFileOutBackup = __pathId + @"\JsonBackup\" + __ccFileOutIdNoSuff + backupSuffix();
if (__filePathId.Trim() == "") { }
else