コード例 #1
0
        /// <summary>
        /// This is the isHotfix method.
        /// It is used to determine a given entry is a hotfix finding or not.
        /// </summary>
        /// <param name="entry">The DataEntry</param>
        /// <returns>true if the given entry is a hotfix finding, false otherwise</returns>
        public static bool isHotfix(DataEntry entry)
        {
            String tempPluginName = entry.getPluginName();

            // here only plugin name starts with "MSXX-XXX" (X = 0-9)
            // are considered as hotfix finding
            if (tempPluginName.Length >= 9 &&
                tempPluginName[0] == 'M' &&
                tempPluginName[1] == 'S' &&
                tempPluginName[2] >= '0' && tempPluginName[2] <= '9' &&
                tempPluginName[3] >= '0' && tempPluginName[3] <= '9' &&
                tempPluginName[4] == '-' &&
                tempPluginName[5] >= '0' && tempPluginName[5] <= '9' &&
                tempPluginName[6] >= '0' && tempPluginName[6] <= '9' &&
                tempPluginName[7] >= '0' && tempPluginName[7] <= '9' &&
                (tempPluginName[8] == ' ' || tempPluginName[8] == ':')
                )
            {
                // check the pluginName contains "KBXXXXXX" (X = 0-9) or
                // other possibilities
                if (tempPluginName.Contains('(') && tempPluginName.Contains(')'))
                {
                    String kbString = tempPluginName.Substring(tempPluginName.LastIndexOf('('));

                    if (kbString[kbString.Length - 1] == ')')
                    {
                        String tempString = "";

                        int counter = 0;
                        for (int i = 1; i < kbString.Length - 1; i++)
                        {
                            if (!(kbString[i] >= '0' && kbString[i] <= '9'))
                            {
                                tempString += kbString[i];
                            }
                            else
                            {
                                counter++;
                            }
                        }

                        if (tempString == "KB" || String.IsNullOrEmpty(tempString))
                        {
                            if (tempPluginName[8] == ':')
                            {
                                tempPluginName = tempPluginName.Substring(0, 8) + tempPluginName.Substring(9);
                                entry.setPluginName(tempPluginName);
                            }
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }