Exemplo n.º 1
0
        public void processPDUFiles(string signature)
        {
            DirectoryInfo theDirectoryInfo = null;

            string pduDirectory = snifferObj.CurrentBaseFileName + signature + @"\PDUs";

            try
            {
                if (pduDirectory != null)
                {
                    theDirectoryInfo = new DirectoryInfo(pduDirectory);
                    if (theDirectoryInfo.Exists)
                    {
                        FileInfo[] files = theDirectoryInfo.GetFiles();

                        string [] pduFileNames = null;
                        if (files.Length != 0)
                        {
                            // PDU files list will be set from Association class during dumping of all PDU files
                            // in the same order as written so we've to order the files in which order we received.
                            FileInfo[] OrderedFiles = orderPDUFiles(files);

                            ArrayList pduFilesList = new ArrayList();
                            foreach (FileInfo pduFileInfo in OrderedFiles)
                            {
                                pduFilesList.Add(pduFileInfo.FullName);
                            }
                            pduFileNames = (string[])pduFilesList.ToArray(typeof(string));
                        }
                        else
                        {
                            string msg = string.Format("No PDUs are saved in {0}", pduDirectory);
                            snifferObj.OutputHandler("Error: " + msg, true, true);
                        }

                        if (dvtkSnifferSession != null)
                        {
                            // Store the original data directory
                            string originalDataDirectory = dvtkSnifferSession.DataDirectory;

                            // Read all the PDU files in the file stream
                            if (pduFileNames.Length != 0)
                            {
                                // Set the Data directory per association
                                dvtkSnifferSession.DataDirectory = originalDataDirectory + signature;
                                Directory.CreateDirectory(dvtkSnifferSession.DataDirectory);
                                dvtkSnifferSession.ReadPDUsInFileStream(pduFileNames);
                            }
                            else
                            {
                                string msg = string.Format("No DICOM PDUs are captured.\n Please capture again.\n");
                                snifferObj.OutputHandler("\nWarning: " + msg, true, true);
                            }

                            // Start the child thread & set the thread options
                            ChildThread childThread = new ChildThread(snifferObj, dvtkSnifferSession, originalDataDirectory, signature);
                            childThread.Initialize(this);
                            childThread.Options.ResultsDirectory = snifferObj.CurrentBaseFileName;
                            childThread.Options.Identifier       = signature.Replace("-", "_");
                            childThread.Options.ResultsFileNameOnlyWithoutExtension  = childThread.Options.Identifier;
                            childThread.Options.StartAndStopResultsGatheringEnabled  = true;
                            childThread.Options.LogChildThreadsOverview              = false;
                            childThread.Options.LogThreadStartingAndStoppingInParent = false;
                            childThread.Options.LogWaitingForCompletionChildThreads  = false;

                            if (!snifferObj.generateDetailedValidation)
                            {
                                childThread.Options.GenerateDetailedResults = false;
                            }

                            childThread.Start();
                            childThread.WaitForCompletion();

                            //Display results only in case of single association selected
                            if (!snifferObj.evaluateAllAssociations)
                            {
                                snifferObj.summaryXmlFullFileName = childThread.Options.SummaryResultsFullFileName;
                                snifferObj.detailXmlFullFileName  = childThread.Options.DetailResultsFullFileName;
                            }
                        }
                    }
                    else
                    {
                        string msg = string.Format("No DICOM PDUs are captured.\n The tool may be running on localhost.\r\n");
                        snifferObj.OutputHandler("\nError: " + msg, true, true);
                    }
                }
                else
                {
                    string msg = string.Format("No DICOM PDUs are captured.\n The tool may be running on localhost.\r\n");
                    snifferObj.OutputHandler("\nError: " + msg, true, true);
                }
            }
            catch (Exception except)
            {
                string msg = string.Format("Exception:{0}\n", except.Message);
                MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        public void processPDUFiles(string signature)
        {
            DirectoryInfo theDirectoryInfo = null;

            string pduDirectory = snifferObj.CurrentBaseFileName + signature + @"\PDUs";
            try
            {
                if(pduDirectory != null)
                {
                    theDirectoryInfo = new DirectoryInfo(pduDirectory);
                    if(theDirectoryInfo.Exists)
                    {
                        FileInfo[] files = theDirectoryInfo.GetFiles();

                        string [] pduFileNames = null;
                        if(files.Length != 0)
                        {
                            // PDU files list will be set from Association class during dumping of all PDU files
                            // in the same order as written so we've to order the files in which order we received.
                            FileInfo[] OrderedFiles = orderPDUFiles(files);

                            ArrayList pduFilesList = new ArrayList();
                            foreach(FileInfo pduFileInfo in OrderedFiles)
                            {
                                pduFilesList.Add(pduFileInfo.FullName);
                            }
                            pduFileNames = (string[]) pduFilesList.ToArray(typeof(string));
                        }
                        else
                        {
                            string msg = string.Format("No PDUs are saved in {0}",pduDirectory);
                            snifferObj.OutputHandler("Error: " + msg, true, true);
                        }

                        if(dvtkSnifferSession != null)
                        {
                            // Store the original data directory
                            string originalDataDirectory = dvtkSnifferSession.DataDirectory;

                            // Read all the PDU files in the file stream
                            if(pduFileNames.Length != 0)
                            {
                                // Set the Data directory per association
                                dvtkSnifferSession.DataDirectory = originalDataDirectory + signature;
                                Directory.CreateDirectory(dvtkSnifferSession.DataDirectory);
                                dvtkSnifferSession.ReadPDUsInFileStream(pduFileNames);
                            }
                            else
                            {
                                string msg = string.Format("No DICOM PDUs are captured.\n Please capture again.\n");
                                snifferObj.OutputHandler("\nWarning: " + msg, true, true);
                            }

                            // Start the child thread & set the thread options
                            ChildThread childThread = new ChildThread(snifferObj,dvtkSnifferSession, originalDataDirectory, signature);
                            childThread.Initialize(this);
                            childThread.Options.ResultsDirectory = snifferObj.CurrentBaseFileName;
                            childThread.Options.Identifier = signature.Replace("-","_");
                            childThread.Options.ResultsFileNameOnlyWithoutExtension = childThread.Options.Identifier;
                            childThread.Options.StartAndStopResultsGatheringEnabled = true;
                            childThread.Options.LogChildThreadsOverview = false;
                            childThread.Options.LogThreadStartingAndStoppingInParent = false;
                            childThread.Options.LogWaitingForCompletionChildThreads  = false;

                            if (!snifferObj.generateDetailedValidation)
                                childThread.Options.GenerateDetailedResults = false;

                            childThread.Start();
                            childThread.WaitForCompletion();

                            //Display results only in case of single association selected
                            if (!snifferObj.evaluateAllAssociations)
                            {
                                snifferObj.summaryXmlFullFileName = childThread.Options.SummaryResultsFullFileName;
                                snifferObj.detailXmlFullFileName = childThread.Options.DetailResultsFullFileName;
                            }
                        }
                    }
                    else
                    {
                        string msg = string.Format("No DICOM PDUs are captured.\n The tool may be running on localhost.\r\n");
                        snifferObj.OutputHandler("\nError: " + msg, true, true);
                    }
                }
                else
                {
                    string msg = string.Format("No DICOM PDUs are captured.\n The tool may be running on localhost.\r\n");
                    snifferObj.OutputHandler("\nError: " + msg, true, true);
                }
            }
            catch (Exception except)
            {
                string msg = string.Format("Exception:{0}\n", except.Message);
                MessageBox.Show(msg, "Error",MessageBoxButtons.OK, MessageBoxIcon.Error );
            }
        }