Added code to replace the repetitive message box popups when an orphaned records are identified during the creation of a rofst with a single message box at the end of creating a rofst directing the user to a file that contains all of the orphaned records
This commit is contained in:
parent
ef9e32b9d6
commit
3f945b04c5
@ -101,6 +101,7 @@ using System.Runtime.InteropServices;
|
||||
using VlnStatus;
|
||||
using System.Collections.Specialized;
|
||||
using ROFST_FILE;
|
||||
using Volian.Base.Library;
|
||||
|
||||
//using VlnProfiler; //don't forget to add VlnProfiler to the reference list
|
||||
|
||||
@ -261,6 +262,14 @@ namespace ROEditor
|
||||
}
|
||||
File.Copy(FstNew,FstPath,true); // save ROFST.NEW as RO.fST
|
||||
File.Delete(FstNew); // remove ROFST.NEW
|
||||
if (OrphanedRecords.Length > 0)
|
||||
{
|
||||
StreamWriter sw = new StreamWriter(VlnSettings.TemporaryFolder + @"\Orphaned RO Records.txt");
|
||||
sw.Write(OrphanedRecords.ToString());
|
||||
sw.Close();
|
||||
MessageBox.Show("The file Orphaned RO Records.txt has been created", "Warning - Orphan RO Record");
|
||||
}
|
||||
|
||||
MessageBox.Show("New RO.FST file created successfully.","Create RO.FST file",System.Windows.Forms.MessageBoxButtons.OK);
|
||||
}
|
||||
// MessageBox.Show(Profiler.ToString("000.00%"),"Timings");
|
||||
@ -531,7 +540,7 @@ namespace ROEditor
|
||||
// Profiler.End("Finish");
|
||||
return RtnVal;
|
||||
}
|
||||
|
||||
StringBuilder OrphanedRecords = new StringBuilder();
|
||||
private uint SaveFstGroup(XmlNode GroupNode, uint parentID,ref ushort typ,ArrayList AvailList,string AccPageIDTplate)
|
||||
{
|
||||
uint RtnVal;
|
||||
@ -568,7 +577,7 @@ namespace ROEditor
|
||||
{
|
||||
// Profiler.Start("GetChildData");
|
||||
// ROdatabase.RODB_GetChildData(elem,true);
|
||||
ROdatabase.RODB_GetGroupAndSubgroups(elem);
|
||||
ROdatabase.RODB_GetGroupAndSubgroups(elem, OrphanedRecords);
|
||||
// Profiler.End("GetChildData");
|
||||
}
|
||||
|
||||
|
@ -1203,7 +1203,7 @@ namespace RODBInterface
|
||||
// Note that this function is designed to be call for the
|
||||
// root node (i.e. it gets all of group and RO data for a given
|
||||
// database table)
|
||||
public bool RODB_GetGroupAndSubgroups(VlnXmlElement node)
|
||||
public bool RODB_GetGroupAndSubgroups(VlnXmlElement node, StringBuilder sb)
|
||||
{
|
||||
VlnStatusBar StatBar = new VlnStatusBar("Reading from the Database");
|
||||
string tablename = node.GetAttribute("Table");
|
||||
@ -1236,8 +1236,15 @@ namespace RODBInterface
|
||||
{
|
||||
if (!dicGroups.Contains(ParID))
|
||||
{
|
||||
string strMBText = "The following record is being skipped. The parent for this RO is missing:\n\n RecID: " + RecID + "\n\n Table: " + tablename +"\n";
|
||||
MessageBox.Show(strMBText, "Warning - Orphan RO Record");
|
||||
if (sb.Length == 0)
|
||||
{
|
||||
sb.AppendLine("The following records were skipped.");
|
||||
sb.AppendLine("The parent for these RO's was missing.");
|
||||
sb.AppendLine();
|
||||
}
|
||||
string strMBText = "RecID: " + RecID + "\n\n Table: " + tablename +"\n";
|
||||
sb.AppendLine(strMBText);
|
||||
// MessageBox.Show(strMBText, "Warning - Orphan RO Record");
|
||||
continue; // skip - no parent for this node
|
||||
}
|
||||
node = (VlnXmlElement)dicGroups[ParID];
|
||||
@ -1636,7 +1643,7 @@ namespace RODBInterface
|
||||
{
|
||||
DBE.Command(readstr);
|
||||
DBE.Reader();
|
||||
|
||||
|
||||
if (recid == null)
|
||||
DBE.Read(); // skip the first parentID record of 00000000
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user