Compare commits

..
16 Commits
Author SHA1 Message Date
sc 3cef040179 Merge branch 'master' of http://www.scserverddns.top:13000/sc/sunlight_cdkey 2024-06-19 21:38:58 +08:00
sc 3cb3007d36 修改页面字符 2024-06-19 21:38:55 +08:00
sc 45be4dae2d Merge branch 'master' of http://192.168.0.12:13000/sc/SUNLIGHT_CDKEY 2024-03-31 22:36:05 +08:00
sc 17a2d0570c 2024-03-31cdkey 2024-03-31 22:36:02 +08:00
sc 3cc75a4d51 Merge branch 'master' of http://192.168.0.12:13000/sc/SUNLIGHT_CDKEY 2024-03-30 22:22:01 +08:00
sc dd8bedf452 Merge branch 'master' of http://www.scserverddns.top:13000/sc/sunlight_cdkey 2024-03-30 22:22:00 +08:00
sc 4e9fb61ff0 Merge branch 'master' of http://www.scserverddns.top:13000/sc/sunlight_cdkey 2024-03-29 23:16:53 +08:00
sc 1a7669f1bf key 2024-03-29 23:16:50 +08:00
sc 4e40658493 key 2024-03-29 23:15:46 +08:00
sc 608f121b5d key 2024-03-29 23:15:14 +08:00
sc 6b06bb643e key 2024-03-29 23:14:40 +08:00
sc 60bc8223b0 KEY 2024-03-29 23:14:20 +08:00
sc b8878d4223 KEY 2024-03-29 23:02:22 +08:00
sc eadb411c73 CDKEY 2024-03-29 23:01:14 +08:00
sc 2fa0249314 CDKEY 2024-03-29 23:00:52 +08:00
sc 481d85d04a CDKET生成 2024-03-29 22:59:10 +08:00
10 changed files with 83 additions and 39 deletions

No files matched your search

File renamed without changes.
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

