private void ConvertNext()
        {
            //while (true)
            //{

            if (_conversionQueue.Count == 0)
            {
                return;
            }

            ConvertProcess convertProcess = _conversionQueue.Dequeue();

            //if (downloadProcess.HasExited)
            //{
            //    continue;
            //}

            _currentConversions.Add(convertProcess);

            void ConversionFinished(object sender, EventArgs e)
            {
                convertProcess.Exited -= ConversionFinished;

                _currentConversions.Remove(convertProcess);

                ConvertNext();
            }

            convertProcess.Exited += ConversionFinished;

            convertProcess.Start();

            //    break;
            //}
        }
Exemplo n.º 2
0
        public FileCustomize(int id, string filename, string directory, string customizedate, ConvertCategory category, ConvertProcess process)
        {
            this.Id   = id;
            this.File = filename;
            string[] para = directory.Split('/');

            this.SetFullPathName(para);
            this.CustomizedDate  = customizedate;
            this.ProcessCategory = category;
            this.WarningMessage  = string.Empty;

            this.ShowHistory = process;
            //this.ForceTerminate = false;
            this.CheckRound    = 0;
            this.CheckFileList = new ArrayList();
            //this.CancelToke = cancelToke;
        }
        private void allFinished(bool showMain = false, ConvertProcess.ProcessStatus status = ConvertProcess.ProcessStatus.Waiting)
        {
            App.Log.Add(string.Format("Doba trvání převodu: {0}", DateTime.Now - startTime));
            timer.Stop();
            TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;

            if (showMain || status == ConvertProcess.ProcessStatus.Stopped)
            {
                Content = originalContent;
                AllowDrop = true;
            }
            else
            {
                convertDone = new ConvertDone(status);
                convertDone.BackButton += new EventHandler(convertDone_BackButton);
                convertDone.ShowOutputFolder += new EventHandler(convertDone_ShowOutputFolder);
                Content = convertDone;
            }
        }
Exemplo n.º 4
0
        public ProcessResults Process(int firstNumber, int lastNumber, out int countModified)
        {
            try
            {
                var process = new ConvertProcess(firstNumber, lastNumber);

                string pattern   = @"(\[""onboard_num""\]\s=\s"")(\d\d\d)("")";
                var    evaluator = new MatchEvaluator(m =>
                {
                    if (process.CurrentNumber > process.LastNumber)
                    {
                        throw new OutOfNumbersException();
                    }

                    string value = string.Format("{0:000}", process.CurrentNumber++);
                    return($"{m.Groups[1].Value}{value}{m.Groups[3].Value}");
                });

                string content = this._Content;
                content       = Regex.Replace(content, pattern, evaluator);
                this._Content = content;

                countModified = process.CurrentNumber - firstNumber;
                return(ProcessResults.Ok);
            }
            catch (OutOfNumbersException)
            {
                countModified = 0;
                return(ProcessResults.OutOfNumbers);
            }
            catch
            {
                countModified = 0;
                return(ProcessResults.Error);
            }
        }
Exemplo n.º 5
0
 public void Initialise(IVideoViewModel videoViewModel, ConvertProcess process, ConvertProgress convertProgress)
 {
     Initialise(videoViewModel, process);
     ConvertProgress = convertProgress;
 }
Exemplo n.º 6
0
        public IConvertProcessViewModel MakeConvertProcessViewModel(IVideoViewModel videoViewModel, ConvertProcess process, ConvertProgress progress)
        {
            IConvertProcessViewModel convertProcessViewModel = IoC.Get <IConvertProcessViewModel>();

            convertProcessViewModel.Initialise(videoViewModel, process, progress);

            return(convertProcessViewModel);
        }
