string ExtractString(string s)
{
// You should check for errors in real-world code, omitted for brevity
try
{
var startTag = "(";
int startIndex = s.IndexOf(startTag) + startTag.Length;
int endIndex = s.IndexOf(")", startIndex);
return s.Substring(startIndex, endIndex - startIndex);
}
catch
{
return ("CNVFL");
}
}
Выше приведен простой метод извлечения строки, который я использую, чтобы обнаружить, что KB находится в пакете безопасности, как упоминал Том Вийсман, и запустите его.
var updateSession = new UpdateSession();
var updateSearcher = updateSession.CreateUpdateSearcher();
var count = updateSearcher.GetTotalHistoryCount();
var history = updateSearcher.QueryHistory(0, count);
for (int i = 0; i < count; ++i){
//sets KB here!!
string _splitstring = ExtractString(history[i].Title);
Console.WriteLine(_splitstring);
}
это даст вам номер КБ, как вы ищете, я считаю