Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            int iCount = args.Count();

            ConvertCategory    category     = ConvertCategory.ALL;
            CustomizedCategory itercategory = CustomizedCategory.CustomizedByFile;
            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":
                            itercategory = CustomizedCategory.CustomizedByService;
                            break;

                        case "F":
                            itercategory = CustomizedCategory.CustomizedByFile;
                            break;

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

                    case CommandPara.Customize:
                        switch (args[i].ToUpper().Trim())
                        {
                        case "A":
                            category = ConvertCategory.AuthorReplacement;
                            break;

                        case "U":
                            category = ConvertCategory.URLReplacement;
                            break;

                        case "C":
                            category = ConvertCategory.URLCorrection;
                            break;

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

                        case "I":
                            category = ConvertCategory.IncludeParentFile;
                            break;

                        case "T":
                            category = ConvertCategory.ToolReplacement;
                            break;

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

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

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



            string error      = "";
            string configfile = CommonFun.GetConfigurationValue("customerfilepath", ref error);

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

            StreamReader sr = null;



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

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

            ArrayList arrFile = new ArrayList();

            int threadCount = 0;

            switch (itercategory)
            {
            case  CustomizedCategory.CustomizedByService:
                customizedate = DateTime.Now.ToString("MM/dd/yyyy");
                arrFile       = GetFileListByService(customizedate);
                break;

            case CustomizedCategory.CustomizedByFile:
                arrFile = GetFileListByArticles();
                break;
            }



            //Get the thread count



            ThreadPool.SetMinThreads(1000, 1000);

            threadCount = arrFile.Count;
            Thread[] newThreads = new Thread[threadCount];

            // Declare the application thread.


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

            for (int i = 0; i < threadCount; i++)
            {
                para          = (string[])arrFile[i];
                filename      = para[0];
                directory     = para[1];
                customizedate = para[2];
                FileCustomize curtFile = new FileCustomize(i, filename, directory, customizedate, category);
                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));


                // Console.WriteLine(string.Format("Join the {0} thread in application", threadIdx));
#if DEBUG
                newThreads[i].Join();
