public SetPlayerTierRule(TierRulesData trd) { m_id = 18208; TierRuleID = trd.TierRulesID; DefaultTierID = trd.DefaultTierID; DownToDefault = trd.DowngradeToDefault; QualifyingStartDate = trd.QualifyingStartDate; QualifyingEndDate = trd.QualifyingEndDate; }
protected override void UnpackResponse() { base.UnpackResponse(); ushort stringLen; MemoryStream responseStream = new MemoryStream(m_responsePayload); BinaryReader responseReader = new BinaryReader(responseStream, Encoding.Unicode); if (responseStream.Length < MinResponseMessageLenght) { throw new MessageWrongSizeException("Get Player Tier Rules"); } try { responseReader.BaseStream.Seek(sizeof(int), SeekOrigin.Begin); //Maybe this is the return code TierRulesData code = new TierRulesData(); code.TierRulesID = responseReader.ReadInt32(); //0 code.DefaultTierID = responseReader.ReadInt32(); //0 code.DowngradeToDefault = responseReader.ReadBoolean(); //false ? stringLen = responseReader.ReadUInt16(); string tempDate = new string(responseReader.ReadChars(stringLen)); //"" 1/1/0001 12:00:00AM if (!string.IsNullOrEmpty(tempDate)) { code.QualifyingStartDate = DateTime.Parse(tempDate, CultureInfo.InvariantCulture); } //If its NULL it will set to 1/1/0001 12:00:00 AM automatically stringLen = responseReader.ReadUInt16(); tempDate = new string(responseReader.ReadChars(stringLen)); if (!string.IsNullOrEmpty(tempDate)) { code.QualifyingEndDate = DateTime.Parse(tempDate, CultureInfo.InvariantCulture); } GetPlayerTierRulesData.getPlayerTierRulesData = code; //save it here } catch (EndOfStreamException e) { throw new MessageWrongSizeException("Get Player Tier Rules", e); } catch (Exception e) { throw new ServerException("Get Player Tier Rules", e); } responseReader.Close(); }
public static int Save(TierRulesData trd) { SetPlayerTierRule msg = new SetPlayerTierRule(trd); try { msg.Send(); } catch (ServerCommException ex) { throw new Exception("SetPlayerTierRule: " + ex.Message); } return(msg.TierRuleID); }
public GetPlayerTierRulesDatam() { m_id = 18207; tierRulesData = new TierRulesData(); }