Example #1
0
        private static void ValidateMediaFile()
        {
            MediaSession mediaSession = new MediaSession();
            mediaSession.OptionVerbose = _OptionVerbose;
            mediaSession.SessionFileName = (string)_NonOptions[0];
            FileInfo sessionFileName = null;
            if(mediaSession.SessionFileName == "")
            {
                Console.WriteLine("Warning : Provide proper arguments.\n");
                return;
            }
            else
            {
                sessionFileName = new FileInfo(mediaSession.SessionFileName);
            }

            if (!sessionFileName.Exists){
                Console.WriteLine(" Error : Session File  does not exists.\n");
            }else {

                MediaInput mediaInput = new MediaInput();
                string mediaFile = (string)_NonOptions[1];
                FileInfo mediaFileInfo = null;
                if(mediaFile == "")
                {
                    Console.WriteLine("Warning : Provide proper arguments.\n");
                    return;
                }
                else
                {
                    mediaFileInfo = new FileInfo(mediaFile);
                }
                if (!mediaFileInfo.Exists){
                    Console.WriteLine("Error : Media File does not exists.\n");
                }else {
                    mediaInput.FileNames.Add(mediaFile);
                    Console.WriteLine();
                    Console.WriteLine("> Validating media file {0}...", mediaInput.FileNames[0]);
                    mediaSession.Execute(mediaInput);
                    DisplayResultCounters(mediaSession);
                }
            }
        }
Example #2
0
        private static void ValidateMediaDirectory()
        {
            MediaSession mediaSession = new MediaSession();
            mediaSession.OptionVerbose = _OptionVerbose;
            mediaSession.SessionFileName = (string)_NonOptions[0];
            FileInfo sessionFileName = null;
            ArrayList allDCMFilesTemp = new ArrayList();
            FileInfo mediaFileInfo = null;
            if(mediaSession.SessionFileName == "")
            {
                Console.WriteLine("Warning : Provide proper arguments.\n");
                return;
            }
            else
            {
                sessionFileName = new FileInfo(mediaSession.SessionFileName);
            }

            if (!sessionFileName.Exists)
            {
                Console.WriteLine(" Error : Session File  does not exists.\n");
            }
            else
            {

                MediaInput mediaInput = new MediaInput();
                string mediaFile = (string)_NonOptions[1];
                mediaFileInfo = new FileInfo(mediaFile);

                if(mediaFile == "")
                {
                    Console.WriteLine("Warning : Provide proper arguments.\n");
                    return;
                }
                else if (mediaFileInfo.Exists)
                {
                    allDCMFilesTemp.Add (mediaFileInfo.FullName);
                    mediaInput.FileNames = allDCMFilesTemp;
                    Console.WriteLine();
                    Console.WriteLine("> Validating media file {0}...", mediaInput.FileNames[0]);
                    mediaSession.Execute(mediaInput);
                    DisplayResultCounters(mediaSession);
                    DetermineExitCode(mediaSession);
                }
                else
                {
                    DirectoryInfo theDirectoryInfo = new DirectoryInfo(mediaFile);
                    if (!theDirectoryInfo.Exists)
                    {
                        Console.WriteLine("Error : Directory or File mentioned does not exists.\n");
                    }
                    else
                    {

                        mediaInput.FileNames = GetFilesRecursively(theDirectoryInfo);
                        Console.WriteLine();
                        Console.WriteLine("> Validating media files ...");
                        _exitCode = mediaSession.ExecuteDir(mediaInput);
                        //DisplayResultCounters(mediaSession);
                        //DetermineExitCode(mediaSession);
                    }
                }
            }
        }