+16 -16
View File
@@ -5,29 +5,29 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SUNLIGHT_CDKEY" xmlns:local="clr-namespace:SUNLIGHT_CDKEY"
mc:Ignorable="d" mc:Ignorable="d"
Title="MainWindow" Height="400" Width="600"> Title="SUNLIGHT_CDKEY" Height="400" Width="600">
<Grid> <Grid>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="20,10,0,0" TextWrapping="Wrap" Text="SN:" VerticalAlignment="Top" Width="170" FontSize="24"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="20,10,0,0" TextWrapping="Wrap" Text="设备识别码:" VerticalAlignment="Top" Width="170" FontSize="24"/>
<TextBox x:Name="sn_id" HorizontalAlignment="Left" Height="40" Margin="170,10,0,0" VerticalAlignment="Top" Width="340" FontSize="24"/> <TextBox x:Name="sn_id" HorizontalAlignment="Left" Height="40" Margin="170,10,0,0" VerticalAlignment="Top" Width="340" FontSize="24"
<TextBlock HorizontalAlignment="Left" Height="40" Margin="20,55,0,0" TextWrapping="Wrap" Text="DURATION:" VerticalAlignment="Top" Width="170" FontSize="24"/> PreviewTextInput="AlphanumericValidationTextBox" InputMethod.IsInputMethodEnabled="False"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="400,55,0,0" TextWrapping="Wrap" Text="MONTHS" VerticalAlignment="Top" Width="170" FontSize="24"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="20,55,0,0" TextWrapping="Wrap" Text="期限:" VerticalAlignment="Top" Width="170" FontSize="24"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="400,55,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="170" FontSize="24"/>
<ComboBox x:Name="DURATION" HorizontalAlignment="Left" Height="40" Margin="170,55,0,0" VerticalAlignment="Top" Width="220" DropDownClosed="DURATION_DropDownClosed" FontSize="24"> <ComboBox x:Name="DURATION" HorizontalAlignment="Left" Height="40" Margin="170,55,0,0" VerticalAlignment="Top" Width="220" DropDownClosed="DURATION_DropDownClosed" FontSize="24">
<ComboBoxItem Content=""></ComboBoxItem> <ComboBoxItem Content=""></ComboBoxItem>
<ComboBoxItem Content="1"></ComboBoxItem> <ComboBoxItem Content="1月"></ComboBoxItem>
<ComboBoxItem Content="2"></ComboBoxItem> <ComboBoxItem Content="3月"></ComboBoxItem>
<ComboBoxItem Content="3"></ComboBoxItem> <ComboBoxItem Content="6月"></ComboBoxItem>
<ComboBoxItem Content="6"></ComboBoxItem> <ComboBoxItem Content="12月"></ComboBoxItem>
<ComboBoxItem Content="12"></ComboBoxItem> <ComboBoxItem Content="长效"></ComboBoxItem>
<ComboBoxItem Content="FOREVER"></ComboBoxItem>
</ComboBox> </ComboBox>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="20,100,0,0" TextWrapping="Wrap" Text="TIME:" VerticalAlignment="Top" Width="88" FontSize="24"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="20,100,0,0" TextWrapping="Wrap" Text="时间:" VerticalAlignment="Top" Width="88" FontSize="24"/>
<TextBox x:Name="T_Y" Text="0" HorizontalAlignment="Left" Height="40" Margin="170,100,0,0" VerticalAlignment="Top" Width="220" FontSize="24" InputMethod.IsInputMethodEnabled="False" PreviewTextInput="Tb_KeyFloating_Y" /> <TextBox x:Name="T_Y" Text="0" HorizontalAlignment="Left" Height="40" Margin="170,100,0,0" VerticalAlignment="Top" Width="220" FontSize="24" InputMethod.IsInputMethodEnabled="False" PreviewTextInput="Tb_KeyFloating_Y" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="400,100,0,0" TextWrapping="Wrap" Text="YEAR" VerticalAlignment="Top" Width="170" FontSize="24"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="400,100,0,0" TextWrapping="Wrap" Text="年" VerticalAlignment="Top" Width="170" FontSize="24"/>
<TextBox x:Name="T_M" Text="0" HorizontalAlignment="Left" Height="40" Margin="170,145,0,0" VerticalAlignment="Top" Width="220" FontSize="24" InputMethod.IsInputMethodEnabled="False" PreviewTextInput="Tb_KeyFloating_M" /> <TextBox x:Name="T_M" Text="0" HorizontalAlignment="Left" Height="40" Margin="170,145,0,0" VerticalAlignment="Top" Width="220" FontSize="24" InputMethod.IsInputMethodEnabled="False" PreviewTextInput="Tb_KeyFloating_M" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="400,145,0,0" TextWrapping="Wrap" Text="MONTHS" VerticalAlignment="Top" Width="170" FontSize="24"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="400,145,0,0" TextWrapping="Wrap" Text="月" VerticalAlignment="Top" Width="170" FontSize="24"/>
<TextBox x:Name="T_D" Text="0" HorizontalAlignment="Left" Height="40" Margin="170,190,0,0" VerticalAlignment="Top" Width="220" FontSize="24" InputMethod.IsInputMethodEnabled="False" PreviewTextInput="Tb_KeyFloating_D" /> <TextBox x:Name="T_D" Text="0" HorizontalAlignment="Left" Height="40" Margin="170,190,0,0" VerticalAlignment="Top" Width="220" FontSize="24" InputMethod.IsInputMethodEnabled="False" PreviewTextInput="Tb_KeyFloating_D" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="400,190,0,0" TextWrapping="Wrap" Text="DAY" VerticalAlignment="Top" Width="170" FontSize="24"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="400,190,0,0" TextWrapping="Wrap" Text="日" VerticalAlignment="Top" Width="170" FontSize="24"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="20,235,0,0" TextWrapping="Wrap" Text="CDKEY:" VerticalAlignment="Top" Width="88" FontSize="24"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="20,235,0,0" TextWrapping="Wrap" Text="密钥:" VerticalAlignment="Top" Width="88" FontSize="24"/>
<TextBox x:Name="cdk" HorizontalAlignment="Left" Height="40" Margin="170,235,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="342" FontSize="24"/> <TextBox x:Name="cdk" HorizontalAlignment="Left" Height="40" Margin="170,235,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="342" FontSize="24"/>
<Button Content="OK" HorizontalAlignment="Left" Height="40" Margin="170,280,0,0" VerticalAlignment="Top" Width="85" Background="#FFE6E6E6" Click="Button_Click"/> <Button Content="OK" HorizontalAlignment="Left" Height="40" Margin="170,280,0,0" VerticalAlignment="Top" Width="85" Background="#FFE6E6E6" Click="Button_Click"/>
+60 -22
View File
@@ -1,8 +1,10 @@
using System; using formula_manage.UserClass;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;
@@ -12,7 +14,6 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using SUNLIGHT_CDKEY.UserClass;
namespace SUNLIGHT_CDKEY namespace SUNLIGHT_CDKEY
{ {
@@ -30,32 +31,50 @@ namespace SUNLIGHT_CDKEY
T_M.Text = DateTime.Now.ToString("MM"); T_M.Text = DateTime.Now.ToString("MM");
T_D.Text = DateTime.Now.ToString("dd"); T_D.Text = DateTime.Now.ToString("dd");
} }
private void AlphanumericValidationTextBox(object sender, TextCompositionEventArgs e)
{
Regex regex = new Regex(@"[^a-eA-E0-9]+$");
e.Handled = regex.IsMatch(e.Text.ToUpper());
}
private void validation_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Space) e.Handled = true;
}
private void Tb_KeyFloating_D(object sender, TextCompositionEventArgs e)//输入事件 private void Tb_KeyFloating_D(object sender, TextCompositionEventArgs e)//输入事件
{ {
d = int.Parse(T_D.Text);
//Regex re = new Regex("[^0-9.-]+"); //Regex re = new Regex("[^0-9.-]+");
Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数 Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数
e.Handled = !re.IsMatch(e.Text); e.Handled = !re.IsMatch(e.Text);
if(d>30)T_D.Text = "30"; d = int.Parse(T_D.Text);
if (d > 30)
{
T_D.Text = "30";
}
} }
private void Tb_KeyFloating_Y(object sender, TextCompositionEventArgs e)//输入事件 private void Tb_KeyFloating_Y(object sender, TextCompositionEventArgs e)//输入事件
{ {
y = int.Parse(T_Y.Text);
//Regex re = new Regex("[^0-9.-]+"); //Regex re = new Regex("[^0-9.-]+");
Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数 Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数
e.Handled = !re.IsMatch(e.Text); e.Handled = !re.IsMatch(e.Text);
if (y > 2099) T_Y.Text = "2099"; y = int.Parse(T_Y.Text);
if (y > 2099)
{
T_Y.Text = "2099";
}
} }
private void Tb_KeyFloating_M(object sender, TextCompositionEventArgs e)//输入事件 private void Tb_KeyFloating_M(object sender, TextCompositionEventArgs e)//输入事件
{ {
m = int.Parse(T_M.Text);
//Regex re = new Regex("[^0-9.-]+"); //Regex re = new Regex("[^0-9.-]+");
Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数 Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数
e.Handled = !re.IsMatch(e.Text); e.Handled = !re.IsMatch(e.Text);
if (m > 12) T_M.Text = "12"; m = int.Parse(T_M.Text);
if (m > 12)
{
T_M.Text = "12";
}
} }
private void DURATION_DropDownClosed(object sender, EventArgs e) private void DURATION_DropDownClosed(object sender, EventArgs e)
@@ -68,29 +87,27 @@ namespace SUNLIGHT_CDKEY
y = int.Parse(T_Y.Text); y = int.Parse(T_Y.Text);
m = int.Parse(T_M.Text); m = int.Parse(T_M.Text);
if (DURATION.Text == "1") if (DURATION.Text == "1月")
{ {
m += 1; m += 1;
} }
else if (DURATION.Text == "2") else if (DURATION.Text == "3月")
{
m += 2;
}
else if (DURATION.Text == "3")
{ {
m += 3; m += 3;
} }
else if (DURATION.Text == "6") else if (DURATION.Text == "6月")
{ {
m += 6; m += 6;
} }
else if (DURATION.Text == "12") else if (DURATION.Text == "12月")
{ {
y += 1; y += 1;
} }
else if (DURATION.Text == "FOREVER") else if (DURATION.Text == "长效")
{ {
y = 2099; y = 2099;
m = 12;
d = 30;
} }
if (m > 12) if (m > 12)
{ {
@@ -105,12 +122,33 @@ namespace SUNLIGHT_CDKEY
private void Button_Click(object sender, RoutedEventArgs e) private void Button_Click(object sender, RoutedEventArgs e)
{ {
string a, b; string a;
string b, my, mm, md;
a= sn_id.Text.Substring(0, 6); d = int.Parse(T_D.Text);
b=(2255-y).ToString()+(255-m).ToString()+(255-d).ToString(); y = int.Parse(T_Y.Text);
m = int.Parse(T_M.Text);
cdk.Text = a + b + CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(b), true); sn_id.Text = sn_id.Text.ToUpper();
if (sn_id.Text.Length < 6)//id字节长度大于6有效
{
sn_id.BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 0, 0));
return;
}
else
{
sn_id.BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255));
}
a= sn_id.Text.Substring(5, 1)+ sn_id.Text.Substring(0, 1)+ sn_id.Text.Substring(4, 1) + sn_id.Text.Substring(1, 1) + sn_id.Text.Substring(3, 1)+ sn_id.Text.Substring(2, 1);
my = Convert.ToString(Convert.ToInt32(2255 - y), 16).ToUpper();
mm = Convert.ToString(Convert.ToInt32(255 - m), 16).ToUpper();
md = Convert.ToString(Convert.ToInt32(255 - d), 16).ToUpper();
b=my+mm+md;
cdk.Text = a + b + CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(a+b), true);
} }
} }
+7 -1
View File
@@ -33,6 +33,9 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<ApplicationIcon>sunlight_logo.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
@@ -66,7 +69,7 @@
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="UserClass\CRCcheck16.cs" /> <Compile Include="CRCcheck16.cs" />
<Compile Include="Properties\Resources.Designer.cs"> <Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
@@ -86,5 +89,8 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="sunlight_logo.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB