注册码显示逻辑修改
This commit is contained in:
commit
85bcc41e58
3 files changed
+64
-46
No files matched your search
+5
-5
@@ -45,7 +45,7 @@ namespace formula_manage
|
||||
}
|
||||
|
||||
string Log_time = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
string logpath = System.Environment.CurrentDirectory + "\\Log\\ERR";//日志文件目录
|
||||
string logpath = System.Environment.CurrentDirectory + "\\ERR";//日志文件目录
|
||||
//string logPathtxt = "" + System.Environment.CurrentDirectory + "\\Log\\"+ Log_time + "Log.txt";//日志文件
|
||||
|
||||
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
||||
@@ -74,13 +74,13 @@ namespace formula_manage
|
||||
System.IO.DirectoryInfo log = new System.IO.DirectoryInfo(@logpath);//生成日志文件目录
|
||||
string log_path = logpath +"\\ERR" +Log_time + ".txt";
|
||||
string Log_timehms = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
if (!File.Exists(log_path))//检查日志文件并写入启动日志
|
||||
if (!File.Exists(log_path))//检查文件并写入
|
||||
{
|
||||
FileStream fs = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建写入文件
|
||||
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||
wr.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
|
||||
wr.WriteLine("[" + Log_timehms + "];[Error source] ||" + e.Exception.Source.ToString() + Environment.NewLine.ToString());
|
||||
wr.WriteLine("[" + Log_timehms + "];[Error message] ||" + e.Exception.Message.ToString() + Environment.NewLine.ToString());
|
||||
wr.WriteLine("[" + Log_timehms + "];[Detailed] ||" + e.Exception.Message.ToString() + Environment.NewLine.ToString());
|
||||
wr.WriteLine("[" + Log_timehms + "];[Error area] ||" + e.Exception.StackTrace.ToString());
|
||||
wr.Close();
|
||||
}
|
||||
@@ -88,9 +88,9 @@ namespace formula_manage
|
||||
{
|
||||
FileStream fs = new FileStream(log_path, FileMode.Append, FileAccess.Write);//创建写入文件
|
||||
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||
wr.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
|
||||
wr.WriteLine("[" + Log_timehms + "];[Error source] ||" + e.Exception.Source.ToString() + Environment.NewLine.ToString());
|
||||
wr.WriteLine("[" + Log_timehms + "];[Error message] ||" + e.Exception.Message.ToString() + Environment.NewLine.ToString());
|
||||
wr.WriteLine("[" + Log_timehms + "];[Detailed] ||" + e.Exception.Message.ToString() + Environment.NewLine.ToString());
|
||||
wr.WriteLine("[" + Log_timehms + "];[Error message] ||" + e.Exception.Message.ToString() + Environment.NewLine.ToString());
|
||||
wr.WriteLine("[" + Log_timehms + "];[Error area] ||" + e.Exception.StackTrace.ToString());
|
||||
wr.Close();
|
||||
}
|
||||
|
||||
+26
-32
@@ -17,7 +17,7 @@ namespace formula_manage.UserClass
|
||||
{
|
||||
public class TCPServer
|
||||
{
|
||||
|
||||
public static string infoR;
|
||||
//第一步:调用socket()函数创建一个用于通信的套接字
|
||||
public static Socket listenSocket;
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace formula_manage.UserClass
|
||||
get { return DateTime.Now.ToString("HH:mm:ss") + Environment.NewLine; }
|
||||
}
|
||||
|
||||
//编码格式
|
||||
Encoding econding = Encoding.Default;
|
||||
//编码格式
|
||||
public static Encoding econding = Encoding.Default;
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
@@ -81,9 +81,9 @@ namespace formula_manage.UserClass
|
||||
/// </summary>
|
||||
/// <param name="clientSocket"></param>
|
||||
public static void ReceiveMsg(Socket clientSocket)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
//定义一个2M的缓冲区
|
||||
byte[] buffer = new byte[1024 * 1024 * 2];
|
||||
|
||||
@@ -118,14 +118,16 @@ namespace formula_manage.UserClass
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// if (length > 0)
|
||||
// {
|
||||
// string info = econding.GetString(buffer, 0, length);
|
||||
// ShowMessage(info);
|
||||
// }
|
||||
}
|
||||
if (length > 0)
|
||||
{
|
||||
infoR = econding.GetString(buffer, 0, length);
|
||||
//ShowMessage(info);
|
||||
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||
Bn_Send(ip, infoR+"return");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
/// <summary>
|
||||
/// 在线列表更新
|
||||
@@ -162,32 +164,24 @@ namespace formula_manage.UserClass
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
/// <summary>
|
||||
/// 消息发送
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btn_Send_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.lst_Online.SelectedItem != null)
|
||||
{
|
||||
foreach (string item in this.lst_Online.SelectedItems)
|
||||
{
|
||||
if (OnLineList.ContainsKey(item))
|
||||
{
|
||||
OnLineList[item].Send(econding.GetBytes(this.txt_Send.Text.Trim()));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("请先选择要发送的对象", "发送消息");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void Bn_Send(string IP ,string DAT)
|
||||
{
|
||||
|
||||
if (OnLineList.ContainsKey(IP))
|
||||
{
|
||||
OnLineList[IP].Send(econding.GetBytes(DAT));
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
/// <summary>
|
||||
/// 群发功能
|
||||
/// </summary>
|
||||
|
||||
+33
-9
@@ -41,16 +41,34 @@ namespace formula_manage.Windows
|
||||
private void Window_CDKEY(object sender, RoutedEventArgs e) //打开页面
|
||||
{
|
||||
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
||||
cdk.Text = Configini.IniReadvalue("SN", "SN1"); //读配置文件
|
||||
string cdk = Configini.IniReadvalue("SN", "SN1"); //读配置文件
|
||||
|
||||
try
|
||||
{
|
||||
string Y = (2255 - StrToInt.To16Convert10(cdk.Text.Substring(6, 2))).ToString();
|
||||
string M = (255 - StrToInt.To16Convert10(cdk.Text.Substring(8, 2))).ToString();
|
||||
string D = (255 - StrToInt.To16Convert10(cdk.Text.Substring(10, 2))).ToString();
|
||||
sn_time.Text = "注册有效时间: " + Y + "-" + M + "-" + D;
|
||||
if (cdk.Length == 16)
|
||||
{
|
||||
if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(cdk.Substring(0, 12)), true) == cdk.Substring(12, 4)) //校验key的crc校验值
|
||||
{
|
||||
try
|
||||
{
|
||||
string Y = (2255 - StrToInt.To16Convert10(cdk.Substring(6, 2))).ToString();
|
||||
string M = (255 - StrToInt.To16Convert10(cdk.Substring(8, 2))).ToString();
|
||||
string D = (255 - StrToInt.To16Convert10(cdk.Substring(10, 2))).ToString();
|
||||
sn_time.Text = "注册有效时间: " + Y + "-" + M + "-" + D;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
sn_time.Text = "注册有效时间: --------";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sn_time.Text = "注册有效时间: --------";
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { }
|
||||
else
|
||||
{
|
||||
sn_time.Text = "注册有效时间: --------";
|
||||
}
|
||||
|
||||
// 获取CPU序列号
|
||||
cpuSerialNumber = HardwareSN.GetCPUSerialNumber();
|
||||
// 获取主板序列号
|
||||
@@ -68,7 +86,13 @@ namespace formula_manage.Windows
|
||||
string id_1;
|
||||
id_1 = 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);
|
||||
|
||||
if ((id_1 == cdk.Text.Substring(0, 6)) && (cdk.Text.Length == 16))
|
||||
if(cdk.Text.Length != 16)
|
||||
{
|
||||
System.Windows.MessageBox.Show("CDKEY: 无效注册码", "ERR", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (id_1 == cdk.Text.Substring(0, 6))
|
||||
{
|
||||
if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(cdk.Text.Substring(0, 12)), true) == cdk.Text.Substring(12, 4)) //校验key的crc校验值
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user