private void btnOk_Click_1(object sender, EventArgs e) { _projectInfo = new ProjectInfo(); _projectInfo.ProjectTitle = edtProjectName.GetValue<string>(); _projectInfo.ProjectName = FileUtils.MakeGoodFileName( edtProjectName.GetValue<string>() ); _projectInfo.Uuid = edtUUID.GetValue<string>(); if (_uutDescription != null) { _projectInfo.UutId = _uutDescription.uuid; _projectInfo.UutName = _uutDescription.Item.Identification.ModelName; } }
private static void SaveProjectInfo( ProjectInfo projectInfo, TestProgramSet currentTestProgramSet ) { FileManager.WriteFile( currentTestProgramSet.TestSetDirectory.FullName + @"\project-info.xml", Encoding.UTF8.GetBytes( projectInfo.Serialize() ) ); }
private static ProjectInfo CreateProjectInfoFile() { var pi = new ProjectInfo(); pi.ProjectName = Instance.CurrentTestProgramSet.TestSetName; pi.Uuid = Guid.NewGuid().ToString(); if (UutManager.ProjectHasUUT( pi.ProjectName )) { UUTDescription uut = UutManager.GetProjectUUT( pi.ProjectName ); if (uut != null) { pi.UutName = uut.name; pi.UutId = uut.uuid; } } string fileName = Path.Combine( ATMLContext.TESTSET_PATH, pi.ProjectName, "project-info.xml" ); FileManager.WriteFile( fileName, Encoding.UTF8.GetBytes( pi.Serialize() ) ); LogManager.Warn( "Failed to find the project information file so a new file has been created." ); return pi; }
public static void CreateProject( ProjectInfo projectInfo ) { //--- Prompt for a test set name ---// //--- Check if the name exisists ---// //--- If name exists then notify the user, ask if they want to open that test set ---// //--- Otherwise create the test set and open it ---// if (projectInfo != null) { TestProgramSet currentTestProgramSet = TestProgramSet.CreateTestSet( projectInfo.ProjectName ); if (currentTestProgramSet != null) { SaveProjectInfo( projectInfo, currentTestProgramSet ); OpenProject( projectInfo.ProjectName ); Document uutDescriptionDocument = DocumentManager.GetDocument( projectInfo.UutId ); if (uutDescriptionDocument != null) { SaveATMLDocument( UutManager.BuildAtmlFileName( projectInfo.UutName ), AtmlFileType.AtmlTypeUut, uutDescriptionDocument.DocumentContent ); } //--- Create a Test Description ---// if (uutDescriptionDocument != null) { var uutDoc = new DocumentReference(); uutDoc.ID = "UUT1"; uutDoc.uuid = uutDescriptionDocument.uuid; var uutRef = new ItemDescriptionReference(); uutRef.Item = uutDoc; var testConfiguration = new TestConfiguration15(); testConfiguration.uuid = Guid.NewGuid().ToString(); testConfiguration.TestedUUTs.Add( uutRef ); SaveATMLDocument( projectInfo.ProjectName + ATMLContext.ATML_CONFIG_FILENAME_SUFFIX, AtmlFileType.AtmlTypeTestConfiguration, Encoding.UTF8.GetBytes( testConfiguration.Serialize() ) ); } } } }
/** * */ public void OpenReaderDocument() { try { OnBeginOpenDocument(); //edtReaderInput.Text = getTPSIFile(out documentName); if (OpenInputFile(out _fileInfo, out _content)) { _documentName = _fileInfo.Name; _extension = _fileInfo.Extension.ToLower(); bool ok2Open = true; if (IsNavigatable()) OnNavigatableInputDocument(); if (IsParsible()) { string tpsName = GetTPSName(); if (!string.IsNullOrEmpty(tpsName)) { //Check to see if there is an open project if (ProjectManager.HasOpenProject()) { string projectName = ProjectManager.ProjectName; if (projectName == tpsName) { } else { //If the project does not match the tps name ask user // if they would like to create a new project or add the ProjectInfo pi = new ProjectInfo(); pi.ProjectName = tpsName; ProjectManager.CreateProject(pi); } //Check to see if the project name matches the tps name // document to the current project if one is open } else { //If no project exists create one if (ProjectManager.HasProject(tpsName)) { ProjectManager.OpenProject(tpsName); } else { ProjectInfo pi = new ProjectInfo(); pi.ProjectName = tpsName; ProjectManager.CreateProject(pi); } } } } //------------------------------------------------------------------------------// //--- Check if the document is in the current test set, if not ask to add it ---// //------------------------------------------------------------------------------// bool hasReaderDocument = ProjectManager.HasReaderDocument(_documentName); if (hasReaderDocument) { ok2Open = false; if (DialogResult.Yes == MessageBox.Show( @"This file already exists as a reader document. Would you like to replace it?", @"V E R I F Y", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { ok2Open = true; } } if (ok2Open) { if (!hasReaderDocument && DialogResult.Yes == MessageBox.Show( string.Format( @"Would you like store this document as a reader document in the {0} project?", ProjectManager.ProjectName), @"V E R I F Y", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { ProjectManager.SaveReaderDocument(_documentName, _content); } OnOpenInputDocument(_fileInfo, _content); if (IsParsible()) OnParseableInputDocument(); } } LogManager.SourceTrace( SOURCE, "Reader Input File \"{0}\" opened. ", _documentName); } catch (Exception err) { LogManager.SourceError(SOURCE, err); } }
public void Copy(ProjectInfo projectInfo) { _projectName = projectInfo.ProjectName; _uuid = projectInfo.Uuid; _uutId = projectInfo.UutId; _uutName = projectInfo.UutName; _projectTitle = projectInfo._projectTitle; _className = projectInfo._className; TranslationInfo = projectInfo.TranslationInfo; }
private void InstanceOnProjectOpened( string testProgramSetName ) { try { dgPropertyInfo.Rows.Clear(); _projectOpened = true; _projectInfo = ProjectManager.ProjectInfo; _originalProjectInfo = XmlUtils.SerializeObject( _projectInfo ); _projectInfo.TranslationInfo = _projectInfo.TranslationInfo ?? new TranslationInfo(); chkSegmentedSource.Checked = _projectInfo.TranslationInfo.Segmented; _sourceFiles = _projectInfo.TranslationInfo.SourceFiles; var fileNames = new List<string>(); if (_projectInfo != null) { CreatePropertyInfoComboRow( "Station Type", _projectInfo.ClassName ); dgPropertyInfo.Rows.Add( CreatePropertyInfoTextRow( "Project Name", _projectInfo.ProjectName ) ); dgPropertyInfo.Rows.Add( CreatePropertyInfoTextRow( "ID", _projectInfo.Uuid ) ); dgPropertyInfo.Rows.Add( CreatePropertyInfoTextRow( "UUT", _projectInfo.UutName ) ); dgPropertyInfo.Rows.Add( CreatePropertyInfoTextRow( "UUT ID", _projectInfo.UutId ) ); } FileManager.GetFileNames( fileNames, ATMLContext.ProjectTranslatorSourcePath, false, "*.as", true ); if (_sourceFiles == null) { _sourceFiles = new List<TranslationSourceInfo>(); foreach (string fileName in fileNames) { _sourceFiles.Add( new TranslationSourceInfo( fileName ) ); } if (_sourceFiles.Count > 0) _sourceFiles[0].Primary = true; _projectInfo.TranslationInfo.SourceFiles = _sourceFiles; } _bindingSource.DataSource = _sourceFiles; dgBuildList.DataSource = _bindingSource; dgBuildList.CellClick += DgBuildListOnCellClick; dgBuildList.CellValueChanged += DgBuildListOnCellValueChanged; dgBuildList.CellMouseUp += DgBuildListOnCellMouseUp; SetSourceGridState(); SetButtonStates(); ResizePropertyGrid(); } catch (Exception err) { LogManager.Error( err ); } }