From 36323b44a76c80fb7d91d0eb0ec5f08dac2fa999 Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 27 Jan 2009 15:31:59 +0000 Subject: [PATCH] --- PROMS/DataLoader/DocVersions.cs | 6 +- PROMS/DataLoader/LoadConfig.cs | 34 ++-- PROMS/DataLoader/Loader.cs | 11 +- .../Properties/Settings.Designer.cs | 14 +- PROMS/DataLoader/Properties/Settings.settings | 3 + PROMS/DataLoader/RefObjs.cs | 20 ++- PROMS/DataLoader/RoFst.cs | 170 ++++++++++++++++++ PROMS/DataLoader/SecObj.cs | 6 +- PROMS/DataLoader/Sections.cs | 2 +- PROMS/DataLoader/Steps.cs | 10 +- PROMS/DataLoader/frmLoader.Designer.cs | 90 ++++++---- PROMS/DataLoader/frmLoader.cs | 20 ++- 12 files changed, 315 insertions(+), 71 deletions(-) create mode 100644 PROMS/DataLoader/RoFst.cs diff --git a/PROMS/DataLoader/DocVersions.cs b/PROMS/DataLoader/DocVersions.cs index eaf6140e..b37b68b7 100644 --- a/PROMS/DataLoader/DocVersions.cs +++ b/PROMS/DataLoader/DocVersions.cs @@ -40,9 +40,7 @@ namespace DataLoader if (convertProcedures) { _OutTran = new OutsideTransition(cn); - // load rofst (use it later).... - DocVersionInfo dvi = DocVersionInfo.Get(docver.VersionID); - rofst = new ROFST(pth + "\\ro.fst",dvi); + MigrateROFST(pth, docver); // Migrate library documents MigrateLibDocs(cn, pth); // Initialize Dictionaries @@ -65,7 +63,7 @@ namespace DataLoader ShowMissingTransitions(); log.InfoFormat("Completed Migration of {0}", pth); MessageBox.Show("Completed Migration of " + pth); - rofst.Close(); + if (rofstinfo != null) rofstinfo.ROFSTLookup.Close(); dicTrans_ItemDone.Clear(); dicTrans_ItemDone = null; } diff --git a/PROMS/DataLoader/LoadConfig.cs b/PROMS/DataLoader/LoadConfig.cs index 51760039..15bb7e0b 100644 --- a/PROMS/DataLoader/LoadConfig.cs +++ b/PROMS/DataLoader/LoadConfig.cs @@ -48,11 +48,14 @@ namespace Config listIni_EleName.Add("procedurelisttabstops"); // proc.ini - listIni_EleName.Add("rodefaults"); + //listIni_EleName.Add("rodefaults"); listIni_EleName.Add("display"); listIni_EleName.Add("backgrounddefaults"); listIni_EleName.Add("unit"); + // roapp.ini + listIni_EleName.Add("roapp"); + // .cfg listIni_EleName.Add("spelldictionary"); // listIni_EleName.Add("wordprocessor"); - already in here. @@ -92,9 +95,9 @@ namespace Config listIni_AttrName.Add("proceduretitletab"); // proc.ini - listIni_AttrName.Add("setpoint"); - listIni_AttrName.Add("graphics"); - listIni_AttrName.Add("ropath"); + //listIni_AttrName.Add("setpoint"); + //listIni_AttrName.Add("graphics"); + //listIni_AttrName.Add("ropath"); listIni_AttrName.Add("display"); listIni_AttrName.Add("sectiontitle"); listIni_AttrName.Add("sectionnumber"); @@ -109,6 +112,8 @@ namespace Config listIni_AttrName.Add("procedurenumber"); + // roapp.ini + listIni_AttrName.Add("extention"); // NOTE MIS-SPELLING was in 16-bit program! // .cfg listIni_AttrName.Add("custom"); @@ -126,10 +131,9 @@ namespace Config public ConfigFile() { } - public void LoadUsrCfg(User user) + public void LoadUsrCfg(User user, string vepromspath) { - string cmdline = System.Environment.CommandLine; - string cfgpath = cmdline.Substring(1, cmdline.LastIndexOf("\\") - 1) + "\\config"; + string cfgpath = vepromspath + "\\config"; if (!Directory.Exists(cfgpath)) { log.Info("No user cfgs found in config directory - did not migrate any user cfgs"); @@ -179,10 +183,9 @@ namespace Config } } - public XmlDocument LoadSystemIni() + public XmlDocument LoadSystemIni(string vepromspath) { - string cmdline = System.Environment.CommandLine; - string inipath = cmdline.Substring(1, cmdline.LastIndexOf("\\") - 1) + "\\veproms.ini"; + string inipath = vepromspath + "\\veproms.ini"; if (!File.Exists(inipath)) { log.InfoFormat("Did not migrate {0} - file not found", inipath); @@ -208,6 +211,17 @@ namespace Config return d; } + public XmlDocument LoadRoAppIni(string ropath) + { + string inipath = ropath + "\\roapp.ini"; + // not an error if it does not exist - just return null. + if (!File.Exists(inipath)) return null; + + XmlDocument d = IniToXml(inipath); + + return d; + } + public XmlDocument IniToXml(string path) { FileInfo fi = new FileInfo(path); diff --git a/PROMS/DataLoader/Loader.cs b/PROMS/DataLoader/Loader.cs index 95245b6f..41ca0eea 100644 --- a/PROMS/DataLoader/Loader.cs +++ b/PROMS/DataLoader/Loader.cs @@ -34,7 +34,8 @@ namespace DataLoader private string ProcFileName; private string ProcNumber; - private ROFST rofst; + private ROFstInfo rofstinfo; + private RODb rodb; private int EditSectId; private Dictionary dicLibDocRef; @@ -73,7 +74,7 @@ namespace DataLoader log = lg; frmMain = fm; } - public bool LoadFolders() + public bool LoadFolders(string vepromspath) { try { @@ -91,7 +92,7 @@ namespace DataLoader at = AnnotationType.MakeAnnotationType("Action Items", null); frmMain.Status = "Load veproms.ini"; - XmlDocument d = cfg.LoadSystemIni(); + XmlDocument d = cfg.LoadSystemIni(vepromspath); frmMain.Status = "Load All Formats"; LoadAllFormats(); @@ -190,9 +191,9 @@ namespace DataLoader return dts; } - public bool LoadSecurity(string VeSamPath) + public bool LoadSecurity(string VeSamPath, string VePromsPath) { - Security sec = new Security(VeSamPath); + Security sec = new Security(VeSamPath, VePromsPath); return sec.Migrate(); } private void WaitMS(int n) diff --git a/PROMS/DataLoader/Properties/Settings.Designer.cs b/PROMS/DataLoader/Properties/Settings.Designer.cs index 2d2eb2e7..e42c9663 100644 --- a/PROMS/DataLoader/Properties/Settings.Designer.cs +++ b/PROMS/DataLoader/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.832 +// Runtime Version:2.0.50727.1434 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -79,5 +79,17 @@ namespace DataLoader.Properties { this["PurgeData"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string VePromsFilename { + get { + return ((string)(this["VePromsFilename"])); + } + set { + this["VePromsFilename"] = value; + } + } } } diff --git a/PROMS/DataLoader/Properties/Settings.settings b/PROMS/DataLoader/Properties/Settings.settings index 11350d20..9d40fcfb 100644 --- a/PROMS/DataLoader/Properties/Settings.settings +++ b/PROMS/DataLoader/Properties/Settings.settings @@ -17,5 +17,8 @@ + + + \ No newline at end of file diff --git a/PROMS/DataLoader/RefObjs.cs b/PROMS/DataLoader/RefObjs.cs index b9eb6a63..8cfc5f04 100644 --- a/PROMS/DataLoader/RefObjs.cs +++ b/PROMS/DataLoader/RefObjs.cs @@ -25,7 +25,7 @@ namespace DataLoader { public partial class Loader { - private string MigrateRos(OleDbConnection cn, string textm, string seqcvt, Content content) + private string MigrateRos(OleDbConnection cn, string textm, string seqcvt, Content content, DocVersion docver) { StringBuilder rotxt = new StringBuilder(); int instance = 0; @@ -61,10 +61,20 @@ namespace DataLoader { DataRow dr = dt.Rows[instance]; string ROID = dr["ROID"].ToString(); - RoUsage ro = RoUsage.MakeRoUsage(content, ROID, null, DateTime.Now, "Migration"); - string results = string.Format(@"{0}{1}\v #Link:ReferencedObject:{2} {3}\v0", - '\x15', rofst.GetRoValue(ROID.Substring(0, 12).ToUpper()), ro.ROUsageID, ROID); - rotxt.Append(results); + RoUsage ro = RoUsage.MakeRoUsage(content, ROID, null, DateTime.Now, "Migration", rodb); + try + { + string rov = rofstinfo.ROFSTLookup.GetRoValue(ROID.Substring(0, 12).ToUpper()); + string results = string.Format(@"{0}{1}\v #Link:ReferencedObject:{2} {3} {4}\v0", + '\x15', rofstinfo.ROFSTLookup.GetRoValue(ROID.Substring(0, 12).ToUpper()), ro.ROUsageID, ROID, rodb.RODbID); + rotxt.Append(results); + } + catch (Exception ex) + { + log.Error("Error setting RO data in text field"); + log.ErrorFormat("Error Message = {0}", ex.Message); + log.ErrorFormat("proc number = {0}, oldstepsequence = {1}, instance = {2}", ProcNumber, seqcvt, instance); + } instance++; } else diff --git a/PROMS/DataLoader/RoFst.cs b/PROMS/DataLoader/RoFst.cs new file mode 100644 index 00000000..8d3fc275 --- /dev/null +++ b/PROMS/DataLoader/RoFst.cs @@ -0,0 +1,170 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml; +using System.Text.RegularExpressions; +using VEPROMS.CSLA.Library; +using Config; + +namespace DataLoader +{ + public partial class Loader + { + public void MigrateROFST(string fstPath, DocVersion docver) + { + //if (!File.Exists(fstPath + @"\ro.fst")) + //{ + // log.ErrorFormat("RO FST Does not exist: {0}", fstPath); + // return; + //} + // get the proc.ini value for the ropath. If it doesn't exist, use "..\" + ConfigFile cfg = new ConfigFile(); + XmlDocument d = cfg.IniToXml(fstPath + @"\proc.ini"); + string roDbpath = null; + string sp_prefix = null; + string img_prefix = null; + if (d != null) + { + XmlElement xml = d.DocumentElement; + XmlNode rodef = xml.SelectSingleNode("//zRODefaults"); + XmlElement ele = rodef as XmlElement; + string tmp = null; + if (ele != null) + { + roDbpath = ele.GetAttribute("zROPATH"); + sp_prefix = ele.GetAttribute("zSetpoint"); + img_prefix = ele.GetAttribute("zGraphics"); + } + + } + if (roDbpath == null || roDbpath == "" || roDbpath.ToLower() == @"..\ro") + roDbpath = fstPath.Substring(0, fstPath.LastIndexOf('\\')) + @"\ro"; + + // first see if this rodb has been migrated (another dataset may have migrated it) + rodb = RODb.GetByFolderPath(roDbpath); + if (rodb == null) + { + DirectoryInfo di = new DirectoryInfo(roDbpath); + + // There may be more than 1 'ro' as the 'ROName' field (ROName is derived from the ropath). + // Get new name be incrementing, if so. + string newname = NewROName(di.Name); + // If there is default graphic file extension data in the roapp.ini, use this as config + // data for the rodb, otherwise set it to 'cstring' for now. + cfg = new ConfigFile(); + d = cfg.LoadRoAppIni(roDbpath); + rodb = RODb.MakeRODb(di.Name, di.FullName, "cstring", d==null?null:d.InnerXml); + } + + // now see if the same ro.fst has been migrated. To determine this check if a record + // exists for the rodb and with the same dts as the file. + FileInfo fi = new FileInfo(fstPath + @"\ro.fst"); + + ROFst rofst = ROFst.GetByRODbID_DTS(rodb.RODbID, fi.LastWriteTime); + if (rofst == null) + { + // Next read in the rofst & make the rofst record. + FileStream fsIn = new FileStream(fstPath + @"\ro.fst", FileMode.Open, FileAccess.Read, FileShare.Read); + // Create an instance of StreamReader that can read characters from the FileStream. + BinaryReader r = new BinaryReader(fsIn); + byte[] ab = r.ReadBytes((int)fsIn.Length); + //r.Close(); + fsIn.Close(); + // get the date time stamp, need to create the record with the file's dts. + rofst = ROFst.MakeROFst(rodb, ab, null, fi.LastWriteTime, "Migration"); + } + // Next hook the rofst to the docversion using the associations table. + DocVersionAssociation dva = docver.DocVersionAssociations.Add(rofst); + AssociationConfig assoc_cfg = new AssociationConfig(); + assoc_cfg.RODefaults_graphicsprefix = img_prefix; + assoc_cfg.RODefaults_setpointprefix = sp_prefix; + dva.Config = assoc_cfg.ToString(); + docver.Save(); + rofstinfo = ROFstInfo.Get(rofst.ROFstID); // refresh the info record! + rofst.Dispose(); + + // Now load any images in... type 8: // Intergrated Graphics RO type + for (int i = 0; i < rofstinfo.ROFSTLookup.myHdr.myDbs.Length; i++) + { + // walk through the rofst 'database' searching for + // all nodes that are integrated graphics, i.e. type 8. + if (rofstinfo.ROFSTLookup.myHdr.myDbs[i].children != null) MigrateRoFstGraphics(roDbpath, rofstinfo.ROFSTLookup.myHdr.myDbs[i].children, rodb); + } + } + + private string NewROName(string roName) + { + string retval = roName; + int iSuffix = -1; + RODbInfoList rodblist = RODbInfoList.Get(); + + foreach (RODbInfo rdi in rodblist) + { + if (rdi.ROName.StartsWith(roName)) + { + if (rdi.ROName == roName) + iSuffix = 0; + else if (Regex.IsMatch(rdi.ROName, roName + "[_][0-9]+")) + { + int ii = int.Parse(rdi.ROName.Substring(1 + roName.Length)); + if (ii > iSuffix) iSuffix = ii; + } + } + } + if (iSuffix >= 0) + retval = string.Format("{0}_{1}", roName, iSuffix + 1); + return retval; + } + private void MigrateRoFstGraphics(string rodbpath, ROFSTLookup.rochild[] rochild, RODb rodb) + { + for (int i = 0; i < rochild.Length; i++) + { + if (rochild[i].type == 8) AddGraphic(rodbpath, rochild[i].value, rodb); + if (rochild[i].children != null) MigrateRoFstGraphics(rodbpath, rochild[i].children, rodb); + } + } + private void AddGraphic(string rodbpath, string p, RODb rodb) + { + if (p == null) return; + string imgname = p.Substring(0, p.IndexOf('\n')); + int thedot = imgname.LastIndexOf('.'); + string fname = imgname; + if (thedot == -1 || (thedot != (imgname.Length - 4))) + { + RODbConfig roDbCfg = new RODbConfig(rodb.Config); + fname += string.Format(".{0}", roDbCfg.GetDefaultGraphicExtension()); + } + + string imgfile = rodbpath + @"\" + fname; + if (File.Exists(imgfile)) + { + FileInfo fi = new FileInfo(imgfile); + // if the roimage record exists, don't create a new one... + ROImage roImg = null; + using (roImg = ROImage.GetByRODbID_FileName_DTS(rodb.RODbID, imgname, fi.LastWriteTime)) + { + if (roImg == null) + { + FileStream fsIn = new FileStream(imgfile, FileMode.Open, FileAccess.Read, FileShare.Read); + // Create an instance of StreamReader that can read characters from the FileStream. + BinaryReader r = new BinaryReader(fsIn); + byte[] ab = r.ReadBytes((int)fsIn.Length); + r.Close(); + fsIn.Close(); + roImg = ROImage.MakeROImage(rodb, imgname, ab, null, fi.LastWriteTime, "Migration"); + } + // see if it's already linked to the current rofst.. + Figure figure = Figure.GetByROFstID_ImageID(rofstinfo.ROFstID, roImg.ImageID); + if (figure != null) return; + using (ROFst rofst = rofstinfo.Get()) + { + figure = Figure.MakeFigure(rofst, roImg, null); + } + } + } + else + Console.WriteLine(string.Format("{0}", imgfile), "Cannot Find Image File"); + } + } +} diff --git a/PROMS/DataLoader/SecObj.cs b/PROMS/DataLoader/SecObj.cs index e93c3ef4..a7e272fd 100644 --- a/PROMS/DataLoader/SecObj.cs +++ b/PROMS/DataLoader/SecObj.cs @@ -472,11 +472,12 @@ namespace DataLoader #endregion Dictionary plntDic = new Dictionary(); List userList = new List(); + private string _VePromsPath = null; private string optfilename; private string[] prflags ={ "Vfw", "Prnt", "Prnt Drft", "Prnt Chgs", "Edit", "Srch", "St Stp", "App", "App Sel", "Lib", "AMD", "Clean", "Lock" }; private string[] sysflags ={ "NetworkLock", "SysMaint", "ROEditor", "SysAdmin" }; #region NewMig - public Security(string pathname) + public Security(string pathname, string vepromspath) { if (File.Exists(pathname) == false) { @@ -484,6 +485,7 @@ namespace DataLoader optfilename = null; return; } + _VePromsPath = vepromspath; optfilename = pathname; } public bool Migrate() @@ -907,7 +909,7 @@ namespace DataLoader User newusr = User.New(); newusr.UserID = sUser; ConfigFile cfg = new ConfigFile(); - cfg.LoadUsrCfg(newusr); + cfg.LoadUsrCfg(newusr, _VePromsPath); Group tmpgrp = Group.Get(dicGroupIds[s]); newusr.UserMemberships.Add(tmpgrp); if (!newusr.IsSavable) ErrorRpt.ErrorReport(newusr); diff --git a/PROMS/DataLoader/Sections.cs b/PROMS/DataLoader/Sections.cs index de62bb53..5f2edf5f 100644 --- a/PROMS/DataLoader/Sections.cs +++ b/PROMS/DataLoader/Sections.cs @@ -476,7 +476,7 @@ namespace DataLoader frmMain.pbStepValue = 0; foreach (DataRowView drv in dv) { - FrItem = MigrateStep(cn, dt, drv, FrItem, conv_caret, pth); + FrItem = MigrateStep(cn, dt, drv, FrItem, conv_caret, pth, docver); if (secitem.MyContent.ContentParts.Count == 0) { // type 6 is step diff --git a/PROMS/DataLoader/Steps.cs b/PROMS/DataLoader/Steps.cs index b7aac153..203375cd 100644 --- a/PROMS/DataLoader/Steps.cs +++ b/PROMS/DataLoader/Steps.cs @@ -16,7 +16,7 @@ namespace DataLoader { public partial class Loader { - private Item AddStep(OleDbConnection cn, string StepType, string Textm, string Recid, string stpseq, string structtype, Item FromItem, DateTime dts, string userid, bool conv_caret, string pth) + private Item AddStep(OleDbConnection cn, string StepType, string Textm, string Recid, string stpseq, string structtype, Item FromItem, DateTime dts, string userid, bool conv_caret, string pth, DocVersion docver) { Content content = null; Item item = null; @@ -69,7 +69,7 @@ namespace DataLoader if (tokrt > -1) { txtdirty = true; - stptext = MigrateRos(cn, stptext, seqcvt, content); + stptext = MigrateRos(cn, stptext, seqcvt, content, docver); } // 16-bit code has the following two defines. @@ -281,7 +281,7 @@ namespace DataLoader } return retval; } - private Item MigrateStep(OleDbConnection cn, DataTable dt, DataRowView drv, Item FromItem, bool conv_caret, string pth) + private Item MigrateStep(OleDbConnection cn, DataTable dt, DataRowView drv, Item FromItem, bool conv_caret, string pth, DocVersion docver) { try { @@ -289,7 +289,7 @@ namespace DataLoader Item item = AddStep(cn, drv["Type"].ToString() , (drv["textm"] == DBNull.Value ? drv["Text"].ToString() : drv["Textm"].ToString()) , drv["Recid"].ToString(), drv["CStep"].ToString() + drv["CSequence"].ToString(), "S", FromItem // was str - , GetDTS(drv["Date"].ToString(), drv["Time"].ToString()), drv["Initials"].ToString(), conv_caret, pth); + , GetDTS(drv["Date"].ToString(), drv["Time"].ToString()), drv["Initials"].ToString(), conv_caret, pth, docver); //Content cont = Content.MakeContent(null,(drv["textm"] == DBNull.Value ? drv["Text"].ToString() : drv["Textm"].ToString()),drv["Type"]+20000,null,null, // GetDTS(drv["Date"].ToString(), drv["Time"].ToString()), drv["Initials"].ToString()); //Item item = Item.MakeItem(FromItem, cont, cont.DTS, cont.UserID); @@ -342,7 +342,7 @@ namespace DataLoader , (drvs["textm"] == DBNull.Value ? drvs["Text"].ToString() : drvs["Textm"].ToString()) , drv["Recid"].ToString(), drvs["CStep"].ToString() + drvs["CSequence"].ToString() , GetStructType(drvs["sequence"].ToString()), FrItem - , GetDTS(drvs["Date"].ToString(), drvs["Time"].ToString()), drvs["Initials"].ToString(), conv_caret, pth); + , GetDTS(drvs["Date"].ToString(), drvs["Time"].ToString()), drvs["Initials"].ToString(), conv_caret, pth, docver); if (FrType > 0 ) { diff --git a/PROMS/DataLoader/frmLoader.Designer.cs b/PROMS/DataLoader/frmLoader.Designer.cs index 7defcb21..f793893e 100644 --- a/PROMS/DataLoader/frmLoader.Designer.cs +++ b/PROMS/DataLoader/frmLoader.Designer.cs @@ -56,6 +56,8 @@ namespace DataLoader this.fbd = new System.Windows.Forms.FolderBrowserDialog(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this.tbVePromsPath = new System.Windows.Forms.TextBox(); + this.btnBrowseVeProms = new System.Windows.Forms.Button(); this.sc.Panel1.SuspendLayout(); this.sc.Panel2.SuspendLayout(); this.sc.SuspendLayout(); @@ -72,6 +74,8 @@ namespace DataLoader // // sc.Panel1 // + this.sc.Panel1.Controls.Add(this.btnBrowseVeProms); + this.sc.Panel1.Controls.Add(this.tbVePromsPath); this.sc.Panel1.Controls.Add(this.btnCtTok); this.sc.Panel1.Controls.Add(this.btnGroup); this.sc.Panel1.Controls.Add(this.btnVETree_CSLA); @@ -99,14 +103,14 @@ namespace DataLoader // sc.Panel2 // this.sc.Panel2.Controls.Add(this.tv); - this.sc.Size = new System.Drawing.Size(829, 506); - this.sc.SplitterDistance = 232; + this.sc.Size = new System.Drawing.Size(829, 542); + this.sc.SplitterDistance = 272; this.sc.TabIndex = 46; // // btnCtTok // this.btnCtTok.Location = new System.Drawing.Point(643, 0); - this.btnCtTok.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnCtTok.Margin = new System.Windows.Forms.Padding(4); this.btnCtTok.Name = "btnCtTok"; this.btnCtTok.Size = new System.Drawing.Size(128, 25); this.btnCtTok.TabIndex = 70; @@ -117,7 +121,7 @@ namespace DataLoader // btnGroup // this.btnGroup.Location = new System.Drawing.Point(516, -4); - this.btnGroup.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnGroup.Margin = new System.Windows.Forms.Padding(4); this.btnGroup.Name = "btnGroup"; this.btnGroup.Size = new System.Drawing.Size(119, 28); this.btnGroup.TabIndex = 69; @@ -128,7 +132,7 @@ namespace DataLoader // btnVETree_CSLA // this.btnVETree_CSLA.Location = new System.Drawing.Point(331, -1); - this.btnVETree_CSLA.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnVETree_CSLA.Margin = new System.Windows.Forms.Padding(4); this.btnVETree_CSLA.Name = "btnVETree_CSLA"; this.btnVETree_CSLA.Size = new System.Drawing.Size(177, 26); this.btnVETree_CSLA.TabIndex = 68; @@ -138,7 +142,7 @@ namespace DataLoader // // btnBrowseVesam // - this.btnBrowseVesam.Location = new System.Drawing.Point(639, 32); + this.btnBrowseVesam.Location = new System.Drawing.Point(638, 71); this.btnBrowseVesam.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnBrowseVesam.Name = "btnBrowseVesam"; this.btnBrowseVesam.Size = new System.Drawing.Size(159, 23); @@ -149,17 +153,17 @@ namespace DataLoader // // tbVesamPath // - this.tbVesamPath.Location = new System.Drawing.Point(152, 32); - this.tbVesamPath.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tbVesamPath.Location = new System.Drawing.Point(151, 71); + this.tbVesamPath.Margin = new System.Windows.Forms.Padding(4); this.tbVesamPath.Name = "tbVesamPath"; this.tbVesamPath.Size = new System.Drawing.Size(469, 22); this.tbVesamPath.TabIndex = 66; - this.tbVesamPath.Text = @"C:\16bit\Ve-proms\vesam.opt"; + this.tbVesamPath.Text = "C:\\16bit\\Ve-proms\\vesam.opt"; // // btnVesam // - this.btnVesam.Location = new System.Drawing.Point(3, 30); - this.btnVesam.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnVesam.Location = new System.Drawing.Point(2, 69); + this.btnVesam.Margin = new System.Windows.Forms.Padding(4); this.btnVesam.Name = "btnVesam"; this.btnVesam.Size = new System.Drawing.Size(144, 26); this.btnVesam.TabIndex = 65; @@ -170,7 +174,7 @@ namespace DataLoader // btnLoadTreeCSLA // this.btnLoadTreeCSLA.Location = new System.Drawing.Point(164, 0); - this.btnLoadTreeCSLA.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnLoadTreeCSLA.Margin = new System.Windows.Forms.Padding(4); this.btnLoadTreeCSLA.Name = "btnLoadTreeCSLA"; this.btnLoadTreeCSLA.Size = new System.Drawing.Size(159, 25); this.btnLoadTreeCSLA.TabIndex = 64; @@ -183,7 +187,7 @@ namespace DataLoader this.cbLazy.AutoSize = true; this.cbLazy.Checked = true; this.cbLazy.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbLazy.Location = new System.Drawing.Point(637, 175); + this.cbLazy.Location = new System.Drawing.Point(636, 214); this.cbLazy.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.cbLazy.Name = "cbLazy"; this.cbLazy.Size = new System.Drawing.Size(96, 21); @@ -193,7 +197,7 @@ namespace DataLoader // // btnConvertSelected // - this.btnConvertSelected.Location = new System.Drawing.Point(3, 204); + this.btnConvertSelected.Location = new System.Drawing.Point(2, 243); this.btnConvertSelected.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnConvertSelected.Name = "btnConvertSelected"; this.btnConvertSelected.Size = new System.Drawing.Size(213, 23); @@ -218,7 +222,7 @@ namespace DataLoader this.cbPurgeData.AutoSize = true; this.cbPurgeData.Checked = true; this.cbPurgeData.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbPurgeData.Location = new System.Drawing.Point(637, 149); + this.cbPurgeData.Location = new System.Drawing.Point(636, 188); this.cbPurgeData.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.cbPurgeData.Name = "cbPurgeData"; this.cbPurgeData.Size = new System.Drawing.Size(154, 21); @@ -229,14 +233,14 @@ namespace DataLoader // lblTime // this.lblTime.BackColor = System.Drawing.SystemColors.ButtonShadow; - this.lblTime.Location = new System.Drawing.Point(93, 166); + this.lblTime.Location = new System.Drawing.Point(92, 205); this.lblTime.Name = "lblTime"; this.lblTime.Size = new System.Drawing.Size(112, 25); this.lblTime.TabIndex = 58; // // pbStep // - this.pbStep.Location = new System.Drawing.Point(213, 146); + this.pbStep.Location = new System.Drawing.Point(212, 185); this.pbStep.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pbStep.Name = "pbStep"; this.pbStep.Size = new System.Drawing.Size(411, 18); @@ -244,7 +248,7 @@ namespace DataLoader // // pbSect // - this.pbSect.Location = new System.Drawing.Point(213, 122); + this.pbSect.Location = new System.Drawing.Point(212, 161); this.pbSect.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pbSect.Name = "pbSect"; this.pbSect.Size = new System.Drawing.Size(409, 18); @@ -252,7 +256,7 @@ namespace DataLoader // // pbProc // - this.pbProc.Location = new System.Drawing.Point(213, 98); + this.pbProc.Location = new System.Drawing.Point(212, 137); this.pbProc.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pbProc.Name = "pbProc"; this.pbProc.Size = new System.Drawing.Size(411, 18); @@ -263,7 +267,7 @@ namespace DataLoader this.cbSaveDoc.AutoSize = true; this.cbSaveDoc.Checked = true; this.cbSaveDoc.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbSaveDoc.Location = new System.Drawing.Point(639, 98); + this.cbSaveDoc.Location = new System.Drawing.Point(638, 137); this.cbSaveDoc.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.cbSaveDoc.Name = "cbSaveDoc"; this.cbSaveDoc.Size = new System.Drawing.Size(96, 21); @@ -275,7 +279,7 @@ namespace DataLoader // cbSaveRTF // this.cbSaveRTF.AutoSize = true; - this.cbSaveRTF.Location = new System.Drawing.Point(639, 123); + this.cbSaveRTF.Location = new System.Drawing.Point(638, 162); this.cbSaveRTF.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.cbSaveRTF.Name = "cbSaveRTF"; this.cbSaveRTF.Size = new System.Drawing.Size(93, 21); @@ -286,7 +290,7 @@ namespace DataLoader // // btnBrowse // - this.btnBrowse.Location = new System.Drawing.Point(639, 65); + this.btnBrowse.Location = new System.Drawing.Point(638, 104); this.btnBrowse.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnBrowse.Name = "btnBrowse"; this.btnBrowse.Size = new System.Drawing.Size(75, 23); @@ -297,7 +301,7 @@ namespace DataLoader // // tbSource // - this.tbSource.Location = new System.Drawing.Point(95, 65); + this.tbSource.Location = new System.Drawing.Point(94, 104); this.tbSource.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tbSource.Name = "tbSource"; this.tbSource.Size = new System.Drawing.Size(528, 22); @@ -308,7 +312,7 @@ namespace DataLoader // lblStep // this.lblStep.BackColor = System.Drawing.SystemColors.ButtonShadow; - this.lblStep.Location = new System.Drawing.Point(93, 142); + this.lblStep.Location = new System.Drawing.Point(92, 181); this.lblStep.Name = "lblStep"; this.lblStep.Size = new System.Drawing.Size(112, 25); this.lblStep.TabIndex = 49; @@ -316,7 +320,7 @@ namespace DataLoader // lblSection // this.lblSection.BackColor = System.Drawing.SystemColors.ButtonShadow; - this.lblSection.Location = new System.Drawing.Point(93, 118); + this.lblSection.Location = new System.Drawing.Point(92, 157); this.lblSection.Name = "lblSection"; this.lblSection.Size = new System.Drawing.Size(112, 23); this.lblSection.TabIndex = 48; @@ -324,14 +328,14 @@ namespace DataLoader // lblProc // this.lblProc.BackColor = System.Drawing.SystemColors.ButtonShadow; - this.lblProc.Location = new System.Drawing.Point(93, 95); + this.lblProc.Location = new System.Drawing.Point(92, 134); this.lblProc.Name = "lblProc"; this.lblProc.Size = new System.Drawing.Size(112, 23); this.lblProc.TabIndex = 47; // // btnConvert // - this.btnConvert.Location = new System.Drawing.Point(3, 66); + this.btnConvert.Location = new System.Drawing.Point(2, 105); this.btnConvert.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnConvert.Name = "btnConvert"; this.btnConvert.Size = new System.Drawing.Size(75, 49); @@ -343,10 +347,10 @@ namespace DataLoader // this.tv.CheckBoxes = true; this.tv.Dock = System.Windows.Forms.DockStyle.Bottom; - this.tv.Location = new System.Drawing.Point(0, -5); + this.tv.Location = new System.Drawing.Point(0, 8); this.tv.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tv.Name = "tv"; - this.tv.Size = new System.Drawing.Size(829, 275); + this.tv.Size = new System.Drawing.Size(829, 258); this.tv.TabIndex = 24; this.tv.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.tv_BeforeExpand); this.tv.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tv_AfterSelect); @@ -355,24 +359,42 @@ namespace DataLoader // this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabel1}); - this.statusStrip1.Location = new System.Drawing.Point(0, 483); + this.statusStrip1.Location = new System.Drawing.Point(0, 517); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 19, 0); - this.statusStrip1.Size = new System.Drawing.Size(829, 23); + this.statusStrip1.Size = new System.Drawing.Size(829, 25); this.statusStrip1.TabIndex = 47; this.statusStrip1.Text = "statusStrip1"; // // toolStripStatusLabel1 // this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; - this.toolStripStatusLabel1.Size = new System.Drawing.Size(130, 18); + this.toolStripStatusLabel1.Size = new System.Drawing.Size(131, 20); this.toolStripStatusLabel1.Text = "Status Information"; // + // tbVePromsPath + // + this.tbVePromsPath.Location = new System.Drawing.Point(3, 36); + this.tbVePromsPath.Name = "tbVePromsPath"; + this.tbVePromsPath.Size = new System.Drawing.Size(617, 22); + this.tbVePromsPath.TabIndex = 71; + // + // btnBrowseVeProms + // + this.btnBrowseVeProms.Location = new System.Drawing.Point(638, 36); + this.btnBrowseVeProms.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.btnBrowseVeProms.Name = "btnBrowseVeProms"; + this.btnBrowseVeProms.Size = new System.Drawing.Size(159, 23); + this.btnBrowseVeProms.TabIndex = 72; + this.btnBrowseVeProms.Text = "Browse for VeProms..."; + this.btnBrowseVeProms.UseVisualStyleBackColor = true; + this.btnBrowseVeProms.Click += new System.EventHandler(this.btnBrowseVeProms_Click); + // // frmLoader // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(829, 506); + this.ClientSize = new System.Drawing.Size(829, 542); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.sc); this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); @@ -421,5 +443,7 @@ namespace DataLoader private System.Windows.Forms.Button btnCtTok; private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; + private System.Windows.Forms.Button btnBrowseVeProms; + private System.Windows.Forms.TextBox tbVePromsPath; } } \ No newline at end of file diff --git a/PROMS/DataLoader/frmLoader.cs b/PROMS/DataLoader/frmLoader.cs index c11a4f6c..673226f2 100644 --- a/PROMS/DataLoader/frmLoader.cs +++ b/PROMS/DataLoader/frmLoader.cs @@ -182,7 +182,7 @@ namespace DataLoader // When loading folders, i.e. the tree from dBase (old 16-bit) // always clear the data ldr.ClearData(); - bool suc = ldr.LoadFolders(); + bool suc = ldr.LoadFolders(tbVePromsPath.Text); } private void btnConvert_Click(object sender, System.EventArgs e) @@ -193,8 +193,8 @@ namespace DataLoader if (cbPurgeData.Checked) { ldr.ClearData(); - success=ldr.LoadFolders(); - if (success) success = ldr.LoadSecurity(tbVesamPath.Text); + success = ldr.LoadFolders(tbVePromsPath.Text); + if (success) success = ldr.LoadSecurity(tbVesamPath.Text, tbVePromsPath.Text); } if (success) { @@ -287,9 +287,9 @@ namespace DataLoader if (cbPurgeData.Checked) { ldr.ClearData(); - ldr.LoadFolders(); + ldr.LoadFolders(tbVePromsPath.Text); } - bool sec = ldr.LoadSecurity(tbVesamPath.Text); + bool sec = ldr.LoadSecurity(tbVesamPath.Text, tbVePromsPath.Text); } private void btnVETree_CSLA_Click(object sender, EventArgs e) @@ -355,6 +355,8 @@ namespace DataLoader this.cbPurgeData.CheckState = Properties.Settings.Default.PurgeData; if (Properties.Settings.Default["LoadRTFDoc"] != null) this.cbSaveRTF.CheckState = Properties.Settings.Default.LoadRTFDoc; + if (Properties.Settings.Default["VePromsFilename"] != null) + this.tbVePromsPath.Text = Properties.Settings.Default.VePromsFilename; _Loading = false; } @@ -365,7 +367,15 @@ namespace DataLoader Properties.Settings.Default.LoadWordDoc = cbSaveDoc.CheckState; Properties.Settings.Default.LoadRTFDoc = cbSaveRTF.CheckState; Properties.Settings.Default.PurgeData = cbPurgeData.CheckState; + Properties.Settings.Default.VePromsFilename = tbVePromsPath.Text; Properties.Settings.Default.Save(); } + + private void btnBrowseVeProms_Click(object sender, EventArgs e) + { + fbd.SelectedPath = tbVePromsPath.Text; + if (fbd.ShowDialog() == DialogResult.OK) + tbVePromsPath.Text = fbd.SelectedPath; + } } } \ No newline at end of file