private void OnClickLogin(string arg1, string arg2) { Msg msg = CreateProcedureEnter("QFrameWork.Demo.HallProcedure"); msg.Add("account", arg1); msg.Add("password", arg2); ChangeProcedure(msg); ChangeProcedure(CreateProcedureLeave("QFrameWork.Demo.LoginProcedure")); }
public List <string> ValidarTipo(Archivo request) { //TODO: Completar malidaciones Msg.Add("El Tipo ingresado no es el correcto"); return(Msg); }
private void SetNewDatabaseFilename(string dbfullname) { this.dbdatafullname = dbfullname; if (!File.Exists(dbfullname)) { Error = true; Msg.Add(dbfullname + "数据库不存在,请重新选择"); return; } if (db != null) { db.connClose(); db = null; } db = new Db.ConnDb(dbfullname); }
private void Read(PTP ptp, Encoding newEncoding) { foreach (var a in ptp.Names) { Name.Add(new BMDName(a.Index, a.NewName.GetTextBases(newEncoding).GetByteArray())); } foreach (var a in ptp.Msg) { Msg.Add(new BMDMSG { Index = a.Index, Name = a.Name, Type = a.Type, NameIndex = a.CharacterIndex, MsgStrings = a.Strings.Select(x => x.GetNew(newEncoding)).ToArray() }); } }
public bool Open(PTP PTP, Encoding New) { Name.Clear(); Msg.Clear(); foreach (var a in PTP.names) { Name.Add(new Names(a.Index, a.NewName.GetTextBaseList(New).GetByteArray().ToArray())); } foreach (var a in PTP.msg) { int Index = a.Index; string Name = a.Name; MSGs.MsgType Type = a.Type == "MSG" ? MSGs.MsgType.MSG : MSGs.MsgType.SEL; int CharacterIndex = a.CharacterIndex; byte[] MsgBytes = a.GetNew(New); Msg.Add(new MSGs(Index, Name, Type, CharacterIndex, MsgBytes.ToArray())); } return(true); }
private void Init() { Error = false; data = null; dt = null; db = null; ReadConfig(); try { SetNewDatabaseFilename(dbdatafullname); data = new Data(); InitUIdata(); db.connClose(); } catch (System.Data.OleDb.OleDbException ole) { if (db != null) { db.connClose(); } Msg.Add(ole.ToString()); Error = true; } }
private void Read(StreamPart streamPart) { streamPart.Stream.Position = streamPart.Position + 0x8; byte[] buffer = new byte[4]; streamPart.Stream.Read(buffer, 0, 4); IsLittleEndian = Encoding.ASCII.GetString(buffer) == "MSG1"; streamPart.Stream.Position = streamPart.Position; using (BinaryReader reader = IOTools.OpenReadFile(streamPart.Stream, IsLittleEndian)) { int MSG_Pointer_Start = 0x20; #region Header if (!reader.ReadBytes(4).SequenceEqual(new byte[] { 0x7, 0x0, 0x0, 0x0 })) { throw new Exception("BMD Read Error: (0x0) not 7"); } int BMD_Size = reader.ReadInt32(); reader.ReadInt32(); // MagicNumber if (reader.ReadInt32() != 0) { throw new Exception("BMD Read Error: (0x0C) not 0"); } reader.ReadInt32(); // Position of EndBlock int MSG_PointerBlock_Size = reader.ReadInt32(); int MSG_Count = reader.ReadInt32(); if (reader.ReadInt16() != 0) { throw new Exception("BMD Read Error: (0x1C) not 0"); } if (reader.ReadInt16() != 2) { throw new Exception("BMD Read Error: (0x1E) not 2"); } #endregion #region MSG/Name Pointer List <int[]> MSGPosition = new List <int[]>(); for (int i = 0; i < MSG_Count; i++) { int[] temp = new int[2]; temp[0] = reader.ReadInt32(); temp[1] = reader.ReadInt32(); MSGPosition.Add(temp); } int Name_Block_Position = reader.ReadInt32(); int Name_Count = reader.ReadInt32(); #endregion reader.BaseStream.Position = Name_Block_Position + MSG_Pointer_Start; List <int> NamePosition = new List <int>(); for (int i = 0; i < Name_Count; i++) { NamePosition.Add(reader.ReadInt32()); } for (int i = 0; i < NamePosition.Count; i++) { reader.BaseStream.Position = NamePosition[i] + MSG_Pointer_Start; List <byte> Bytes = new List <byte>(30); byte Byte = reader.ReadByte(); while (Byte != 0) { Bytes.Add(Byte); Byte = reader.ReadByte(); } Name.Add(new BMDName(i, Bytes.ToArray())); } for (int i = 0; i < MSGPosition.Count; i++) { reader.BaseStream.Position = MSG_Pointer_Start + MSGPosition[i][1]; Msg.Add(new BMDMSG(reader, i, MSGPosition[i][0])); } } }
private static void Getres(object entityObject) { if (entityObject == null) { return; } Type type = entityObject.GetType(); if (type.IsGenericType && type.Name.Contains("List")) { IEnumerable <object> d = entityObject as IEnumerable <object>; if (d != null) { foreach (var item in d) { Getres(item); } } } else { PropertyInfo[] properties = type.GetProperties(); foreach (PropertyInfo property in properties) { //获取属性的值 object value = property.GetValue(entityObject, null); if (value != null && !value.GetType().IsValueType&& value.GetType() != typeof(string)) { Getres(value); } else { //获取验证特性 object[] validateContent = property.GetCustomAttributes(typeof(ValidateAttribute), true); if (validateContent != null) { string resErrorVali = string.Empty; string resVali = string.Empty; foreach (ValidateAttribute validateAttribute in validateContent) { if (!validateAttribute.ToValidate(value)) { if ((ErrorCode & Convert.ToInt32(validateAttribute.ErrorType)) <= 0) { ErrorCode = ErrorCode | Convert.ToInt32(validateAttribute.ErrorType); } var msg = validateAttribute.ErrorMessage; if (validateAttribute.Mode == EnumValidateMode.NotPass) { IsValidate = false; if (!string.IsNullOrEmpty(msg)) { resErrorVali += msg; } } else if (validateAttribute.Mode == EnumValidateMode.Pass) { if (!string.IsNullOrEmpty(msg)) { resVali += msg; } } } } if (!string.IsNullOrEmpty(resErrorVali)) { ErrorMsg.Add(type.Name + "-字段:" + property.Name + "," + resErrorVali); } if (!string.IsNullOrEmpty(resVali)) { Msg.Add(resVali); } } } } } }
private void ParseMSG1(BinaryReader BR) { try { byte[] buffer; int MSG_PointBlock_Pos = 0x20; BR.BaseStream.Position = 24; int MSG_count = BR.ReadInt32(); BR.BaseStream.Position = MSG_PointBlock_Pos; List <int[]> MSGPosition = new List <int[]>(); for (int i = 0; i < MSG_count; i++) { int[] temp = new int[2]; temp[0] = BR.ReadInt32(); temp[1] = BR.ReadInt32(); MSGPosition.Add(temp); } int Name_Block_Position = BR.ReadInt32(); int Name_Count = BR.ReadInt32(); BR.BaseStream.Position = Name_Block_Position + MSG_PointBlock_Pos; List <long> NamePosition = new List <long>(); for (int i = 0; i < Name_Count; i++) { NamePosition.Add(BR.ReadInt32()); } for (int i = 0; i < NamePosition.Count; i++) { BR.BaseStream.Position = NamePosition[i] + MSG_PointBlock_Pos; byte Byte = BR.ReadByte(); List <byte> Bytes = new List <byte>(); while (Byte != 0) { Bytes.Add(Byte); Byte = BR.ReadByte(); } Name.Add(new Names(i, Bytes.ToArray())); } for (int i = 0; i < MSGPosition.Count; i++) { BR.BaseStream.Position = MSG_PointBlock_Pos + MSGPosition[i][1]; buffer = BR.ReadBytes(24); string MSG_Name = System.Text.Encoding.Default.GetString(buffer).Trim('\0'); if (string.IsNullOrEmpty(MSG_Name)) { MSG_Name = "<EMPTY>"; } byte[] MSG_bytes = new byte[0]; MSGs.MsgType Type; int CharacterIndex = 0xFFFF; if (MSGPosition[i][0] == 0) { Type = MSGs.MsgType.MSG; int count = BR.ReadUInt16(); CharacterIndex = BR.ReadUInt16(); if (count > 0) { BR.BaseStream.Position = BR.BaseStream.Position + 4 * count; int size = BR.ReadInt32(); MSG_bytes = BR.ReadBytes(size); } } else if (MSGPosition[i][0] == 1) { Type = MSGs.MsgType.SEL; BR.BaseStream.Position += 2; int count = BR.ReadUInt16(); if (count > 0) { BR.BaseStream.Position += 4 * count + 4; int size = BR.ReadInt32(); MSG_bytes = BR.ReadBytes(size); } } else { Logging.Write("PersonaEditorLib", "Error: Unknown message type!"); return; } MSGs MSG = new MSGs(i, MSG_Name, Type, CharacterIndex, MSG_bytes); Msg.Add(MSG); } } catch (Exception e) { Logging.Write("PersonaEditorLib", "Error: Parse MSG1 error!"); Logging.Write("PersonaEditorLib", e); Name.Clear(); Msg.Clear(); } }