Exemplo n.º 7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            int             iCount   = args.Count();
            ConvertCategory category = ConvertCategory.CheckBrokenLinkByService;
            ConvertProcess  process  = ConvertProcess.ShowResult;

            DateTime timeStart = DateTime.Now;

            //TimeSpan runTime = new TimeSpan();
            //DateTime timeEnd = new DateTime();


            if (iCount != 2)
            {
                ShowUseageTip();
                return;
            }
            else
            {
                switch (args[0].TrimStart('-'))
                {
                case "S":
                case "s":
                    category = ConvertCategory.CheckBrokenLinkByService;
                    break;

                case "F":
                case "f":
                    category = ConvertCategory.CheckBrokenLinkByFile;
                    break;

                default:
                    ShowUseageTip();
                    return;
                }

                if (iCount == 2)
                {
                    switch (args[1].TrimStart('-'))
                    {
                    case "H":
                    case "h":
                        process = ConvertProcess.ShowHistory;
                        break;

                    case "R":
                    case "r":
                        process = ConvertProcess.ShowResult;
                        break;

                    default:
                        ShowUseageTip();
                        return;
                    }
                }
            }


            string error = "";

            string fileprefix = CommonFun.GetConfigurationValue("GlobalRepository", ref error);

            if (error.Length > 0)
            {
                Console.WriteLine(error);
                ExitWithUserConfirm();
                return;
            }

            string customizedate = CommonFun.GetConfigurationValue("CustomizeDate", ref error);

            if (error.Length > 0)
            {
                Console.WriteLine(error);
                ExitWithUserConfirm();
                return;
            }

            bool   successFlag   = false;
            int    MaxCheckRound = 0;
            string configValue   = CommonFun.GetConfigurationValue("CheckRound", ref error);

            if (error.Length > 0)
            {
                Console.WriteLine(error);
                ExitWithUserConfirm();
                return;
            }
            else
            {
                successFlag = int.TryParse(configValue, out MaxCheckRound);
                if (successFlag == true)
                {
                }
                else
                {
                    Console.WriteLine("Convert {0} to int failed!", configValue);
                    ExitWithUserConfirm();
                    return;
                }
            }



            string filename     = "";
            string directory    = "";
            string curtFullName = "";

            List <FileCustomize> fileList = new List <FileCustomize>();
            ArrayList            arrFile  = new ArrayList();

            //Get the thread count
            int threadCount = 0;

            switch (category)
            {
            case ConvertCategory.CheckBrokenLinkByService:
                arrFile = GetFileListByService();
                break;

            case ConvertCategory.CheckBrokenLinkByFile:
                arrFile = GetFileListByArticles();
                break;
            }


            threadCount = arrFile.Count;
            Thread[] newThreads = new Thread[threadCount];
            //CancellationTokenSource[] threadCancel = new CancellationTokenSource[threadCount];

            for (int i = 0; i < threadCount; i++)
            {
                curtFullName = arrFile[i].ToString();
                filename     = Path.GetFileName(curtFullName);
                directory    = curtFullName.Substring(fileprefix.Length, curtFullName.Length - fileprefix.Length - filename.Length - 1).Replace("\\", "/");

                //threadCancel[i] = new CancellationTokenSource();

                FileCustomize curtFile = new FileCustomize(i, filename, directory, customizedate, category, process);
                fileList.Add(curtFile);
                newThreads[i] = new Thread(new ThreadStart(curtFile.ProcessFileCustomize));


                newThreads[i].Start();

#if DEBUG
                newThreads[i].Join();
#endif
            }


            bool allThreadOver = false;
            while (allThreadOver == false)
            {
                Thread.Sleep(10000);
                allThreadOver = true;
                for (int i = 0; i < threadCount; i++)
                {
                    if (newThreads[i].ThreadState != ThreadState.Stopped && newThreads[i].ThreadState != ThreadState.Aborted)
                    {
                        allThreadOver = false;
                        Console.WriteLine(string.Format("Checking status of the Thread[{0}] : {1} ", i, newThreads[i].ThreadState.ToString()));
                        fileList[i].CheckRound += 1;



                        if (fileList[i].CheckRound == MaxCheckRound)
                        {
                            newThreads[i].Priority = ThreadPriority.AboveNormal;
                            Console.WriteLine(string.Format("Levelrage the porior of Thread[{0}] to {1} ", i, newThreads[i].Priority.ToString()));
                        }


                        if (fileList[i].CheckRound > MaxCheckRound * 2)
                        {
                            fileList[i].BrokenLink += string.Format("Error : The Check Round({0}) Exceed the limit of {1}", fileList[i].CheckRound, MaxCheckRound);
                            Console.WriteLine(string.Format("Abort the Thread[{0}] to {1} ", i, newThreads[i].Priority.ToString()));
                            newThreads[i].Abort();
                        }

                        break;
                    }
                }
            }

            if (category == ConvertCategory.ALL || category == ConvertCategory.IncludeParentFile)
            {
                Console.WriteLine();
                Console.WriteLine(String.Format("**********************Check Process Result({0})**********************", ConvertCategory.IncludeParentFile.ToString()));

                foreach (FileCustomize curtFile in fileList)
                {
                    if (curtFile.ArticleCategory == FileCategory.Includes)
                    {
                        Console.WriteLine("The parent file of \t{0} \tis \t{1}", curtFile.File, curtFile.ParentFile);
                    }
                }
            }

            if (category == ConvertCategory.ALL || category == ConvertCategory.H1ToTitle)
            {
                Console.WriteLine();
                Console.WriteLine(String.Format("**********************Check Process Result({0})**********************", ConvertCategory.H1ToTitle.ToString()));

                foreach (FileCustomize curtFile in fileList)
                {
                    if (!string.IsNullOrEmpty(curtFile.WarningMessage))
                    {
                        Console.WriteLine(curtFile.FullPath);
                        Console.WriteLine("File: \t{0} \tMessage: \t{1}", curtFile.FullPath, curtFile.WarningMessage);
                    }
                }
            }

            if (category == ConvertCategory.CheckBrokenLinkByFile || category == ConvertCategory.CheckBrokenLinkByService)
            {
                StringBuilder sbText = new StringBuilder();

                Console.WriteLine();
                sbText.AppendLine(String.Format("**********************Check Process Result({0})**********************", category.ToString()));
                //Console.WriteLine(String.Format("**********************Check Process Result({0})**********************", category.ToString()));

                int iIdx = 1;

                foreach (FileCustomize curtFile in fileList)
                {
                    if (!string.IsNullOrEmpty(curtFile.BrokenLink))
                    {
                        //Console.WriteLine("{0} : {1} ",iIdx++,  curtFile.File);
                        //Console.WriteLine(curtFile.BrokenLink);
                        sbText.AppendLine(string.Format("{0} : {1}", iIdx++, curtFile.FullPath.Replace(fileprefix, "").Replace("/", "\\")));
                        string[] param = curtFile.BrokenLink.Split('\n');
                        foreach (string curtText in param)
                        {
                            sbText.AppendLine(curtText);
                        }
                    }
                }


                sbText.AppendLine(string.Format("--------------Abort List in this round of Check Broken Link--------------"));
                iIdx = 1;
                foreach (FileCustomize curtFile in fileList)
                {
                    if (curtFile.CheckRound > MaxCheckRound * 2)
                    {
                        sbText.AppendLine(string.Format("{0} : {1}", iIdx++, curtFile.FullPath.Replace(fileprefix, "").Replace("/", "\\")));
                    }
                }

                sbText.AppendLine(string.Format("Total {0} abourt thread in the round of Check Broken List.", --iIdx));
                CommonFun.GenerateDownloadFile(category, ref sbText);
            }


            ExitWithUserConfirm();
        }
