コード例 #1
0
ファイル: FileCustomize.cs プロジェクト: lingliw/Production
        public bool GetProcessConvertRuleValidService(ref JObject JConvert, ConvertCategory category, int iIndex, ConvertItem key, string filePath)
        {
            bool   bProcess  = false;
            string valReturn = string.Empty;

            string[] validKey = null;

            try
            {
                valReturn = JConvert[category.ToString()][iIndex][key.ToString()].ToString();
                validKey  = valReturn.Split(':');
                foreach (string curtVal in validKey)
                {
                    if (filePath.Contains(curtVal) == true)
                    {
                        bProcess = true;
                        break;
                    }
                }
                bProcess = false;
            }
            catch (Exception ex)
            {
                bProcess = true;
            }

            return(bProcess);
        }
コード例 #2
0
        public bool GetProcessConvertRule(ref JObject JConvert, ConvertCategory category, int iIndex, ConvertItem key, ref string valReturn)
        {
            bool bProcess = false;

            try
            {
                valReturn = JConvert[category.ToString()][iIndex][key.ToString()].ToString();
                bProcess  = true;
            }
            catch (Exception ex)
            {
            }

            return(bProcess);
        }
コード例 #3
0
        public bool GetProcessValidService(ref JObject JConvert, ConvertCategory category, int iIndex, ConvertItem key, string[] fileKey, int iCheckStart, string fileName)
        {
            bool   bProcess  = false;
            string valReturn = string.Empty;

            try
            {
                // service="ALL"
                valReturn = JConvert[category.ToString()][iIndex][key.ToString()].ToString().ToLower();

                bool   bCheckALLPattern = false;
                string sFirstChar       = "";

                string[] invloveService = valReturn.Split('|');
                for (int j = 0; j <= invloveService.Length - 1; j++)
                {
                    if (invloveService[j].ToLower().Substring(0, 1) == "!")
                    {
                        bCheckALLPattern = true;
                        break;
                    }
                }


                for (int i = iCheckStart + 1; i <= fileKey.Length - 1; i++)
                {
                    for (int j = 0; j <= invloveService.Length - 1; j++)
                    {
                        sFirstChar = invloveService[j].ToLower().Substring(0, 1);

                        // Take most priority
                        if (sFirstChar == "!")
                        {
                            bProcess = CheckIsPatternfile(fileKey, invloveService[j].ToLower());
                            if (bProcess == true)
                            {
                                bProcess = false;
                                return(bProcess);
                            }
                        }

                        if (sFirstChar == "*")
                        {
                            bProcess = CheckIsPatternfile(fileKey, invloveService[j].ToLower());
                            if (bCheckALLPattern == false)
                            {
                                return(bProcess);
                            }
                        }


                        if (invloveService[j].ToLower() == "all")
                        {
                            bProcess = true;
                            if (bCheckALLPattern == false)
                            {
                                return(bProcess);
                            }
                        }

                        if (fileKey[i].ToLower() == invloveService[j].ToLower())
                        {
                            bProcess = true;
                            if (bCheckALLPattern == false)
                            {
                                return(bProcess);
                            }
                        }

                        //for check the files in the include directory.
                        if (invloveService[j].Length < fileName.Length && invloveService[j].ToLower() == fileName.Substring(0, invloveService[j].Length))
                        {
                            bProcess = true;
                            if (bCheckALLPattern == false)
                            {
                                return(bProcess);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(bProcess);
        }