Upgrade to v2.1

Upgrade to v2.1
Support some experimental features
Add install key mode (without activate)
Add manual enter key mode
This commit is contained in:
TGSAN 2018-05-31 19:30:34 +08:00
parent 824f03b0da
commit f51df4aa01
22 changed files with 2035 additions and 155 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 KiB

View File

@ -82,6 +82,9 @@
<DependentUpon>App.xaml</DependentUpon> <DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Domain\IsSN.cs" />
<Compile Include="Domain\NotifyPropertyChangedExtension.cs" />
<Compile Include="Domain\ViewModel.cs" />
<Compile Include="MainWindow.xaml.cs"> <Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon> <DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>

View File

@ -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
/// <summary>
/// 验证字符串是否匹配正则表达式描述的规则
/// </summary>
/// <param name="inputStr">待验证的字符串</param>
/// <param name="patternStr">正则表达式字符串</param>
/// <returns>是否匹配</returns>
public static bool IsMatch(string inputStr, string patternStr)
{
return IsMatch(inputStr, patternStr, false, false);
}
/// <summary>
/// 验证字符串是否匹配正则表达式描述的规则
/// </summary>
/// <param name="inputStr">待验证的字符串</param>
/// <param name="patternStr">正则表达式字符串</param>
/// <param name="ifIgnoreCase">匹配时是否不区分大小写</param>
/// <returns>是否匹配</returns>
public static bool IsMatch(string inputStr, string patternStr, bool ifIgnoreCase)
{
return IsMatch(inputStr, patternStr, ifIgnoreCase, false);
}
/// <summary>
/// 验证字符串是否匹配正则表达式描述的规则
/// </summary>
/// <param name="inputStr">待验证的字符串</param>
/// <param name="patternStr">正则表达式字符串</param>
/// <param name="ifIgnoreCase">匹配时是否不区分大小写</param>
/// <param name="ifValidateWhiteSpace">是否验证空白字符串</param>
/// <returns>是否匹配</returns>
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.");
}
}
}
}

View File

@ -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<TField>(this INotifyPropertyChanged instance, ref TField field, TField newValue, Action<PropertyChangedEventArgs> raise, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<TField>.Default.Equals(field, newValue)) return;
field = newValue;
raise?.Invoke(new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@ -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<int>(Enumerable.Range(0, 1000));
}
public string SN
{
get { return _sn; }
set
{
this.MutateVerbose(ref _sn, value, RaisePropertyChanged());
}
}
public IList<int> LongListToTestComboVirtualization { get; }
public event PropertyChangedEventHandler PropertyChanged;
private Action<PropertyChangedEventArgs> RaisePropertyChanged()
{
return args => PropertyChanged?.Invoke(this, args);
}
}
}

View File

@ -3,9 +3,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:domain="clr-namespace:CMWTAT_DIGITAL.Domain"
xmlns:local="clr-namespace:CMWTAT_DIGITAL" xmlns:local="clr-namespace:CMWTAT_DIGITAL"
mc:Ignorable="d" mc:Ignorable="d"
Title="CMWTAT Digital Edition V2" Height="380" Width="450" Title="CMWTAT Digital Edition V2" Height="550" Width="450"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
TextElement.Foreground="{DynamicResource MaterialDesignBody}" TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextElement.FontWeight="Regular" TextElement.FontWeight="Regular"
@ -13,148 +14,173 @@
TextOptions.TextFormattingMode="Ideal" TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto" TextOptions.TextRenderingMode="Auto"
Background="{DynamicResource MaterialDesignPaper}" Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{DynamicResource MaterialDesignFont}" ResizeMode="NoResize"> FontFamily="{DynamicResource MaterialDesignFont}"
ResizeMode="NoResize"
d:DataContext="{d:DesignInstance domain:ViewModel, d:IsDesignTimeCreatable=False}"
>
<Grid> <Grid>
<Button x:Name="actbtn" Content="Activation" Margin="30,250,30,0" VerticalAlignment="Top" Click="Button_Click" Height="65"/> <StackPanel>
<materialDesign:Card Padding="32" Margin="16,70,16,0"> <materialDesign:Card Padding="32" Margin="15,15,15,0">
<ComboBox x:Name="SystemEditionText" DisplayMemberPath="DisplayOS" VerticalAlignment="Top"/> <TextBlock Style="{DynamicResource MaterialDesignTitleTextBlock}"><Run Text="CMWTAT Digital Edition V2"/></TextBlock>
<!--<TextBlock x:Name="SystemEditionText" Style="{DynamicResource MaterialDesignTitleTextBlock}" Text="Checking System" />--> </materialDesign:Card>
</materialDesign:Card> <materialDesign:Card Padding="32" Margin="15,15,15,0">
<materialDesign:Card Padding="32" Margin="16"> <StackPanel>
<TextBlock Style="{DynamicResource MaterialDesignTitleTextBlock}"><Run Text="CMWTAT Digital Edition V2"/></TextBlock> <Grid>
</materialDesign:Card> <ComboBox x:Name="SystemEditionText" DisplayMemberPath="DisplayOS" VerticalAlignment="Center" Visibility="Visible"/>
<materialDesign:DialogHost x:Name="DialogWait" IsOpen="False"> <TextBox x:Name="SystemEditionTextInput" materialDesign:HintAssist.Hint="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" MaxLength="29" xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCore" input:InputMethod.IsInputMethodEnabled="False" VerticalAlignment="Center" Visibility="Hidden" TextChanged="SystemEditionTextInput_TextChanged">
<materialDesign:DialogHost.DialogContent> <TextBox.Text>
<Grid> <Binding Path="SN" UpdateSourceTrigger="PropertyChanged">
<materialDesign:Card> <Binding.ValidationRules>
<StackPanel> <domain:IsSN ValidatesOnTargetUpdated="True"/>
<StackPanel Margin="32,24,32,24"> </Binding.ValidationRules>
<ProgressBar Style="{DynamicResource MaterialDesignCircularProgressBar}" HorizontalAlignment="Center" Margin="0,0,0,0" IsIndeterminate="True" Value="0" VerticalAlignment="Top" Width="32" Height="32" /> </Binding>
<TextBlock Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0,24,0,0" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontSize="14" >Loading</TextBlock> </TextBox.Text>
</TextBox>
</Grid>
<!--<TextBlock x:Name="SystemEditionText" Style="{DynamicResource MaterialDesignTitleTextBlock}" Text="Checking System" />-->
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Margin="0,30,0,0">
<RadioButton x:Name="AutoRadio" Content="Auto Mode" Margin="30,0,30,0" IsChecked="True" Checked="A_RadioButton_Checked"/>
<RadioButton x:Name="ManualRadio" Content="Manual Mode" Margin="30,0,30,0" Checked="M_RadioButton_Checked"/>
</StackPanel>
</StackPanel>
</materialDesign:Card>
<Button x:Name="actbtn" Content="Activate" Margin="30,30,30,0" VerticalAlignment="Top" Click="Activate_Button_Click" Height="65"/>
<Button x:Name="installbtn" Content="Convert versions (Install Key without Activate)" Margin="30,30,30,0" VerticalAlignment="Top" Click="installbtn_Click" Height="65"/>
</StackPanel>
<Grid x:Name="DialogHostGrid" Visibility="Hidden">
<materialDesign:DialogHost x:Name="DialogWait" IsOpen="False">
<materialDesign:DialogHost.DialogContent>
<Grid>
<materialDesign:Card>
<StackPanel>
<StackPanel Margin="32,24,32,24">
<ProgressBar Style="{DynamicResource MaterialDesignCircularProgressBar}" HorizontalAlignment="Center" Margin="0,0,0,0" IsIndeterminate="True" Value="0" VerticalAlignment="Top" Width="32" Height="32" />
<TextBlock Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0,24,0,0" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontSize="14" >Loading</TextBlock>
</StackPanel>
</StackPanel> </StackPanel>
</StackPanel> </materialDesign:Card>
</materialDesign:Card> </Grid>
</Grid> </materialDesign:DialogHost.DialogContent>
</materialDesign:DialogHost.DialogContent> </materialDesign:DialogHost>
</materialDesign:DialogHost> <materialDesign:DialogHost x:Name="DialogActProg" IsOpen="False">
<materialDesign:DialogHost x:Name="DialogActProg" IsOpen="False"> <materialDesign:DialogHost.DialogContent>
<materialDesign:DialogHost.DialogContent> <Grid>
<Grid> <materialDesign:Card>
<materialDesign:Card> <StackPanel>
<StackPanel> <StackPanel Margin="32,24,32,24">
<StackPanel Margin="32,24,32,24"> <ProgressBar Style="{DynamicResource MaterialDesignCircularProgressBar}" HorizontalAlignment="Center" Margin="0,0,0,0" IsIndeterminate="True" Value="0" VerticalAlignment="Top" Width="32" Height="32" />
<ProgressBar Style="{DynamicResource MaterialDesignCircularProgressBar}" HorizontalAlignment="Center" Margin="0,0,0,0" IsIndeterminate="True" Value="0" VerticalAlignment="Top" Width="32" Height="32" /> <TextBlock x:Name="activatingtext" Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0,24,0,0" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontSize="14" >Activating</TextBlock>
<TextBlock x:Name="activatingtext" Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0,24,0,0" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontSize="14" >Activating</TextBlock> </StackPanel>
</StackPanel> </StackPanel>
</StackPanel> </materialDesign:Card>
</materialDesign:Card> </Grid>
</Grid> </materialDesign:DialogHost.DialogContent>
</materialDesign:DialogHost.DialogContent> </materialDesign:DialogHost>
</materialDesign:DialogHost> <materialDesign:DialogHost x:Name="DialogWithCancel" IsOpen="False">
<materialDesign:DialogHost x:Name="DialogWithCancel" IsOpen="False"> <materialDesign:DialogHost.DialogContent>
<materialDesign:DialogHost.DialogContent> <Grid>
<Grid> <materialDesign:Card>
<materialDesign:Card> <StackPanel>
<StackPanel> <StackPanel Margin="24,24,24,8">
<StackPanel Margin="24,24,24,8"> <ProgressBar Style="{DynamicResource MaterialDesignCircularProgressBar}" HorizontalAlignment="Center" Margin="0,0,0,0" IsIndeterminate="True" Value="0" VerticalAlignment="Top" Width="32" Height="32" />
<ProgressBar Style="{DynamicResource MaterialDesignCircularProgressBar}" HorizontalAlignment="Center" Margin="0,0,0,0" IsIndeterminate="True" Value="0" VerticalAlignment="Top" Width="32" Height="32" /> <TextBlock Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="24,16,24,0" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontSize="14" >Loading</TextBlock>
<TextBlock Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="24,16,24,0" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontSize="14" >Loading</TextBlock> </StackPanel>
</StackPanel> <StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal" Margin="8,0,8,8">
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal" Margin="8,0,8,8"> <Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True"
<Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True"
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
CommandParameter="Sample2Cancel" CommandParameter="Sample2Cancel"
HorizontalAlignment="Center">CANCEL</Button> HorizontalAlignment="Center">CANCEL</Button>
</StackPanel>
</StackPanel> </StackPanel>
</StackPanel> </materialDesign:Card>
</materialDesign:Card> </Grid>
</Grid> </materialDesign:DialogHost.DialogContent>
</materialDesign:DialogHost.DialogContent> </materialDesign:DialogHost>
</materialDesign:DialogHost> <materialDesign:DialogHost x:Name="DialogWithOK" IsOpen="False">
<materialDesign:DialogHost x:Name="DialogWithOK" IsOpen="False"> <materialDesign:DialogHost.DialogContent>
<materialDesign:DialogHost.DialogContent> <Grid>
<Grid> <materialDesign:Card>
<materialDesign:Card> <StackPanel>
<StackPanel> <StackPanel Margin="16,16,16,8">
<StackPanel Margin="16,16,16,8"> <!--<ProgressBar Style="{DynamicResource MaterialDesignCircularProgressBar}" HorizontalAlignment="Center" Margin="0,0,0,0" IsIndeterminate="True" Value="0" VerticalAlignment="Top" Width="32" Height="32" />-->
<!--<ProgressBar Style="{DynamicResource MaterialDesignCircularProgressBar}" HorizontalAlignment="Center" Margin="0,0,0,0" IsIndeterminate="True" Value="0" VerticalAlignment="Top" Width="32" Height="32" />--> <TextBlock Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="16" FontWeight="Bold" >Title</TextBlock>
<TextBlock Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="16" FontWeight="Bold" >Title</TextBlock> <TextBlock Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0,8,0,0" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontSize="14" >Hello World</TextBlock>
<TextBlock Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0,8,0,0" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontSize="14" >Hello World</TextBlock> </StackPanel>
</StackPanel> <StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal" Margin="8,0,8,8">
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal" Margin="8,0,8,8"> <Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True"
<Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True"
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
CommandParameter="Sample2Cancel" CommandParameter="Sample2Cancel"
HorizontalAlignment="Center">OK</Button> HorizontalAlignment="Center">OK</Button>
</StackPanel>
</StackPanel> </StackPanel>
</StackPanel> </materialDesign:Card>
</materialDesign:Card> </Grid>
</Grid> </materialDesign:DialogHost.DialogContent>
</materialDesign:DialogHost.DialogContent> </materialDesign:DialogHost>
</materialDesign:DialogHost> <materialDesign:DialogHost x:Name="DialogWithExit" IsOpen="False">
<materialDesign:DialogHost x:Name="DialogWithExit" IsOpen="False"> <materialDesign:DialogHost.DialogContent>
<materialDesign:DialogHost.DialogContent> <Grid>
<Grid> <materialDesign:Card>
<materialDesign:Card> <StackPanel>
<StackPanel> <StackPanel Margin="16,16,16,8">
<StackPanel Margin="16,16,16,8"> <!--<ProgressBar Style="{DynamicResource MaterialDesignCircularProgressBar}" HorizontalAlignment="Center" Margin="0,0,0,0" IsIndeterminate="True" Value="0" VerticalAlignment="Top" Width="32" Height="32" />-->
<!--<ProgressBar Style="{DynamicResource MaterialDesignCircularProgressBar}" HorizontalAlignment="Center" Margin="0,0,0,0" IsIndeterminate="True" Value="0" VerticalAlignment="Top" Width="32" Height="32" />--> <TextBlock x:Name="DialogWithExitTitle" Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="16" FontWeight="Bold" >Error</TextBlock>
<TextBlock x:Name="DialogWithExitTitle" Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="16" FontWeight="Bold" >Error</TextBlock> <TextBlock x:Name="DialogWithExitText" Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0,8,0,0" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontSize="14" >Unable to connect to server, program will exit.</TextBlock>
<TextBlock x:Name="DialogWithExitText" Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0,8,0,0" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontSize="14" >Unable to connect to server, program will exit.</TextBlock> </StackPanel>
</StackPanel> <StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal" Margin="8,0,8,8">
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal" Margin="8,0,8,8"> <Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True"
<Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True"
Click="Exit_Button_Click" Click="Exit_Button_Click"
HorizontalAlignment="Center">Exit</Button> HorizontalAlignment="Center">Exit</Button>
</StackPanel>
</StackPanel> </StackPanel>
</StackPanel> </materialDesign:Card>
</materialDesign:Card> </Grid>
</Grid> </materialDesign:DialogHost.DialogContent>
</materialDesign:DialogHost.DialogContent> </materialDesign:DialogHost>
</materialDesign:DialogHost> <materialDesign:DialogHost x:Name="DialogWithOKToCloseDialog" IsOpen="False">
<materialDesign:DialogHost x:Name="DialogWithOKToCloseDialog" IsOpen="False"> <materialDesign:DialogHost.DialogContent>
<materialDesign:DialogHost.DialogContent> <Grid>
<Grid> <materialDesign:Card>
<materialDesign:Card> <StackPanel>
<StackPanel> <StackPanel Margin="16,16,16,8">
<StackPanel Margin="16,16,16,8"> <!--<ProgressBar Style="{DynamicResource MaterialDesignCircularProgressBar}" HorizontalAlignment="Center" Margin="0,0,0,0" IsIndeterminate="True" Value="0" VerticalAlignment="Top" Width="32" Height="32" />-->
<!--<ProgressBar Style="{DynamicResource MaterialDesignCircularProgressBar}" HorizontalAlignment="Center" Margin="0,0,0,0" IsIndeterminate="True" Value="0" VerticalAlignment="Top" Width="32" Height="32" />--> <TextBlock x:Name="DialogWithOKToCloseDialogTitle" Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="16" FontWeight="Bold" >Title</TextBlock>
<TextBlock x:Name="DialogWithOKToCloseDialogTitle" Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="16" FontWeight="Bold" >Title</TextBlock> <TextBlock x:Name="DialogWithOKToCloseDialogText" Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0,8,0,0" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontSize="14" >Text</TextBlock>
<TextBlock x:Name="DialogWithOKToCloseDialogText" Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0,8,0,0" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontSize="14" >Text</TextBlock> </StackPanel>
</StackPanel> <StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal" Margin="8,0,8,8">
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal" Margin="8,0,8,8"> <Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True"
<Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True"
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
HorizontalAlignment="Center">OK</Button> HorizontalAlignment="Center">OK</Button>
</StackPanel>
</StackPanel> </StackPanel>
</StackPanel> </materialDesign:Card>
</materialDesign:Card> </Grid>
</Grid> </materialDesign:DialogHost.DialogContent>
</materialDesign:DialogHost.DialogContent> </materialDesign:DialogHost>
</materialDesign:DialogHost> <materialDesign:DialogHost x:Name="DialogWithOKToCloseDialogDonate" IsOpen="False">
<materialDesign:DialogHost x:Name="DialogWithOKToCloseDialogDonate" IsOpen="False"> <materialDesign:DialogHost.DialogContent>
<materialDesign:DialogHost.DialogContent> <Grid>
<Grid> <materialDesign:Card>
<materialDesign:Card> <StackPanel>
<StackPanel> <StackPanel Margin="16,16,16,8">
<StackPanel Margin="16,16,16,8"> <!--<ProgressBar Style="{DynamicResource MaterialDesignCircularProgressBar}" HorizontalAlignment="Center" Margin="0,0,0,0" IsIndeterminate="True" Value="0" VerticalAlignment="Top" Width="32" Height="32" />-->
<!--<ProgressBar Style="{DynamicResource MaterialDesignCircularProgressBar}" HorizontalAlignment="Center" Margin="0,0,0,0" IsIndeterminate="True" Value="0" VerticalAlignment="Top" Width="32" Height="32" />--> <TextBlock x:Name="DialogWithOKToCloseDialogDonateTitle" Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="16" FontWeight="Bold" >Title</TextBlock>
<TextBlock x:Name="DialogWithOKToCloseDialogDonateTitle" Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="16" FontWeight="Bold" >Title</TextBlock> <TextBlock x:Name="DialogWithOKToCloseDialogDonateText" Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0,8,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom" FontSize="14" >Text</TextBlock>
<TextBlock x:Name="DialogWithOKToCloseDialogDonateText" Style="{DynamicResource MaterialDesignTitleTextBlock}" Margin="0,8,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom" FontSize="14" ><LineBreak/>Congratulation! <LineBreak/><LineBreak/> Windows 10 has been successful activated.<LineBreak/></TextBlock> </StackPanel>
</StackPanel> <StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal" Margin="8,0,8,8">
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal" Margin="8,0,8,8"> <Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True"
<Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True"
Click="Donate_Button_Click" Click="Donate_Button_Click"
HorizontalAlignment="Center">Thanks developer and donate a dinner</Button> HorizontalAlignment="Center">Thanks developer and donate a dinner</Button>
<Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True" <Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True"
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
HorizontalAlignment="Center">Refuse</Button> HorizontalAlignment="Center">Refuse</Button>
</StackPanel>
</StackPanel> </StackPanel>
</StackPanel> </materialDesign:Card>
</materialDesign:Card> </Grid>
</Grid> </materialDesign:DialogHost.DialogContent>
</materialDesign:DialogHost.DialogContent> </materialDesign:DialogHost>
</materialDesign:DialogHost> </Grid>
</Grid> </Grid>
</Window> </Window>

View File

@ -19,6 +19,8 @@ using System.Net;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using Microsoft.Win32; using Microsoft.Win32;
using CMWTAT_DIGITAL.Domain;
using System.Text.RegularExpressions;
namespace CMWTAT_DIGITAL namespace CMWTAT_DIGITAL
{ {
@ -38,7 +40,13 @@ namespace CMWTAT_DIGITAL
public string SystemEdition = OSVersionInfo.Edition; public string SystemEdition = OSVersionInfo.Edition;
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
DataContext = new ViewModel();
this.DialogHostGrid.Visibility = Visibility.Visible;
//MessageBox.Show(@"reg add ""HKLM\SYSTEM\Tokens\"" /v ""Channel"" /t REG_SZ /d ""Retail"" /f"); //MessageBox.Show(@"reg add ""HKLM\SYSTEM\Tokens\"" /v ""Channel"" /t REG_SZ /d ""Retail"" /f");
DialogWait.IsOpen = true; DialogWait.IsOpen = true;
try try
@ -59,6 +67,9 @@ namespace CMWTAT_DIGITAL
JArray ositems; JArray ositems;
int now_os_index = 0; int now_os_index = 0;
string checked_os = "unknow"; string checked_os = "unknow";
bool is_auto = true; //是否为自动模式false为手动
private void InvokeTest() private void InvokeTest()
{ {
actbtn.Dispatcher.Invoke(new Action(() => actbtn.Dispatcher.Invoke(new Action(() =>
@ -74,7 +85,7 @@ namespace CMWTAT_DIGITAL
})); }));
try try
{ {
string json = GetHttpWebRequest("https://kms.kumo.moe/api/digital?list=1"); string json = GetHttpWebRequest("https://kms.kumo.moe/api/digital?list=1&ver=2");
JObject jsonobj = JObject.Parse(json); JObject jsonobj = JObject.Parse(json);
List<Frequency> list = new List<Frequency>(); List<Frequency> list = new List<Frequency>();
Frequency freq = new Frequency(); Frequency freq = new Frequency();
@ -93,6 +104,11 @@ namespace CMWTAT_DIGITAL
now_os_index = i; now_os_index = i;
checked_os = SystemEdition + OSVersionInfo.BuildVersion; checked_os = SystemEdition + OSVersionInfo.BuildVersion;
} }
if (jsonobj["OS"][i].ToString() == "(Experimental) " + SystemEdition)
{
now_os_index = i;
checked_os = "(Experimental) " + SystemEdition;
}
list.Add(freq); list.Add(freq);
} }
@ -114,7 +130,6 @@ namespace CMWTAT_DIGITAL
})); }));
//this.SystemEditionText.SelectedIndex = now_os_index; //this.SystemEditionText.SelectedIndex = now_os_index;
// 在此点之下插入创建对象所需的代码。
} }
catch catch
{ {
@ -129,7 +144,7 @@ namespace CMWTAT_DIGITAL
})); }));
} }
private void Button_Click(object sender, RoutedEventArgs e) private void Activate_Button_Click(object sender, RoutedEventArgs e)
{ {
Thread actthread = new Thread(RunAct); Thread actthread = new Thread(RunAct);
actthread.Start(); actthread.Start();
@ -141,6 +156,13 @@ namespace CMWTAT_DIGITAL
//MessageBox.Show(rss["OS"][0].ToString()); //MessageBox.Show(rss["OS"][0].ToString());
//MessageBox.Show(SystemEdition); //MessageBox.Show(SystemEdition);
} }
private void installbtn_Click(object sender, RoutedEventArgs e)
{
Thread installthread = new Thread(RunInstall);
installthread.Start();
}
private string GetHttpWebRequest(string url) private string GetHttpWebRequest(string url)
{ {
Uri uri = new Uri(url); Uri uri = new Uri(url);
@ -164,6 +186,131 @@ namespace CMWTAT_DIGITAL
Application.Current.Shutdown(); Application.Current.Shutdown();
} }
private void RunInstall()
{
actbtn.Dispatcher.Invoke(new Action(() =>
{
this.DialogActProg.IsOpen = true;
this.activatingtext.Text = "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 = 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 = "Getting Key";
}));
//获取密钥和SKU
try
{
string json = GetHttpWebRequest("https://kms.kumo.moe/api/digital?list=0&ver=2");
JObject jsonobj = JObject.Parse(json);
List<Frequency> list = new List<Frequency>();
ositems = (JArray)jsonobj["OS"];
key = jsonobj[system]["key"].ToString();
sku = jsonobj[system]["sku"].ToString();
Console.WriteLine("Edition:" + system + "\r\nKEY:" + key + "\r\nSKU:" + sku);
}
catch
{
code = "-0";
msg = "激活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 = "Uninstalling old Key";
}));
//卸载
string runend = RunCScript(slmgr_self, "-upk").Trim();
Console.WriteLine(runend);
if (runend.EndsWith("successfully.") || runend.EndsWith("not found."))
{
actbtn.Dispatcher.Invoke(new Action(() =>
{
this.activatingtext.Text = "Installing Key";
}));
//安装数字权利升级密钥
if (RunCScript(slmgr_self, "-ipk " + key).Trim().EndsWith("successfully."))
{
code = "200";
}
else
{
code = "-2";
msg = "无法安装密钥,可能没有选择或输入正确的版本 :(\nCannot to install key, may be you choose or enter a incorrect version. :(";
}
}
else
{
code = "-1";
msg = "无法卸载旧密钥 :(\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 = "Converting";
this.DialogWithOKToCloseDialog.IsOpen = true;
this.DialogWithOKToCloseDialogTitle.Text = "Error";
this.DialogWithOKToCloseDialogText.Text = msg + "\r\nCode:" + code;
}));
//MessageBox.Show(msg + "\r\nCode:" + code);
}
else
{
actbtn.Dispatcher.Invoke(new Action(() =>
{
this.DialogActProg.IsOpen = false;
this.activatingtext.Text = "Converting";
this.DialogWithOKToCloseDialogDonate.IsOpen = true;
this.DialogWithOKToCloseDialogDonateTitle.Text = "Complete";
this.DialogWithOKToCloseDialogDonateText.Text = "\nCongratulation! \n\nWindows 10 has been successful converted.\n";
}));
//MessageBox.Show("Congratulation!");
}
}
private void RunAct() private void RunAct()
{ {
actbtn.Dispatcher.Invoke(new Action(() => actbtn.Dispatcher.Invoke(new Action(() =>
@ -179,45 +326,68 @@ namespace CMWTAT_DIGITAL
string sku = "0"; string sku = "0";
string msg = "Unknow Error!"; string msg = "Unknow Error!";
string system = ""; string system = "";
actbtn.Dispatcher.Invoke(new Action(() => string mode = "1"; //1普通SYS、SKU、KEY完全2.需要获取SKUSYS、KEY3.手动输入KEY
{
system = this.SystemEditionText.Text;
}));
string slmgr = Environment.GetFolderPath(Environment.SpecialFolder.SystemX86) + "\\slmgr.vbs"; string slmgr = Environment.GetFolderPath(Environment.SpecialFolder.SystemX86) + "\\slmgr.vbs";
string slmgr_self = System.AppDomain.CurrentDomain.BaseDirectory + "slmgr.vbs"; string slmgr_self = System.AppDomain.CurrentDomain.BaseDirectory + "slmgr.vbs";
string changepk = Environment.SystemDirectory + "\\changepk.exe"; string changepk = Environment.SystemDirectory + "\\changepk.exe";
actbtn.Dispatcher.Invoke(new Action(() => if (is_auto == true)
{
this.activatingtext.Text = "Getting Key";
}));
//获取密钥和SKU
try
{ {
string json = GetHttpWebRequest("https://kms.kumo.moe/api/digital?list=0"); actbtn.Dispatcher.Invoke(new Action(() =>
JObject jsonobj = JObject.Parse(json); {
List<Frequency> list = new List<Frequency>(); system = this.SystemEditionText.Text;
ositems = (JArray)jsonobj["OS"]; }));
key = jsonobj[system]["key"].ToString();
sku = jsonobj[system]["sku"].ToString(); actbtn.Dispatcher.Invoke(new Action(() =>
Console.WriteLine("Edition:" + system + "\r\nSKU:" + key + "\r\nSKU:" + sku); {
this.activatingtext.Text = "Getting Key";
}));
//获取密钥和SKU
try
{
string json = GetHttpWebRequest("https://kms.kumo.moe/api/digital?list=0&ver=2");
JObject jsonobj = JObject.Parse(json);
List<Frequency> list = new List<Frequency>();
ositems = (JArray)jsonobj["OS"];
key = jsonobj[system]["key"].ToString();
sku = jsonobj[system]["sku"].ToString();
Console.WriteLine("Edition:" + system + "\r\nKEY:" + key + "\r\nSKU:" + sku);
if (sku == "unknow")
{
mode = "2";
}
}
catch
{
code = "-0";
msg = "激活Windows10需要网络获取产品密钥 :) \nActivate Windows 10 requires a network to gets the product key :)";
goto EndLine;
}
} }
catch else
{ {
code = "-0";
msg = "激活Windows10需要网络获取产品密钥 :) \nActivate Windows 10 requires a network to gets the product key :)"; actbtn.Dispatcher.Invoke(new Action(() =>
goto EndLine; {
key = this.SystemEditionTextInput.Text;
}));
mode = "3";
} }
actbtn.Dispatcher.Invoke(new Action(() => actbtn.Dispatcher.Invoke(new Action(() =>
{ {
this.activatingtext.Text = "Uninstalling old Key"; this.activatingtext.Text = "Uninstalling old Key";
})); }));
//卸载 //卸载
string runend = RunCScript(slmgr_self, "-upk").Trim(); string runend = RunCScript(slmgr_self, "-upk").Trim();
Console.WriteLine(runend); Console.WriteLine(runend);
@ -226,6 +396,54 @@ namespace CMWTAT_DIGITAL
RunCScript(slmgr_self, "-ckms").Trim(); RunCScript(slmgr_self, "-ckms").Trim();
if (mode == "2" || mode == "3")
{
actbtn.Dispatcher.Invoke(new Action(() =>
{
this.activatingtext.Text = "Getting edition code (Experimental)";
}));
//安装转换密钥
runend = RunCScript(slmgr_self, "-ipk " + key);
Console.WriteLine(slmgr_self + " -ipk " + key);
Console.WriteLine(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 = "Uninstalling old Key (Experimental)";
}));
runend = RunCScript(slmgr_self, "-upk").Trim();
Console.WriteLine(runend);
if (runend.EndsWith("successfully.") || runend.EndsWith("not found."))
{
actbtn.Dispatcher.Invoke(new Action(() =>
{
this.activatingtext.Text = "Prepare for the next step (Experimental)";
}));
}
}
else
{
code = "-1.2";
msg = "无法获取版本代号 :(\nCannot to get edition code. :(";
goto EndLine;
}
}
else
{
code = "-1.1";
msg = "无法安装密钥,可能没有选择或输入正确的版本 :(\nCannot to install key, may be you choose or enter a incorrect version. :(";
goto EndLine;
}
}
//写入Win7特征 //写入Win7特征
//ChangePKAction(changepk + " /ProductKey " + key); //ChangePKAction(changepk + " /ProductKey " + key);
@ -245,7 +463,10 @@ namespace CMWTAT_DIGITAL
})); }));
//安装数字权利升级密钥 //安装数字权利升级密钥
if (RunCScript(slmgr_self, "-ipk " + key).Trim().EndsWith("successfully.")) runend = RunCScript(slmgr_self, "-ipk " + key);
Console.WriteLine(slmgr_self + " -ipk " + key);
Console.WriteLine(runend);
if (runend.Trim().EndsWith("successfully."))
{ {
actbtn.Dispatcher.Invoke(new Action(() => actbtn.Dispatcher.Invoke(new Action(() =>
@ -298,13 +519,13 @@ namespace CMWTAT_DIGITAL
else else
{ {
code = "-3"; code = "-3";
msg = "执行超时,可能没有选择正确的版本 :(\nTime out, may be you choose a incorrect version. :("; msg = "执行超时,可能没有选择正确或输入的版本 :(\nTime out, may be you choose or enter a incorrect version. :(";
} }
} }
else else
{ {
code = "-2"; code = "-2";
msg = "无法安装密钥,可能没有选择正确的版本 :(\nCannot to install key, may be you choose a incorrect version. :("; msg = "无法安装密钥,可能没有选择或输入正确的版本 :(\nCannot to install key, may be you choose or enter a incorrect version. :(";
} }
} }
else else
@ -333,8 +554,8 @@ namespace CMWTAT_DIGITAL
this.DialogActProg.IsOpen = false; this.DialogActProg.IsOpen = false;
this.activatingtext.Text = "Activating"; this.activatingtext.Text = "Activating";
this.DialogWithOKToCloseDialogDonate.IsOpen = true; this.DialogWithOKToCloseDialogDonate.IsOpen = true;
//this.DialogWithOKToCloseDialogDonateTitle.Text = "Complete"; this.DialogWithOKToCloseDialogDonateTitle.Text = "Complete";
//this.DialogWithOKToCloseDialogDonateText.Text = "Congratulation!"; this.DialogWithOKToCloseDialogDonateText.Text = "\nCongratulation! \n\nWindows 10 has been successful activated.\n";
})); }));
//MessageBox.Show("Congratulation!"); //MessageBox.Show("Congratulation!");
} }
@ -352,7 +573,7 @@ namespace CMWTAT_DIGITAL
p.StartInfo.CreateNoWindow = true;//不显示程序窗口 p.StartInfo.CreateNoWindow = true;//不显示程序窗口
p.Start();//启动程序 p.Start();//启动程序
//向CMD窗口发送输入信息 //向CMD窗口发送输入信息
p.StandardInput.WriteLine(var); //10秒后重启C#中可不好做哦) p.StandardInput.WriteLine(var);
Console.WriteLine(var); Console.WriteLine(var);
//Wow64EnableWow64FsRedirection(false);//关闭文件重定向 //Wow64EnableWow64FsRedirection(false);//关闭文件重定向
//System.Diagnostics.Process.Start(var); //System.Diagnostics.Process.Start(var);
@ -386,10 +607,71 @@ namespace CMWTAT_DIGITAL
} }
} }
public static string GetSKU()
{
Wow64EnableWow64FsRedirection(false);//关闭文件重定向
//执行命令行函数
try
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe";//要执行的程序名称
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.Arguments = "/c wmic os get OperatingSystemSKU";
//myProcessStartInfo.Arguments = "/c chcp 65001 > nul && cmd /c \"" + PHPRuntimePath + "\" \"" + path + "\" " + var;
//myProcessStartInfo.Arguments = "/c " & Commands
p.StartInfo.StandardOutputEncoding = Encoding.UTF8;
p.Start();
p.WaitForExit(120 * 1000);
System.IO.StreamReader myStreamReader = p.StandardOutput;
string myString = myStreamReader.ReadToEnd();
p.Close();
myString = Regex.Replace(myString, @"[^0-9]+", "");
Console.WriteLine("Get SKU:\"" + myString + "\"");
return myString; //只保留数字SKU
}
catch
{
return "Error";
}
}
private void Donate_Button_Click(object sender, RoutedEventArgs e) private void Donate_Button_Click(object sender, RoutedEventArgs e)
{ {
System.Diagnostics.Process.Start("https://waxel.cloudmoe.com/donate/"); System.Diagnostics.Process.Start("https://waxel.cloudmoe.com/donate/");
this.DialogWithOKToCloseDialogDonate.IsOpen = false; 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<Match>().ToList());
SystemEditionTextInput.Text = temp.ToUpper();
last_key = SystemEditionTextInput.Text;
SystemEditionTextInput.SelectionStart = SystemEditionTextInput.Text.Length;
}
}
private void A_RadioButton_Checked(object sender, RoutedEventArgs e)
{
SystemEditionText.Visibility = Visibility.Visible;
SystemEditionTextInput.Visibility = Visibility.Hidden;
is_auto = true;
}
private void M_RadioButton_Checked(object sender, RoutedEventArgs e)
{
SystemEditionText.Visibility = Visibility.Hidden;
SystemEditionTextInput.Visibility = Visibility.Visible;
is_auto = false;
}
} }
} }

View File

@ -51,5 +51,5 @@ using System.Windows;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: : // 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.1.0.0")]

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{9599DF4F-9D56-4448-8F56-76B3966982A4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>JCS</RootNamespace>
<AssemblyName>OSVersionInfo</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="OSVersionInfoClass.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OSVersionInfoDLL")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OSVersionInfoDLL")]
[assembly: AssemblyCopyright("Copyright © 2010-2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a3be4af5-b38a-442d-a0a8-8c63450c2888")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace JCS.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.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() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[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("JCS.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace JCS.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.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;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>