private void PluginCommansGrid_Shown(object sender, EventArgs e) { PluginRequestData = new PluginRequestDataStruct[99]; openFileDialog1.InitialDirectory = Directory.GetCurrentDirectory(); XmlDocument doc = new XmlDocument(); try { doc.Load(@"PluginCommands"); foreach (XmlNode node in doc.DocumentElement.ChildNodes) { foreach (XmlNode Cnode in node) { if (node.Name == "LastPath") { openFileDialog1.InitialDirectory = node.InnerText; } } } } catch { } DialogResult result = openFileDialog1.ShowDialog(); if (result != DialogResult.OK) { Close(); return; } FileToUse = openFileDialog1.FileName; if (!File.Exists(FileToUse)) { PluginRequestDataStruct NewPluginDataStruct = new PluginRequestDataStruct(); NewPluginDataStruct.FileName = FileToUse; NewPluginDataStruct.New = true; PluginCommands PluginCommandsForm = new PluginCommands(NewPluginDataStruct); PluginCommandsForm.ShowDialog(); } XmlDocument Data = new XmlDocument(); XmlNode DataNode = Data.CreateXmlDeclaration("1.0", "UTF-8", null); Data.AppendChild(DataNode); XmlNode DataNodeRoot; XmlNode DataNodeNode; DataNodeRoot = Data.CreateElement("PluginCommandsDocumentation"); Data.AppendChild(DataNodeRoot); DataNodeNode = Data.CreateElement("LastPath"); DataNodeNode.AppendChild(Data.CreateTextNode(Path.GetDirectoryName(FileToUse))); DataNodeRoot.AppendChild(DataNodeNode); Data.Save("PluginCommands"); MainListView.Columns.Add("Command Number", -2, HorizontalAlignment.Left); MainListView.Columns.Add("Command Name", -2, HorizontalAlignment.Left); MainListView.Columns.Add("Comments", -2, HorizontalAlignment.Left); LoadandProcessDocumentation(); SortColumns(ColumnSorted); Save.Enabled = false; }
private void GetDBName() { if (!string.IsNullOrEmpty(DBToUse)) { return; } XmlDocument doc = new XmlDocument(); try { doc.Load(@"DatabaseLocation"); foreach (XmlNode node in doc.DocumentElement.ChildNodes) { foreach (XmlNode Cnode in node) { if (node.Name == "LastPath") { openFileDialog1.InitialDirectory = node.InnerText; } } } } catch { } DialogResult result = openFileDialog1.ShowDialog(); if (result != DialogResult.OK) { Close(); return; } DBToUse = openFileDialog1.FileName; XmlDocument Data = new XmlDocument(); XmlNode DataNode = Data.CreateXmlDeclaration("1.0", "UTF-8", null); Data.AppendChild(DataNode); XmlNode DataNodeRoot; XmlNode DataNodeNode; DataNodeRoot = Data.CreateElement("DataBaseLocation"); Data.AppendChild(DataNodeRoot); DataNodeNode = Data.CreateElement("LastPath"); DataNodeNode.AppendChild(Data.CreateTextNode(Path.GetDirectoryName(DBToUse))); DataNodeRoot.AppendChild(DataNodeNode); Data.Save("DatabaseLocation"); EnterPasswordForm EnterPassword = new EnterPasswordForm("Enter Database Password"); EnterPassword.ShowDialog(); EnterPassword.Close(); if (EnterPassword.Saved) { EncryptedMasterPassword = EnterPassword.EnteredPassword; } else { EncryptedMasterPassword = ""; } return; }
private void DatabaseFieldsGrid_Shown(object sender, EventArgs e) { int i; StoredStuff = new string[Dimensioned, Dimensioned]; openFileDialog1.InitialDirectory = Directory.GetCurrentDirectory(); DatabaseGrid.Columns.Add("Field Code", -2, HorizontalAlignment.Left); DatabaseGrid.Columns.Add("Field Code Description", -2, HorizontalAlignment.Left); DatabaseGrid.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); XmlDocument doc = new XmlDocument(); try { doc.Load(@"DatabaseFields"); foreach (XmlNode node in doc.DocumentElement.ChildNodes) { foreach (XmlNode Cnode in node) { if (node.Name == "LastPath") { openFileDialog1.InitialDirectory = node.InnerText; } } } } catch { } DialogResult result = openFileDialog1.ShowDialog(); if (result != DialogResult.OK) { Close(); return; } FileToUse = openFileDialog1.FileName; DatabaseName.Text = Path.GetFileNameWithoutExtension(@FileToUse); XmlDocument Data = new XmlDocument(); XmlNode DataNode = Data.CreateXmlDeclaration("1.0", "UTF-8", null); Data.AppendChild(DataNode); XmlNode DataNodeRoot; XmlNode DataNodeNode; DataNodeRoot = Data.CreateElement("DataBaseFieldsDocumentation"); Data.AppendChild(DataNodeRoot); DataNodeNode = Data.CreateElement("LastPath"); DataNodeNode.AppendChild(Data.CreateTextNode(Path.GetDirectoryName(FileToUse))); DataNodeRoot.AppendChild(DataNodeNode); Data.Save("DataBaseFields"); try { doc.Load(@FileToUse); DatabaseName.Text = Path.GetFileNameWithoutExtension(@FileToUse); LastStoredStuff = 0; foreach (XmlNode node in doc.DocumentElement.ChildNodes) { ComboboxItem item = new ComboboxItem(); item.Text = node.Name; item.Value = LastStoredStuff; LastStoredStuff++; Fields.Items.Add(item); i = 0; foreach (XmlNode Cnode in node) { StoredStuff[LastStoredStuff - 1, i] = Cnode.Attributes.GetNamedItem("Code").Value; StoredStuff[LastStoredStuff - 1, i + 1] = Cnode.FirstChild.InnerText; i = i + 2; } } if (Fields.Items.Count > 0) { Fields.SelectedIndex = 0; } } catch { } Save.Enabled = false; }
private void LogViewer_Shown(object sender, EventArgs e) { string line; openFileDialog1.InitialDirectory = Directory.GetCurrentDirectory(); XmlDocument doc = new XmlDocument(); try { doc.Load(@"Logs"); foreach (XmlNode node in doc.DocumentElement.ChildNodes) { foreach (XmlNode Cnode in node) { if (node.Name == "LastPath") { openFileDialog1.InitialDirectory = node.InnerText; } } } } catch { } openFileDialog1.FileName = ""; openFileDialog1.Filter = Mask; DialogResult result = openFileDialog1.ShowDialog(); if (result != DialogResult.OK) { Close(); return; } FileToUse = openFileDialog1.FileName; XmlDocument Data = new XmlDocument(); XmlNode DataNode = Data.CreateXmlDeclaration("1.0", "UTF-8", null); Data.AppendChild(DataNode); XmlNode DataNodeRoot; XmlNode DataNodeNode; DataNodeRoot = Data.CreateElement("Logs"); Data.AppendChild(DataNodeRoot); DataNodeNode = Data.CreateElement("LastPath"); DataNodeNode.AppendChild(Data.CreateTextNode(Path.GetDirectoryName(FileToUse))); DataNodeRoot.AppendChild(DataNodeNode); Data.Save("Logs"); try { System.IO.StreamReader file = new System.IO.StreamReader(FileToUse); while ((line = file.ReadLine()) != null) { LogListBox.Items.Add(line); } file.Close(); } finally { LogListBox.SelectedIndex = 0; this.Text = this.Text + " - " + Path.GetFileNameWithoutExtension(@FileToUse); } }