using System; using System.Collections.Generic; using System.Text; namespace LYFZ.WinAPI { public class KeyMethodReturnValues { public KeyMethodReturnValues() { } /// /// 设置授权码 /// /// public bool SetGrantNumberValue(string grantNumber) { try { this.D1 = 888888888; this.S2 = grantNumber.Substring(0, 49); this.S3 = grantNumber.Substring(49, 49); this.S4 = grantNumber.Substring(98, 49); this.S5 = grantNumber.Substring(147, 49); this.S6 = grantNumber.Substring(196, 49); this.S7 = grantNumber.Substring(245); return true; } catch { return false; } } /// /// 设置初始值 /// /// public bool SetInitialValue(string valueSring) { this.D1 = 999999999; try { string[] values = valueSring.Split('&'); this.S2 = values[0]; this.S5 = values[1]; this.S6 = values[2]; this.D2 = Convert.ToInt32(values[3]); this.D3 = Convert.ToInt32(values[4]); this.D4 = Convert.ToInt32(values[5]); return true; } catch {return false; } } /// /// 设置UpdateSeat /// /// public bool SetUpdateSeatValue(string valueSring) { try { string[] SeatCountGrantNumber = LYFZ.WinAPI.SDKSecurity.Decode16Hex(valueSring.Trim().Substring(256)).Split('|'); this.D4 = Convert.ToInt32(SeatCountGrantNumber[0]); this.S7 = SeatCountGrantNumber[1]; return true; } catch { return false; } } /// /// 设置时间初始值 /// /// public bool SetTimeRegisterValue(string valueSring) { try { this.S5 = valueSring.Substring(0, 16) + valueSring.Substring(56, 16); this.S6 = valueSring.Substring(16, 40); this.S7 = valueSring.Substring(72, 40); this.S2 = valueSring.Substring(112); if (LYFZ.WinAPI.SDKSecurity.Checking16(this.S2)) { this.S2 = LYFZ.WinAPI.SDKSecurity.Decode16Hex(this.S2); try { string[] tempTimes = this.S2.Split(' '); string[] Year_Month_Day = tempTimes[0].Split('-'); string[] Hour_Minuts = tempTimes[1].Split(':'); int _Year = Convert.ToInt32(Year_Month_Day[0]); int _Month = Convert.ToInt32(Year_Month_Day[1]); int _Day = Convert.ToInt32(Year_Month_Day[2]); int _Hour = Convert.ToInt32(Hour_Minuts[0]); int _Minuts = 0; try { _Minuts = Convert.ToInt32(Hour_Minuts[1]); } catch { } } catch { return false; } } else { return false; } return true; } catch { return false; } } int _D0 = 0; int _D1 = 0; int _D2 = 0; int _D3 = 0; int _D4 = 0; int _D5 = 0; int _D6 = 0; int _D7 = 0; double _F0 = 0; double _F1 = 0; double _F2 = 0; double _F3 = 0; double _F4 = 0; double _F5 = 0; double _F6 = 0; double _F7 = 0; string _S0 = ""; string _S1 = ""; string _S2 = ""; string _S3 = ""; string _S4 = ""; string _S5 = ""; string _S6 = ""; string _S7 = ""; public int D0{ get { return _D0; }set { _D0 = value; }} public int D1 { get { return _D1; } set { _D1 = value; } } public int D2 { get { return _D2; } set { _D2 = value; } } public int D3 { get { return _D3; } set { _D3 = value; } } public int D4 { get { return _D4; } set { _D4 = value; } } public int D5 { get { return _D5; } set { _D5 = value; } } public int D6 { get { return _D6; } set { _D6 = value; } } public int D7 { get { if (_D7 == 0) { _D7 = 99999; }; return _D7; } set { _D7 = value; } } public double F0 { get { return _F0; } set { _F0 = value; } } public double F1 { get { return _F1; } set { _F1 = value; } } public double F2 { get { return _F2; } set { _F2 = value; } } public double F3 { get { return _F3; } set { _F3 = value; } } public double F4 { get { return _F4; } set { _F4 = value; } } public double F5 { get { return _F5; } set { _F5 = value; } } public double F6 { get { return _F6; } set { _F6 = value; } } public double F7 { get { return _F7; } set { _F7 = value; } } public string S0 { get { return _S0; } set { _S0 = value; } } public string S1 { get { return _S1; } set { _S1 = value; } } public string S2 { get { return _S2; } set { _S2 = value; } } public string S3 { get { return _S3; } set { _S3 = value; } } public string S4 { get { return _S4; } set { _S4 = value; } } public string S5 { get { return _S5; } set { _S5 = value; } } public string S6 { get { return _S6; } set { _S6 = value; } } public string S7 { get { return _S7; } set { _S7 = value; } } /// /// /// /// /// /// public static string GetStringBuilderToString(StringBuilder _fromString, int len) { string _string = ""; try { int EffectiveLength = len - 1; if (_fromString.Capacity >= len && _fromString.Length >= EffectiveLength) { _string = _fromString.ToString().Substring(0, EffectiveLength).Trim().Replace("", ""); } else { _string = _fromString.ToString().Trim().Replace("", ""); } } catch { _string = _fromString.ToString().Trim().Replace("", ""); } return _string; } } }