#endif
            }

            bool allThreadOver = false;
            while (allThreadOver == false)
            {
                Thread.Sleep(20000);
                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}] \t : \t {1} -> \t {2}", i, newThreads[i].ThreadState.ToString(), newThreads[i].Name.ToString()));
                        break;
                    }
                }
            }


            if (category == ConvertCategory.ALL || category == ConvertCategory.IncludeParentFile)
            {
                //Display the Parent of Include file in Console.
                string sPath       = string.Empty;
                string sFileName   = string.Empty;
                int    idxLastDash = 0;

                foreach (FileCustomize curtFile in fileList)
                {
                    if (curtFile.ArticleCategory == FileCategory.Includes)
                    {
                        idxLastDash = curtFile.ParentFile.LastIndexOf(@"\");
                        if (idxLastDash >= 0)
                        {
                            sPath     = curtFile.ParentFile.Substring(0, idxLastDash);
                            sFileName = curtFile.ParentFile.Substring(idxLastDash + 1);
                        }
                        else
                        {
                            sPath     = "";
                            sFileName = "";
                        }

                        Console.WriteLine(string.Format("The parent file of\t{0}\tis\t{1}\t{2}\t.", curtFile.File, sPath, sFileName));
                    }
                }


                //Save the download file for the parent of Include file in text file.
                StringBuilder sbText = new StringBuilder();

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

                foreach (FileCustomize curtFile in fileList)
                {
                    if (curtFile.ArticleCategory == FileCategory.Includes)
                    {
                        //if (!string.IsNullOrEmpty(curtFile.ParentFile))
                        //{
                        idxLastDash = curtFile.ParentFile.LastIndexOf(@"\");
                        if (idxLastDash >= 0)
                        {
                            sPath     = curtFile.ParentFile.Substring(0, idxLastDash);
                            sFileName = curtFile.ParentFile.Substring(idxLastDash + 1);
                        }
                        else
                        {
                            sPath     = "";
                            sFileName = "";
                        }
                        sbText.AppendLine(string.Format("The parent file of\t{0}\tis\t{1}\t{2}\t.", curtFile.File, sPath, sFileName));
                        //}
                    }
                }

                CommonFun.GenerateDownloadFile(category, ref sbText);
            }

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

            ExitWithUserConfirm();
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            int             iCount   = args.Count();
            ConvertCategory category = ConvertCategory.ALL;

            if (iCount > 1)
            {
                ShowUseageTip();
                return;
            }
            else if (iCount == 1)
            {
                string sParam = args[0].TrimStart('-').ToUpper();
                switch (sParam)
                {
                case "CLI":
                    category = ConvertCategory.CLIReplacement;
                    break;

                default:
                    ShowUseageTip();
                    return;
                }
            }


            string error      = "";
            string configfile = CommonFun.GetConfigurationValue("customerfilepath", ref error);

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

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

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

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

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

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

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

            //Get the thread count
            int threadCount = 0;

            CollectAllFileByService fileByService = new CollectAllFileByService();
            ArrayList arrFile = new ArrayList();

            arrFile = fileByService.GetAllFileByService();

            threadCount = arrFile.Count;
            Thread[] newThreads = new Thread[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("\\", "/");


                FileCustomize curtFile = new FileCustomize(i, filename, directory, customizedate, category);
                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)
                    {
                        allThreadOver = false;
                        Console.WriteLine(string.Format("Checking status of the Thread[{0}] : {1} ", i, newThreads[i].ThreadState.ToString()));
                        break;
                    }
                }
            }

            if (category == ConvertCategory.ALL || category == ConvertCategory.IncludeParentFile)
            {
                foreach (FileCustomize curtFile in fileList)
                {
                    if (curtFile.ArticleCategory == FileCategory.Includes)
                    {
                        Console.WriteLine("The parent file of {0} is {1}", curtFile.File, curtFile.ParentFile);
                    }
                }
            }

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

            ExitWithUserConfirm();
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            int                iCount       = args.Count();
            ConvertCategory    category     = ConvertCategory.SXSUpdate;
            CustomizedCategory itercategory = CustomizedCategory.CustomizedByFile;
            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":
                            itercategory = CustomizedCategory.CustomizedByService;
                            break;

                        case "F":
                            itercategory = CustomizedCategory.CustomizedByFile;
                            break;

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

                    case CommandPara.Customize:
                        switch (args[i].ToUpper().Trim())
                        {
                        case "X":
                            category = ConvertCategory.SXSUpdate;
                            break;

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

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

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


            string error = "";

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

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

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

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

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

            ArrayList arrFile = new ArrayList();

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

            int threadCount = 0;

            switch (itercategory)
            {
            case CustomizedCategory.CustomizedByService:
                customizedate = DateTime.Now.ToString("MM/dd/yyyy");
                arrFile       = GetFileListByService(customizedate);
                break;

            case CustomizedCategory.CustomizedByFile:
                arrFile = GetFileListByArticles();
                break;
            }

            ThreadPool.SetMinThreads(1000, 1000);

            threadCount = arrFile.Count;
            Thread[] newThreads = new Thread[threadCount];

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

            int iRemoveFileCount = 0;

            for (int i = 0; i < threadCount; i++)
            {
                para          = (string[])arrFile[i];
                filename      = para[0];
                directory     = para[1];
                customizedate = para[2];


                FileCustomize curtFile = new FileCustomize(i, filename, directory, customizedate, category);

                if (System.IO.File.Exists(curtFile.FullMasterPath) == true)
                {
                    fileList.Add(curtFile);
                    newThreads[i - iRemoveFileCount] = new Thread(new ThreadStart(curtFile.ProcessFileCustomize));
                    newThreads[i - iRemoveFileCount].Start();
#if DEBUG
                    newThreads[i].Join();
#endif
                }
                else
                {
                    iRemoveFileCount += 1;
                }
            }


            bool allThreadOver = false;
            while (allThreadOver == false)
            {
                Thread.Sleep(10000);
                allThreadOver = true;
                for (int i = 0; i < threadCount - iRemoveFileCount; 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.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.SXSUpdate)
            {
                Console.WriteLine();
                Console.WriteLine(String.Format("**********************Check Process Result({0})**********************", ConvertCategory.SXSUpdate.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);
                    }
                }
            }

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

            ExitWithUserConfirm();
        }
