FrmBase.cs
2.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.ACPackingStore
{
public partial class FrmBase : Form
{
internal static string GetVersion(bool isShow=false)
{
string str = "";
string version = "";
DateTime newData = DateTime.Parse("2000-01-01");
try
{
System.Reflection.AssemblyName assemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName();
version = assemblyName.Version.ToString();
string[] strArray = version.Split('.');
if (strArray.Length.Equals(4))
{
int days = Convert.ToInt32(strArray[2]);
int seconds = Convert.ToInt32(strArray[3]);
DateTime d1 = DateTime.Parse("2000-01-01");
newData = d1.AddDays(days);
newData = newData.AddSeconds(seconds * 2);
str = newData.ToString("yyyy-MM-dd HH:mm");
}
}
catch (Exception ex)
{
str = version;
LogUtil.error("解析版本号【" + str + "】出错:" + ex.ToString());
}
if (isShow)
{
LogUtil.info("版本号[" + version + "][" + str + "][" + GetCodeNum() + "]");
}
return str;
}
internal static string GetCodeNum(string codeName = "RC1250-ACPackingStore")
{
byte[] byteArray = System.Text.Encoding.ASCII.GetBytes(codeName);
string result = "";
result = AcSerialBean.ByteToString(byteArray);
return result;
}
public FrmBase()
{
InitializeComponent();
//skinEngine1.SkinAllForm = false;
}
}
}