static internal void ImportXML(string strRepositoryFullPath, string strPathToFile, string strFileName) { UCRepoClassLibrary.EAImporter theEAImporter; UCRepoClassLibrary.EAImporter.LogMsgCallbackType myLogMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(Program.FormLogMsg); UCRepoClassLibrary.EAImporter.LogMsgCallbackType myErrorMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(Program.FormLogError); theEAImporter = new UCRepoClassLibrary.EAImporter(myLogMsgCallback, myErrorMsgCallback); if (theEAImporter.Open(strRepositoryFullPath) != 0) { Console.WriteLine("."); Console.WriteLine("Import failed."); return; } int iErrorCount = theEAImporter.ImportXMLFile(strPathToFile, strFileName); Console.WriteLine("."); if (iErrorCount == 0) { Console.WriteLine("Import completed successfully"); } else { Console.WriteLine("Import ABORTED. Errors found. Error count=" + iErrorCount.ToString()); } theEAImporter.Close(); }
private void ImportXML_Click(object sender, EventArgs e) { UCRepoClassLibrary.EAImporter theEAImporter; string strPath; richTextBox1.Clear(); richTextBoxErrors.Clear(); UCRepoClassLibrary.EAImporter.LogMsgCallbackType myLogMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(this.FormLogMsg); UCRepoClassLibrary.EAImporter.LogMsgCallbackType myErrorMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(this.FormLogError); theEAImporter = new UCRepoClassLibrary.EAImporter(myLogMsgCallback, myErrorMsgCallback); string strRepositoryFullPath = textBoxEAFile.Text; theEAImporter.Open(strRepositoryFullPath); strPath = _strUserResourcesFolder + @"\FilledInTemplates"; int iErrorCount = theEAImporter.ImportXMLFile(strPath, listBox2.Text); if (iErrorCount == 0) { UCRepoClassLibrary.EAImporter.LogMsg(UCRepoClassLibrary.EAImporter.LogMsgType.Info, "Import completed successfully"); } else { UCRepoClassLibrary.EAImporter.LogMsg(UCRepoClassLibrary.EAImporter.LogMsgType.Info, "Import ABORTED. Errors found. Error count=" + iErrorCount.ToString()); } theEAImporter.Close(); Form1_Load(sender, e); // refresh screen }
private void disableEAImagesShareToolStripMenuItem_Click(object sender, EventArgs e) { System.Windows.Forms.DialogResult oResult = MessageBox.Show("Warning: please be certain you wish to disable the share. Import/Export functionality will not function until a new share is created.", "UCRepoClientApp", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (oResult == System.Windows.Forms.DialogResult.Cancel) { return; } UCRepoClassLibrary.EAImporter theEAImporter; UCRepoClassLibrary.EAImporter.LogMsgCallbackType myLogMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(this.FormLogMsg); UCRepoClassLibrary.EAImporter.LogMsgCallbackType myErrorMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(this.FormLogError); theEAImporter = new UCRepoClassLibrary.EAImporter(myLogMsgCallback, myErrorMsgCallback); int iResult = theEAImporter.DisableCurrentShare(); }
private void ImportWordDoc_Click(object sender, EventArgs e) { UCRepoClassLibrary.EAImporter theEAImporter; string strPathtoWordDoc; string strFileName; richTextBox1.Clear(); richTextBoxErrors.Clear(); UCRepoClassLibrary.EAImporter.LogMsgCallbackType myLogMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(this.FormLogMsg); UCRepoClassLibrary.EAImporter.LogMsgCallbackType myErrorMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(this.FormLogError); theEAImporter = new UCRepoClassLibrary.EAImporter(myLogMsgCallback, myErrorMsgCallback); string strRepositoryFullPath = textBoxEAFile.Text; if (theEAImporter.Open(strRepositoryFullPath) != 0) { // failed return; } strPathtoWordDoc = _strUserResourcesFolder + @"\FilledInTemplates"; strFileName = strPathtoWordDoc + "\\" + listBox1.Text; string strXSLTFullPath = _strBaseRsourcesFolder + @"\Translators\EUToIntermediate.xslt"; int iErrorCount = theEAImporter.ImportWordDoc(strPathtoWordDoc, listBox1.Text, strXSLTFullPath); if (iErrorCount == 0) { UCRepoClassLibrary.EAImporter.LogMsg(UCRepoClassLibrary.EAImporter.LogMsgType.Info, "Import completed successfully"); } else { UCRepoClassLibrary.EAImporter.LogMsg(UCRepoClassLibrary.EAImporter.LogMsgType.Info, "Import ABORTED. Errors found. Error count=" + iErrorCount.ToString()); } theEAImporter.Close(); Form1_Load(sender, e); // refresh screen }
private void CreateNewUserDataFolder() { string strBaseResourceFolder = ""; if (System.Diagnostics.Debugger.IsAttached) { //In Debugging mode strBaseResourceFolder = Path.GetFullPath(Application.StartupPath) + @"\..\..\..\.."; } else { //In Published mode strBaseResourceFolder = Path.GetFullPath(Application.StartupPath) + @"\Resources"; } FolderBrowserDialog folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); folderBrowserDialog.RootFolder = Environment.SpecialFolder.Personal; folderBrowserDialog.Description = "Select a folder for support data files. Creation of a new UCRepository folder is recommended. Sample files will automatically be copied to the specified folder."; string strUserResourcesFolder; // Show the FolderBrowserDialog. DialogResult result = folderBrowserDialog.ShowDialog(); if (result == DialogResult.OK) { strUserResourcesFolder = folderBrowserDialog.SelectedPath; } else { return; } try { if (!Directory.Exists(strUserResourcesFolder + @"\EAResources")) { DirectoryInfo di = Directory.CreateDirectory(strUserResourcesFolder + @"\EAResources"); } } catch (Exception ex) { MessageBox.Show("Could not create directory for EAResources: " + ex.Message); return; } try { if (!Directory.Exists(strUserResourcesFolder + @"\FilledInTemplates")) { DirectoryInfo di = Directory.CreateDirectory(strUserResourcesFolder + @"\FilledInTemplates"); } } catch (Exception ex) { MessageBox.Show("Could not create directory for FilledInTemplates: " + ex.Message); return; } try { System.IO.File.Copy(strBaseResourceFolder + @"\EAResources\ImportAll.cmd", strUserResourcesFolder + @"\ImportAll.cmd", true); System.IO.File.Copy(strBaseResourceFolder + @"\EAResources\ExchangeProfileXMI.xml", strUserResourcesFolder + @"\EAResources\ExchangeProfileXMI.xml", true); System.IO.File.Copy(strBaseResourceFolder + @"\EAResources\UCRepo.eap", strUserResourcesFolder + @"\EAResources\UCRepo.eap", true); System.IO.File.Copy(strBaseResourceFolder + @"\EAResources\EmptyUCRepo.eap", strUserResourcesFolder + @"\EAResources\EmptyUCRepo.eap", true); System.IO.File.Copy(strBaseResourceFolder + @"\EAResources\Help.rtf", strUserResourcesFolder + @"\EAResources\Help.rtf", true); System.IO.File.Copy(strBaseResourceFolder + @"\FilledInTemplates\IEC_UseCaseTemplateGOOD.docx", strUserResourcesFolder + @"\FilledInTemplates\IEC_UseCaseTemplateGOOD.docx", true); System.IO.File.Copy(strBaseResourceFolder + @"\TC8Template\IEC_UseCaseTemplate.docx", strUserResourcesFolder + @"\FilledInTemplates\IEC_UseCaseTemplate.docx", true); string strCommand = "call \"" + _strBaseAppPath + "\\UCRepoClientApp.exe\" %1 %2 %3 %4 %5 %6"; StreamWriter outfile = new StreamWriter(strUserResourcesFolder + @"\ucrepoclientapp.cmd", true); if (outfile != null) { outfile.WriteLine(strCommand); outfile.Close(); } } catch (Exception ex) { MessageBox.Show("Error copying file(s) to destination folder: " + ex.Message); return; } UCRepoClassLibrary.EAImporter theEAImporter; UCRepoClassLibrary.EAImporter.LogMsgCallbackType myLogMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(this.FormLogMsg); UCRepoClassLibrary.EAImporter.LogMsgCallbackType myErrorMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(this.FormLogError); theEAImporter = new UCRepoClassLibrary.EAImporter(myLogMsgCallback, myErrorMsgCallback); string strRepositoryFullPath = textBoxEAFile.Text; int iResult = theEAImporter.CreateFolderForShare(strUserResourcesFolder + @"\EAResources\EAImages"); // 0 = success other is failure if (iResult != 0) { MessageBox.Show("Error creating EAImages share folder."); return; } Properties.Settings.Default.ResourceFolder = strUserResourcesFolder; Properties.Settings.Default.Save(); }