private void LoadCategoriesFromSheet(CategoryCollection categories, CSVSheet sheet) { categories.Clear(); for (int x = 0; x < sheet.Columns; x++) { string category = sheet[x, 0]; if (String.IsNullOrEmpty(category)) continue; for (int y = 1; y < sheet.Rows; y++) if (!String.IsNullOrEmpty(sheet[x, y])) categories.AddCard(category, sheet[x, y]); } }
private CSVSheet SaveCategoriesToSheet(CategoryCollection categories) { CSVSheet sheet = new CSVSheet(); for (int x = 0; x < categories.Count; x++) { sheet[x, 0] = categories[x].Name; for (int y = 0; y < categories[x].Cards.Count; y++) sheet[x, y + 1] = categories[x].Cards[y]; } return sheet; }