Example #1
0
        public void ProcessFileCustomize()
        {
            this.Status = ProcessStatus.Start;

            string fullContent = string.Empty;

            bool needLog = true;

            string error = "";

            // If we involve the ReplaceLink function. It will cause the images file missing.
            // images function will reference the include file check itself.
            //this.ReplaceIncludeLinkWithContent(this.FullPath, ref fullContent);
            string globalprefix = CommonFun.GetConfigurationValue("GlobalRepository", ref error);


            string mooncakeprefix = CommonFun.GetConfigurationValue("MooncakeImageRepository", ref error);


            try
            {
                ConvertCategory category = this.ProcessCategory;
                Console.WriteLine(string.Format("Processing Thread[{0}] : {1}", this.Id, this.FullPath));

                this.CountOriginAndModifyImageCount(this.ImagePath, globalprefix, mooncakeprefix);


                //Check Broken Link No need to modified the content.
                //sw = new StreamWriter(this.Fullpath,false);
                //sw.Write(fullcontent);
                //sw.Flush();
            }
            catch (Exception ex)
            {
                this.BrokenLink += string.Format("Error : {0}\n", ex.Message.ToString());
                Console.WriteLine(string.Format("Thread[{0}]({1}) occure error with {2}. ", this.Id, this.FullPath, ex.Message.ToString()));
            }
            finally
            {
            }

            this.Status = ProcessStatus.Complete;
            Console.WriteLine("The Thread[{0}] run successfully : {1}", this.Id, this.Status.ToString());
        }
Example #2
0
        public void SetFullPathName(string[] para)
        {
            string diskpath     = "";
            string message      = "";
            string relativefile = "";

            if (para[0].ToLower() == "articles")
            {
                diskpath             = CommonFun.GetConfigurationValue("RepositoryGlobalArticleDir", ref message);
                relativefile         = GetRightFileName(para);
                this.FullPath        = string.Format(@"{0}\{1}\{2}", diskpath, relativefile, this.File);
                this.ArticleCategory = FileCategory.Article;
            }

            if (para[0].ToLower() == "includes")
            {
                diskpath             = CommonFun.GetConfigurationValue("RepositoryGlobalIncludeDir", ref message);
                relativefile         = GetRightFileName(para);
                this.FullPath        = string.Format(@"{0}\{2}", diskpath, relativefile, this.File);
                this.ArticleCategory = FileCategory.Includes;
            }
        }
Example #3
0
        public ArrayList GetAllFileByService()
        {
            ArrayList fileList   = new ArrayList();
            string    message    = string.Empty;
            string    diskpath   = string.Empty;
            string    parentpath = string.Empty;

            if (this.CheckFileList != null && this.CheckFileList.Count > 0)
            {
                this.CheckFileList = new ArrayList();
            }

            string medianame   = CommonFun.GetConfigurationValue("MediaDirName", ref message);
            string servicename = string.Empty;


            foreach (InvolvedService curtService in Enum.GetValues(typeof(InvolvedService)))
            {
                servicename = this.GetInitFormat(curtService.ToString());
                if (curtService.ToString().ToLower() == InvolvedService.includes.ToString().ToLower())
                {
                    diskpath   = CommonFun.GetConfigurationValue("RepositoryGlobalIncludeDir", ref message);
                    parentpath = string.Format("{0}", diskpath);
                }
                else
                {
                    diskpath   = CommonFun.GetConfigurationValue("RepositoryGlobalArticleDir", ref message);
                    parentpath = string.Format("{0}\\{1}", diskpath, curtService.ToString().Replace('_', '-'));
                }

                this.GetAllFilesInDirectory(curtService, parentpath, medianame);
            }



            fileList = this.CheckFileList;
            return(fileList);
        }