//////////////////////////////////////////////////////////////////////// // Documentation-Tool //////////////////////////////////////////////////////////////////////// // Erstellt am: 2009-11-13 // Letzte Änderung: 2009-11-13 // Version: 1.0 // Erstellt von: Jonny-Wire //////////////////////////////////////////////////////////////////////// using System.Collections.Generic; using System.Text; using Eplan.EplApi.Gui; using System.IO; using System.Collections; using System.Diagnostics; using System.Globalization; public class FormAllInc : System.Windows.Forms.Form { //////////////////////////////////////////////////////////////////////// // Formular (Programmdateien zur Generierung des Forms //////////////////////////////////////////////////////////////////////// #region Formular public FormAllInc() { InitializeComponent(); } private System.Windows.Forms.Button btnAbbrechen; private System.Windows.Forms.ToolStripStatusLabel lblStatus2; private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.DataGridView dgvNoDocu; private System.Windows.Forms.ToolStripStatusLabel tsName; private System.Windows.Forms.ToolStripStatusLabel tsLabel; private System.Windows.Forms.ToolStripProgressBar tsPrgBar; private System.Windows.Forms.DataGridView dgvNoData; private System.Windows.Forms.Button btnParts; private System.Windows.Forms.Button button1; private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1; private System.Windows.Forms.DataGridViewTextBoxColumn colArtikelnummer; private System.Windows.Forms.DataGridViewTextBoxColumn colBez1; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.TextBox txtpath; private System.Windows.Forms.Button btnPath; /// /// Erforderliche Designervariable. /// private System.ComponentModel.IContainer components = null; /// /// Verwendete Ressourcen bereinigen. /// /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Vom Windows Form-Designer generierter Code /// /// Erforderliche Methode für die Designerunterstützung. /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. /// private void InitializeComponent() { this.btnCopyDocu = new System.Windows.Forms.Button(); this.btnAbbrechen = new System.Windows.Forms.Button(); this.lblStatus2 = new System.Windows.Forms.ToolStripStatusLabel(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.tsName = new System.Windows.Forms.ToolStripStatusLabel(); this.tsLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.tsPrgBar = new System.Windows.Forms.ToolStripProgressBar(); this.dgvNoDocu = new System.Windows.Forms.DataGridView(); this.colArtikelnummer = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colBez1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dgvNoData = new System.Windows.Forms.DataGridView(); this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.btnParts = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.txtpath = new System.Windows.Forms.TextBox(); this.btnPath = new System.Windows.Forms.Button(); this.statusStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgvNoDocu)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvNoData)).BeginInit(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // btnCopyDocu // this.btnCopyDocu.Location = new System.Drawing.Point(590, 485); this.btnCopyDocu.Name = "btnCopyDocu"; this.btnCopyDocu.Size = new System.Drawing.Size(120, 24); this.btnCopyDocu.TabIndex = 2; this.btnCopyDocu.Text = "Dokumente kopieren"; this.btnCopyDocu.UseVisualStyleBackColor = true; this.btnCopyDocu.Click += new System.EventHandler(this.btnOK_Click); // // btnAbbrechen // this.btnAbbrechen.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnAbbrechen.Location = new System.Drawing.Point(716, 485); this.btnAbbrechen.Name = "btnAbbrechen"; this.btnAbbrechen.Size = new System.Drawing.Size(66, 24); this.btnAbbrechen.TabIndex = 16; this.btnAbbrechen.Text = "Beenden"; this.btnAbbrechen.UseVisualStyleBackColor = true; // // lblStatus2 // this.lblStatus2.Margin = new System.Windows.Forms.Padding(2, 3, 0, 2); this.lblStatus2.Name = "lblStatus2"; this.lblStatus2.Size = new System.Drawing.Size(235, 17); this.lblStatus2.Text = "Letzte Änderung: 2009-10-23 - Johann Weiher"; // // statusStrip1 // this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.tsName, this.tsLabel, this.tsPrgBar}); this.statusStrip1.Location = new System.Drawing.Point(0, 517); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Size = new System.Drawing.Size(794, 22); this.statusStrip1.SizingGrip = false; this.statusStrip1.TabIndex = 27; this.statusStrip1.Text = "statusStrip1"; // // tsName // this.tsName.Name = "tsName"; this.tsName.Size = new System.Drawing.Size(165, 17); this.tsName.Text = "Erstellt: Jonny Wire - Version 1.0"; // // tsLabel // this.tsLabel.AutoSize = false; this.tsLabel.Margin = new System.Windows.Forms.Padding(10, 3, 10, 2); this.tsLabel.Name = "tsLabel"; this.tsLabel.Size = new System.Drawing.Size(210, 17); this.tsLabel.Text = "Documentation-Tool"; this.tsLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // tsPrgBar // this.tsPrgBar.AutoSize = false; this.tsPrgBar.Maximum = 0; this.tsPrgBar.Name = "tsPrgBar"; this.tsPrgBar.Size = new System.Drawing.Size(384, 16); // // dgvNoDocu // this.dgvNoDocu.AllowUserToAddRows = false; this.dgvNoDocu.AllowUserToResizeColumns = false; this.dgvNoDocu.AllowUserToResizeRows = false; this.dgvNoDocu.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dgvNoDocu.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dgvNoDocu.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders; this.dgvNoDocu.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dgvNoDocu.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colArtikelnummer, this.colBez1}); this.dgvNoDocu.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dgvNoDocu.Location = new System.Drawing.Point(6, 19); this.dgvNoDocu.MultiSelect = false; this.dgvNoDocu.Name = "dgvNoDocu"; this.dgvNoDocu.ReadOnly = true; this.dgvNoDocu.RowHeadersVisible = false; this.dgvNoDocu.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders; this.dgvNoDocu.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; this.dgvNoDocu.Size = new System.Drawing.Size(758, 205); this.dgvNoDocu.TabIndex = 31; // // colArtikelnummer // this.colArtikelnummer.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; this.colArtikelnummer.FillWeight = 166.5821F; this.colArtikelnummer.HeaderText = "Artikelnummer"; this.colArtikelnummer.Name = "colArtikelnummer"; this.colArtikelnummer.ReadOnly = true; this.colArtikelnummer.Resizable = System.Windows.Forms.DataGridViewTriState.True; this.colArtikelnummer.Width = 98; // // colBez1 // this.colBez1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colBez1.HeaderText = "Bezeichnung 1"; this.colBez1.Name = "colBez1"; this.colBez1.ReadOnly = true; // // dgvNoData // this.dgvNoData.AllowUserToAddRows = false; this.dgvNoData.AllowUserToResizeColumns = false; this.dgvNoData.AllowUserToResizeRows = false; this.dgvNoData.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dgvNoData.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dgvNoData.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders; this.dgvNoData.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dgvNoData.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dataGridViewTextBoxColumn1}); this.dgvNoData.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dgvNoData.Location = new System.Drawing.Point(6, 19); this.dgvNoData.MultiSelect = false; this.dgvNoData.Name = "dgvNoData"; this.dgvNoData.ReadOnly = true; this.dgvNoData.RowHeadersVisible = false; this.dgvNoData.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders; this.dgvNoData.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dgvNoData.Size = new System.Drawing.Size(758, 205); this.dgvNoData.TabIndex = 32; // // dataGridViewTextBoxColumn1 // this.dataGridViewTextBoxColumn1.FillWeight = 166.5821F; this.dataGridViewTextBoxColumn1.HeaderText = "Datei"; this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1"; this.dataGridViewTextBoxColumn1.ReadOnly = true; this.dataGridViewTextBoxColumn1.Resizable = System.Windows.Forms.DataGridViewTriState.True; // // btnParts // this.btnParts.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.btnParts.Location = new System.Drawing.Point(12, 485); this.btnParts.Name = "btnParts"; this.btnParts.Size = new System.Drawing.Size(100, 23); this.btnParts.TabIndex = 33; this.btnParts.Text = "Artikelverwaltung"; this.btnParts.UseVisualStyleBackColor = true; this.btnParts.Click += new System.EventHandler(this.btnParts_Click); // // button1 // this.button1.Location = new System.Drawing.Point(118, 485); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(86, 23); this.button1.TabIndex = 35; this.button1.Text = "Ordner öffnen"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // groupBox1 // this.groupBox1.Controls.Add(this.dgvNoData); this.groupBox1.Location = new System.Drawing.Point(12, 12); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(770, 230); this.groupBox1.TabIndex = 37; this.groupBox1.TabStop = false; this.groupBox1.Text = "Datei nicht gefunden"; // // groupBox2 // this.groupBox2.Controls.Add(this.dgvNoDocu); this.groupBox2.Location = new System.Drawing.Point(12, 249); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(770, 230); this.groupBox2.TabIndex = 38; this.groupBox2.TabStop = false; this.groupBox2.Text = "Artikel ohne externes Dokument 1"; // // txtpath // this.txtpath.Enabled = false; this.txtpath.Location = new System.Drawing.Point(210, 487); this.txtpath.Name = "txtpath"; this.txtpath.Size = new System.Drawing.Size(344, 20); this.txtpath.TabIndex = 39; // // btnPath // this.btnPath.Location = new System.Drawing.Point(560, 487); this.btnPath.Name = "btnPath"; this.btnPath.Size = new System.Drawing.Size(24, 20); this.btnPath.TabIndex = 40; this.btnPath.Text = "..."; this.btnPath.UseVisualStyleBackColor = true; this.btnPath.Click += new System.EventHandler(this.btnPath_Click); // // FormAllInc // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.btnAbbrechen; this.ClientSize = new System.Drawing.Size(794, 539); this.Controls.Add(this.btnPath); this.Controls.Add(this.txtpath); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.button1); this.Controls.Add(this.btnParts); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.btnAbbrechen); this.Controls.Add(this.btnCopyDocu); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MaximumSize = new System.Drawing.Size(800, 800); this.MinimizeBox = false; this.Name = "FormAllInc"; this.ShowIcon = false; this.ShowInTaskbar = false; this.Load += new System.EventHandler(this.FormDocu_Load_1); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgvNoDocu)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvNoData)).EndInit(); this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Button btnCopyDocu; # endregion // Code für das Formular //////////////////////////////////////////////////////////////////////// // Start Action //////////////////////////////////////////////////////////////////////// // Projektdatei, Projektpfad, Projektname public string sSelectedProjectData = string.Empty; // kompletter Pfad + Projektdateinamen + Erweiterung public string sSelectedProjectName = string.Empty; // Projektname public string sSelectedProjectPath = string.Empty; // Projektpfad public string sSelectedProjectPathDocs = string.Empty; // Projektpfad\Documents public string sMD_DOCUMENTS = string.Empty; // Dokumentenpfad (Pfadvariable Eplan) // Action initialisieren [DeclareAction("DokumentationJW")] public void AllInc() { // Form aufrufen FormAllInc Frm1 = new FormAllInc(); Frm1.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; Frm1.ShowDialog(); return; } // OK-Button public void btnOK_Click(object sender, System.EventArgs e) { //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// // Fehlende Dateien + Dateien kopieren //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// // BUGFIX: Eplan sperrt Objekt new CommandLineInterpreter().Execute("EsGenerateConnections"); //////////////////////////////////////////////////////////////////////// // Beschriftung //////////////////////////////////////////////////////////////////////// ActionCallingContext labellingContext1 = new ActionCallingContext(); labellingContext1.AddParameter("CONFIGSCHEME", "Dokumentation"); labellingContext1.AddParameter("DESTINATIONFILE", sSelectedProjectPath + "Dokumentation_1_out.txt"); labellingContext1.AddParameter("FILTERSCHEME", ""); labellingContext1.AddParameter("LANGUAGE", "de_DE"); labellingContext1.AddParameter("LogMsgActionDone", "true"); labellingContext1.AddParameter("SHOWOUTPUT", "0"); labellingContext1.AddParameter("RECREPEAT", "1"); labellingContext1.AddParameter("SORTSCHEME", ""); labellingContext1.AddParameter("TASKREPEAT", "1"); new CommandLineInterpreter().Execute("label", labellingContext1); //////////////////////////////////////////////////////////////////////// // Progressbar //////////////////////////////////////////////////////////////////////// int iZeilenMax = 0; int iZeilenNow = 0; //////////////////////////////////////////////////////////////////////// // Dateinamen //////////////////////////////////////////////////////////////////////// string sDokulisteFullFilenameEplanOut = sSelectedProjectPath + "Dokumentation_1_out.txt"; string sDokulisteDelNoPDF = sSelectedProjectPath + "Dokumentation_2_del_Description.txt"; string sDokulisteDupl = sSelectedProjectPath + "Dokumentation_3_Dupli.txt"; string sDokulisteMdDocs = sSelectedProjectPath + "Dokumentation_4_MD_Docs.txt"; string sDokulisteCopyFail = sSelectedProjectPath + "Dokumentation_5_Copy_fail.txt"; if(File.Exists(sDokulisteFullFilenameEplanOut)) { //////////////////////////////////////////////////////////////////////// // 1. Filtern nach Zeilen welche .pdf-Dateien enhalten //////////////////////////////////////////////////////////////////////// List resultPDF = new List(); foreach (string linePDF in File.ReadAllLines(sDokulisteFullFilenameEplanOut)) { if (linePDF.ToLower().EndsWith(".pdf")) { resultPDF.Add(linePDF); } } File.WriteAllLines(sDokulisteDelNoPDF, resultPDF.ToArray()); //////////////////////////////////////////////////////////////////////// // 2. Doppelte Einträge entfernen //////////////////////////////////////////////////////////////////////// // Einlesen ArrayList Text = new ArrayList(); System.IO.StreamReader SR = new System.IO.StreamReader(sDokulisteDelNoPDF); while (SR.Peek() > -1) { Text.Add(SR.ReadLine()); } SR.Close(); // Arraylist: Doppelte Einträge suchen Hashtable ht = new Hashtable(); ArrayList textNeu = new ArrayList(); foreach (Object obj in Text) { String val = obj.ToString(); if (!ht.Contains(val)) { textNeu.Add(obj); ht[val] = true; iZeilenMax += 1; } } // Schreiben System.IO.StreamWriter sr = new System.IO.StreamWriter(sDokulisteDupl, false, System.Text.Encoding.Unicode); for (int i = 0; i < textNeu.Count; i++) sr.WriteLine((string)textNeu[i]); sr.Close(); tsPrgBar.Maximum = iZeilenMax; //////////////////////////////////////////////////////////////////////// // 3. Pfadvariable ersetzen //////////////////////////////////////////////////////////////////////// if (File.Exists(sDokulisteDupl)) { string sMDdocs = ""; StreamReader srMDdocs = new StreamReader(sDokulisteDupl, System.Text.Encoding.Default); sMDdocs = srMDdocs.ReadToEnd(); sMDdocs = sMDdocs.Replace(@"$(MD_DOCUMENTS)", sMD_DOCUMENTS); srMDdocs.Close(); StreamWriter swFTP = new StreamWriter(sDokulisteMdDocs); swFTP.Write(sMDdocs); swFTP.Close(); } //////////////////////////////////////////////////////////////////////// // 4. Dateien kopieren //////////////////////////////////////////////////////////////////////// List resultCopy = new List(); foreach (string lineCopy in File.ReadAllLines(sDokulisteMdDocs)) { string sFileName = System.IO.Path.GetFileName(lineCopy); string sdestFile = System.IO.Path.Combine(txtpath.Text, sFileName); iZeilenNow += 1; tsPrgBar.Value = iZeilenNow; tsLabel.Text = "Kopiere Datei " + iZeilenNow + " von " + iZeilenMax; this.Update(); if (!File.Exists(lineCopy)) { resultCopy.Add(lineCopy); } else { if (!File.Exists(sdestFile)) { System.IO.File.Copy(lineCopy, sdestFile); } } } File.WriteAllLines(sDokulisteCopyFail, resultCopy.ToArray()); //////////////////////////////////////////////////////////////////////// // 5. Fehlende Dateien anzeigen //////////////////////////////////////////////////////////////////////// dgvNoData.Rows.Clear(); if (File.Exists(sDokulisteCopyFail)) { foreach (string lineMissingCopy in File.ReadAllLines(sDokulisteCopyFail)) { dgvNoData.Rows.Add(lineMissingCopy); } } } //End: file überprüfen else { MessageBox.Show("Es wurde keine Dokumentationliste erzeugt!\nMögliche Fehlerursachen: Beschriftungsschema fehlt, Beschriftungsprozessorfehler"); } //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// // Fehlende Dokumentation bei Artikel //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// // Dateinamen //////////////////////////////////////////////////////////////////////// string sMissingDokuOut = sSelectedProjectPath + "Dokumentation_fehlt_1_out.txt"; string sMissingDoku = sSelectedProjectPath + "Dokumentation_fehlt_2_NoDocu.txt"; if (File.Exists(sMissingDoku)) { File.Delete(sMissingDoku); } //////////////////////////////////////////////////////////////////////// // Beschriftung //////////////////////////////////////////////////////////////////////// ActionCallingContext labellingContext2 = new ActionCallingContext(); labellingContext2.AddParameter("CONFIGSCHEME", "Dokumentation-fehlt"); labellingContext2.AddParameter("DESTINATIONFILE", sMissingDokuOut); labellingContext2.AddParameter("FILTERSCHEME", ""); labellingContext2.AddParameter("LANGUAGE", "de_DE"); labellingContext2.AddParameter("LogMsgActionDone", "true"); labellingContext2.AddParameter("SHOWOUTPUT", "0"); labellingContext2.AddParameter("RECREPEAT", "1"); labellingContext2.AddParameter("SORTSCHEME", ""); labellingContext2.AddParameter("TASKREPEAT", "1"); new CommandLineInterpreter().Execute("label", labellingContext2); //////////////////////////////////////////////////////////////////////// // Filter ob Dokument hinterlegt //////////////////////////////////////////////////////////////////////// if (File.Exists(sMissingDokuOut)) { List resultNoDocu = new List(); foreach (string lineNoDocu in File.ReadAllLines(sMissingDokuOut)) { if (lineNoDocu.EndsWith("\t\t")) { resultNoDocu.Add(lineNoDocu); } } File.WriteAllLines(sMissingDoku, resultNoDocu.ToArray()); } //End: file überprüfen else { MessageBox.Show("Es wurde keine Dokumentation-fehlt Liste erzeugt!\nMögliche Fehlerursachen: Beschriftungsschema fehlt, Beschriftungsprozessorfehler"); } //////////////////////////////////////////////////////////////////////// // Fehlende Dokumentation anzeigen //////////////////////////////////////////////////////////////////////// dgvNoDocu.Rows.Clear(); if (File.Exists(sMissingDoku)) { foreach (string lineMissingDocu in File.ReadAllLines(sMissingDoku)) { string[] splitMissingDocu = lineMissingDocu.Split('\t'); dgvNoDocu.Rows.Add(splitMissingDocu); } } tsLabel.Text = "Dokumentation wurde erzeugt"; tsPrgBar.Value = 0; //Dateien löschen try { File.Delete(sDokulisteFullFilenameEplanOut); File.Delete(sDokulisteDelNoPDF); File.Delete(sDokulisteDupl); File.Delete(sDokulisteCopyFail); File.Delete(sMissingDokuOut); File.Delete(sMissingDoku); File.Delete(sDokulisteMdDocs); } catch { } return; } // Laden der Form: Projektdaten / Titelzeile private void FormDocu_Load_1(object sender, System.EventArgs e) { //////////////////////////////////////////////////////////////////////// // Allgemeine Funktionen (Projekt) //////////////////////////////////////////////////////////////////////// // Dokumentenverzeichnis Eplan.EplApi.Base.PathMap oPM = new Eplan.EplApi.Base.PathMap(); sMD_DOCUMENTS = oPM.Substitute("$(MD_DOCUMENTS)"); // Projektdatei komplett CommandLineInterpreter oCLI = new CommandLineInterpreter(); Eplan.EplApi.ApplicationFramework.ActionCallingContext ctx = new Eplan.EplApi.ApplicationFramework.ActionCallingContext(); ctx.AddParameter("TYPE", "PROJECT"); bool bRet = oCLI.Execute("selectionset", ctx); // Action: Projektpfad if (bRet == true) { ctx.GetParameter("PROJECT", ref sSelectedProjectData); } // Projektname sSelectedProjectName = System.IO.Path.GetFileNameWithoutExtension(sSelectedProjectData); // Projektpfad sSelectedProjectPath = System.IO.Path.GetDirectoryName(sSelectedProjectData) + @"\"; // Projektpfad/Documents sSelectedProjectPathDocs = sSelectedProjectPath + "Documents"; if (!Directory.Exists(sSelectedProjectPathDocs)) { Directory.CreateDirectory(sSelectedProjectPathDocs); } // Textbox txtpath.Text = sSelectedProjectPathDocs; // Titelzeile this.Text = "Dokumentation erzeugen [Projekt: " + sSelectedProjectName + "]"; return; } // Artikelverwaltung öffnen private void btnParts_Click(object sender, System.EventArgs e) { CommandLineInterpreter oCLI = new CommandLineInterpreter(); oCLI.Execute("XPartsManagementStart"); } // Im Explorer öffnen private void button1_Click(object sender, System.EventArgs e) { // Explorer System.Diagnostics.Process.Start("explorer", txtpath.Text); } private void btnPath_Click(object sender, System.EventArgs e) { System.Windows.Forms.FolderBrowserDialog objDialog = new FolderBrowserDialog(); objDialog.Description = "Wähle den Zielordner:"; objDialog.SelectedPath = txtpath.Text; // Vorgabe Pfad (und danach der gewählte Pfad) DialogResult objResult = objDialog.ShowDialog(this); if (objResult == DialogResult.OK) { txtpath.Text = objDialog.SelectedPath; } } }