Exemplo n.º 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            //Check the Redirect URL Category
            int             iCount   = args.Count();
            ConvertCategory category = ConvertCategory.CheckRedirectByFile;
            ConvertProcess  process  = ConvertProcess.ShowResult;

            CommandPara curtpara = CommandPara.Null;

            for (int i = 0; i < iCount; i++)
            {
                switch (args[i].ToUpper().Trim())
                {
                case "--SERVICE":
                case "-S":
                    curtpara = CommandPara.Servcie;
                    break;

                case "--CUSTOMIZE":
                case "-C":
                    curtpara = CommandPara.Customize;
                    break;

                case "--HELP":
                case "-H":
                    ShowUseageTip();
                    return;

                default:
                    switch (curtpara)
                    {
                    case CommandPara.Servcie:
                        switch (args[i].ToUpper().Trim())
                        {
                        case "S":
                            category = ConvertCategory.CheckRedirectByService;
                            break;

                        case "F":
                            category = ConvertCategory.CheckRedirectByFile;
                            break;

                        default:
                            curtpara = CommandPara.VerifyFail;
                            break;
                        }
                        break;

                    case CommandPara.Customize:
                        switch (args[i].ToUpper().Trim())
                        {
                        case "R":
                            process = ConvertProcess.ShowResult;
                            break;

                        case "H":
                            process = ConvertProcess.ShowHistory;
                            break;

                        default:
                            curtpara = CommandPara.VerifyFail;
                            break;
                        }
                        break;

                    case CommandPara.Null:
                        curtpara = CommandPara.VerifyFail;
                        break;

                    case CommandPara.VerifyFail:
                        ShowUseageTip();
                        return;
                    }

                    if (curtpara == CommandPara.VerifyFail)
                    {
                        ShowUseageTip();
                        return;
                    }
                    break;
                }
            }



            //Get the following config file , redirect file(both global and mooncake repository)
            bool   errFlag    = false;
            string error      = "";
            string configfile = CommonFun.GetConfigurationValue("CustomerFilePath", ref error);

            if (error.Length > 0)
            {
                Console.WriteLine(error);
                ExitWithUserConfirm();
                return;
            }

            string fileGlobal = CommonFun.GetConfigurationValue("GlobalRedirectFile", ref error);

            if (error.Length > 0)
            {
                Console.WriteLine(error);
                ExitWithUserConfirm();
                return;
            }

            string fileMooncakeDir = CommonFun.GetConfigurationValue("MooncakeRedirectDir", ref error);

            if (error.Length > 0)
            {
                Console.WriteLine(error);
                ExitWithUserConfirm();
                return;
            }

            string fileGlobalDir = CommonFun.GetConfigurationValue("GlobalRedirectDir", ref error);

            if (error.Length > 0)
            {
                Console.WriteLine(error);
                ExitWithUserConfirm();
                return;
            }

            string fileMooncake = CommonFun.GetConfigurationValue("MooncakeRedirectFile", ref error);

            if (error.Length > 0)
            {
                Console.WriteLine(error);
                ExitWithUserConfirm();
                return;
            }


            string mooncakeSite = CommonFun.GetConfigurationValue("MooncakeSite", ref error);

            if (error.Length > 0)
            {
                Console.WriteLine(error);
                ExitWithUserConfirm();
                return;
            }


            ////Get the redirect file content(both global and mooncake repository)
            string fileGlobalContent   = string.Empty;
            string fileMooncakeContent = string.Empty;

            errFlag = CommonFun.GetFileContent(fileGlobal, ref fileGlobalContent) && CommonFun.GetFileContent(fileMooncake, ref fileMooncakeContent);
            if (errFlag == false)
            {
                return;
            }

            List <CollectRedirectFileByArticle> fileList = new List <CollectRedirectFileByArticle>();
            ArrayList arrFile = new ArrayList();

            //Get the thread count
            int threadCount = 0;


            errFlag = CommonFun.GetConfigFileRowCount(configfile, ref threadCount);

            if (errFlag == false)
            {
                return;
            }

            string customizedate = string.Empty;

            switch (category)
            {
            case ConvertCategory.CheckRedirectByService:
                customizedate = DateTime.Now.ToString("MM/dd/yyyy");
                arrFile       = GetFileListByService(customizedate);
                break;

            case ConvertCategory.CheckRedirectByFile:
                arrFile = GetFileListByArticles();
                break;
            }

            threadCount = arrFile.Count;

            Thread[] newThreads = new Thread[threadCount];



            string filename  = "";
            string directory = "";

            string[] para = new string[] { };

            for (int i = 0; i < threadCount; i++)
            {
                para = (string[])arrFile[i];

                filename      = para[0];
                directory     = para[1];
                customizedate = para[2];
                CollectRedirectFileByArticle curtFile = new CollectRedirectFileByArticle(i, filename, directory, customizedate, category, mooncakeSite, fileGlobalContent, fileMooncakeContent);
                fileList.Add(curtFile);
                newThreads[i]      = new Thread(new ThreadStart(curtFile.ProcessFileCustomize));
                newThreads[i].Name = string.Format("{0}/{1}", directory, filename);
                newThreads[i].Start();
                Console.WriteLine(string.Format("Start the Thread[{0}] in application...", i));
#if DEBUG
                newThreads[i].Join();
#endif
                // Console.WriteLine(string.Format("Join the {0} thread in application", threadIdx));
            }



            bool allThreadOver = false;
            while (allThreadOver == false)
            {
                Thread.Sleep(10000);
                allThreadOver = true;
                for (int i = 0; i < threadCount; i++)
                {
                    if (newThreads[i].ThreadState != ThreadState.Stopped)
                    {
                        allThreadOver = false;
                        Console.WriteLine(string.Format("Checking status of the Thread[{0}] : {1} ", i, newThreads[i].ThreadState.ToString()));
                        break;
                    }
                }
            }

            if (category == ConvertCategory.CheckRedirectByService || category == ConvertCategory.CheckRedirectByFile)
            {
                foreach (CollectRedirectFileByArticle curtFile in fileList)
                {
                    Console.WriteLine("------------------------");
                    Console.WriteLine(curtFile.RelativeFile);
                    Console.WriteLine("Global Redirections");
                    Console.Write(curtFile.RedirectGContent);
                    Console.WriteLine("Mooncake Redirections");
                    Console.Write(curtFile.RedirectMContent);
                }

                Console.WriteLine("************Result Start for Json**************");
                foreach (CollectRedirectFileByArticle curtFile in fileList)
                {
                    if (curtFile.RedirectGContent.Length > 0 && curtFile.RedirectMContent.Length == 0)
                    {
                        Console.Write(curtFile.RedirectGContent);
                    }
                }
                Console.WriteLine("************Result End for Json**************");

                Console.WriteLine("************Result Start for Excel**************");
                foreach (CollectRedirectFileByArticle curtFile in fileList)
                {
                    if (curtFile.RedirectGContent.Length > 0 && curtFile.RedirectMContent.Length == 0)
                    {
                        Console.Write(curtFile.RedirectExcelContent);
                    }
                }
                Console.WriteLine("************Result End for Excel**************");

                Console.WriteLine("************Delete File List Start for Excel**************");
                foreach (CollectRedirectFileByArticle curtFile in fileList)
                {
                    if (curtFile.RedirectGContent.Length == 0 && curtFile.RedirectMContent.Length == 0)
                    {
                        Console.WriteLine(curtFile.RelativeFile);
                    }
                }
                Console.WriteLine("************Delete File List End for Excel**************");
            }

            Console.WriteLine("Program run finished, Press <Enter> to exit....");

            ExitWithUserConfirm();
        }
		public ConvertDone(ConvertProcess.ProcessStatus status)
		{
			InitializeComponent();
		}
Exemplo n.º 10
0
        public FileCustomize(int id, string imagefilepath, string filename, string directory, string customizedate, ConvertCategory category, ConvertProcess process)
        {
            this.Id        = id;
            this.ImagePath = imagefilepath;

            string fullFileName = "";

            string[] para = directory.Split('/');


            foreach (string vpara in para)
            {
                if (vpara != "media")
                {
                    fullFileName += string.Format("/{0}", vpara);
                }
            }
            fullFileName = fullFileName.TrimStart('/') + "/" + string.Format("{0}.md", filename);
            this.File    = fullFileName;

            if (para[0] == "includes")
            {
                this.ServiceName = para[0];
            }
            else
            {
                this.ServiceName = para[1];
            }


            this.SetFullPathName(para);
            this.CustomizedDate  = customizedate;
            this.ProcessCategory = category;
            this.WarningMessage  = string.Empty;

            this.ShowHistory = process;
            //this.ForceTerminate = false;
            this.CheckRound    = 0;
            this.CheckFileList = new ArrayList();
            //this.CancelToke = cancelToke;
        }
Exemplo n.º 11
0
        public void Dispatch(IViewModelBase viewModel)
        {
            ProcessTransferType nextTransfer;
            IProcessViewModel   dispatch;

            void DispatchToDownload(IVideoViewModel videoViewModel)
            {
                nextTransfer = ProcessTransferType.Download;
                dispatch     = _processFactory.MakeDownloadProcessViewModel(videoViewModel);
            }

            void DispatchToComplete(IVideoViewModel videoViewModel, DownloadState downloadState)
            {
                nextTransfer = ProcessTransferType.Complete;
                dispatch     = _processFactory.MakeCompleteProcessViewModel(videoViewModel, downloadState);
            }

            switch (viewModel)
            {
            case IVideoViewModel videoViewModel:
            {
                string videoTitle = videoViewModel.Video.Title;

                if (Directory.GetFiles(_settings.DownloadPath).Select(Path.GetFileNameWithoutExtension).Any(filename => filename == videoTitle))
                {
                    DispatchToComplete(videoViewModel, DownloadState.Exited);
                }
                else
                {
                    DispatchToDownload(videoViewModel);
                }
            }
            break;

            case IDownloadProcessViewModel downloadProcessViewModel:
            {
                if (downloadProcessViewModel.Process.Killed)
                {
                    DispatchToComplete(downloadProcessViewModel.VideoViewModel, DownloadState.Exited);
                    break;
                }

                string destinationFilename = (string)downloadProcessViewModel.Process.ProcessMonitor.ParameterMonitorings["Destination"].Value;

                FileInfo fileInfo = new FileInfo(destinationFilename);

                if (_settings.OutputFormat == OutputFormat.Auto ||
                    _settings.OutputFormat == OutputFormat.Mp4 && fileInfo.Extension == ".mp4" ||
                    _settings.OutputFormat == OutputFormat.Mp3 && fileInfo.Extension == ".mp3")
                {
                    DispatchToComplete(downloadProcessViewModel.VideoViewModel, DownloadState.Completed);
                }
                else
                {
                    nextTransfer = ProcessTransferType.Convert;

                    ConvertProgress convertProgress = new ConvertProgress(fileInfo.Length);
                    ConvertProcess  convertProcess  = new ConvertProcess(fileInfo.FullName, _settings.OutputFormat.ToString().ToLower(), convertProgress);

                    dispatch = _processFactory.MakeConvertProcessViewModel(downloadProcessViewModel.VideoViewModel, convertProcess, convertProgress);
                }
            }
            break;

            case IConvertProcessViewModel convertProcessViewModel:
                DispatchToComplete(convertProcessViewModel.VideoViewModel, convertProcessViewModel.Process.Killed ? DownloadState.Exited : DownloadState.Completed);
                break;

            default:
                throw new InvalidOperationException("Cannot dispatch non-download or non-convert process.");
            }

            if (dispatch is IActiveProcessViewModel activeProcessViewModel)
            {
                void ProcessStarted(object sender, EventArgs e)
                {
                    switch (dispatch)
                    {
                    case IDownloadProcessViewModel _:
                        dispatch.DownloadState = DownloadState.Downloading;
                        break;

                    case IConvertProcessViewModel _:
                        dispatch.DownloadState = DownloadState.Converting;
                        break;
                    }
                }

                void ProcessExited(object sender, EventArgs e)
                {
                    activeProcessViewModel.Process.Started -= ProcessStarted;
                    activeProcessViewModel.Process.Exited  -= ProcessExited;
                }

                activeProcessViewModel.Process.Started += ProcessStarted;
                activeProcessViewModel.Process.Exited  += ProcessExited;
            }

            _eventAggregator.BeginPublishOnUIThread(new ProcessTransferMessage(nextTransfer, dispatch.ToEnumerable()));
        }
Exemplo n.º 12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            //Check the Redirect URL Category
            int             iCount   = args.Count();
            ConvertCategory category = ConvertCategory.CollectNewFileByService;
            ConvertProcess  process  = ConvertProcess.ShowResult;

            CommandPara curtpara = CommandPara.Null;

            for (int i = 0; i < iCount; i++)
            {
                switch (args[i].ToUpper().Trim())
                {
                case "--SERVICE":
                case "-S":
                    curtpara = CommandPara.Servcie;
                    break;

                case "--CUSTOMIZE":
                case "-C":
                    curtpara = CommandPara.Customize;
                    break;

                case "--HELP":
                case "-H":
                    ShowUseageTip();
                    return;

                default:
                    switch (curtpara)
                    {
                    case CommandPara.Servcie:
                        switch (args[i].ToUpper().Trim())
                        {
                        case "S":
                            category = ConvertCategory.CollectNewFileByService;
                            break;

                        default:
                            curtpara = CommandPara.VerifyFail;
                            break;
                        }
                        break;

                    case CommandPara.Customize:
                        switch (args[i].ToUpper().Trim())
                        {
                        case "R":
                            process = ConvertProcess.ShowResult;
                            break;

                        default:
                            curtpara = CommandPara.VerifyFail;
                            break;
                        }
                        break;

                    case CommandPara.Null:
                        curtpara = CommandPara.VerifyFail;
                        break;

                    case CommandPara.VerifyFail:
                        ShowUseageTip();
                        return;
                    }

                    if (curtpara == CommandPara.VerifyFail)
                    {
                        ShowUseageTip();
                        return;
                    }
                    break;
                }
            }



            //Get the following config file , redirect file(both global and mooncake repository)
            bool   errFlag    = false;
            string error      = "";
            string configfile = CommonFun.GetConfigurationValue("CustomerFilePath", ref error);

            if (error.Length > 0)
            {
                Console.WriteLine(error);
                ExitWithUserConfirm();
                return;
            }

            string fileGlobal = CommonFun.GetConfigurationValue("GlobalRedirectFile", ref error);

            if (error.Length > 0)
            {
                Console.WriteLine(error);
                ExitWithUserConfirm();
                return;
            }

            string fileMooncakeDir = CommonFun.GetConfigurationValue("MooncakeRedirectDir", ref error);

            if (error.Length > 0)
            {
                Console.WriteLine(error);
                ExitWithUserConfirm();
                return;
            }

            string fileGlobalDir = CommonFun.GetConfigurationValue("GlobalRedirectDir", ref error);

            if (error.Length > 0)
            {
                Console.WriteLine(error);
                ExitWithUserConfirm();
                return;
            }

            string fileMooncake = CommonFun.GetConfigurationValue("MooncakeRedirectFile", ref error);

            if (error.Length > 0)
            {
                Console.WriteLine(error);
                ExitWithUserConfirm();
                return;
            }


            string mooncakeSite = CommonFun.GetConfigurationValue("MooncakeSite", ref error);

            if (error.Length > 0)
            {
                Console.WriteLine(error);
                ExitWithUserConfirm();
                return;
            }


            ////Get the redirect file content(both global and mooncake repository)
            string fileGlobalContent   = string.Empty;
            string fileMooncakeContent = string.Empty;


            ArrayList arrFile = new ArrayList();

            //Get the thread count
            int threadCount = 0;


            errFlag = CommonFun.GetConfigFileRowCount(configfile, ref threadCount);

            if (errFlag == false)
            {
                return;
            }

            string customizedate = string.Empty;

            switch (category)
            {
            case ConvertCategory.CollectNewFileByService:
                customizedate = DateTime.Now.ToString("MM/dd/yyyy");
                arrFile       = GetFileListByService(customizedate);
                break;
            }

            threadCount = arrFile.Count;


            string filename  = "";
            string directory = "";

            string[] para = new string[] { };

            if (category == ConvertCategory.CollectNewFileByService)
            {
                for (int i = 0; i < threadCount; i++)
                {
                    para = (string[])arrFile[i];

                    filename      = para[0];
                    directory     = para[1];
                    customizedate = para[2];

                    Console.WriteLine(directory + "/" + filename);
                }
            }

            Console.WriteLine("Program run finished, Press <Enter> to exit....");

            ExitWithUserConfirm();
        }