diff --git a/CMWTAT_DIGITAL.sln b/CMWTAT_DIGITAL.sln
new file mode 100644
index 0000000..0119cec
--- /dev/null
+++ b/CMWTAT_DIGITAL.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.27130.2036
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CMWTAT_DIGITAL", "CMWTAT_DIGITAL\CMWTAT_DIGITAL.csproj", "{961DE925-B82C-4515-8FBD-6805E36D1212}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {961DE925-B82C-4515-8FBD-6805E36D1212}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {961DE925-B82C-4515-8FBD-6805E36D1212}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {961DE925-B82C-4515-8FBD-6805E36D1212}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {961DE925-B82C-4515-8FBD-6805E36D1212}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {653ED007-6FEF-4A82-9898-F60578205F1C}
+ EndGlobalSection
+EndGlobal
diff --git a/CMWTAT_DIGITAL/App.xaml b/CMWTAT_DIGITAL/App.xaml
new file mode 100644
index 0000000..e7f7e0f
--- /dev/null
+++ b/CMWTAT_DIGITAL/App.xaml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CMWTAT_DIGITAL/App.xaml.cs b/CMWTAT_DIGITAL/App.xaml.cs
new file mode 100644
index 0000000..ac47f66
--- /dev/null
+++ b/CMWTAT_DIGITAL/App.xaml.cs
@@ -0,0 +1,17 @@
+using CMWTAT_DIGITAL;
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Windows;
+
+namespace CMWTAT_KMS
+{
+ ///
+ /// App.xaml 的交互逻辑
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/CMWTAT_DIGITAL/CMWTAT.ico b/CMWTAT_DIGITAL/CMWTAT.ico
new file mode 100644
index 0000000..42f687a
Binary files /dev/null and b/CMWTAT_DIGITAL/CMWTAT.ico differ
diff --git a/CMWTAT_DIGITAL/CMWTAT.png b/CMWTAT_DIGITAL/CMWTAT.png
new file mode 100644
index 0000000..e0ebb76
Binary files /dev/null and b/CMWTAT_DIGITAL/CMWTAT.png differ
diff --git a/CMWTAT_DIGITAL/CMWTAT_DIGITAL.csproj b/CMWTAT_DIGITAL/CMWTAT_DIGITAL.csproj
new file mode 100644
index 0000000..7f10051
--- /dev/null
+++ b/CMWTAT_DIGITAL/CMWTAT_DIGITAL.csproj
@@ -0,0 +1,198 @@
+
+
+
+
+ 10.0.10240.0
+ Debug
+ AnyCPU
+ {961DE925-B82C-4515-8FBD-6805E36D1212}
+ WinExe
+ CMWTAT_DIGITAL
+ CMWTAT_DIGITAL
+ v4.5.2
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ false
+
+
+ app.manifest
+
+
+ CMWTAT.ico
+
+
+ CMWTAT_DIGITAL.Program
+
+
+
+ ..\packages\MaterialDesignColors.1.1.3\lib\net45\MaterialDesignColors.dll
+ False
+
+
+ ..\packages\MaterialDesignThemes.2.5.0.1205\lib\net45\MaterialDesignThemes.Wpf.dll
+ False
+
+
+ ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ App.xaml
+ Code
+
+
+
+
+
+ MainWindow.xaml
+ Code
+
+
+
+
+
+
+ Code
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ Designer
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+
+
+ Res\MaterialDesignColors.dll
+
+
+ Res\MaterialDesignThemes.Wpf.dll
+
+
+ Res\Newtonsoft.Json.dll
+
+
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CMWTAT_DIGITAL/CMWTAT_DIGITAL.csproj.user b/CMWTAT_DIGITAL/CMWTAT_DIGITAL.csproj.user
new file mode 100644
index 0000000..1aab52f
--- /dev/null
+++ b/CMWTAT_DIGITAL/CMWTAT_DIGITAL.csproj.user
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+ publish\
+
+
+
+
+
+ zh-CN
+ false
+
+
+ -l -%3f
+
+
\ No newline at end of file
diff --git a/CMWTAT_DIGITAL/Domain/IsSN.cs b/CMWTAT_DIGITAL/Domain/IsSN.cs
new file mode 100644
index 0000000..3e5bbfe
--- /dev/null
+++ b/CMWTAT_DIGITAL/Domain/IsSN.cs
@@ -0,0 +1,82 @@
+using System;
+using System.Globalization;
+using System.Text.RegularExpressions;
+using System.Windows.Controls;
+
+namespace CMWTAT_DIGITAL.Domain
+{
+ class IsSN : ValidationRule
+ {
+ #region 匹配方法
+
+ ///
+ /// 验证字符串是否匹配正则表达式描述的规则
+ ///
+ /// 待验证的字符串
+ /// 正则表达式字符串
+ /// 是否匹配
+ public static bool IsMatch(string inputStr, string patternStr)
+ {
+ return IsMatch(inputStr, patternStr, false, false);
+ }
+
+ ///
+ /// 验证字符串是否匹配正则表达式描述的规则
+ ///
+ /// 待验证的字符串
+ /// 正则表达式字符串
+ /// 匹配时是否不区分大小写
+ /// 是否匹配
+ public static bool IsMatch(string inputStr, string patternStr, bool ifIgnoreCase)
+ {
+ return IsMatch(inputStr, patternStr, ifIgnoreCase, false);
+ }
+
+ ///
+ /// 验证字符串是否匹配正则表达式描述的规则
+ ///
+ /// 待验证的字符串
+ /// 正则表达式字符串
+ /// 匹配时是否不区分大小写
+ /// 是否验证空白字符串
+ /// 是否匹配
+ public static bool IsMatch(string inputStr, string patternStr, bool ifIgnoreCase, bool ifValidateWhiteSpace)
+ {
+ if (!ifValidateWhiteSpace && string.IsNullOrEmpty(inputStr))
+ return false;//如果不要求验证空白字符串而此时传入的待验证字符串为空白字符串,则不匹配
+ Regex regex = null;
+ if (ifIgnoreCase)
+ regex = new Regex(patternStr, RegexOptions.IgnoreCase);//指定不区分大小写的匹配
+ else
+ regex = new Regex(patternStr);
+ return regex.IsMatch(inputStr);
+ }
+
+ #endregion
+
+ public override ValidationResult Validate(object value, CultureInfo cultureInfo)
+ {
+ //Console.WriteLine("\""+value+"\"");
+ //return string.IsNullOrWhiteSpace((value ?? "").ToString())
+ // ? new ValidationResult(false, "Key is required.")
+ // : ValidationResult.ValidResult;
+
+ string pattern = @"^[a-zA-Z0-9]{5}-[a-zA-Z0-9]{5}-[a-zA-Z0-9]{5}-[a-zA-Z0-9]{5}-[a-zA-Z0-9]{5}$";
+
+ if (IsMatch((value ?? "").ToString(), pattern))
+ {
+ return ValidationResult.ValidResult;
+
+ }
+ else if (string.IsNullOrWhiteSpace((value ?? "").ToString()))
+ {
+ return new ValidationResult(false, "Please enter the key for the current edition.");
+ }
+ else
+ {
+ return new ValidationResult(false, "Invalid format.");
+ }
+
+ }
+ }
+}
diff --git a/CMWTAT_DIGITAL/Domain/NotifyPropertyChangedExtension.cs b/CMWTAT_DIGITAL/Domain/NotifyPropertyChangedExtension.cs
new file mode 100644
index 0000000..4d9a982
--- /dev/null
+++ b/CMWTAT_DIGITAL/Domain/NotifyPropertyChangedExtension.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CMWTAT_DIGITAL.Domain
+{
+ public static class NotifyPropertyChangedExtension
+ {
+ public static void MutateVerbose(this INotifyPropertyChanged instance, ref TField field, TField newValue, Action raise, [CallerMemberName] string propertyName = null)
+ {
+ if (EqualityComparer.Default.Equals(field, newValue)) return;
+ field = newValue;
+ raise?.Invoke(new PropertyChangedEventArgs(propertyName));
+ }
+ }
+}
diff --git a/CMWTAT_DIGITAL/Domain/ViewModel.cs b/CMWTAT_DIGITAL/Domain/ViewModel.cs
new file mode 100644
index 0000000..68d3228
--- /dev/null
+++ b/CMWTAT_DIGITAL/Domain/ViewModel.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CMWTAT_DIGITAL.Domain
+{
+ class ViewModel : INotifyPropertyChanged
+ {
+ private string _sn;
+
+ public ViewModel()
+ {
+ LongListToTestComboVirtualization = new List(Enumerable.Range(0, 1000));
+ }
+
+ public string SN
+ {
+ get { return _sn; }
+ set
+ {
+ this.MutateVerbose(ref _sn, value, RaisePropertyChanged());
+ }
+ }
+
+ public IList LongListToTestComboVirtualization { get; }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ private Action RaisePropertyChanged()
+ {
+ return args => PropertyChanged?.Invoke(this, args);
+ }
+ }
+}
diff --git a/CMWTAT_DIGITAL/Lang/en.xaml b/CMWTAT_DIGITAL/Lang/en.xaml
new file mode 100644
index 0000000..f1d933a
--- /dev/null
+++ b/CMWTAT_DIGITAL/Lang/en.xaml
@@ -0,0 +1,213 @@
+
+
+
+
+
+
+
+ Roboto
+
+
+
+
+
+ OK
+
+
+ Cancel
+
+
+ Refuse
+
+
+ Thanks developer and donate a dinner
+
+
+ Exit
+
+
+ Update Now
+
+
+ Ignore
+
+
+ CMWTAT Digital Edition
+
+
+ CMWTAT Digital Edition V2
+
+
+ A new version available!
+
+
+ Current Version
+
+
+ Latest Version
+
+
+ Auto Mode
+
+
+ Manual Mode
+
+
+ Activate
+
+
+ Convert versions (Install Key without Activate)
+
+
+ Test Text
+
+
+ Loading
+
+
+ Activating
+
+
+ Complete
+
+
+ CloudMoe Windows 10 Activation Toolkit V2
+
+
+ Running.
+
+
+ Experimental
+
+
+ Attention
+
+
+ System edition
+
+
+ Unable to correctly identify your operating system edition in support list, may be not be supported.
+
+
+ Only found experimental options that can be used with this operating system edition, little hope of activation success.
+
+
+ Your system edition may not be supported, program will exit. you can try add --expact or -e to startup.
+
+
+ Your system edition may not be supported, program will exit.
+
+
+ Unable to connect to server, Please check the network and try to try again later, program will exit.
+
+
+ Unable to connect to server, Please check the network and try to try again later, program will exit.
+
+
+ Converting
+
+
+ Activating
+
+
+ Getting Key via Internet
+
+
+ Getting Key via Internet
+
+
+ Uninstalling old Key
+
+
+ Uninstalling old Key
+
+
+ Uninstalling old Key (Experimental)
+
+
+ Installing Key
+
+
+ Installing Key
+
+
+ Getting edition code (Experimental)
+
+
+ Prepare for the next step (Experimental)
+
+
+ Writing feature of old Windows version
+
+
+ Getting free upgrade permissions
+
+
+ Cleaning changes
+
+
+ Getting digital license
+
+
+ Complete
+
+
+ Error
+
+
+ Code:
+
+
+ System return:
+
+
+
+
+
+This application now supports the use of console args to startup!
-a --auto Auto activate.
-h --hide Run with hide mode (Only be worked with -auto).
-e --expact Experimental activation.
-l --log Output log to file.
-? --help Show this help Dialog.
+
+
+Congratulation!
Windows 10 has been successful converted.
+
+
+Congratulation!
Windows 10 has been successful activated.
+
+
+We found a new version for CloudMoe Windows 10 Activation Toolkit Digital Edition.
Please update to the latest version to make sure it works.
+
+
+We found a new version for CloudMoe Windows 10 Activation Toolkit Digital Edition.
And because your version is too old, so you MUST update to the latest version to make sure it works.
+
+
+Activate Windows 10 requires a network to gets the product key :)
+
+
+Cannot to uninstall old key. :(
+
+
+Cannot to install key, may be you choose or enter a incorrect version. :(
+
+
+Cannot to get edition code. :(
+
+
+Cannot to install key, may be you choose or enter a incorrect version. :(
+
+
+Time out, may be you choose or enter a incorrect version. :(
+
+
+Activation Failed. :(
Maybe:
1.This edition/version of Windows does not support digital license activation.
2. Unable to connect to Microsoft Windows Activation Server.
3. Other unexpected problems.
You can try to wait a minute or try again later.
+
+
+Only found Long-Term Offline KMS (LTOK) options that can be used with this operating system edition.
This means that it will not be activate automatically after you reinstalled the system.
But don't worry, this is different from the legacy KMS activation method (it can keep activating for 180 days in offline environment).
LTOK (The prefix is Offline-KMS) can keep activating for up to 19 years even it is without networking!
+
+
+Congratulation!
Windows 10 is ready to activate.
However, it seems that Windows cannot connect to the Microsoft Activation Server.
Your system will be activated automatically the next time the server is connected.
+
+
\ No newline at end of file
diff --git a/CMWTAT_DIGITAL/Lang/ja.xaml b/CMWTAT_DIGITAL/Lang/ja.xaml
new file mode 100644
index 0000000..f60cac9
--- /dev/null
+++ b/CMWTAT_DIGITAL/Lang/ja.xaml
@@ -0,0 +1,213 @@
+
+
+
+
+
+
+
+ Yu Gothic UI
+
+
+
+
+
+ はい
+
+
+ キャンセル
+
+
+ リフューズ
+
+
+ 寄付します
+
+
+ 終了
+
+
+ 今すぐアップデート
+
+
+ 無視する
+
+
+ 雲萌 Windows 10 デジタルライセンス認証アプリ
+
+
+ CMWTAT Digital Edition V2
+
+
+ 新しいバージョンがあります!
+
+
+ バージョン
+
+
+ ラストバージョン
+
+
+ オートモード
+
+
+ マニュアルモード
+
+
+ 認証
+
+
+ エディション変換 (キーをインストールするが、認証しません)
+
+
+ テストテキスト
+
+
+ ローディング
+
+
+ 認証中
+
+
+ コンプリート
+
+
+ 雲萌 Windows 10 認証アプリ V2
+
+
+ 実行中。
+
+
+ 実験性
+
+
+ 注意
+
+
+ システムエディション
+
+
+ あなたのシステムエディションが判別できません、対応していないかもしれません。
+
+
+ このシステムエディションに実験性オプションしか取れません、認証成功の可能性は極めて低い。
+
+
+ あなたのシステムエディションは対応していないかもしれません。アプリは終了する。試して、--expactまたは-eを追加することでアプリ起動してください。
+
+
+ あなたのシステムエディションは対応していないかもしれません。アプリは終了する。
+
+
+ サーバーに接続できません、インターネット接続を確認するまたは後で試してください、アプリは終了します。
+
+
+ サーバーに接続できません、インターネット接続を確認するまたは後で試してください、アプリは終了します。
+
+
+ 変換中
+
+
+ ライセンス認証中
+
+
+ インターネットを通じてキーを取得しています
+
+
+ インターネットを通じてキーを取得しています
+
+
+ 以前のキーをアンインストールしています
+
+
+ 以前のキーをアンインストールしています
+
+
+ 以前のキーをアンインストールしています(実験性)
+
+
+ キーをインストールしています
+
+
+ キーをインストールしています
+
+
+ エディションコードを取得中(実験性)
+
+
+ 次のステップに準備しています(実験性)
+
+
+ 旧システムの特徴を書き込み中
+
+
+ 無償アップグレード権限を取得中
+
+
+ 変更がクリーンアップされます
+
+
+ デジタルライセンスを取得中
+
+
+ コンプリート
+
+
+ エラー
+
+
+ コード:
+
+
+ システムメッセージ:
+
+
+
+
+
+このアプリは起動時にコンソール引数を使用できるようになりました!
-a --auto 自動認証。
-h --hide 非表示モードで実行 (-autoと一緒に使用するだけ可能)。
-e --expact 実験性認証。
-l --log ログをファイルに出力。
-? --help この説明ダイアログボックスを表示する。
+
+
+おめでとう!
Windows 10 エディション変換成功。
+
+
+おめでとう!
Windows 10 認証成功。
+
+
+雲萌 Windows10 デジタルライセンス認証アプリの新しいバージョン発見しました。
最新バージョンにアップデートしてください。
+
+
+雲萌 Windows10 デジタルライセンス認証アプリの新しいバージョン発見しました。
アプリが古すぎるため、最新バージョンにアップデートしてから利用ください。
+
+
+Windows10ライセンス認証にはインターネットを通じてキーを取得する必要があります :)
+
+
+以前のキーをアンインストールできません :(
+
+
+キーをインストールできません、選択または入力されたエディションが間違っているかもしれません :(
+
+
+エディションコードを取得できません :(
+
+
+キーをインストールできません、選択または入力されたエディションが間違っているかもしれません :(
+
+
+タイムアウト,選択または入力されたエディションが間違っているかもしれません :(
+
+
+認証失敗。 :(
多分:
1. このエディション/バージョンの Windows はデジタルライセンス認証が適用しない。
2. マイクロソフトの認証サーバーに接続できません。
3. その他。
暫くお待ちくださいまたはあとでもう一度やり直してください。
+
+
+このシステムエディションに適用されたのは長期オフラインKMS(LTOK)オプションしか見つかりません。これによってシステムを再インストールした時自動的にライセンス認証しませんが、心配する必要はありません。この方法(LTOK)でライセンス認証後、インターネット接続なしでも最大19年間稼働を継続できます!
+
+
+おめでとうございます!
Windows 10はライセンス認証の準備が出来ています。
でも、マイクロソフトのライセンス認証サーバーに接続できませんみたいです。
システムは認証サーバーに接続出来る次第に自動的にライセンス認証します。
+
+
diff --git a/CMWTAT_DIGITAL/Lang/zh.xaml b/CMWTAT_DIGITAL/Lang/zh.xaml
new file mode 100644
index 0000000..b686399
--- /dev/null
+++ b/CMWTAT_DIGITAL/Lang/zh.xaml
@@ -0,0 +1,213 @@
+
+
+
+
+
+
+
+ Microsoft YaHei UI
+
+
+
+
+
+ 好
+
+
+ 取消
+
+
+ 丑拒
+
+
+ 请顿晚饭,感谢作者
+
+
+ 退出
+
+
+ 立即更新
+
+
+ 忽略
+
+
+ 云萌 Windows 10 数字权利激活工具
+
+
+ CMWTAT Digital Edition V2
+
+
+ 新版本可用!
+
+
+ 当前版本
+
+
+ 最新版本
+
+
+ 自动模式
+
+
+ 手动模式
+
+
+ 激活
+
+
+ 版本无缝转换 (安装产品密钥而不激活)
+
+
+ 测试文本
+
+
+ 载入中
+
+
+ 激活中
+
+
+ 完成
+
+
+ 云萌 Windows 10 激活工具 V2
+
+
+ 运行中。
+
+
+ 实验性
+
+
+ 注意
+
+
+ 系统版本
+
+
+ 无法在支持列表里识别您的操作系统版本,可能不受支持。
+
+
+ 只找到用于此版本系统的实验性选项,成功概率极低。
+
+
+ 你的系统版本可能不受支持,程序即将退出。不过你可以尝试添加 --expact 或者 -e 参数来启动。
+
+
+ 你的系统版本可能不受支持,程序即将退出。
+
+
+ 无法连接服务器,请检查网络并尝试稍后重试,程序即将退出。
+
+
+ 无法连接服务器,请检查网络并尝试稍后重试,程序即将退出。
+
+
+ 转换中
+
+
+ 激活中
+
+
+ 正在通过网络获取产品密钥
+
+
+ 正在通过网络获取产品密钥
+
+
+ 正在卸载旧的产品密钥
+
+
+ 正在卸载旧的产品密钥
+
+
+ 正在卸载旧的产品密钥(实验性)
+
+
+ 正在安装产品密钥
+
+
+ 正在安装产品密钥
+
+
+ 正在获取版本代号(实验性)
+
+
+ 正在准备下一步(实验性)
+
+
+ 正在写入旧系统残留特征
+
+
+ 正在获取免费升级许可
+
+
+ 正在清理更改
+
+
+ 正在获取数字许可证
+
+
+ 完成
+
+
+ 错误
+
+
+ 代码:
+
+
+ 系统返回:
+
+
+
+
+
+这个应用现已支持通过控制台参数启动!
-a --auto 自动激活。
-h --hide 隐藏模式运行 (只能与 -auto 一起使用)。
-e --expact 实验性激活。
-l --log 输出日志到文件。
-? --help 显示此说明对话框。
+
+
+祝贺!
Windows 10 已经成功转换。
+
+
+祝贺!
Windows 10 已经成功激活。
+
+
+我们发现了新版本的 云萌 Windows10 数字权利激活工具。
请更新到最新版本来确保它可以正常工作。
+
+
+我们发现了新版本的 云萌 Windows10 数字权利激活工具。
由于您的版本太旧,所以您必须更新到最新版本来确保它可以正常工作。
+
+
+激活Windows10需要网络获取产品密钥 :)
+
+
+无法卸载旧密钥 :(
+
+
+无法安装密钥,可能没有选择或输入正确的版本 :(
+
+
+无法获取版本代号 :(
+
+
+无法安装密钥,可能没有选择或输入正确的版本 :(
+
+
+执行超时,可能没有选择正确或输入的版本 :(
+
+
+激活失败。 :(
可能因为:
1. 此版本/类型的 Windows 不支持数字权利(数字许可证)方式激活。
2. 无法连接到微软Windows激活服务器。
3. 其它未知问题。
你可以尝试稍等片刻或者稍后重试。
+
+
+只找到用于此版本系统的长期离线KMS(批量激活)选项。
这表示您将不能在下次重装系统后自动激活。
不过无需担心,这不同于传统的KMS激活方式(离线状态下可以保持激活180天)
长期离线KMS(Offline-KMS)即使不联网也可以保持激活长达19年!
+
+
+祝贺!
Windows 10 已经快要激活成功了。
不过似乎Windows无法连接到微软激活服务器,
当下次连接上服务器时系统将会自动激活。
+
+
\ No newline at end of file
diff --git a/CMWTAT_DIGITAL/MainWindow.xaml b/CMWTAT_DIGITAL/MainWindow.xaml
new file mode 100644
index 0000000..2675932
--- /dev/null
+++ b/CMWTAT_DIGITAL/MainWindow.xaml
@@ -0,0 +1,237 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Title
+ Text
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CMWTAT_DIGITAL/MainWindow.xaml.cs b/CMWTAT_DIGITAL/MainWindow.xaml.cs
new file mode 100644
index 0000000..5975e8f
--- /dev/null
+++ b/CMWTAT_DIGITAL/MainWindow.xaml.cs
@@ -0,0 +1,1552 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using OSVersionInfoClass;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System.Net;
+using System.IO;
+using System.Threading;
+using Microsoft.Win32;
+using CMWTAT_DIGITAL.Domain;
+using System.Text.RegularExpressions;
+using System.Windows.Forms;
+using System.Globalization;
+using System.Reflection;
+using MaterialDesignThemes.Wpf;
+
+namespace CMWTAT_DIGITAL
+{
+
+ static class Constants
+ {
+ public const string DefaultLang = "en"; // 缺省语言
+ }
+
+ ///
+ /// MainWindow.xaml 的交互逻辑
+ ///
+ public partial class MainWindow : Window
+ {
+ [DllImport("Kernel32.dll")]
+ private static extern bool Wow64EnableWow64FsRedirection(bool Wow64FsEnableRedirection);//重定向
+
+ public struct Frequency
+ {
+ public int ID { get; set; }
+ public string DisplayOS { get; set; }
+ }
+
+ public static void ConsoleLog(string log_text = "")
+ {
+ Console.WriteLine(log_text);
+ if (Program.log2file == true)
+ {
+ WriteLog(log_text);
+ }
+ }
+
+ public static void WriteLog(string strLog)
+ {
+ string sFilePath = AppDomain.CurrentDomain.BaseDirectory;
+ string sFileName = "CMWTAT-" + DateTime.Now.ToString("yyyy-MM-dd") + ".log";
+ sFileName = sFilePath + sFileName; //文件的绝对路径
+ if (!Directory.Exists(sFilePath))//验证路径是否存在
+ {
+ Directory.CreateDirectory(sFilePath);
+ //不存在则创建
+ }
+ FileStream fs;
+ StreamWriter sw;
+ if (File.Exists(sFileName))
+ //验证文件是否存在,有则追加,无则创建
+ {
+ fs = new FileStream(sFileName, FileMode.Append, FileAccess.Write);
+ }
+ else
+ {
+ fs = new FileStream(sFileName, FileMode.Create, FileAccess.Write);
+ }
+ sw = new StreamWriter(fs);
+ sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + " --- " + strLog);
+ sw.Close();
+ fs.Close();
+ }
+
+ string tempfile = System.IO.Path.GetTempPath() + @"CMWTAT_DIGITAL\";
+
+ public void DelectTempFile()
+ {
+ //string tempfile = System.IO.Path.GetTempPath() + @"CMWTAT_DIGITAL\";
+ if (Directory.Exists(tempfile))
+ {
+ try
+ {
+ //DirectoryInfo dir = new DirectoryInfo(srcPath);
+ //FileSystemInfo[] fileinfo = dir.GetFileSystemInfos(); //返回目录中所有文件和子目录
+ //foreach (FileSystemInfo i in fileinfo)
+ //{
+ // if (i is DirectoryInfo) //判断是否文件夹
+ // {
+ // DirectoryInfo subdir = new DirectoryInfo(i.FullName);
+ // subdir.Delete(true); //删除子目录和文件
+ // }
+ // else
+ // {
+ // File.Delete(i.FullName); //删除指定文件
+ // }
+ //}
+ FileAttributes attr = File.GetAttributes(tempfile);
+ if (attr == FileAttributes.Directory)
+ {
+
+ Directory.Delete(tempfile, true);
+
+ }
+ else
+ {
+ File.Delete(tempfile);
+ }
+ }
+ catch (Exception e)
+ {
+ ConsoleLog("DelectTempFile:" + e.Message);
+ }
+ }
+ }
+
+ public void ExportTempFile()
+ {
+
+ //string tempfile = System.IO.Path.GetTempPath() + @"CMWTAT_DIGITAL\";
+
+ //if (tempfile.EndsWith(@"\"))
+ //{
+ // tempfile = tempfile.Remove(tempfile.Length - 1, 1);
+ //}
+
+ if (Directory.Exists(tempfile))
+ {
+ ConsoleLog("找到已存在的缓存,开始删除");
+ DelectTempFile();
+ ConsoleLog("删除操作完毕");
+ if (Directory.Exists(tempfile))
+ {
+ ConsoleLog("检测到文件依旧存在,等待三秒");
+ Thread.Sleep(3000);
+ }
+ else
+ {
+ ConsoleLog("确认完毕");
+ }
+ }
+
+ ConsoleLog("开始创建缓存");
+ Directory.CreateDirectory(tempfile);
+ ConsoleLog("创建缓存完毕");
+
+ byte[] temp;
+ System.IO.FileStream fileStream;
+
+ temp = CMWTAT_DIGITAL.Properties.Resources.gatherosstate;
+ fileStream = new System.IO.FileStream(tempfile + "gatherosstate" + ".exe", System.IO.FileMode.CreateNew);
+ fileStream.Write(temp, 0, (int)(temp.Length));
+ fileStream.Close();
+
+ temp = CMWTAT_DIGITAL.Properties.Resources.gatherosstateltsc;
+ fileStream = new System.IO.FileStream(tempfile + "gatherosstateltsc" + ".exe", System.IO.FileMode.CreateNew);
+ fileStream.Write(temp, 0, (int)(temp.Length));
+ fileStream.Close();
+
+ temp = CMWTAT_DIGITAL.Properties.Resources.slc;
+ fileStream = new System.IO.FileStream(tempfile + "slc" + ".dll", System.IO.FileMode.CreateNew);
+ fileStream.Write(temp, 0, (int)(temp.Length));
+ fileStream.Close();
+
+ temp = CMWTAT_DIGITAL.Properties.Resources.slmgr;
+ fileStream = new System.IO.FileStream(tempfile + "slmgr" + ".vbs", System.IO.FileMode.CreateNew);
+ fileStream.Write(temp, 0, (int)(temp.Length));
+ fileStream.Close();
+ }
+
+ public static string LocalLang = Constants.DefaultLang;
+ public static string NowLang = LocalLang;
+ ResourceDictionary langRd = null; //语言资源字典
+ public static CultureInfo currentCultureInfo = CultureInfo.CurrentCulture; //获取系统语言
+ public static bool NotSupportLang = false;
+
+ ///
+ /// 加载指定语言(支持热加载)
+ ///
+ public void LoadLang(string LangName = Constants.DefaultLang)
+ {
+
+ //MessageBox.Show(currentCultureInfo.Name);
+
+ try
+ {
+ //根据名字载入语言文件
+ langRd = System.Windows.Application.LoadComponent(new Uri(@"Lang\" + LangName + ".xaml", UriKind.Relative)) as ResourceDictionary;
+ NowLang = LangName;
+ if (LangName != Constants.DefaultLang)
+ {
+ LocalLang = LangName;
+ //btnChangeLang.Tag = LocalLang;
+ }
+ NotSupportLang = false;
+ }
+ catch
+ {
+ NotSupportLang = true;
+ //System.Windows.MessageBox.Show("The " + LangName + " language pack was not found and the language was set to English.\nIf you want to use Chinese as the interface language, click the \"Language\" button to switch.");
+ langRd = System.Windows.Application.LoadComponent(new Uri(@"Lang\" + Constants.DefaultLang + ".xaml", UriKind.Relative)) as ResourceDictionary;
+ NowLang = Constants.DefaultLang;
+ }
+
+ if (langRd != null)
+ {
+ //如果已使用其他语言,先清空
+ if (this.Resources.MergedDictionaries.Count > 0)
+ {
+ this.Resources.MergedDictionaries.Clear();
+ }
+ this.Resources.MergedDictionaries.Add(langRd);
+ }
+ }
+
+ private static void ApplyBase(bool isDark)
+ {
+ new PaletteHelper().SetLightDark(isDark);
+ }
+
+ string ProductVersion = "0.0.0.0"; // 存储程序版本
+
+ ///
+ /// 获取当前版本
+ ///
+ private void GetEdition()
+ {
+ Assembly assembly = Assembly.GetExecutingAssembly();
+
+ ConsoleLog("AppAssemblyFullName: " + assembly.FullName);
+
+ // 获取程序集元数据
+ AssemblyCopyrightAttribute copyright = (AssemblyCopyrightAttribute)
+ AssemblyCopyrightAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),
+ typeof(AssemblyCopyrightAttribute));
+ AssemblyDescriptionAttribute description = (AssemblyDescriptionAttribute)
+ AssemblyDescriptionAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(),
+ typeof(AssemblyDescriptionAttribute));
+
+ ProductVersion = System.Windows.Forms.Application.ProductVersion;
+
+ ConsoleLog("AppDescription: " + description.Description);
+ ConsoleLog("AppCopyright: " + copyright.Copyright);
+ ConsoleLog("AppProductVersion: " + System.Windows.Forms.Application.ProductVersion);
+ }
+
+ //static bool autoact = false;
+ //static bool hiderun = false;
+ //static bool expact = false;
+ //static bool log2file = false;
+ //static bool showhelp = false;
+
+ //public string SystemEdition = OSVersionInfo.Name + " " + OSVersionInfo.Edition;
+ public string SystemEdition = OSVersionInfo.Edition;
+
+ bool isDark = false;
+
+ string WindowsTheme = "Light";
+
+ NotifyIcon notifyIcon;
+
+ public void CheckWindowsTheme()
+ {
+ var uiSettings = new Windows.UI.ViewManagement.UISettings();
+ Windows.UI.Color Wcolor = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background);
+ System.Drawing.Color Scolor = System.Drawing.Color.FromArgb(Wcolor.R, Wcolor.G, Wcolor.B);
+ float hue = Scolor.GetHue(); // 色调
+ float saturation = Scolor.GetSaturation(); // 饱和度
+ float lightness = Scolor.GetBrightness(); // 亮度
+
+ if (lightness > 0.75)
+ {
+ isDark = false;
+ WindowsTheme = "Light";
+ }
+ else
+ {
+ isDark = true;
+ WindowsTheme = "Dark";
+ }
+
+ //ConsoleLog("Windows Theme Background is: " + Wcolor);
+ //ConsoleLog("Windows Theme Brightness is: " + lightness);
+ //ConsoleLog("Windows Theme Mode is: " + WindowsTheme);
+ }
+
+ public MainWindow()
+ {
+
+ CheckWindowsTheme();
+
+ ConsoleLog("Windows Theme Mode is: " + WindowsTheme);
+
+ GetEdition(); // 获取程序版本
+
+ //autoact = Program.autoact;
+ //hiderun = Program.hiderun;
+ //expact = Program.expact;
+ //log2file = Program.log2file;
+ //showhelp = Program.showhelp;
+
+ //MessageBox.Show("A:" + autoact.ToString() + ";H:" + hiderun.ToString());
+
+ InitializeComponent();
+
+ ApplyBase(isDark);
+
+ string LangName = currentCultureInfo.Name;
+ //根据本地语言来进行本地化
+ LangName = LangName.Substring(0, LangName.IndexOf("-"));
+ //LangName = "ja"; // 如需测试语言,请取消注释此行
+ LoadLang(LangName);
+
+ this.Title = this.Title + " V" + ProductVersion; // 初始化语言后为标题增加版本号
+
+ //System.Windows.MessageBox.Show((string)this.Resources["HelpText"]);
+
+ if (Program.showhelp == true)
+ {
+ DialogHelp.IsOpen = true;
+ }
+
+ notifyIcon = new System.Windows.Forms.NotifyIcon(); // 先初始化托盘图标,以方便语言缺省时提示
+ notifyIcon.Text = (string)this.Resources["notifyIconTitle"]; //托盘图标标题
+ notifyIcon.Icon = ((System.Drawing.Icon)(CMWTAT_DIGITAL.Properties.Resources.CMWTAT_ICON));
+
+ if ((Program.hiderun == true && Program.autoact == true) || NotSupportLang == true)
+ {
+
+ //notifyIcon.BalloonTipText = "The app has been minimised. Click the tray icon to show.";
+ //notifyIcon.BalloonTipTitle = "The App";
+
+ //notifyIcon.Icon = new System.Drawing.Icon("TheAppIcon.ico");
+
+ //notifyIcon.Click += new EventHandler(notifyIcon_Click);
+
+ notifyIcon.Visible = true;
+
+ //打开菜单项
+ //System.Windows.Forms.MenuItem open = new System.Windows.Forms.MenuItem("Open");
+ //open.Click += new EventHandler((o, e) =>
+ //{
+ // this.Show();
+ //});
+
+ //退出菜单项
+ System.Windows.Forms.MenuItem exit = new System.Windows.Forms.MenuItem("Exit");
+ exit.Click += new EventHandler(Exit_Button_Click);
+
+ //关联托盘控件
+ //System.Windows.Forms.MenuItem[] childen = new System.Windows.Forms.MenuItem[] { open, exit };
+
+ System.Windows.Forms.MenuItem[] childen = new System.Windows.Forms.MenuItem[] { exit };
+
+ notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(childen);
+
+ //this.notifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler((o, e) =>
+ //{
+ // if (e.Button == MouseButtons.Left) this.Show();
+ //});
+ }
+
+ if (NotSupportLang == true)
+ {
+ int tipShowMilliseconds = 0;
+ string tipTitle = (string)this.Resources["notifyIconTitle"];
+ string tipContent = "The language pack \"" + LangName + "\" was not found, language has been automatically switched to English. You can submit this language on GitHub."; // 提示不支持语言提示
+ ToolTipIcon tipType = ToolTipIcon.None;
+ notifyIcon.ShowBalloonTip(tipShowMilliseconds, tipTitle, tipContent, tipType);
+ }
+
+ if (Program.hiderun == true && Program.autoact == true)
+ {
+ this.Hide();
+
+ int tipShowMilliseconds = 0;
+ string tipTitle = (string)this.Resources["notifyIconTitle"]; //通知气泡标题
+ string tipContent = (string)this.Resources["Running"]; //提示正在运行
+ ToolTipIcon tipType = ToolTipIcon.None;
+ notifyIcon.ShowBalloonTip(tipShowMilliseconds, tipTitle, tipContent, tipType);
+
+ //notifyIcon.BalloonTipClicked += new EventHandler((o, e) =>
+ //{
+ // //System.Windows.MessageBox.Show(System.Windows.Forms.Control.MouseButtons.ToString());
+ // if (System.Windows.Forms.Control.MouseButtons == MouseButtons.None) //左键返回不是Right是None
+ // {
+ // System.Windows.MessageBox.Show("Hello");
+ // };
+ //});
+ }
+
+ //初始化动态表单数据绑定
+ DataContext = new ViewModel();
+
+ this.DialogHostGrid.Visibility = Visibility.Visible;
+
+ //MessageBox.Show(@"reg add ""HKLM\SYSTEM\Tokens\"" /v ""Channel"" /t REG_SZ /d ""Retail"" /f");
+ DialogWait.IsOpen = true;
+ try
+ {
+ RegistryKey pRegKey = Registry.LocalMachine;
+ pRegKey = pRegKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");
+ SystemEdition = pRegKey.GetValue("EditionID").ToString();
+ }
+ catch
+ {
+ SystemEdition = OSVersionInfo.Edition;
+ }
+
+ //SystemEditionText.Text = SystemEdition;
+ Thread loadthread = new Thread(LoadOSList);
+ loadthread.Start();
+
+ }
+
+ JArray ositems;
+ int now_os_index = 0;
+ string checked_os = "unknow";
+
+ bool is_auto = true; //是否为自动模式,false为手动
+
+ private void InvokeTest()
+ {
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ LoadOSList();
+ }));
+ }
+
+ ///
+ /// 检查更新
+ ///
+ private void CheckUpdate()
+ {
+ try
+ {
+ string check_update_json = GetHttpWebRequest("https://cmwtat.cloudmoe.com/api/check_update?version=" + ProductVersion);
+ JObject check_update_jsonobj = JObject.Parse(check_update_json);
+ List check_update_list = new List();
+ JValue latest_version = (JValue)check_update_jsonobj["latest"];
+ JValue oldest_version = (JValue)check_update_jsonobj["oldest"];
+ //System.Windows.MessageBox.Show(latest_version.ToString());
+ Version CurrentVersion = new Version(ProductVersion);
+ Version LatestVersion = new Version(latest_version.ToString());
+ Version AllowedVersion = new Version(oldest_version.ToString());
+ if (CurrentVersion >= LatestVersion) // 当前版本大于等于最新版本
+ {
+ //System.Windows.MessageBox.Show("无需更新");
+ }
+ if (CurrentVersion < LatestVersion) // 当前版本小于最新版本
+ {
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ if (CurrentVersion < AllowedVersion) // 当前版本小于最低允许版本
+ {
+ this.IgnoreUpdate.IsEnabled = false;
+ //System.Windows.MessageBox.Show("必须更新");
+ }
+ else
+ {
+ this.IgnoreUpdate.IsEnabled = true;
+ }
+ this.DialogUpdateTitle.Text = (string)this.Resources["UpdateTitle"];
+ this.DialogUpdateText.Text = (string)this.Resources["UpdateText"] + "\r\n" + (string)this.Resources["CurrentVersion"] + ": " + ProductVersion + "\r\n" + (string)this.Resources["LatestVersion"] + ": " + latest_version.ToString();
+ this.DialogUpdate.IsOpen = true;
+ }));
+ //System.Windows.MessageBox.Show("需要更新");
+ }
+ }
+ catch
+ {
+ }
+ }
+
+ public static string MainServerDomain = "https://cmwtat.cloudmoe.com"; // 主要服务器
+ public static string BackupServerDomain = "https://kms.kumo.moe"; // 备用服务器
+
+ private void LoadOSList()
+ {
+
+ int is_selected = 0; //是否已经自动选择,0未选择,1普通模式,2实验模式,3离线KMS模式
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ DialogWait.IsOpen = true;
+ }));
+
+ try
+ {
+ string json;
+ try
+ {
+ json = GetHttpWebRequest(MainServerDomain + "/api/digital?list=1&ver=3"); // 主要服务器
+ }
+ catch (Exception e)
+ {
+ ConsoleLog("MainServer:" + MainServerDomain + " is not working.");
+ ConsoleLog("Error Message:" + e.Message);
+ ConsoleLog("Ready to use BackupServer:" + BackupServerDomain);
+ json = GetHttpWebRequest(BackupServerDomain + "/api/digital?list=1&ver=3"); // 备用服务器
+ }
+ JObject jsonobj = JObject.Parse(json);
+ List list = new List();
+ Frequency freq = new Frequency();
+ ositems = (JArray)jsonobj["OS"];
+
+ for (int i = 0; i < ositems.Count(); i++)
+ {
+ freq.ID = i;
+ freq.DisplayOS = jsonobj["OS"][i].ToString();
+
+ //按照优先级判断,如果已经自动选择则忽略新的
+ //选择带版本号
+ if (String.Equals(jsonobj["OS"][i].ToString(), SystemEdition + OSVersionInfo.BuildVersion, StringComparison.CurrentCultureIgnoreCase) && is_selected == 0)//jsonobj["OS"][i].ToString() == SystemEdition + OSVersionInfo.BuildVersion
+ {
+ now_os_index = i;
+ checked_os = SystemEdition + OSVersionInfo.BuildVersion;
+ is_selected = 1;
+ }
+
+ //选择带版本号Offline-KMS
+ if (String.Equals(jsonobj["OS"][i].ToString(), "(Offline-KMS) " + SystemEdition + OSVersionInfo.BuildVersion, StringComparison.CurrentCultureIgnoreCase) && is_selected == 0)//旧的方法:jsonobj["OS"][i].ToString() == "(Experimental) " + SystemEdition,新方法忽略大小写并提升效率
+ {
+ now_os_index = i;
+ checked_os = "(Offline-KMS) " + SystemEdition + OSVersionInfo.BuildVersion;
+ is_selected = 3;
+ }
+
+ //选择不带版本号
+ if (String.Equals(jsonobj["OS"][i].ToString(), SystemEdition, StringComparison.CurrentCultureIgnoreCase) && is_selected == 0)//jsonobj["OS"][i].ToString() == SystemEdition
+ {
+ now_os_index = i;
+ checked_os = SystemEdition;
+ is_selected = 1;
+ }
+
+ //选择不带版本号Offline-KMS
+ if (String.Equals(jsonobj["OS"][i].ToString(), "(Offline-KMS) " + SystemEdition, StringComparison.CurrentCultureIgnoreCase) && is_selected == 0)//旧的方法:jsonobj["OS"][i].ToString() == "(Experimental) " + SystemEdition,新方法忽略大小写并提升效率
+ {
+ now_os_index = i;
+ checked_os = "(Offline-KMS) " + SystemEdition;
+ is_selected = 3;
+ }
+
+ //选择不带版本号实验
+ if (String.Equals(jsonobj["OS"][i].ToString(), "(Experimental) " + SystemEdition, StringComparison.CurrentCultureIgnoreCase) && is_selected == 0)//旧的方法:jsonobj["OS"][i].ToString() == "(Experimental) " + SystemEdition,新方法忽略大小写并提升效率
+ {
+ now_os_index = i;
+ checked_os = "(Experimental) " + SystemEdition;
+ is_selected = 2;
+ }
+ list.Add(freq);
+ }
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.SystemEditionText.ItemsSource = list;//控件的ID
+
+ if (is_selected == 0)//没有匹配
+ {
+ this.SystemEditionText.SelectedIndex = 0;
+ this.DialogWithOKToCloseDialogTitle.Text = (string)this.Resources["Attention"];
+ this.DialogWithOKToCloseDialogText.Text = (string)this.Resources["May_be_not_be_supported"] + "\r\n(" + (string)this.Resources["System_Edition"] + ": " + SystemEdition + OSVersionInfo.BuildVersion + ")";
+ this.DialogWithOKToCloseDialog.IsOpen = true;
+ }
+ else if (is_selected == 2)//只找到实验性
+ {
+ this.SystemEditionText.SelectedIndex = now_os_index;
+ this.DialogWithOKToCloseDialogTitle.Text = (string)this.Resources["Attention"];
+ this.DialogWithOKToCloseDialogText.Text = (string)this.Resources["Only_find_experimental"] + "\r\n(" + (string)this.Resources["System_Edition"] + ": " + SystemEdition + OSVersionInfo.BuildVersion + ")";
+ this.DialogWithOKToCloseDialog.IsOpen = true;
+ }
+ else if (is_selected == 3)//只找到长期KMS
+ {
+ this.SystemEditionText.SelectedIndex = now_os_index;
+ this.DialogWithOKToCloseDialogTitle.Text = (string)this.Resources["Attention"];
+ this.DialogWithOKToCloseDialogText.Text = (string)this.Resources["Only_find_ltok"] + "\r\n(" + (string)this.Resources["System_Edition"] + ": " + SystemEdition + OSVersionInfo.BuildVersion + ")";
+ this.DialogWithOKToCloseDialog.IsOpen = true;
+ }
+ else
+ {
+ this.SystemEditionText.SelectedIndex = now_os_index;
+ }
+ }));
+
+ //this.SystemEditionText.SelectedIndex = now_os_index;
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ DialogWait.IsOpen = false;
+ }));
+
+ if (Program.autoact == true)//自动激活
+ {
+ Thread actthread = new Thread(RunAct);
+ switch (is_selected)
+ {
+ case 1: //正常
+ actthread.Start();
+ break;
+ case 2: //实验性
+ if (Program.expact == true)
+ {
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ DialogWithOKToCloseDialog.IsOpen = false;
+ }));
+ actthread.Start();
+ }
+ else
+ {
+ if (Program.hiderun == true)
+ {
+ int tipShowMilliseconds = 0;
+ string tipTitle = (string)this.Resources["notifyIconTitle"];
+ string tipContent = (string)this.Resources["notify_May_be_not_be_supported_try"]; //提示不支持可尝试实验性
+ ToolTipIcon tipType = ToolTipIcon.None;
+ notifyIcon.ShowBalloonTip(tipShowMilliseconds, tipTitle, tipContent, tipType);
+ Exit_Button_Click(null, null);//退出
+ }
+ }
+ break;
+ default:
+ if (Program.hiderun == true)
+ {
+ int tipShowMilliseconds = 0;
+ string tipTitle = (string)this.Resources["notifyIconTitle"];
+ string tipContent = (string)this.Resources["notify_May_be_not_be_supported_exit"]; //提示不支持并退出(实验性开启)
+ ToolTipIcon tipType = ToolTipIcon.None;
+ notifyIcon.ShowBalloonTip(tipShowMilliseconds, tipTitle, tipContent, tipType);
+ Exit_Button_Click(null, null);//退出
+ }
+ break;
+ }
+ }
+ }
+ catch
+ {
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ DialogWait.IsOpen = false;
+ }));
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ DialogWithExit.IsOpen = true;
+ }));
+
+ if (Program.hiderun == true && Program.autoact == true)
+ {
+ int tipShowMilliseconds = 0;
+ string tipTitle = (string)this.Resources["notifyIconTitle"];
+ string tipContent = (string)this.Resources["notify_Disconnect_to_server_exit"]; //提示无法连接服务器退出
+ ToolTipIcon tipType = ToolTipIcon.None;
+ notifyIcon.ShowBalloonTip(tipShowMilliseconds, tipTitle, tipContent, tipType);
+ Exit_Button_Click(null, null);//退出
+ }
+ }
+ CheckUpdate(); // 检查更新
+ }
+ private void Activate_Button_Click(object sender, RoutedEventArgs e)
+ {
+ Thread actthread = new Thread(RunAct);
+ actthread.Start();
+
+ //RunAct();
+ //LoadOSList();
+
+ //MessageBox.Show(json);
+ //MessageBox.Show(rss["OS"][0].ToString());
+ //MessageBox.Show(SystemEdition);
+ }
+
+ private void installbtn_Click(object sender, RoutedEventArgs e)
+ {
+ Thread installthread = new Thread(RunInstall);
+ installthread.Start();
+ }
+
+ private string GetHttpWebRequest(string url, int timeout = 10000, int retry = 2)
+ {
+ string outex = "UnknowError";
+ for (int i = 0; i < retry; i++) // 默认重试2次
+ {
+ ConsoleLog("GetHttpWebRequest Try: " + i.ToString());
+ try
+ {
+ Uri uri = new Uri(url);
+ HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(uri);
+ myReq.UserAgent = "User-Agent:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705";
+ myReq.Accept = "*/*";
+ myReq.KeepAlive = true;
+ myReq.Headers.Add("Accept-Language", "zh-cn,en-us;q=0.5");
+ myReq.Timeout = timeout; // 默认10s超时
+ HttpWebResponse result = null;
+ string strHTML = null;
+ result = (HttpWebResponse)myReq.GetResponse();
+ Stream receviceStream = result.GetResponseStream();
+ StreamReader readerOfStream = new StreamReader(receviceStream, System.Text.Encoding.GetEncoding("utf-8"));
+ strHTML = readerOfStream.ReadToEnd();
+ readerOfStream.Close();
+ receviceStream.Close();
+ result.Close();
+ return strHTML;
+ }
+ catch (WebException ex)
+ {
+ outex = ex.Message;
+ ConsoleLog("GetHttpWebRequest Exception: " + ex.Message);
+ if (ex.Status == WebExceptionStatus.Timeout) // 超时重试
+ {
+ continue;
+ }
+ throw new Exception(ex.Message); // 其他错误抛出
+ }
+ }
+ throw new Exception(outex);
+ }
+
+ private void Exit_Button_Click(object sender, EventArgs e)
+ {
+ DelectTempFile();
+ notifyIcon.Visible = false;
+ System.Windows.Application.Current.Shutdown();
+ }
+
+ private void RunInstall()
+ {
+ ExportTempFile();
+ //释放文件
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.DialogActProg.IsOpen = true;
+ this.activatingtext.Text = (string)this.Resources["RunInstall_Converting"]; //提示转换中
+ }));
+
+ Wow64EnableWow64FsRedirection(false);//关闭文件重定向
+
+ string code = "-0";
+ string key = "00000-00000-00000-00000-00000";
+ string sku = "0";
+ string msg = "Unknow Error!";
+ string system = "";
+
+ string slmgr = Environment.GetFolderPath(Environment.SpecialFolder.SystemX86) + "\\slmgr.vbs";
+
+ string slmgr_self = tempfile + "slmgr.vbs";
+
+ try
+ {
+ string sourceFile = slmgr;
+ string targetFile = slmgr_self;
+ bool isrewrite = true; // true=覆盖已存在的同名文件,false则反之
+ ConsoleLog("Copy Start: " + sourceFile + " To " + targetFile);
+ System.IO.File.Copy(sourceFile, targetFile, isrewrite);
+ ConsoleLog("Copy Completed.");
+ }
+ catch (Exception CopyExc)
+ {
+ ConsoleLog("Copy has Exception: " + CopyExc.Message);
+ }
+
+ //旧的位置
+ //string slmgr_self = System.AppDomain.CurrentDomain.BaseDirectory + "slmgr.vbs";
+
+ string changepk = Environment.SystemDirectory + "\\changepk.exe";
+
+ if (is_auto == true)
+ {
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ system = this.SystemEditionText.Text;
+ }));
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.activatingtext.Text = (string)this.Resources["RunInstall_Getting_Key"]; //提示正在获取密钥
+ }));
+
+ //获取密钥和SKU
+ try
+ {
+
+ string json;
+ try
+ {
+ json = GetHttpWebRequest(MainServerDomain + "/api/digital?list=0&ver=3"); // 主要服务器
+ }
+ catch (Exception e)
+ {
+ ConsoleLog("MainServer:" + MainServerDomain + " is not working.");
+ ConsoleLog("Error Message:" + e.Message);
+ ConsoleLog("Ready to use BackupServer:" + BackupServerDomain);
+ json = GetHttpWebRequest(BackupServerDomain + "/api/digital?list=0&ver=3"); // 备用服务器
+ }
+ JObject jsonobj = JObject.Parse(json);
+ List list = new List();
+ ositems = (JArray)jsonobj["OS"];
+ key = jsonobj[system]["key"].ToString();
+ sku = jsonobj[system]["sku"].ToString();
+ ConsoleLog("Edition:" + system + "\r\nKEY:" + key + "\r\nSKU:" + sku);
+
+ }
+ catch
+ {
+ code = "-0";
+ msg = (string)this.Resources["ErrorMsg-0"]; // "激活Windows10需要网络获取产品密钥 :) \nActivate Windows 10 requires a network to gets the product key :)";
+ goto EndLine;
+ }
+ }
+ else
+ {
+
+ //手动密钥
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ key = this.SystemEditionTextInput.Text;
+ }));
+
+ }
+
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.activatingtext.Text = (string)this.Resources["RunInstall_Uninstalling_old_Key"]; //提示正在卸载旧密钥
+ }));
+ //卸载
+ string runend = RunCScript(slmgr_self, "-upk").Trim();
+ //string runend = RunCMD(@"cscript.exe /nologo %systemroot%\system32\slmgr.vbs -upk").Trim();
+ ConsoleLog(runend);
+ if (runend.EndsWith("successfully.") || runend.EndsWith("not found."))
+ {
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.activatingtext.Text = (string)this.Resources["RunInstall_Installing_Key"]; //提示正在安装密钥
+ }));
+
+ //安装数字权利升级密钥
+ if (RunCScript(slmgr_self, "-ipk " + key).Trim().EndsWith("successfully."))
+ //if (RunCMD(@"cscript.exe /nologo %systemroot%\system32\slmgr.vbs -ipk " + key).Trim().EndsWith("successfully."))
+ {
+ code = "200";
+ }
+ else
+ {
+ code = "-2";
+ msg = (string)this.Resources["ErrorMsg-2"]; // "无法安装密钥,可能没有选择或输入正确的版本 :(\nCannot to install key, may be you choose or enter a incorrect version. :(";
+ }
+ }
+ else
+ {
+ code = "-1";
+ msg = (string)this.Resources["ErrorMsg-1"]; // "无法卸载旧密钥 :(\nCannot to uninstall old key. :(";
+ }
+ //string runend = RunCScript(slmgr_self, "-upk").Trim();
+ EndLine:;
+ if (code != "200")
+ {
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.DialogActProg.IsOpen = false;
+ this.activatingtext.Text = (string)this.Resources["RunInstall_Converting"]; //提示转换中
+ this.DialogWithOKToCloseDialog.IsOpen = true;
+ this.DialogWithOKToCloseDialogTitle.Text = (string)this.Resources["ErrorTitle"]; //错误标题
+ this.DialogWithOKToCloseDialogText.Text = msg + "\r\n" + (string)this.Resources["ErrorCode"] + code; //错误代码 如:错误信息\r\nCode:000
+ }));
+ //MessageBox.Show(msg + "\r\nCode:" + code);
+ }
+ else
+ {
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.DialogActProg.IsOpen = false;
+ this.activatingtext.Text = (string)this.Resources["RunInstall_Converting"]; //提示转换中
+ this.DialogWithOKToCloseDialogDonate.IsOpen = true;
+ this.DialogWithOKToCloseDialogDonateTitle.Text = (string)this.Resources["CompleteTitle"]; //完成标题
+ this.DialogWithOKToCloseDialogDonateText.Text = (string)this.Resources["DonateTextConverted"]; //完成转换内容
+ }));
+ //MessageBox.Show("Congratulation!");
+ }
+ DelectTempFile();
+ //清理文件
+ }
+
+ private void ShowBallSameDig()
+ {
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ if (Program.hiderun == true && Program.autoact == true)
+ {
+ int tipShowMilliseconds = 0;
+ string tipTitle = (string)this.Resources["notifyIconTitle"];
+ string tipContent = this.activatingtext.Text;
+ ToolTipIcon tipType = ToolTipIcon.None;
+ notifyIcon.ShowBalloonTip(tipShowMilliseconds, tipTitle, tipContent, tipType);
+ }
+ }));
+ }
+
+ private void RunAct()
+ {
+ bool is_not_network_to_act = false; //是否无法联网稍后激活
+ ExportTempFile();
+ //释放文件
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.DialogActProg.IsOpen = true;
+ this.activatingtext.Text = (string)this.Resources["RunAct_Activating"]; //提示激活中
+ ShowBallSameDig();
+ }));
+
+ Wow64EnableWow64FsRedirection(false);//关闭文件重定向
+
+ string code = "-0";
+ string key = "00000-00000-00000-00000-00000";
+ string sku = "0";
+ string msg = "Unknow Error!";
+ string system = "";
+ string mode = "1"; //1:普通(SYS、SKU、KEY完全);2.需要获取SKU(SYS、KEY);3.手动输入KEY;4.普通OfflineKMS(SYS、SKU、KEY完全)
+
+ string slmgr = Environment.GetFolderPath(Environment.SpecialFolder.SystemX86) + "\\slmgr.vbs";
+
+ string slmgr_self = tempfile + "slmgr.vbs";
+
+ try
+ {
+ string sourceFile = slmgr;
+ string targetFile = slmgr_self;
+ bool isrewrite = true; // true=覆盖已存在的同名文件,false则反之
+ ConsoleLog("Copy Start: " + sourceFile + " To " + targetFile);
+ System.IO.File.Copy(sourceFile, targetFile, isrewrite);
+ ConsoleLog("Copy Completed.");
+ }
+ catch (Exception CopyExc)
+ {
+ ConsoleLog("Copy has Exception: " + CopyExc.Message);
+ }
+
+ //旧的位置
+ //string slmgr_self = System.AppDomain.CurrentDomain.BaseDirectory + "slmgr.vbs";
+
+ string changepk = Environment.SystemDirectory + "\\changepk.exe";
+
+ if (is_auto == true)
+ {
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ system = this.SystemEditionText.Text;
+ }));
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.activatingtext.Text = (string)this.Resources["RunAct_Getting_Key"]; //提示正在获取密钥
+ ShowBallSameDig();
+ }));
+
+ //获取密钥和SKU
+ try
+ {
+
+ string json;
+ try
+ {
+ json = GetHttpWebRequest(MainServerDomain + "/api/digital?list=0&ver=3"); // 主要服务器
+ }
+ catch (Exception e)
+ {
+ ConsoleLog("MainServer:" + MainServerDomain + " is not working.");
+ ConsoleLog("Error Message:" + e.Message);
+ ConsoleLog("Ready to use BackupServer:" + BackupServerDomain);
+ json = GetHttpWebRequest(BackupServerDomain + "/api/digital?list=0&ver=3"); // 备用服务器
+ }
+ JObject jsonobj = JObject.Parse(json);
+ List list = new List();
+ ositems = (JArray)jsonobj["OS"];
+ key = jsonobj[system]["key"].ToString();
+ sku = jsonobj[system]["sku"].ToString();
+ ConsoleLog("Edition:" + system + "\r\nKEY:" + key + "\r\nSKU:" + sku);
+
+ string selecos = "";
+ // 获取当前选择的选择的文本
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ selecos = SystemEditionText.Text;
+ }));
+
+ ConsoleLog("Selected OS: " + selecos);
+
+ if (sku == "unknow")
+ {
+ mode = "2";
+ }
+
+ if (selecos.ToUpper().StartsWith("(Offline-KMS)".ToUpper()))
+ {
+ ConsoleLog("Switch Mode Offline-KMS");
+ mode = "4";
+ }
+
+ }
+ catch
+ {
+ code = "-0";
+ msg = (string)this.Resources["ErrorMsg-0"]; // "激活Windows10需要网络获取产品密钥 :) \nActivate Windows 10 requires a network to gets the product key :)";
+ goto EndLine;
+ }
+
+ }
+ else
+ {
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ key = this.SystemEditionTextInput.Text;
+ }));
+ mode = "3";
+ sku = "unknow";
+
+ }
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.activatingtext.Text = (string)this.Resources["RunAct_Uninstalling_old_Key"]; //提示正在卸载旧密钥
+ ShowBallSameDig();
+ }));
+
+ //卸载
+ string runend = RunCScript(slmgr_self, "-upk").Trim();
+ //string runend = RunCMD(@"cscript.exe /nologo %systemroot%\system32\slmgr.vbs -upk").Trim();
+ ConsoleLog(runend);
+ if (runend.EndsWith("successfully.") || runend.EndsWith("not found."))
+ {
+
+ RunCScript(slmgr_self, "-ckms").Trim();
+
+ if (mode == "4")
+ {
+ //长期KMS
+ RunCMD(@"sc stop sppsvc");
+
+ RunCMD(@"del /F /Q %systemroot%\system32\spp\store\2.0\tokens.dat");
+ RunCMD(@"del /F /Q %systemroot%\system32\spp\store\2.0\data.dat");
+ RunCMD(@"del /F /Q %systemroot%\system32\spp\store\2.0\cache\cache.dat");
+ }
+
+ if (sku == "unknow")//if (mode == "2" || mode == "3") //获取SKU
+ {
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.activatingtext.Text = (string)this.Resources["RunAct_Getting_edition_code_Exp"]; // "Getting edition code (Experimental)";
+ ShowBallSameDig();
+ }));
+
+ //安装转换密钥
+ runend = RunCScript(slmgr_self, "-ipk " + key);
+ //runend = RunCMD(@"cscript.exe /nologo %systemroot%\system32\slmgr.vbs -ipk " + key);
+ ConsoleLog(slmgr_self + " -ipk " + key);
+ ConsoleLog(runend);
+ if (runend.Trim().EndsWith("successfully."))
+ {
+ Thread.Sleep(6000); //等待6秒,确保SKU生效
+ sku = GetSKU(); //获取SKU
+ if (sku != "Error")
+ {
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.activatingtext.Text = (string)this.Resources["RunAct_Uninstalling_old_Key_Exp"]; //提示正在卸载旧密钥(实验性)
+ ShowBallSameDig();
+ }));
+
+ runend = RunCScript(slmgr_self, "-upk").Trim();
+ //runend = RunCMD(@"cscript.exe /nologo %systemroot%\system32\slmgr.vbs -upk").Trim();
+ ConsoleLog(runend);
+ if (runend.EndsWith("successfully.") || runend.EndsWith("not found."))
+ {
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.activatingtext.Text = (string)this.Resources["RunAct_Prepare_for_the_next_step_Exp"]; // "Prepare for the next step (Experimental)";
+ ShowBallSameDig();
+ }));
+ }
+ }
+ else
+ {
+ code = "-1.2";
+ msg = (string)this.Resources["ErrorMsg-1.2"]; // "无法获取版本代号 :(\nCannot to get edition code. :(";
+ goto EndLine;
+ }
+ }
+ else
+ {
+ code = "-1.1";
+ msg = (string)this.Resources["ErrorMsg-1.1"]; // "无法安装密钥,可能没有选择或输入正确的版本 :(\nCannot to install key, may be you choose or enter a incorrect version. :(";
+ goto EndLine;
+ }
+ }
+
+ //写入Win7特征
+ //ChangePKAction(changepk + " /ProductKey " + key);
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.activatingtext.Text = (string)this.Resources["RunAct_Writing_old_OS"]; // "Writing feature of old Windows version";
+ ShowBallSameDig();
+ }));
+
+ if (mode == "4")
+ {
+ //长期KMS
+ ConsoleLog(RunCScript(slmgr_self, "-skms 1.1.45.14:1919").Trim()); // いいよ、来いよ www
+ //ConsoleLog(RunCMD(@"cscript.exe /nologo %systemroot%\system32\slmgr.vbs -skms 1.1.45.14:1919").Trim()); // いいよ、来いよ www
+ //if (runend.EndsWith("successfully."))
+ //{
+ //}
+ RunCMD(@"reg add ""HKLM\SYSTEM\Tokens"" /v ""Channel"" /t REG_SZ /d ""Volume:GVLK"" /f");
+ }
+ else
+ {
+ RunCMD(@"reg add ""HKLM\SYSTEM\Tokens"" /v ""Channel"" /t REG_SZ /d ""Retail"" /f");
+ }
+
+ RunCMD(@"reg add ""HKLM\SYSTEM\Tokens\Kernel"" /v ""Kernel-ProductInfo"" /t REG_DWORD /d " + sku + " /f");
+ RunCMD(@"reg add ""HKLM\SYSTEM\Tokens\Kernel"" /v ""Security-SPP-GenuineLocalStatus"" /t REG_DWORD /d 1 /f");
+ RunCMD(@"reg add ""HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"" /v ""C:\gatherosstate.exe"" /d ""~ WIN7RTM"" /f");
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.activatingtext.Text = (string)this.Resources["RunAct_Installing_Key"]; //提示正在安装密钥
+ ShowBallSameDig();
+ }));
+
+ //安装数字权利升级密钥
+ runend = RunCScript(slmgr_self, "-ipk " + key);
+ //runend = RunCMD(@"cscript.exe /nologo %systemroot%\system32\slmgr.vbs -ipk " + key);
+ ConsoleLog(slmgr_self + " -ipk " + key);
+ ConsoleLog(runend);
+ if (runend.Trim().EndsWith("successfully."))
+ {
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.activatingtext.Text = (string)this.Resources["RunAct_Getting_free_upgrade_permissions"]; // "Getting free upgrade permissions";
+ ShowBallSameDig();
+ }));
+
+ if (mode == "4")
+ {
+ //长期KMS
+ RunCLI(tempfile + "gatherosstateltsc.exe");
+ ConsoleLog("进入下一步");
+ }
+ else
+ {
+ RunCLI(tempfile + "gatherosstate.exe");
+ ConsoleLog("进入下一步");
+ }
+
+ //旧的位置
+ //RunCMD(System.AppDomain.CurrentDomain.BaseDirectory + "gatherosstate.exe"); tempfile
+ int try_max_count = 6;
+ for (int i = 0; i < try_max_count + 1 && !File.Exists(tempfile + "GenuineTicket.xml"); i++) //旧的位置: for (int i = 0; i < 3 || !File.Exists(System.AppDomain.CurrentDomain.BaseDirectory + "GenuineTicket.xml"); i++)
+ {
+ Thread.Sleep(10000);
+ ConsoleLog($"检查许可证 重试 {i}/{try_max_count}");
+ }
+
+ if (File.Exists(tempfile + "GenuineTicket.xml")) //旧的位置: if (File.Exists(System.AppDomain.CurrentDomain.BaseDirectory + "GenuineTicket.xml"))
+ {
+
+ //actbtn.Dispatcher.Invoke(new Action(() =>
+ //{
+ // this.activatingtext.Text = (string)this.Resources["RunAct_Cleaning_changes"]; // "Cleaning changes";
+ // ShowBallSameDig();
+ //}));
+
+ //RunCMD(@"reg delete ""HKLM\SYSTEM\Tokens"" /f");
+ //RunCMD(@"reg delete ""HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"" /v ""C:\gatherosstate.exe"" /f");
+ //此处代码移至EndLine
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.activatingtext.Text = (string)this.Resources["RunAct_Getting_digital_license"]; // "Getting digital license";
+ ShowBallSameDig();
+ }));
+
+ //Wow64EnableWow64FsRedirection(false); // 关闭文件重定向
+ //RunCMD(Environment.SystemDirectory + @"\ClipUp.exe -v -o -altto " + tempfile);
+ RunCMD(@"clipup -v -o -altto " + tempfile);
+
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.activatingtext.Text = (string)this.Resources["RunAct_Activating"]; // 提示激活中
+ ShowBallSameDig();
+ }));
+
+ runend = RunCScript(slmgr_self, "-ato").Trim();
+ //runend = RunCMD(@"cscript.exe /nologo %systemroot%\system32\slmgr.vbs -ato").Trim();
+ ConsoleLog(runend);
+ if (runend.EndsWith("successfully.") || runend.Contains("0xC004F074") || runend.Contains("0xC004C003")) //0xC004F074是KMS(19年)长期激活会出的提示,Error 0xC004C003: The activation server determined that the specified product key is blocked. 是因为未连接激活服务器,下次连接时会自动激活。
+ {
+ if (runend.Contains("0xC004C003"))
+ {
+ is_not_network_to_act = true;
+ }
+ code = "200";
+ }
+ else
+ {
+ code = "-4";
+ msg = (string)this.Resources["ErrorMsg-4"] + "\r\n" + (string)this.Resources["SysMsg"] + "\r\n" + runend; // "激活失败 :(\nActivation Failed. :(";
+ }
+ }
+ else
+ {
+ code = "-3";
+ msg = (string)this.Resources["ErrorMsg-3"]; // "执行超时,可能没有选择正确或输入的版本 :(\nTime out, may be you choose or enter a incorrect version. :(";
+ }
+ }
+ else
+ {
+ code = "-2";
+ msg = (string)this.Resources["ErrorMsg-2"]; // "无法安装密钥,可能没有选择或输入正确的版本 :(\nCannot to install key, may be you choose or enter a incorrect version. :(";
+ }
+ }
+ else
+ {
+ code = "-1";
+ msg = (string)this.Resources["ErrorMsg-1"]; // "无法卸载旧密钥 :(\nCannot to uninstall old key. :(";
+ }
+ //string runend = RunCScript(slmgr_self, "-upk").Trim();
+ EndLine:;
+ // 此处确保注册表清理一定进行
+ try
+ {
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.activatingtext.Text = (string)this.Resources["RunAct_Cleaning_changes"]; // "Cleaning changes";
+ ShowBallSameDig();
+ }));
+
+ RunCMD(@"reg delete ""HKLM\SYSTEM\Tokens"" /f");
+ RunCMD(@"reg delete ""HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"" /v ""C:\gatherosstate.exe"" /f");
+ }
+ catch
+ {
+ ConsoleLog("Delete Reg Error");
+ }
+ if (code != "200")
+ {
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.DialogActProg.IsOpen = false;
+ this.activatingtext.Text = (string)this.Resources["RunAct_Activating"]; //提示激活中
+ this.DialogWithOKToCloseDialog.IsOpen = true;
+ this.DialogWithOKToCloseDialogTitle.Text = (string)this.Resources["ErrorTitle"]; //错误标题
+ this.DialogWithOKToCloseDialogText.Text = msg + "\r\n" + (string)this.Resources["ErrorCode"] + code; //错误代码 如:错误信息\r\nCode:000
+ if (Program.hiderun == true && Program.autoact == true)
+ {
+ int tipShowMilliseconds = 0;
+ string tipTitle = (string)this.Resources["notifyIconTitle"];
+ string tipContent = msg;
+ ToolTipIcon tipType = ToolTipIcon.None;
+ notifyIcon.ShowBalloonTip(tipShowMilliseconds, tipTitle, tipContent, tipType);
+ Exit_Button_Click(null, null);
+ }
+ }));
+ //MessageBox.Show(msg + "\r\nCode:" + code);
+ }
+ else
+ {
+ actbtn.Dispatcher.Invoke(new Action(() =>
+ {
+ this.DialogActProg.IsOpen = false;
+ this.activatingtext.Text = (string)this.Resources["RunAct_Activating"]; //提示激活中
+ this.DialogWithOKToCloseDialogDonate.IsOpen = true;
+ this.DialogWithOKToCloseDialogDonateTitle.Text = (string)this.Resources["CompleteTitle"]; //完成标题
+ if (is_not_network_to_act == true)
+ {
+ this.DialogWithOKToCloseDialogDonateText.Text = (string)this.Resources["DonateTextWillActivated"]; //即将激活内容
+ }
+ else
+ {
+ this.DialogWithOKToCloseDialogDonateText.Text = (string)this.Resources["DonateTextActivated"]; //完成激活内容
+ }
+
+ if (Program.hiderun == true && Program.autoact == true)
+ {
+ int tipShowMilliseconds = 0;
+ string tipTitle = (string)this.Resources["notifyIconTitle"];
+ string tipContent = this.DialogWithOKToCloseDialogDonateText.Text;
+ ToolTipIcon tipType = ToolTipIcon.None;
+ notifyIcon.ShowBalloonTip(tipShowMilliseconds, tipTitle, tipContent, tipType);
+ Exit_Button_Click(null, null);
+ }
+ }));
+ //MessageBox.Show("Congratulation!");
+ }
+ DelectTempFile();
+ //清理文件
+ }
+
+ private void RunCMD_old(string var)
+ {
+ Wow64EnableWow64FsRedirection(false);//关闭文件重定向
+ System.Diagnostics.Process p = new System.Diagnostics.Process();
+ p.StartInfo.FileName = "cmd.exe";//要执行的程序名称
+ p.StartInfo.WorkingDirectory = System.AppDomain.CurrentDomain.BaseDirectory;
+ p.StartInfo.UseShellExecute = false;
+ p.StartInfo.RedirectStandardInput = true;//可能接受来自调用程序的输入信息
+ p.StartInfo.RedirectStandardOutput = true;//由调用程序获取输出信息
+ p.StartInfo.CreateNoWindow = true;//不显示程序窗口
+ p.Start();//启动程序
+ //向CMD窗口发送输入信息:
+ p.StandardInput.WriteLine(var);
+ ConsoleLog(var);
+ //p.WaitForExit();
+ ConsoleLog(p.StandardOutput.ReadToEnd().Trim());
+ p.Close();
+
+ //Wow64EnableWow64FsRedirection(false);//关闭文件重定向
+ //System.Diagnostics.Process.Start(var);
+ }
+
+ public static string RunCLI(string path, string var = "")
+ {
+ ConsoleLog(path + " " + var);
+ Wow64EnableWow64FsRedirection(false);//关闭文件重定向
+ //执行命令行函数
+ try
+ {
+ System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
+ myProcess.StartInfo.FileName = path;//要执行的程序名称
+ myProcess.StartInfo.UseShellExecute = false;
+ myProcess.StartInfo.RedirectStandardInput = true;//可能接受来自调用程序的输入信息
+ myProcess.StartInfo.RedirectStandardOutput = true;//由调用程序获取输出信息
+ myProcess.StartInfo.CreateNoWindow = true;//不显示程序窗口
+ myProcess.StartInfo.Arguments = var;
+ //myProcess.Arguments = "/c chcp 65001 > nul && cmd /c \"" + PHPRuntimePath + "\" \"" + path + "\" " + var;
+ //myProcess.Arguments = "/c " & Commands
+ //myProcess.StartInfo.StandardOutputEncoding = Encoding.UTF8;
+ myProcess.Start();
+ myProcess.WaitForExit(60 * 1000);
+ System.IO.StreamReader myStreamReader = myProcess.StandardOutput;
+ string myString = myStreamReader.ReadToEnd();
+ myProcess.Close();
+ ConsoleLog(myString.Trim());
+ ConsoleLog("执行完毕");
+ return myString.Trim();
+ }
+ catch
+ {
+ return "Error";
+ }
+ }
+
+ public static string RunCMD(string var)
+ {
+ ConsoleLog(var);
+ Wow64EnableWow64FsRedirection(false);//关闭文件重定向
+ //执行命令行函数
+ try
+ {
+ System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
+ myProcess.StartInfo.FileName = "cmd.exe";//要执行的程序名称
+ myProcess.StartInfo.UseShellExecute = false;
+ myProcess.StartInfo.RedirectStandardInput = true;//可能接受来自调用程序的输入信息
+ myProcess.StartInfo.RedirectStandardOutput = true;//由调用程序获取输出信息
+ myProcess.StartInfo.CreateNoWindow = true;//不显示程序窗口
+ myProcess.StartInfo.Arguments = "/c chcp 437 > nul && cmd /c \"" + var + "\"";
+ //myProcess.Arguments = "/c chcp 65001 > nul && cmd /c \"" + PHPRuntimePath + "\" \"" + path + "\" " + var;
+ //myProcess.Arguments = "/c " & Commands
+ //myProcess.StartInfo.StandardOutputEncoding = Encoding.UTF8;
+ myProcess.Start();
+ myProcess.WaitForExit(60 * 1000);
+ System.IO.StreamReader myStreamReader = myProcess.StandardOutput;
+ string myString = myStreamReader.ReadToEnd();
+ myProcess.Close();
+ ConsoleLog(myString.Trim());
+ return myString.Trim();
+ }
+ catch
+ {
+ return "Error";
+ }
+ }
+
+ public static string RunCScript(string path, string var = "")
+ {
+ ConsoleLog("CScript" + " " + "//Nologo \"" + path + "\" " + var);
+ Wow64EnableWow64FsRedirection(false);//关闭文件重定向
+ //执行命令行函数
+ try
+ {
+ System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
+ System.Diagnostics.ProcessStartInfo ProcessStartInfo = new System.Diagnostics.ProcessStartInfo("CScript", "//Nologo \"" + path + "\" " + var);
+ ProcessStartInfo.UseShellExecute = false;
+ ProcessStartInfo.RedirectStandardOutput = true;
+ ProcessStartInfo.CreateNoWindow = true;
+ //myProcessStartInfo.Arguments = "/c chcp 65001 > nul && cmd /c \"" + PHPRuntimePath + "\" \"" + path + "\" " + var;
+ //myProcessStartInfo.Arguments = "/c " & Commands
+ ProcessStartInfo.StandardOutputEncoding = Encoding.UTF8;
+ myProcess.StartInfo = ProcessStartInfo;
+ myProcess.Start();
+ myProcess.WaitForExit(60 * 1000);
+ System.IO.StreamReader myStreamReader = myProcess.StandardOutput;
+ string myString = myStreamReader.ReadToEnd();
+ myProcess.Close();
+ ConsoleLog(myString.Trim());
+ return myString.Trim();
+ }
+ catch
+ {
+ return "Error";
+ }
+ }
+
+ public static string GetSKU()
+ {
+ ConsoleLog("Geting SKU");
+ Wow64EnableWow64FsRedirection(false);//关闭文件重定向
+ //执行命令行函数
+ try
+ {
+ System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
+ myProcess.StartInfo.FileName = "cmd.exe";//要执行的程序名称
+ myProcess.StartInfo.UseShellExecute = false;
+ myProcess.StartInfo.RedirectStandardOutput = true;
+ myProcess.StartInfo.CreateNoWindow = true;
+ myProcess.StartInfo.Arguments = "/c wmic os get OperatingSystemSKU";
+ //myProcess.Arguments = "/c chcp 65001 > nul && cmd /c \"" + PHPRuntimePath + "\" \"" + path + "\" " + var;
+ //myProcess.Arguments = "/c " & Commands
+ myProcess.StartInfo.StandardOutputEncoding = Encoding.UTF8;
+ myProcess.Start();
+ myProcess.WaitForExit(60 * 1000);
+ System.IO.StreamReader myStreamReader = myProcess.StandardOutput;
+ string myString = myStreamReader.ReadToEnd();
+ myProcess.Close();
+ myString = Regex.Replace(myString, @"[^0-9]+", "");
+ ConsoleLog("Get SKU:\"" + myString.Trim() + "\"");
+ return myString.Trim(); //只保留数字SKU
+ }
+ catch
+ {
+ return "Error";
+ }
+ }
+
+ private void Donate_Button_Click(object sender, RoutedEventArgs e)
+ {
+ System.Diagnostics.Process.Start("https://cmwtat.cloudmoe.com/donate"); // 打开捐赠页
+ this.DialogWithOKToCloseDialogDonate.IsOpen = false;
+ }
+
+ string last_key = "";
+
+ private void SystemEditionTextInput_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ if (SystemEditionTextInput.Text != last_key)
+ {
+ int selectlen = SystemEditionTextInput.SelectionStart;
+ string temp = SystemEditionTextInput.Text;
+ temp = Regex.Replace(temp, @"[^a-zA-Z0-9]+", "");//XAML禁用输入法,并替换可能粘贴进的意外字符
+ temp = Regex.Replace(temp, @"([a-zA-Z0-9]{5}(?!$))", "$1-");
+ //temp = string.Join("-", Regex.Matches(temp, @".....").Cast().ToList());
+ SystemEditionTextInput.Text = temp.ToUpper();
+ last_key = SystemEditionTextInput.Text;
+ SystemEditionTextInput.SelectionStart = SystemEditionTextInput.Text.Length;
+ }
+ UpdateInputMatch(); // 更新按钮启用状态
+ }
+
+ ///
+ /// 验证产品密钥字符串是否匹配正则表达式描述的规则并更新按钮状态(如果自动模式则启用按钮)
+ ///
+ private void UpdateInputMatch()
+ {
+ //防止初始化前访问null出错
+ try
+ {
+ string pattern = @"^[a-zA-Z0-9]{5}-[a-zA-Z0-9]{5}-[a-zA-Z0-9]{5}-[a-zA-Z0-9]{5}-[a-zA-Z0-9]{5}$";
+ if (is_auto == false)
+ {
+ if (CMWTAT_DIGITAL.Domain.IsSN.IsMatch((SystemEditionTextInput.Text ?? "").ToString(), pattern))
+ {
+ actbtn.IsEnabled = true;
+ installbtn.IsEnabled = true;
+ }
+ else
+ {
+ actbtn.IsEnabled = false;
+ installbtn.IsEnabled = false;
+ }
+ }
+ else
+ {
+ actbtn.IsEnabled = true;
+ installbtn.IsEnabled = true;
+ }
+ }
+ catch { }
+ }
+
+ private void A_RadioButton_Checked(object sender, RoutedEventArgs e)
+ {
+ SystemEditionText.Visibility = Visibility.Visible;
+ SystemEditionTextInput.Visibility = Visibility.Hidden;
+ is_auto = true;
+ UpdateInputMatch(); // 更新按钮启用状态
+ }
+
+ private void M_RadioButton_Checked(object sender, RoutedEventArgs e)
+ {
+ SystemEditionText.Visibility = Visibility.Hidden;
+ SystemEditionTextInput.Visibility = Visibility.Visible;
+ is_auto = false;
+ UpdateInputMatch(); // 更新按钮启用状态
+ }
+
+ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
+ {
+ DelectTempFile();
+ notifyIcon.Visible = false;
+ }
+
+ private void UpdateBtn_Click(object sender, RoutedEventArgs e)
+ {
+ System.Diagnostics.Process.Start("https://cmwtat.cloudmoe.com"); // 打开官网
+ }
+
+ private void Window_Activated(object sender, EventArgs e)
+ {
+ CheckWindowsTheme();
+ ApplyBase(isDark); // 应用颜色
+ }
+ }
+}
diff --git a/CMWTAT_DIGITAL/OSVersionInfoClass.cs b/CMWTAT_DIGITAL/OSVersionInfoClass.cs
new file mode 100644
index 0000000..8f292a8
--- /dev/null
+++ b/CMWTAT_DIGITAL/OSVersionInfoClass.cs
@@ -0,0 +1,1089 @@
+using Microsoft.Win32;
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+// http://www.codeproject.com/Articles/73000/Getting-Operating-System-Version-Info-Even-for-Win
+//https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
+
+//Thanks to Member 7861383, Scott Vickery for the Windows 8.1 update and workaround.
+//I have moved it to the beginning of the Name property, though...
+
+//Thakts to Brisingr Aerowing for help with the Windows 10 adapatation
+
+namespace OSVersionInfoClass
+{
+ ///
+ /// Provides detailed information about the host operating system.
+ ///
+ public static class OSVersionInfo
+ {
+ #region ENUMS
+ public enum SoftwareArchitecture
+ {
+ Unknown = 0,
+ Bit32 = 1,
+ Bit64 = 2
+ }
+
+ public enum ProcessorArchitecture
+ {
+ Unknown = 0,
+ Bit32 = 1,
+ Bit64 = 2,
+ Itanium64 = 3
+ }
+ #endregion ENUMS
+
+ #region DELEGATE DECLARATION
+ private delegate bool IsWow64ProcessDelegate([In] IntPtr handle, [Out] out bool isWow64Process);
+ #endregion DELEGATE DECLARATION
+
+ #region BITS
+ ///
+ /// Determines if the current application is 32 or 64-bit.
+ ///
+ static public SoftwareArchitecture ProgramBits
+ {
+ get
+ {
+ SoftwareArchitecture pbits = SoftwareArchitecture.Unknown;
+
+ System.Collections.IDictionary test = Environment.GetEnvironmentVariables();
+
+ switch (IntPtr.Size * 8)
+ {
+ case 64:
+ pbits = SoftwareArchitecture.Bit64;
+ break;
+
+ case 32:
+ pbits = SoftwareArchitecture.Bit32;
+ break;
+
+ default:
+ pbits = SoftwareArchitecture.Unknown;
+ break;
+ }
+
+ return pbits;
+ }
+ }
+
+ static public SoftwareArchitecture OSBits
+ {
+ get
+ {
+ SoftwareArchitecture osbits = SoftwareArchitecture.Unknown;
+
+ switch (IntPtr.Size * 8)
+ {
+ case 64:
+ osbits = SoftwareArchitecture.Bit64;
+ break;
+
+ case 32:
+ if (Is32BitProcessOn64BitProcessor())
+ osbits = SoftwareArchitecture.Bit64;
+ else
+ osbits = SoftwareArchitecture.Bit32;
+ break;
+
+ default:
+ osbits = SoftwareArchitecture.Unknown;
+ break;
+ }
+
+ return osbits;
+ }
+ }
+
+ ///
+ /// Determines if the current processor is 32 or 64-bit.
+ ///
+ static public ProcessorArchitecture ProcessorBits
+ {
+ get
+ {
+ ProcessorArchitecture pbits = ProcessorArchitecture.Unknown;
+
+ try
+ {
+ SYSTEM_INFO l_System_Info = new SYSTEM_INFO();
+ GetNativeSystemInfo(ref l_System_Info);
+
+ switch (l_System_Info.uProcessorInfo.wProcessorArchitecture)
+ {
+ case 9: // PROCESSOR_ARCHITECTURE_AMD64
+ pbits = ProcessorArchitecture.Bit64;
+ break;
+ case 6: // PROCESSOR_ARCHITECTURE_IA64
+ pbits = ProcessorArchitecture.Itanium64;
+ break;
+ case 0: // PROCESSOR_ARCHITECTURE_INTEL
+ pbits = ProcessorArchitecture.Bit32;
+ break;
+ default: // PROCESSOR_ARCHITECTURE_UNKNOWN
+ pbits = ProcessorArchitecture.Unknown;
+ break;
+ }
+ }
+ catch
+ {
+ // Ignore
+ }
+
+ return pbits;
+ }
+ }
+ #endregion BITS
+
+ #region EDITION
+ static private string s_Edition;
+ ///
+ /// Gets the edition of the operating system running on this computer.
+ ///
+ static public string Edition
+ {
+ get
+ {
+ if (s_Edition != null)
+ return s_Edition; //***** RETURN *****//
+
+ string edition = String.Empty;
+
+ OperatingSystem osVersion = Environment.OSVersion;
+ OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX();
+ osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX));
+
+ if (GetVersionEx(ref osVersionInfo))
+ {
+ int majorVersion = osVersion.Version.Major;
+ int minorVersion = osVersion.Version.Minor;
+ byte productType = osVersionInfo.wProductType;
+ short suiteMask = osVersionInfo.wSuiteMask;
+
+ #region VERSION 4
+ if (majorVersion == 4)
+ {
+ if (productType == VER_NT_WORKSTATION)
+ {
+ // Windows NT 4.0 Workstation
+ edition = "Workstation";
+ }
+ else if (productType == VER_NT_SERVER)
+ {
+ if ((suiteMask & VER_SUITE_ENTERPRISE) != 0)
+ {
+ // Windows NT 4.0 Server Enterprise
+ edition = "Enterprise Server";
+ }
+ else
+ {
+ // Windows NT 4.0 Server
+ edition = "Standard Server";
+ }
+ }
+ }
+ #endregion VERSION 4
+
+ #region VERSION 5
+ else if (majorVersion == 5)
+ {
+ if (productType == VER_NT_WORKSTATION)
+ {
+ if ((suiteMask & VER_SUITE_PERSONAL) != 0)
+ {
+ edition = "Home";
+ }
+ else
+ {
+ if (GetSystemMetrics(86) == 0) // 86 == SM_TABLETPC
+ edition = "Professional";
+ else
+ edition = "Tablet Edition";
+ }
+ }
+ else if (productType == VER_NT_SERVER)
+ {
+ if (minorVersion == 0)
+ {
+ if ((suiteMask & VER_SUITE_DATACENTER) != 0)
+ {
+ // Windows 2000 Datacenter Server
+ edition = "Datacenter Server";
+ }
+ else if ((suiteMask & VER_SUITE_ENTERPRISE) != 0)
+ {
+ // Windows 2000 Advanced Server
+ edition = "Advanced Server";
+ }
+ else
+ {
+ // Windows 2000 Server
+ edition = "Server";
+ }
+ }
+ else
+ {
+ if ((suiteMask & VER_SUITE_DATACENTER) != 0)
+ {
+ // Windows Server 2003 Datacenter Edition
+ edition = "Datacenter";
+ }
+ else if ((suiteMask & VER_SUITE_ENTERPRISE) != 0)
+ {
+ // Windows Server 2003 Enterprise Edition
+ edition = "Enterprise";
+ }
+ else if ((suiteMask & VER_SUITE_BLADE) != 0)
+ {
+ // Windows Server 2003 Web Edition
+ edition = "Web Edition";
+ }
+ else
+ {
+ // Windows Server 2003 Standard Edition
+ edition = "Standard";
+ }
+ }
+ }
+ }
+ #endregion VERSION 5
+
+ #region VERSION 6
+ else if (majorVersion == 6)
+ {
+ int ed;
+ if (GetProductInfo(majorVersion, minorVersion,
+ osVersionInfo.wServicePackMajor, osVersionInfo.wServicePackMinor,
+ out ed))
+ {
+ switch (ed)
+ {
+ case PRODUCT_BUSINESS:
+ edition = "Business";
+ break;
+ case PRODUCT_BUSINESS_N:
+ edition = "Business N";
+ break;
+ case PRODUCT_CLUSTER_SERVER:
+ edition = "HPC Edition";
+ break;
+ case PRODUCT_CLUSTER_SERVER_V:
+ edition = "HPC Edition without Hyper-V";
+ break;
+ case PRODUCT_DATACENTER_SERVER:
+ edition = "Datacenter Server";
+ break;
+ case PRODUCT_DATACENTER_SERVER_CORE:
+ edition = "Datacenter Server (core installation)";
+ break;
+ case PRODUCT_DATACENTER_SERVER_V:
+ edition = "Datacenter Server without Hyper-V";
+ break;
+ case PRODUCT_DATACENTER_SERVER_CORE_V:
+ edition = "Datacenter Server without Hyper-V (core installation)";
+ break;
+ case PRODUCT_EMBEDDED:
+ edition = "Embedded";
+ break;
+ case PRODUCT_ENTERPRISE:
+ edition = "Enterprise";
+ break;
+ case PRODUCT_ENTERPRISE_N:
+ edition = "Enterprise N";
+ break;
+ case PRODUCT_ENTERPRISE_E:
+ edition = "Enterprise E";
+ break;
+ case PRODUCT_ENTERPRISE_SERVER:
+ edition = "Enterprise Server";
+ break;
+ case PRODUCT_ENTERPRISE_SERVER_CORE:
+ edition = "Enterprise Server (core installation)";
+ break;
+ case PRODUCT_ENTERPRISE_SERVER_CORE_V:
+ edition = "Enterprise Server without Hyper-V (core installation)";
+ break;
+ case PRODUCT_ENTERPRISE_SERVER_IA64:
+ edition = "Enterprise Server for Itanium-based Systems";
+ break;
+ case PRODUCT_ENTERPRISE_SERVER_V:
+ edition = "Enterprise Server without Hyper-V";
+ break;
+ case PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT:
+ edition = "Essential Business Server MGMT";
+ break;
+ case PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL:
+ edition = "Essential Business Server ADDL";
+ break;
+ case PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC:
+ edition = "Essential Business Server MGMTSVC";
+ break;
+ case PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC:
+ edition = "Essential Business Server ADDLSVC";
+ break;
+ case PRODUCT_HOME_BASIC:
+ edition = "Home Basic";
+ break;
+ case PRODUCT_HOME_BASIC_N:
+ edition = "Home Basic N";
+ break;
+ case PRODUCT_HOME_BASIC_E:
+ edition = "Home Basic E";
+ break;
+ case PRODUCT_HOME_PREMIUM:
+ edition = "Home Premium";
+ break;
+ case PRODUCT_HOME_PREMIUM_N:
+ edition = "Home Premium N";
+ break;
+ case PRODUCT_HOME_PREMIUM_E:
+ edition = "Home Premium E";
+ break;
+ case PRODUCT_HOME_PREMIUM_SERVER:
+ edition = "Home Premium Server";
+ break;
+ case PRODUCT_HYPERV:
+ edition = "Microsoft Hyper-V Server";
+ break;
+ case PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT:
+ edition = "Windows Essential Business Management Server";
+ break;
+ case PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING:
+ edition = "Windows Essential Business Messaging Server";
+ break;
+ case PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY:
+ edition = "Windows Essential Business Security Server";
+ break;
+ case PRODUCT_PROFESSIONAL:
+ edition = "Professional";
+ break;
+ case PRODUCT_PROFESSIONAL_N:
+ edition = "Professional N";
+ break;
+ case PRODUCT_PROFESSIONAL_E:
+ edition = "Professional E";
+ break;
+ case PRODUCT_SB_SOLUTION_SERVER:
+ edition = "SB Solution Server";
+ break;
+ case PRODUCT_SB_SOLUTION_SERVER_EM:
+ edition = "SB Solution Server EM";
+ break;
+ case PRODUCT_SERVER_FOR_SB_SOLUTIONS:
+ edition = "Server for SB Solutions";
+ break;
+ case PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM:
+ edition = "Server for SB Solutions EM";
+ break;
+ case PRODUCT_SERVER_FOR_SMALLBUSINESS:
+ edition = "Windows Essential Server Solutions";
+ break;
+ case PRODUCT_SERVER_FOR_SMALLBUSINESS_V:
+ edition = "Windows Essential Server Solutions without Hyper-V";
+ break;
+ case PRODUCT_SERVER_FOUNDATION:
+ edition = "Server Foundation";
+ break;
+ case PRODUCT_SMALLBUSINESS_SERVER:
+ edition = "Windows Small Business Server";
+ break;
+ case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM:
+ edition = "Windows Small Business Server Premium";
+ break;
+ case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE:
+ edition = "Windows Small Business Server Premium (core installation)";
+ break;
+ case PRODUCT_SOLUTION_EMBEDDEDSERVER:
+ edition = "Solution Embedded Server";
+ break;
+ case PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE:
+ edition = "Solution Embedded Server (core installation)";
+ break;
+ case PRODUCT_STANDARD_SERVER:
+ edition = "Standard Server";
+ break;
+ case PRODUCT_STANDARD_SERVER_CORE:
+ edition = "Standard Server (core installation)";
+ break;
+ case PRODUCT_STANDARD_SERVER_SOLUTIONS:
+ edition = "Standard Server Solutions";
+ break;
+ case PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE:
+ edition = "Standard Server Solutions (core installation)";
+ break;
+ case PRODUCT_STANDARD_SERVER_CORE_V:
+ edition = "Standard Server without Hyper-V (core installation)";
+ break;
+ case PRODUCT_STANDARD_SERVER_V:
+ edition = "Standard Server without Hyper-V";
+ break;
+ case PRODUCT_STARTER:
+ edition = "Starter";
+ break;
+ case PRODUCT_STARTER_N:
+ edition = "Starter N";
+ break;
+ case PRODUCT_STARTER_E:
+ edition = "Starter E";
+ break;
+ case PRODUCT_STORAGE_ENTERPRISE_SERVER:
+ edition = "Enterprise Storage Server";
+ break;
+ case PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE:
+ edition = "Enterprise Storage Server (core installation)";
+ break;
+ case PRODUCT_STORAGE_EXPRESS_SERVER:
+ edition = "Express Storage Server";
+ break;
+ case PRODUCT_STORAGE_EXPRESS_SERVER_CORE:
+ edition = "Express Storage Server (core installation)";
+ break;
+ case PRODUCT_STORAGE_STANDARD_SERVER:
+ edition = "Standard Storage Server";
+ break;
+ case PRODUCT_STORAGE_STANDARD_SERVER_CORE:
+ edition = "Standard Storage Server (core installation)";
+ break;
+ case PRODUCT_STORAGE_WORKGROUP_SERVER:
+ edition = "Workgroup Storage Server";
+ break;
+ case PRODUCT_STORAGE_WORKGROUP_SERVER_CORE:
+ edition = "Workgroup Storage Server (core installation)";
+ break;
+ case PRODUCT_UNDEFINED:
+ edition = "Unknown product";
+ break;
+ case PRODUCT_ULTIMATE:
+ edition = "Ultimate";
+ break;
+ case PRODUCT_ULTIMATE_N:
+ edition = "Ultimate N";
+ break;
+ case PRODUCT_ULTIMATE_E:
+ edition = "Ultimate E";
+ break;
+ case PRODUCT_WEB_SERVER:
+ edition = "Web Server";
+ break;
+ case PRODUCT_WEB_SERVER_CORE:
+ edition = "Web Server (core installation)";
+ break;
+ }
+ }
+ }
+ #endregion VERSION 6
+ }
+
+ s_Edition = edition;
+ return edition;
+ }
+ }
+ #endregion EDITION
+
+ #region NAME
+ static private string s_Name;
+ ///
+ /// Gets the name of the operating system running on this computer.
+ ///
+ static public string Name
+ {
+ get
+ {
+ if (s_Name != null)
+ return s_Name; //***** RETURN *****//
+
+ string name = "unknown";
+
+ OperatingSystem osVersion = Environment.OSVersion;
+ OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX();
+ osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX));
+
+ if (GetVersionEx(ref osVersionInfo))
+ {
+ int majorVersion = osVersion.Version.Major;
+ int minorVersion = osVersion.Version.Minor;
+
+ if (majorVersion == 6 && minorVersion == 2)
+ {
+ //The registry read workaround is by Scott Vickery. Thanks a lot for the help!
+
+ //http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx
+
+ // For applications that have been manifested for Windows 8.1 & Windows 10. Applications not manifested for 8.1 or 10 will return the Windows 8 OS version value (6.2).
+ // By reading the registry, we'll get the exact version - meaning we can even compare against Win 8 and Win 8.1.
+ string exactVersion = RegistryRead(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CurrentVersion", "");
+ if (!string.IsNullOrEmpty(exactVersion))
+ {
+ string[] splitResult = exactVersion.Split('.');
+ majorVersion = Convert.ToInt32(splitResult[0]);
+ minorVersion = Convert.ToInt32(splitResult[1]);
+ }
+ if (IsWindows10())
+ {
+ majorVersion = 10;
+ minorVersion = 0;
+ }
+ }
+
+ switch (osVersion.Platform)
+ {
+ case PlatformID.Win32S:
+ name = "Windows 3.1";
+ break;
+ case PlatformID.WinCE:
+ name = "Windows CE";
+ break;
+ case PlatformID.Win32Windows:
+ {
+ if (majorVersion == 4)
+ {
+ string csdVersion = osVersionInfo.szCSDVersion;
+ switch (minorVersion)
+ {
+ case 0:
+ if (csdVersion == "B" || csdVersion == "C")
+ name = "Windows 95 OSR2";
+ else
+ name = "Windows 95";
+ break;
+ case 10:
+ if (csdVersion == "A")
+ name = "Windows 98 Second Edition";
+ else
+ name = "Windows 98";
+ break;
+ case 90:
+ name = "Windows Me";
+ break;
+ }
+ }
+ break;
+ }
+ case PlatformID.Win32NT:
+ {
+ byte productType = osVersionInfo.wProductType;
+
+ switch (majorVersion)
+ {
+ case 3:
+ name = "Windows NT 3.51";
+ break;
+ case 4:
+ switch (productType)
+ {
+ case 1:
+ name = "Windows NT 4.0";
+ break;
+ case 3:
+ name = "Windows NT 4.0 Server";
+ break;
+ }
+ break;
+ case 5:
+ switch (minorVersion)
+ {
+ case 0:
+ name = "Windows 2000";
+ break;
+ case 1:
+ name = "Windows XP";
+ break;
+ case 2:
+ name = "Windows Server 2003";
+ break;
+ }
+ break;
+ case 6:
+ switch (minorVersion)
+ {
+ case 0:
+ switch (productType)
+ {
+ case 1:
+ name = "Windows Vista";
+ break;
+ case 3:
+ name = "Windows Server 2008";
+ break;
+ }
+ break;
+
+ case 1:
+ switch (productType)
+ {
+ case 1:
+ name = "Windows 7";
+ break;
+ case 3:
+ name = "Windows Server 2008 R2";
+ break;
+ }
+ break;
+ case 2:
+ switch (productType)
+ {
+ case 1:
+ name = "Windows 8";
+ break;
+ case 3:
+ name = "Windows Server 2012";
+ break;
+ }
+ break;
+ case 3:
+ switch (productType)
+ {
+ case 1:
+ name = "Windows 8.1";
+ break;
+ case 3:
+ name = "Windows Server 2012 R2";
+ break;
+ }
+ break;
+ }
+ break;
+ case 10:
+ switch (minorVersion)
+ {
+ case 0:
+ switch (productType)
+ {
+ case 1:
+ name = "Windows 10";
+ break;
+ case 3:
+ name = "Windows Server 2016";
+ break;
+ }
+ break;
+ }
+ break;
+ }
+ break;
+ }
+ }
+ }
+
+ s_Name = name;
+ return name;
+ }
+ }
+ #endregion NAME
+
+ #region PINVOKE
+
+ #region GET
+ #region PRODUCT INFO
+ [DllImport("Kernel32.dll")]
+ internal static extern bool GetProductInfo(
+ int osMajorVersion,
+ int osMinorVersion,
+ int spMajorVersion,
+ int spMinorVersion,
+ out int edition);
+ #endregion PRODUCT INFO
+
+ #region VERSION
+ [DllImport("kernel32.dll")]
+ private static extern bool GetVersionEx(ref OSVERSIONINFOEX osVersionInfo);
+ #endregion VERSION
+
+ #region SYSTEMMETRICS
+ [DllImport("user32")]
+ public static extern int GetSystemMetrics(int nIndex);
+ #endregion SYSTEMMETRICS
+
+ #region SYSTEMINFO
+ [DllImport("kernel32.dll")]
+ public static extern void GetSystemInfo([MarshalAs(UnmanagedType.Struct)] ref SYSTEM_INFO lpSystemInfo);
+
+ [DllImport("kernel32.dll")]
+ public static extern void GetNativeSystemInfo([MarshalAs(UnmanagedType.Struct)] ref SYSTEM_INFO lpSystemInfo);
+ #endregion SYSTEMINFO
+
+ #endregion GET
+
+ #region OSVERSIONINFOEX
+ [StructLayout(LayoutKind.Sequential)]
+ private struct OSVERSIONINFOEX
+ {
+ public int dwOSVersionInfoSize;
+ public int dwMajorVersion;
+ public int dwMinorVersion;
+ public int dwBuildNumber;
+ public int dwPlatformId;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
+ public string szCSDVersion;
+ public short wServicePackMajor;
+ public short wServicePackMinor;
+ public short wSuiteMask;
+ public byte wProductType;
+ public byte wReserved;
+ }
+ #endregion OSVERSIONINFOEX
+
+ #region SYSTEM_INFO
+ [StructLayout(LayoutKind.Sequential)]
+ public struct SYSTEM_INFO
+ {
+ internal _PROCESSOR_INFO_UNION uProcessorInfo;
+ public uint dwPageSize;
+ public IntPtr lpMinimumApplicationAddress;
+ public IntPtr lpMaximumApplicationAddress;
+ public IntPtr dwActiveProcessorMask;
+ public uint dwNumberOfProcessors;
+ public uint dwProcessorType;
+ public uint dwAllocationGranularity;
+ public ushort dwProcessorLevel;
+ public ushort dwProcessorRevision;
+ }
+ #endregion SYSTEM_INFO
+
+ #region _PROCESSOR_INFO_UNION
+ [StructLayout(LayoutKind.Explicit)]
+ public struct _PROCESSOR_INFO_UNION
+ {
+ [FieldOffset(0)]
+ internal uint dwOemId;
+ [FieldOffset(0)]
+ internal ushort wProcessorArchitecture;
+ [FieldOffset(2)]
+ internal ushort wReserved;
+ }
+ #endregion _PROCESSOR_INFO_UNION
+
+ #region 64 BIT OS DETECTION
+ [DllImport("kernel32", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
+ public extern static IntPtr LoadLibrary(string libraryName);
+
+ [DllImport("kernel32", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
+ public extern static IntPtr GetProcAddress(IntPtr hwnd, string procedureName);
+ #endregion 64 BIT OS DETECTION
+
+ #region PRODUCT
+ private const int PRODUCT_UNDEFINED = 0x00000000;
+ private const int PRODUCT_ULTIMATE = 0x00000001;
+ private const int PRODUCT_HOME_BASIC = 0x00000002;
+ private const int PRODUCT_HOME_PREMIUM = 0x00000003;
+ private const int PRODUCT_ENTERPRISE = 0x00000004;
+ private const int PRODUCT_HOME_BASIC_N = 0x00000005;
+ private const int PRODUCT_BUSINESS = 0x00000006;
+ private const int PRODUCT_STANDARD_SERVER = 0x00000007;
+ private const int PRODUCT_DATACENTER_SERVER = 0x00000008;
+ private const int PRODUCT_SMALLBUSINESS_SERVER = 0x00000009;
+ private const int PRODUCT_ENTERPRISE_SERVER = 0x0000000A;
+ private const int PRODUCT_STARTER = 0x0000000B;
+ private const int PRODUCT_DATACENTER_SERVER_CORE = 0x0000000C;
+ private const int PRODUCT_STANDARD_SERVER_CORE = 0x0000000D;
+ private const int PRODUCT_ENTERPRISE_SERVER_CORE = 0x0000000E;
+ private const int PRODUCT_ENTERPRISE_SERVER_IA64 = 0x0000000F;
+ private const int PRODUCT_BUSINESS_N = 0x00000010;
+ private const int PRODUCT_WEB_SERVER = 0x00000011;
+ private const int PRODUCT_CLUSTER_SERVER = 0x00000012;
+ private const int PRODUCT_HOME_SERVER = 0x00000013;
+ private const int PRODUCT_STORAGE_EXPRESS_SERVER = 0x00000014;
+ private const int PRODUCT_STORAGE_STANDARD_SERVER = 0x00000015;
+ private const int PRODUCT_STORAGE_WORKGROUP_SERVER = 0x00000016;
+ private const int PRODUCT_STORAGE_ENTERPRISE_SERVER = 0x00000017;
+ private const int PRODUCT_SERVER_FOR_SMALLBUSINESS = 0x00000018;
+ private const int PRODUCT_SMALLBUSINESS_SERVER_PREMIUM = 0x00000019;
+ private const int PRODUCT_HOME_PREMIUM_N = 0x0000001A;
+ private const int PRODUCT_ENTERPRISE_N = 0x0000001B;
+ private const int PRODUCT_ULTIMATE_N = 0x0000001C;
+ private const int PRODUCT_WEB_SERVER_CORE = 0x0000001D;
+ private const int PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT = 0x0000001E;
+ private const int PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY = 0x0000001F;
+ private const int PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING = 0x00000020;
+ private const int PRODUCT_SERVER_FOUNDATION = 0x00000021;
+ private const int PRODUCT_HOME_PREMIUM_SERVER = 0x00000022;
+ private const int PRODUCT_SERVER_FOR_SMALLBUSINESS_V = 0x00000023;
+ private const int PRODUCT_STANDARD_SERVER_V = 0x00000024;
+ private const int PRODUCT_DATACENTER_SERVER_V = 0x00000025;
+ private const int PRODUCT_ENTERPRISE_SERVER_V = 0x00000026;
+ private const int PRODUCT_DATACENTER_SERVER_CORE_V = 0x00000027;
+ private const int PRODUCT_STANDARD_SERVER_CORE_V = 0x00000028;
+ private const int PRODUCT_ENTERPRISE_SERVER_CORE_V = 0x00000029;
+ private const int PRODUCT_HYPERV = 0x0000002A;
+ private const int PRODUCT_STORAGE_EXPRESS_SERVER_CORE = 0x0000002B;
+ private const int PRODUCT_STORAGE_STANDARD_SERVER_CORE = 0x0000002C;
+ private const int PRODUCT_STORAGE_WORKGROUP_SERVER_CORE = 0x0000002D;
+ private const int PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE = 0x0000002E;
+ private const int PRODUCT_STARTER_N = 0x0000002F;
+ private const int PRODUCT_PROFESSIONAL = 0x00000030;
+ private const int PRODUCT_PROFESSIONAL_N = 0x00000031;
+ private const int PRODUCT_SB_SOLUTION_SERVER = 0x00000032;
+ private const int PRODUCT_SERVER_FOR_SB_SOLUTIONS = 0x00000033;
+ private const int PRODUCT_STANDARD_SERVER_SOLUTIONS = 0x00000034;
+ private const int PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE = 0x00000035;
+ private const int PRODUCT_SB_SOLUTION_SERVER_EM = 0x00000036;
+ private const int PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM = 0x00000037;
+ private const int PRODUCT_SOLUTION_EMBEDDEDSERVER = 0x00000038;
+ private const int PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE = 0x00000039;
+ //private const int ???? = 0x0000003A;
+ private const int PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT = 0x0000003B;
+ private const int PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL = 0x0000003C;
+ private const int PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC = 0x0000003D;
+ private const int PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC = 0x0000003E;
+ private const int PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE = 0x0000003F;
+ private const int PRODUCT_CLUSTER_SERVER_V = 0x00000040;
+ private const int PRODUCT_EMBEDDED = 0x00000041;
+ private const int PRODUCT_STARTER_E = 0x00000042;
+ private const int PRODUCT_HOME_BASIC_E = 0x00000043;
+ private const int PRODUCT_HOME_PREMIUM_E = 0x00000044;
+ private const int PRODUCT_PROFESSIONAL_E = 0x00000045;
+ private const int PRODUCT_ENTERPRISE_E = 0x00000046;
+ private const int PRODUCT_ULTIMATE_E = 0x00000047;
+ //private const int PRODUCT_UNLICENSED = 0xABCDABCD;
+ #endregion PRODUCT
+
+ #region VERSIONS
+ private const int VER_NT_WORKSTATION = 1;
+ private const int VER_NT_DOMAIN_CONTROLLER = 2;
+ private const int VER_NT_SERVER = 3;
+ private const int VER_SUITE_SMALLBUSINESS = 1;
+ private const int VER_SUITE_ENTERPRISE = 2;
+ private const int VER_SUITE_TERMINAL = 16;
+ private const int VER_SUITE_DATACENTER = 128;
+ private const int VER_SUITE_SINGLEUSERTS = 256;
+ private const int VER_SUITE_PERSONAL = 512;
+ private const int VER_SUITE_BLADE = 1024;
+ #endregion VERSIONS
+
+ #endregion PINVOKE
+
+ #region SERVICE PACK
+ ///
+ /// Gets the service pack information of the operating system running on this computer.
+ ///
+ static public string ServicePack
+ {
+ get
+ {
+ string servicePack = String.Empty;
+ OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX();
+
+ osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX));
+
+ if (GetVersionEx(ref osVersionInfo))
+ {
+ servicePack = osVersionInfo.szCSDVersion;
+ }
+
+ return servicePack;
+ }
+ }
+ #endregion SERVICE PACK
+
+ #region VERSION
+ #region BUILD
+ ///
+ /// Gets the build version number of the operating system running on this computer.
+ ///
+ static public int BuildVersion
+ {
+ get
+ {
+ return int.Parse(RegistryRead(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CurrentBuildNumber", "0"));
+ }
+ }
+ #endregion BUILD
+
+ #region FULL
+ #region STRING
+ ///
+ /// Gets the full version string of the operating system running on this computer.
+ ///
+ static public string VersionString
+ {
+ get
+ {
+ return Version.ToString();
+ }
+ }
+ #endregion STRING
+
+ #region VERSION
+ ///
+ /// Gets the full version of the operating system running on this computer.
+ ///
+ static public Version Version
+ {
+ get
+ {
+ return new Version(MajorVersion, MinorVersion, BuildVersion, RevisionVersion);
+ }
+ }
+ #endregion VERSION
+ #endregion FULL
+
+ #region MAJOR
+ ///
+ /// Gets the major version number of the operating system running on this computer.
+ ///
+ static public int MajorVersion
+ {
+ get
+ {
+ if(IsWindows10())
+ {
+ return 10;
+ }
+ string exactVersion = RegistryRead(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CurrentVersion", "");
+ if(!string.IsNullOrEmpty(exactVersion))
+ {
+ string[] splitVersion = exactVersion.Split('.');
+ return int.Parse(splitVersion[0]);
+ }
+ return Environment.OSVersion.Version.Major;
+ }
+ }
+ #endregion MAJOR
+
+ #region MINOR
+ ///
+ /// Gets the minor version number of the operating system running on this computer.
+ ///
+ static public int MinorVersion
+ {
+ get
+ {
+ if (IsWindows10())
+ {
+ return 0;
+ }
+ string exactVersion = RegistryRead(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CurrentVersion", "");
+ if (!string.IsNullOrEmpty(exactVersion))
+ {
+ string[] splitVersion = exactVersion.Split('.');
+ return int.Parse(splitVersion[1]);
+ }
+ return Environment.OSVersion.Version.Minor;
+ }
+ }
+ #endregion MINOR
+
+ #region REVISION
+ ///
+ /// Gets the revision version number of the operating system running on this computer.
+ ///
+ static public int RevisionVersion
+ {
+ get
+ {
+ if(IsWindows10())
+ {
+ return 0;
+ }
+ return Environment.OSVersion.Version.Revision;
+ }
+ }
+ #endregion REVISION
+ #endregion VERSION
+
+ #region 64 BIT OS DETECTION
+ private static IsWow64ProcessDelegate GetIsWow64ProcessDelegate()
+ {
+ IntPtr handle = LoadLibrary("kernel32");
+
+ if (handle != IntPtr.Zero)
+ {
+ IntPtr fnPtr = GetProcAddress(handle, "IsWow64Process");
+
+ if (fnPtr != IntPtr.Zero)
+ {
+ return (IsWow64ProcessDelegate)Marshal.GetDelegateForFunctionPointer((IntPtr)fnPtr, typeof(IsWow64ProcessDelegate));
+ }
+ }
+
+ return null;
+ }
+
+ private static bool Is32BitProcessOn64BitProcessor()
+ {
+ IsWow64ProcessDelegate fnDelegate = GetIsWow64ProcessDelegate();
+
+ if (fnDelegate == null)
+ {
+ return false;
+ }
+
+ bool isWow64;
+ bool retVal = fnDelegate.Invoke(Process.GetCurrentProcess().Handle, out isWow64);
+
+ if (retVal == false)
+ {
+ return false;
+ }
+
+ return isWow64;
+ }
+ #endregion 64 BIT OS DETECTION
+
+ #region Windows 10 Detection
+
+ private static bool IsWindows10()
+ {
+ string productName = RegistryRead(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName", "");
+ if (productName.StartsWith("Windows 10", StringComparison.OrdinalIgnoreCase))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ #endregion
+
+ #region Registry Methods
+
+ private static string RegistryRead(string RegistryPath, string Field, string DefaultValue)
+ {
+ string rtn = "";
+ string backSlash = "";
+ string newRegistryPath = "";
+
+ try
+ {
+ RegistryKey OurKey = null;
+ string[] split_result = RegistryPath.Split('\\');
+
+ if (split_result.Length > 0)
+ {
+ split_result[0] = split_result[0].ToUpper(); // Make the first entry uppercase...
+
+ if (split_result[0] == "HKEY_CLASSES_ROOT") OurKey = Registry.ClassesRoot;
+ else if (split_result[0] == "HKEY_CURRENT_USER") OurKey = Registry.CurrentUser;
+ else if (split_result[0] == "HKEY_LOCAL_MACHINE") OurKey = Registry.LocalMachine;
+ else if (split_result[0] == "HKEY_USERS") OurKey = Registry.Users;
+ else if (split_result[0] == "HKEY_CURRENT_CONFIG") OurKey = Registry.CurrentConfig;
+
+ if (OurKey != null)
+ {
+ for (int i = 1; i < split_result.Length; i++)
+ {
+ newRegistryPath += backSlash + split_result[i];
+ backSlash = "\\";
+ }
+
+ if (newRegistryPath != "")
+ {
+ //rtn = (string)Registry.GetValue(RegistryPath, "CurrentVersion", DefaultValue);
+
+ OurKey = OurKey.OpenSubKey(newRegistryPath);
+ rtn = (string)OurKey.GetValue(Field, DefaultValue);
+ OurKey.Close();
+ }
+ }
+ }
+ }
+ catch { }
+
+ return rtn;
+ }
+
+ #endregion Registry Methods
+ }
+}
diff --git a/CMWTAT_DIGITAL/Program.cs b/CMWTAT_DIGITAL/Program.cs
new file mode 100644
index 0000000..8db9f09
--- /dev/null
+++ b/CMWTAT_DIGITAL/Program.cs
@@ -0,0 +1,112 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace CMWTAT_DIGITAL
+{
+ public static class Program
+ {
+
+ public static bool autoact = false;
+ public static bool hiderun = false;
+ public static bool expact = false;
+ public static bool log2file = false;
+ public static bool showhelp = false;
+
+ ///
+ /// Application Entry Point.
+ ///
+ [System.STAThreadAttribute()]
+ [System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
+
+ public static void Main(string[] startup_args)
+ {
+ //添加程序集解析事件
+ //AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
+ //{
+ // String resourceName = "CMWTAT_DIGITAL.Res." +
+
+ // new AssemblyName(args.Name).Name + ".dll";
+
+ // Console.WriteLine("Load Assembly: " + resourceName);
+
+ // using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
+ // {
+ // if (stream == null)
+ // return null;
+
+ // Byte[] assemblyData = new Byte[stream.Length];
+
+ // stream.Read(assemblyData, 0, assemblyData.Length);
+
+ // return Assembly.Load(assemblyData);
+ // }
+ //};
+ var loadedAssemblies = new Dictionary();
+ AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
+ {
+ String resourceName = "CMWTAT_DIGITAL.Res." +
+ new AssemblyName(args.Name).Name + ".dll";
+
+ //Must return the EXACT same assembly, do not reload from a new stream
+ if (loadedAssemblies.TryGetValue(resourceName, out Assembly loadedAssembly))
+ {
+ return loadedAssembly;
+ }
+
+ using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
+ {
+ if (stream == null)
+ return null;
+ Byte[] assemblyData = new Byte[stream.Length];
+
+ stream.Read(assemblyData, 0, assemblyData.Length);
+
+ var assembly = Assembly.Load(assemblyData);
+ loadedAssemblies[resourceName] = assembly;
+ return assembly;
+ }
+ };
+
+ foreach (string arg in startup_args)
+ {
+ Console.WriteLine("arg: " + arg);
+ if (arg == "-a" || arg == "--auto")
+ {
+ Console.WriteLine("AUTO: True");
+ autoact = true;
+ }
+ if (arg == "-h" || arg == "--hide")
+ {
+ Console.WriteLine("HIDE: True");
+ hiderun = true;
+ }
+ if (arg == "-e" || arg == "--expact")
+ {
+ Console.WriteLine("EXPACT: True");
+ expact = true;
+ }
+ if (arg == "-l" || arg == "--log")
+ {
+ Console.WriteLine("LOG: True");
+ log2file = true;
+ }
+ if (arg == "-?" || arg == "--help")
+ {
+ Console.WriteLine("SHOWHELP: True");
+ showhelp = true;
+ }
+ }
+
+ CMWTAT_DIGITAL.App app = new CMWTAT_DIGITAL.App();//WPF项目的Application实例,用来启动WPF项目的
+ app.InitializeComponent();
+ app.Run();
+ }
+ }
+}
diff --git a/CMWTAT_DIGITAL/Properties/AssemblyInfo.cs b/CMWTAT_DIGITAL/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..7bdb34a
--- /dev/null
+++ b/CMWTAT_DIGITAL/Properties/AssemblyInfo.cs
@@ -0,0 +1,55 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("CMWTAT Digital Edition V2")]
+[assembly: AssemblyDescription("CloudMoe Windows 10 Activation Toolkit V2")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("CloudMoe Network")]
+[assembly: AssemblyProduct("CMWTAT Digital Edition V2")]
+[assembly: AssemblyCopyright("Copyright © CloudMoe Saltfish Studio 2018")]
+[assembly: AssemblyTrademark("CloudMoe Saltfish Studio")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+//若要开始生成可本地化的应用程序,请设置
+//.csproj 文件中的 CultureYouAreCodingWith
+//例如,如果您在源文件中使用的是美国英语,
+//使用的是美国英语,请将 设置为 en-US。 然后取消
+//对以下 NeutralResourceLanguage 特性的注释。 更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+ //(未在页面中找到资源时使用,
+ //或应用程序资源字典中找到时使用)
+ ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+ //(未在页面中找到资源时使用,
+ //、应用程序或任何主题专用资源字典中找到时使用)
+)]
+
+
+// 程序集的版本信息由下列四个值组成:
+//
+// 主版本
+// 次版本
+// 生成号
+// 修订号
+//
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
+// 方法是按如下所示使用“*”: :
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("2.5.0.0")]
+[assembly: AssemblyFileVersion("2.5.0.0")]
diff --git a/CMWTAT_DIGITAL/Properties/Resources.Designer.cs b/CMWTAT_DIGITAL/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..abf9149
--- /dev/null
+++ b/CMWTAT_DIGITAL/Properties/Resources.Designer.cs
@@ -0,0 +1,113 @@
+//------------------------------------------------------------------------------
+//
+// 此代码由工具生成。
+// 运行时版本:4.0.30319.42000
+//
+// 对此文件的更改可能会导致不正确的行为,并且如果
+// 重新生成代码,这些更改将会丢失。
+//
+//------------------------------------------------------------------------------
+
+namespace CMWTAT_DIGITAL.Properties {
+ using System;
+
+
+ ///
+ /// 一个强类型的资源类,用于查找本地化的字符串等。
+ ///
+ // 此类是由 StronglyTypedResourceBuilder
+ // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+ // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+ // (以 /str 作为命令选项),或重新生成 VS 项目。
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// 返回此类使用的缓存的 ResourceManager 实例。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CMWTAT_DIGITAL.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// 重写当前线程的 CurrentUICulture 属性
+ /// 重写当前线程的 CurrentUICulture 属性。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// 查找类似于 (图标) 的 System.Drawing.Icon 类型的本地化资源。
+ ///
+ internal static System.Drawing.Icon CMWTAT_ICON {
+ get {
+ object obj = ResourceManager.GetObject("CMWTAT_ICON", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+
+ ///
+ /// 查找 System.Byte[] 类型的本地化资源。
+ ///
+ internal static byte[] gatherosstate {
+ get {
+ object obj = ResourceManager.GetObject("gatherosstate", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+
+ ///
+ /// 查找 System.Byte[] 类型的本地化资源。
+ ///
+ internal static byte[] gatherosstateltsc {
+ get {
+ object obj = ResourceManager.GetObject("gatherosstateltsc", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+
+ ///
+ /// 查找 System.Byte[] 类型的本地化资源。
+ ///
+ internal static byte[] slc {
+ get {
+ object obj = ResourceManager.GetObject("slc", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+
+ ///
+ /// 查找 System.Byte[] 类型的本地化资源。
+ ///
+ internal static byte[] slmgr {
+ get {
+ object obj = ResourceManager.GetObject("slmgr", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+ }
+}
diff --git a/CMWTAT_DIGITAL/Properties/Resources.resx b/CMWTAT_DIGITAL/Properties/Resources.resx
new file mode 100644
index 0000000..2e834d8
--- /dev/null
+++ b/CMWTAT_DIGITAL/Properties/Resources.resx
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ ..\CMWTAT.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Res\gatherosstate.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ ..\Res\gatherosstateltsc.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ ..\Res\slc.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ ..\Res\slmgr.vbs;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/CMWTAT_DIGITAL/Properties/Settings.Designer.cs b/CMWTAT_DIGITAL/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..bbb5524
--- /dev/null
+++ b/CMWTAT_DIGITAL/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// 此代码由工具生成。
+// 运行时版本:4.0.30319.42000
+//
+// 对此文件的更改可能会导致不正确的行为,并且如果
+// 重新生成代码,这些更改将会丢失。
+//
+//------------------------------------------------------------------------------
+
+namespace CMWTAT_DIGITAL.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/CMWTAT_DIGITAL/Properties/Settings.settings b/CMWTAT_DIGITAL/Properties/Settings.settings
new file mode 100644
index 0000000..033d7a5
--- /dev/null
+++ b/CMWTAT_DIGITAL/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CMWTAT_DIGITAL/app.config b/CMWTAT_DIGITAL/app.config
new file mode 100644
index 0000000..ff99501
--- /dev/null
+++ b/CMWTAT_DIGITAL/app.config
@@ -0,0 +1,3 @@
+
+
+
diff --git a/CMWTAT_DIGITAL/app.manifest b/CMWTAT_DIGITAL/app.manifest
new file mode 100644
index 0000000..2b17b0a
--- /dev/null
+++ b/CMWTAT_DIGITAL/app.manifest
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
diff --git a/CMWTAT_DIGITAL/packages.config b/CMWTAT_DIGITAL/packages.config
new file mode 100644
index 0000000..41354c7
--- /dev/null
+++ b/CMWTAT_DIGITAL/packages.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CMWTAT_Digital_Release_2_5_0_0.exe b/CMWTAT_Digital_Release_2_5_0_0.exe
new file mode 100644
index 0000000..304e4c6
Binary files /dev/null and b/CMWTAT_Digital_Release_2_5_0_0.exe differ
diff --git a/CMWTAT_Digital_Release_2_5_0_0.zip b/CMWTAT_Digital_Release_2_5_0_0.zip
new file mode 100644
index 0000000..abb56ae
Binary files /dev/null and b/CMWTAT_Digital_Release_2_5_0_0.zip differ
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..8391529
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,342 @@
+GNU GENERAL PUBLIC LICENSE
+
+Copyright (c) 2018 TGSAN
+
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C) 2018 TGSAN
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ {signature of Ty Coon}, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/_config.yml b/_config.yml
new file mode 100644
index 0000000..8b07c2e
--- /dev/null
+++ b/_config.yml
@@ -0,0 +1,15 @@
+theme: jekyll-theme-cayman
+show_downloads: false
+title: CloudMoe Windows 10 Toolkit Digital Edition
+description: CloudMoe Windows 10 Acivation Toolkit get digital license, the best open source Win 10 activator in GitHub.
GitHub 上最棒的开源 Win10 数字权利(数字许可证)激活工具!
+# SEORelate
+google_site_verification :
+bing_site_verification :
+alexa_site_verification :
+yandex_site_verification :
+tags: [Digital License, Windows 10 Acivation Toolkit, Activator]
+navbar-links:
+ Resources:
+ - Learn markdown: "http://www.markdowntutorial.com/"
+ - GitHub Pages: "https://pages.github.com/"
+
diff --git a/images/2.2.0.1.jpg b/images/2.2.0.1.jpg
new file mode 100644
index 0000000..5817486
Binary files /dev/null and b/images/2.2.0.1.jpg differ
diff --git a/images/UI.jpg b/images/UI.jpg
new file mode 100644
index 0000000..c18c1fd
Binary files /dev/null and b/images/UI.jpg differ