public void CreateAddress() { var lob = new Lob(Settings.Default.LobTestApiKey); var newAddress = lob.Addresses.Create(address1); Assert.AreEqual(address1.name, (string)newAddress.name, "name of newly created address does not match"); Assert.AreEqual(address1.address_line1, (string)newAddress.address_line1, "address_line1 of newly created address does not match"); }
public bool MergeLOB(string listLob, int lOperation) { if (lOperation != addLobOperation && lOperation != deleteLobOperation) { return(false); } bool bUpdateNeeded = false; var dicLob = new SortedDictionary <string, string>(); string[] myList = Lob.Split(DecodeLobCharacter, StringSplitOptions.RemoveEmptyEntries); foreach (string strLob in myList) { dicLob[strLob.Trim()] = strLob.Trim(); } myList = listLob.Split(DecodeLobCharacter, StringSplitOptions.RemoveEmptyEntries); foreach (string strLob in myList) { string strLobTrimmed = strLob.Trim(); if (!_validLobs.Any(validLob => string.Compare(validLob, strLobTrimmed, true) == 0)) { continue; // Do not add undesired LOBs } if (lOperation == addLobOperation) { dicLob[strLobTrimmed] = strLobTrimmed; } else { dicLob.Remove(strLobTrimmed); } } // NOTE: NOT CHECKING FOR EMPTY LOB LIST StringBuilder sbLob = new StringBuilder(255); foreach (KeyValuePair <string, string> valuePair in dicLob) { sbLob.AppendFormat("{0} ;", valuePair.Key); } // Now check if LOB has changed. if (Lob.CompareTo(sbLob.ToString()) != 0) { bUpdateNeeded = true; Lob = sbLob.ToString(); // Also update the Upload_key string[] strUpload_key = UploadKey.Split("/".ToCharArray(), StringSplitOptions.None); strUpload_key[5] = sbLob.ToString(); UploadKey = string.Join("/", strUpload_key); } return(bUpdateNeeded); }
private DataReader DecodeFile(DataReader reader, FileType containerType, int fileNumber) { var header = reader.Size < 4 ? 0 : reader.PeekDword(); var fileType = ((header & 0xffff0000) == (uint)FileType.JH) ? FileType.JH : (FileType)header; if (fileType == FileType.JH) { reader.Position += 4; // skip header reader = new DataReader(JH.Crypt(reader, (ushort)(((header & 0xffff0000u) >> 16) ^ (header & 0x0000ffffu)))); } else if (containerType == FileType.AMNC) // AMNC archives are always encoded { reader = new DataReader(JH.Crypt(reader, (ushort)fileNumber)); } header = reader.Size < 4 ? 0 : reader.PeekDword(); // Note: The header might have changed above. fileType = (FileType)header; // Note: No need to check for JH here as this can not happen. // See if it is a LOB file if (fileType == FileType.LOB || fileType == FileType.VOL1) { reader.Position += 4; // skip header uint decodedSize = reader.PeekDword() & 0x00ffffff; // the first byte would contain the offset for the size entry (= 6) // AMNP archives are always encoded if (containerType == FileType.AMNP) { reader.Position += 4; // skip decoded size reader = new DataReader(JH.Crypt(reader, (ushort)fileNumber)); reader.Position += 4; // skip encoded size } else { reader.Position += 8; // skip decoded and encoded size } return(Lob.Decompress(reader, decodedSize)); } else { // AMNP archives are always encoded if (containerType == FileType.AMNP) { // ensure and skip the header (should be FileType.None here) if (reader.ReadDword() != (uint)FileType.None) { throw new AmbermoonException(ExceptionScope.Data, "Invalid AMNP file data."); } reader = new DataReader(JH.Crypt(reader, (ushort)fileNumber)); } return(reader); } }
public Resource(Lob lob) { this.lob = lob; this.client.BaseAddress = new Uri(BaseUrl); // Set default request headers this.client.DefaultRequestHeaders.Clear(); this.client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Format("{0}:{1}", this.lob.ApiKey, ""))); this.client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", credentials); this.client.DefaultRequestHeaders.UserAgent.ParseAdd("Lob/v1 C#Bindings/" + this.lob.ClientVersion); this.client.DefaultRequestHeaders.Add("Lob-Version", this.lob.Version); }
/// <summary> /// /// </summary> /// <param name="record"></param> public bool MergeLOB(SpecificDestinationActiveRecord record) { bool bUpdateNeeded = false; var dicLob = new SortedDictionary <string, string>(); string[] myList = Lob.Split(DecodeLobCharacter, StringSplitOptions.RemoveEmptyEntries); foreach (string strLob in myList) { dicLob[strLob.Trim()] = strLob.Trim(); } myList = record.Lob.Split(DecodeLobCharacter, StringSplitOptions.RemoveEmptyEntries); foreach (string strLob in myList) { dicLob[strLob.Trim()] = strLob.Trim(); } StringBuilder sbLob = new StringBuilder(255); foreach (KeyValuePair <string, string> valuePair in dicLob) { sbLob.AppendFormat("{0} ;", valuePair.Key); } // Now check if LOB has changed. if (Lob.CompareTo(sbLob.ToString()) != 0) { bUpdateNeeded = true; Lob = sbLob.ToString(); // Also update the Upload_key string[] strUpload_key = UploadKey.Split("/".ToCharArray(), StringSplitOptions.None); strUpload_key[5] = sbLob.ToString(); UploadKey = string.Join("/", strUpload_key); } return(bUpdateNeeded); }
public LobService(string apiKey) { this.lobClient = new Lob(apiKey); }
public Addresses(Lob lob) : base(lob) { }
public Postcards(Lob lob) : base(lob) { }
public Checks(Lob lob) : base(lob) { }
public Letters(Lob lob) : base(lob) { }
public Countries(Lob lob) : base(lob) { }
public Routes(Lob lob) : base(lob) { }
public void InitializeTests() { this.db = MockDbContext.GetContext(); this.mapper = MockAutoMapper.GetMapper(); this.service = new Lob(this.db); }
public void Update() { if (selecting) { if ((Input.GetButtonDown("Up") || Input.GetButtonDown("Left")) && selIndex > 0) { selIndex--; } if ((Input.GetButtonDown("Down") || Input.GetButtonDown("Right")) && selIndex < options.Length - 1) { selIndex++; } if (Input.GetButtonDown("Select")) { string result = options[selIndex]; if (result != "Skill") { CharAction caction = null; if (result == "Move") { caction = new Move(dchar) as CharAction; } if (result == "Lift") { caction = new Lift(dchar) as CharAction; } if (result == "Attack") { caction = new Attack(dchar) as CharAction; } if (result == "Lob") { caction = new Lob(dchar) as CharAction; } if (result == "Whirlwind") { caction = new Whirlwind(dchar) as CharAction; } if (result == "Inferno") { caction = new Inferno(dchar) as CharAction; } if (result == "Exit") { Application.Quit(); } selecting = false; Camera.mainCamera.audio.PlayOneShot(Resources.Load("audio/se/select") as AudioClip); StartCoroutine(YieldReturn(caction)); } } if (Input.GetButtonDown("Cancel")) { selecting = false; Camera.mainCamera.audio.PlayOneShot(Resources.Load("audio/se/cancel") as AudioClip); cfunc(); } } }
public States(Lob lob) : base(lob) { }
public Areas(Lob lob) : base(lob) { }
public void GetLobs_WithFewLobs_ShouldReturnAll() { this.db.TblLob.Add(new tbl_Lob() { IdLob = 1, Lob = "Lob1", MmcpLob = "MmcpLob", MmcpSegment = "MmcpSegment", ProductLine1 = "ProductLine1", ProductLine2 = "ProductLine2", ProductLine3 = "ProductLine3", SpphIdProduct = 1234 }); this.db.TblLob.Add(new tbl_Lob() { IdLob = 2, Lob = "Lob2", MmcpLob = "MmcpLob", MmcpSegment = "MmcpSegment", ProductLine1 = "ProductLine1", ProductLine2 = "ProductLine2", ProductLine3 = "ProductLine3", SpphIdProduct = 1234 }); this.db.TblLob.Add(new tbl_Lob() { IdLob = 3, Lob = "Lob3", MmcpLob = "MmcpLob", MmcpSegment = "MmcpSegment", ProductLine1 = "ProductLine1", ProductLine2 = "ProductLine2", ProductLine3 = "ProductLine3", SpphIdProduct = 1234 }); this.db.TblLob.Add(new tbl_Lob() { IdLob = 4, Lob = "Lob4", MmcpLob = "MmcpLob", MmcpSegment = "MmcpSegment", ProductLine1 = "ProductLine1", ProductLine2 = "ProductLine2", ProductLine3 = "ProductLine3", SpphIdProduct = 1234 }); this.db.SaveChanges(); var service = new Lob(this.db); var allLobs = service.All(); Assert.IsNotNull(allLobs); Assert.AreEqual(4, allLobs.Count()); CollectionAssert.AreEqual(new[] { 1, 2, 3, 4 }, allLobs.Select(l => l.IdLob).ToArray()); }
public void OnLob(Lob lob) { Currency?.Commit(lob.Amount).AndSave(); }
public BankAccounts(Lob lob) : base(lob) { }