public static string Bulid(HttpContext context) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); try { using (ProduceBussiness db = new ProduceBussiness()) { BallInfo[] infos = db.GetAllBall(); foreach (BallInfo info in infos) { result.Add(Road.Flash.FlashUtils.CreateBallInfo(info)); } } value = true; message = "Success!"; } catch (Exception ex) { log.Error("BallList", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); //return result.ToString(false); return(csFunction.CreateCompressXml(context, result, "BallList", true)); }
private static bool LoadBall(Dictionary <int, BallInfo> balls, Dictionary <int, Tile> ballTile) { using (ProduceBussiness db = new ProduceBussiness()) { BallInfo[] ballInfos = db.GetAllBall(); foreach (BallInfo b in ballInfos) { if (!balls.ContainsKey(b.ID)) { balls.Add(b.ID, b); Tile shape = null; string file = string.Format("bomb\\{0}.bomb", b.ID); if (File.Exists(file)) { shape = new Tile(file, false); } if (shape != null) { ballTile.Add(b.ID, shape); } else { if (b.ID != 1 && b.ID != 2 && b.ID != 3) { if (log.IsErrorEnabled) { log.Error("Ball's file is not exist!"); } return(false); } } } } } if (!balls.ContainsKey(0)) { BallInfo temp = new BallInfo(); temp.ID = 0; temp.Power = 1; temp.Radii = 60; temp.Amount = 1; balls.Add(0, temp); } return(true); }
private static Dictionary <int, BallInfo> LoadFromDatabase() { Dictionary <int, BallInfo> list = new Dictionary <int, BallInfo>(); using (ProduceBussiness db = new ProduceBussiness()) { BallInfo[] ballInfos = db.GetAllBall(); foreach (BallInfo b in ballInfos) { if (!list.ContainsKey(b.ID)) { list.Add(b.ID, b); } } } return(list); }
private static Dictionary <int, BallInfo> LoadFromDatabase() { Dictionary <int, BallInfo> dictionary = new Dictionary <int, BallInfo>(); using (ProduceBussiness produceBussiness = new ProduceBussiness()) { BallInfo[] allBall = produceBussiness.GetAllBall(); BallInfo[] array = allBall; for (int i = 0; i < array.Length; i++) { BallInfo ballInfo = array[i]; if (!dictionary.ContainsKey(ballInfo.ID)) { dictionary.Add(ballInfo.ID, ballInfo); } } } return(dictionary); }
private static Dictionary <int, BallInfo> LoadFromDatabase() { Dictionary <int, BallInfo> list = new Dictionary <int, BallInfo>(); using (ProduceBussiness db = new ProduceBussiness()) { BallInfo[] ballInfos = db.GetAllBall(); BallInfo[] array = ballInfos; for (int i = 0; i < array.Length; i++) { BallInfo b = array[i]; if (!list.ContainsKey(b.ID)) { list.Add(b.ID, b); } } } return(list); }