Exemplo n.º 1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="theSession"></param>
 /// <param name="theEmulatorType"></param>
 /// <returns></returns>
 public static string GetSummaryNameForEmulator(DvtkApplicationLayer.Session theSession, Emulator.EmulatorTypes theEmulatorType)
 {
     return("Summary_" + GetExpandedNameForEmulator(theSession, theEmulatorType));
 }
Exemplo n.º 2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="theSession"></param>
 /// <param name="theEmulatorType"></param>
 /// <returns></returns>
 public static string GetExpandedNameForEmulator(DvtkApplicationLayer.Session theSession, Emulator.EmulatorTypes theEmulatorType)
 {
     return(GetExpandedName(theSession, GetBaseNameForEmulator(theEmulatorType)));
 }
Exemplo n.º 3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="theEmulatorType"></param>
        /// <returns></returns>
        public static string GetBaseNameForEmulator(Emulator.EmulatorTypes theEmulatorType)
        {
            string theBaseName = "";

            switch(theEmulatorType)
            {
                case Emulator.EmulatorTypes.PRINT_SCP:
                    theBaseName = "Pr_Scp_Em";
                    break;

                case Emulator.EmulatorTypes.STORAGE_SCP:
                    theBaseName = "St_Scp_Em";
                    break;

                case Emulator.EmulatorTypes.STORAGE_SCU:
                    theBaseName = "St_Scu_Em";
                    break;

                default:
                    // Not implemented.
                    Debug.Assert(false);
                    break;
            }

            return(theBaseName);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="theEvent"></param>
        public void Notify(object theEvent)
        {
            if (theEvent is EndExecution)
            {
                _State = ProjectFormState.IDLE;
            }
            if (theEvent is StartExecution)
            {
                if (userControlSessionTree.GetSelectedTag() is DvtkApplicationLayer.Script)
                {
                    _State = ProjectFormState.EXECUTING_SCRIPT;
                }
                else if (userControlSessionTree.GetSelectedTag() is DvtkApplicationLayer.Emulator)
                {
                    DvtkApplicationLayer.Emulator emulator = new DvtkApplicationLayer.Emulator();
                    emulator = (DvtkApplicationLayer.Emulator)userControlSessionTree.GetSelectedTag();
                    //
                    switch(emulator.EmulatorType)
                    {
                        case DvtkApplicationLayer.Emulator.EmulatorTypes.PRINT_SCP:
                            _State = ProjectFormState.EXECUTING_PRINT_SCP;
                            break;

                        case DvtkApplicationLayer.Emulator.EmulatorTypes.STORAGE_SCP:
                            _State = ProjectFormState.EXECUTING_STORAGE_SCP;
                            break;

                        case DvtkApplicationLayer.Emulator.EmulatorTypes.STORAGE_SCU:
                            _State = ProjectFormState.EXECUTING_STORAGE_SCU;
                            break;
                    }
                }
                else if (userControlSessionTree.GetSelectedTag() is DvtkApplicationLayer.MediaSession)
                {
                    _State = ProjectFormState.EXECUTING_MEDIA_VALIDATION;
                }
                else
                {
                    // Sanity check.
                    throw new System.ApplicationException("Not supposed to get here.");
                }
            }

            if (this.ParentForm is MainForm)
            {
                ((MainForm)this.ParentForm).Notify(this, theEvent);
            }
        }
Exemplo n.º 5
0
        public void UpdateEmulatorNode(TreeNode emulatorTreeNode,Emulator emulator )
        {
            emulatorTreeNode.Text = emulator.EmulatorName;
            if (emulator.ParentSession.IsExecute) {
                emulatorTreeNode.Text += " (executing)";
            }

            // Set the tag for this media file tree node.
            emulatorTreeNode.Tag = emulator;

            // Remove the old tree nodes that may be present under this script file tree node.
            emulatorTreeNode.Nodes.Clear();
            // For all results that belong to this media file, create a sub node.
            // The theResultsFiles object contains all results files that have not yet been added to
            // already processed script file nodes.
            // Set the text on this session tree node.
            foreach (Result results in emulator.Result ) {
                foreach (string filename in results.ResultFiles) {
                    TreeNode resultsFileTreeNode = new TreeNode();
                    emulatorTreeNode.Nodes.Add(resultsFileTreeNode);
                    UpdateResultsFileNode(resultsFileTreeNode,results,filename );
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Method to create result for a emulator and set its properties.
        /// </summary>
        public void CreateEmulatorFiles()
        {
            if(emulators == null) {
                emulators = new ArrayList();
            } else {
                emulators.Clear();
            }
            ArrayList emulatorFilesBaseName = new ArrayList();
            emulatorFilesBaseName.Add("Pr_Scp_Em");
            emulatorFilesBaseName.Add("St_Scp_Em");
            emulatorFilesBaseName.Add("St_Scu_Em");
            Emulator emulator = null;
            foreach ( string emulatorFileBaseName in emulatorFilesBaseName)
                {
                    if (emulatorFileBaseName == "Pr_Scp_Em" )
                    {
                        Emulator tempEmulator = new Emulator(this , "Print Scp Emulator");
                        tempEmulator.EmulatorType = Emulator.EmulatorTypes.PRINT_SCP ;
                        emulator = tempEmulator ;
                    }
                    else if (emulatorFileBaseName == "St_Scp_Em")
                    {
                        Emulator tempEmulator = new Emulator(this , "Storage Scp Emulator");
                        tempEmulator.EmulatorType = Emulator.EmulatorTypes.STORAGE_SCP;
                        emulator = tempEmulator ;
                    }
                    else
                    {
                        Emulator tempEmulator = new Emulator(this , "Storage Scu Emulator");
                        tempEmulator.EmulatorType = Emulator.EmulatorTypes.STORAGE_SCU;
                        emulator = tempEmulator ;

                    }
                    ArrayList emulatorFile = new ArrayList();
                    DirectoryInfo directoryInfo = new DirectoryInfo(((DvtkSession.EmulatorSession)Implementation).ResultsRootDirectory);
                    if( directoryInfo.Exists)
                    {
                        FileInfo[] filesInfo = directoryInfo.GetFiles("*" + emulatorFileBaseName + "*.xml");

                        foreach (FileInfo fileInfo in filesInfo)
                        {
                            Result correctResult = null;
                            String sessionId = GetSessionId (fileInfo.Name);

                            foreach(Result result in emulator.Result)
                            {
                                if (result.SessionId == sessionId)
                                {
                                    correctResult = result;
                                    break;
                                }
                            }

                            if (correctResult == null)
                            {
                                correctResult = new Result(this);
                                correctResult.SessionId = sessionId;

                                emulator.Result.Add(correctResult);
                            }

                            bool isSummaryFile = true;
                            bool isMainResult = true;

                            if (fileInfo.Name.ToLower().StartsWith("summary_"))
                            {
                                isSummaryFile = true;
                            }
                            else
                            {
                                isSummaryFile = false;
                            }

                            if (fileInfo.Name.ToLower().EndsWith(emulatorFileBaseName.ToLower() +"_res.xml"))
                            {
                                isMainResult = true;
                            }
                            else
                            {
                                isMainResult = false;
                            }

                            if (isSummaryFile)
                            {
                                if (isMainResult)
                                {
                                    correctResult.SummaryFile = fileInfo.Name;
                                    correctResult.ResultFiles.Add(fileInfo.Name);
                                }
                                else
                                {
                                    correctResult.SubSummaryResultFiles.Add(fileInfo.Name);
                                }
                            }
                            else
                            {
                                if (isMainResult)
                                {
                                    correctResult.DetailFile = fileInfo.Name;
                                    correctResult.ResultFiles.Add(fileInfo.Name);
                                }
                                else
                                {
                                    correctResult.SubDetailResultFiles.Add(fileInfo.Name);
                                }
                            }
                        }
                    }

                    Emulators.Add(emulator);
                }
        }