protected void btnLoad_Click(object sender, EventArgs e) { if (FileUploadControl.HasFile) { try { string filename = Path.GetFileName(FileUploadControl.FileName); AllData ad = new AllData(); IFormatter formatter = new BinaryFormatter(); ad = (AllData)formatter.Deserialize(FileUploadControl.FileContent); foreach (var item in ad) { string sType = item.GetType().Name; if (sType == "StoneList") { sel = new StoneList(); foreach (var element in item as StoneList) { //Debug.Print(element.ToString()); sel.AddStone(element); } } else if (sType == "StockList") { skl = new StockList(); foreach (var element in item as StockList) { //Debug.Print(element.ToString()); skl.AddStock(element); } } else if (sType == "Scores") { sc = new Scores(); sc = item as Scores; } } RestoreGame(); } catch (Exception ex) { Debug.Print(ex.ToString()); } } }
private void StonesInOrder() { skl = new StockList(); //Stones set to stock on order for (int k = 0; k < 2; ++k) { for (int i = 0; i < 6; ++i) { for (int j = 0; j < 6; ++j) { Stock s = new Stock(k * 36 + (i) * 6 + j, sFruitName[i], cStoneColor[j]); skl.AddStock(s); } } } //// Debug Only //foreach (var stock in skl) //{ // Debug.Print("In Order: " + stock.ToString()); //} }