summaryrefslogtreecommitdiff
path: root/WinKeyRecover/KeyChecker/GetProductDescription.cs
diff options
context:
space:
mode:
Diffstat (limited to 'WinKeyRecover/KeyChecker/GetProductDescription.cs')
-rw-r--r--WinKeyRecover/KeyChecker/GetProductDescription.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/WinKeyRecover/KeyChecker/GetProductDescription.cs b/WinKeyRecover/KeyChecker/GetProductDescription.cs
new file mode 100644
index 0000000..3a42418
--- /dev/null
+++ b/WinKeyRecover/KeyChecker/GetProductDescription.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml;
+
+namespace WinKeyRecover
+{
+ internal class GetProductDescription
+ {
+ public string Get(string aid, string fileXml)
+ {
+ XmlDocument xmlDocument = new XmlDocument();
+ xmlDocument.Load(fileXml);
+ Stream inStream = new MemoryStream(Convert.FromBase64String(xmlDocument.GetElementsByTagName("tm:infoBin")[0].InnerText));
+ xmlDocument.Load(inStream);
+ XmlNamespaceManager xmlNamespaceManager = new XmlNamespaceManager(xmlDocument.NameTable);
+ xmlNamespaceManager.AddNamespace("pkc", "http://www.microsoft.com/DRM/PKEY/Configuration/2.0");
+ XmlNode xmlNode = xmlDocument.SelectSingleNode("/pkc:ProductKeyConfiguration/pkc:Configurations/pkc:Configuration[pkc:ActConfigId='" + aid + "']", xmlNamespaceManager);
+ if (xmlNode == null)
+ {
+ xmlNode = xmlDocument.SelectSingleNode("/pkc:ProductKeyConfiguration/pkc:Configurations/pkc:Configuration[pkc:ActConfigId='" + aid.ToUpper() + "']", xmlNamespaceManager);
+ }
+ return xmlNode.ChildNodes.Item(3).InnerText;
+ }
+ }
+}