/// <summary> /// Returns a file containing the exported identity information /// Encoding is iso-8859-1 /// </summary> /// <param name="items"></param> /// <returns></returns> private byte[] GetIdentityCsv(List <ExportItem> items) { StringBuilder builder = new StringBuilder(); builder.AppendLine("title,firstName,middleName,lastName,address1,address2,address3,city,state,postalCode,country,company,email,phone,ssn,username,passportNumber,licenseNumber"); foreach (ExportItem item in items) { builder.AppendLine(CellBuilder.BuildCells( item.Object.Identity.Title, item.Object.Identity.FirstName, item.Object.Identity.MiddleName, item.Object.Identity.LastName, item.Object.Identity.Adress1, item.Object.Identity.Adress2, item.Object.Identity.Adress3, item.Object.Identity.City, item.Object.Identity.State, item.Object.Identity.PostalCode, item.Object.Identity.Country, item.Object.Identity.Company, item.Object.Identity.EMail, item.Object.Identity.Phone, item.Object.Identity.SSN, item.Object.Identity.Username, item.Object.Identity.PassportNumber, item.Object.Identity.LicenseNumber).Join(",")); } return(Encoding.GetEncoding("iso-8859-1").GetBytes(builder.ToString())); }
public void BuildEmptyCube() { CellBuilder builder = new CellBuilder(new GameMaster(0)); builder.BuildCells(new Form1(), new Panel()); int cells = 0; Assert.AreEqual(cells, builder.GameMaster.Cells.Count); }
/// <summary> /// Returns a file containing the exported secure notes /// Encoding is iso-8859-1 /// </summary> /// <param name="items"></param> /// <returns></returns> private byte[] GetSecureNoteCsv(List <ExportItem> items) { StringBuilder builder = new StringBuilder(); builder.AppendLine("title,note"); foreach (ExportItem item in items) { builder.AppendLine(CellBuilder.BuildCells( item.Object.Name, item.Object.Notes).Join(",")); } return(Encoding.GetEncoding("iso-8859-1").GetBytes(builder.ToString())); }
/// <summary> /// Returns a file that contains credit card information /// Encoding is iso-8859-1 /// </summary> /// <param name="items"></param> /// <returns></returns> private byte[] GetCardCsv(List <ExportItem> items) { StringBuilder builder = new StringBuilder(); builder.AppendLine("cardholderName,brand,number,expMonth,expYear,code"); foreach (ExportItem item in items) { builder.AppendLine(CellBuilder.BuildCells( item.Object.Card.CardholderName, item.Object.Card.Brand, item.Object.Card.Number, item.Object.Card.ExpiryMonth, item.Object.Card.ExpiryYear, item.Object.Card.Code).Join(",")); } return(Encoding.GetEncoding("iso-8859-1").GetBytes(builder.ToString())); }
static void Main(string[] args) { var rule = new Rule(); var builder = new CellBuilder(rule); var cells = builder.BuildCells( rowLength: 20, colLength: 20, percentOfLivingCells: 30); var grid = new Grid(cells); var writer = new StreamWriter(Console.OpenStandardOutput(), Encoding.ASCII); var drawer = new ConsoleDrawer(writer); while (!Console.KeyAvailable) { drawer.DrawCells(grid.Cells); grid.ToNextGen(); Thread.Sleep(200); } }
/// <summary> /// Returns a file that contains credit card information /// Encoding is iso-8859-1 /// </summary> /// <param name="items"></param> /// <returns></returns> private byte[] GetCardCsv(List <ExportItem> items) { StringBuilder builder = new StringBuilder(); builder.AppendLine("title,card number,expiry date (MM/YYYY),cardholder name,PIN,bank name,CVV,notes"); foreach (ExportItem item in items) { builder.AppendLine(CellBuilder.BuildCells( item.Object.Card.Brand, item.Object.Card.Number, new DateTime(int.Parse(item.Object.Card.ExpiryYear), int.Parse(item.Object.Card.ExpiryMonth), 1).ToString("MM/yyyy"), item.Object.Card.CardholderName, item.Object.Card.Code, string.Empty, string.Empty, item.Object.Notes).Join(",")); } return(Encoding.GetEncoding("iso-8859-1").GetBytes(builder.ToString())); }
/// <summary> /// Returns a file containing login information /// Encoding is iso-8859-1 /// </summary> /// <param name="items"></param> /// <returns></returns> private byte[] GetLoginCsv(List <ExportItem> items) { StringBuilder builder = new StringBuilder(); builder.AppendLine("folder,favorite,type,name,notes,fields,login_uri,login_username,login_password,login_totp"); foreach (ExportItem item in items) { builder.AppendLine(CellBuilder.BuildCells( item.Folder?.Name, item.Object.IsFavorite ? 1 : 0, item.Object.Type.ToString(), item.Object.Name, item.Object.Notes, item.Object.Fields?.Select(x => $"{x.Name}: {x.Value}").Join("; "), item.Object.Login?.Uris?.Select(x => x.Uri).Join(";"), item.Object.Login?.Username, item.Object.Login?.Password, item.Object.Login?.Totp).Join(",")); } return(Encoding.GetEncoding("iso-8859-1").GetBytes(builder.ToString())); }
/// <summary> /// Returns a file containing login information /// Encoding is iso-8859-1 /// </summary> /// <param name="items"></param> /// <returns></returns> private byte[] GetLoginCsv(List <ExportItem> items) { StringBuilder builder = new StringBuilder(); builder.AppendLine("title,website,username,password,notes"); foreach (ExportItem item in items) { List <string> lstCells = new List <string>() { item.Object.Name, item.Object.Login?.Uris?.Select(x => x.Uri).Join(";"), item.Object.Login?.Username, item.Object.Login?.Password, item.Object.Notes }; lstCells.AddRangeIfNotNull(item.Object.Fields?.Select(x => $"{x.Name}:{x.Value}")); builder.AppendLine(CellBuilder.BuildCells(lstCells.ToArray()).Join(",")); } return(Encoding.GetEncoding("iso-8859-1").GetBytes(builder.ToString())); }