Exemplo n.º 4
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.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            int             iCount   = args.Count();
            ConvertCategory category = ConvertCategory.ALL;

            if (iCount > 1)
            {
                ShowUseageTip();
                return;
            }
            else if (iCount == 1)
            {
                string sParam      = args[0].TrimStart('-').ToUpper();
                int    iParamCount = sParam.Trim().Length;


                if (iParamCount == 1)
                {
                    switch (sParam)
                    {
                    case "A":
                        category = ConvertCategory.AuthorReplacement;
                        break;

                    case "U":
                        category = ConvertCategory.URLReplacement;
                        break;

                    case "C":
                        category = ConvertCategory.URLCorrection;
                        break;

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

                    case "I":
                        category = ConvertCategory.IncludeParentFile;
                        break;

                    case "T":
                        category = ConvertCategory.ToolReplacement;
                        break;

                    case "H":
                    default:
                        ShowUseageTip();
                        return;
                    }
                }
                else
                {
                    switch (sParam)
                    {
                    case "HELP":
                        ShowUseageTip();
                        return;

                    default:
                        Console.WriteLine("You type the wrong command:");
                        ShowUseageTip();
                        return;
                    }
                }
            }


            string error      = "";
            string configfile = CommonFun.GetConfigurationValue("customerfilepath", ref error);

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

            StreamReader sr  = File.OpenText(configfile);
            string       row = "";

            row = sr.ReadLine();

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

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

            //Get the thread count
            int threadCount = 0;

            while (row != null)
            {
                string[] para = row.Split(new Char[] { '\t' });

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

                //fileList.Add(new FileCustomize(filename, directory, customizedate));
                threadCount += 1;
                row          = sr.ReadLine();
            }

            ThreadPool.SetMinThreads(1000, 1000);

            // Declare the application thread.
            Thread[] newThreads = new Thread[threadCount];
            sr.BaseStream.Seek(0, SeekOrigin.Begin);

            int threadIdx = 0;

            row = sr.ReadLine();
            while (row != null)
            {
                string[] para = row.Split(new Char[] { '\t' });

                filename      = para[0];
                directory     = para[1];
                customizedate = para[2];
                FileCustomize curtFile = new FileCustomize(threadIdx, filename, directory, customizedate, category);
                fileList.Add(curtFile);
                newThreads[threadIdx]      = new Thread(new ThreadStart(curtFile.ProcessFileCustomize));
                newThreads[threadIdx].Name = string.Format("{0}/{1}", directory, filename);
                newThreads[threadIdx].Start();
                Console.WriteLine(string.Format("Start the Thread[{0}] in application...", threadIdx));


                // Console.WriteLine(string.Format("Join the {0} thread in application", threadIdx));
#if DEBUG
                newThreads[threadIdx].Join();
#endif


                row        = sr.ReadLine();
                threadIdx += 1;
            }

            sr.Close();

            bool allThreadOver = false;
            while (allThreadOver == false)
            {
                Thread.Sleep(20000);
                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}] \t : \t {1} -> \t {2}", i, newThreads[i].ThreadState.ToString(), newThreads[i].Name.ToString()));
                        break;
                    }
                }
            }


            if (category == ConvertCategory.ALL || category == ConvertCategory.IncludeParentFile)
            {
                //Display the Parent of Include file in Console.
                string sPath       = string.Empty;
                string sFileName   = string.Empty;
                int    idxLastDash = 0;

                foreach (FileCustomize curtFile in fileList)
                {
                    if (curtFile.ArticleCategory == FileCategory.Includes)
                    {
                        idxLastDash = curtFile.ParentFile.LastIndexOf(@"\");
                        if (idxLastDash >= 0)
                        {
                            sPath     = curtFile.ParentFile.Substring(0, idxLastDash);
                            sFileName = curtFile.ParentFile.Substring(idxLastDash + 1);
                        }
                        else
                        {
                            sPath     = "";
                            sFileName = "";
                        }

                        Console.WriteLine(string.Format("The parent file of\t{0}\tis\t{1}\t{2}\t.", curtFile.File, sPath, sFileName));
                    }
                }


                //Save the download file for the parent of Include file in text file.
                StringBuilder sbText = new StringBuilder();

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

                foreach (FileCustomize curtFile in fileList)
                {
                    if (curtFile.ArticleCategory == FileCategory.Includes)
                    {
                        //if (!string.IsNullOrEmpty(curtFile.ParentFile))
                        //{
                        idxLastDash = curtFile.ParentFile.LastIndexOf(@"\");
                        if (idxLastDash >= 0)
                        {
                            sPath     = curtFile.ParentFile.Substring(0, idxLastDash);
                            sFileName = curtFile.ParentFile.Substring(idxLastDash + 1);
                        }
                        else
                        {
                            sPath     = "";
                            sFileName = "";
                        }
                        sbText.AppendLine(string.Format("The parent file of\t{0}\tis\t{1}\t{2}\t.", curtFile.File, sPath, sFileName));
                        //}
                    }
                }

                CommonFun.GenerateDownloadFile(category, ref sbText);
            }

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

            ExitWithUserConfirm();
        }