static void CreateDiscardList(string Argument, List<Argument> ArgList, List<Search.Result> Results) { string Dir = "discard"; bool RiichiLimit = false; bool NakiHL = false; bool TsumogiriHL = false; bool ShowHand = false; // Parse options foreach (Argument A in ArgList) { switch (A.Name) { case "tileset": Paifu.PaifuTileImage.TilesDirectory = A.Value; break; case "dir": Dir = A.Value; if (!Directory.Exists(Dir)) Directory.CreateDirectory(Dir); break; case "riichi": RiichiLimit = true; break; case "naki": NakiHL = true; break; case "tsumogiri": TsumogiriHL = true; break; case "hand": ShowHand = true; break; default: break; } } for (int i = 0; i < Results.Count; i++) { Search.Result R = Results[i]; Console.Title = String.Format("Discard creating {0:d}/{1:d}", i + 1, Results.Count); for (int r = 0; r < R.Replay.Rounds.Count; r++) { Mahjong.Round Rnd = R.Replay.Rounds[r]; if (!R.RoundMark[r]) continue; for (int p = 0; p < R.Replay.PlayerCount; p++) { if (!R.HandMark[r][p]) continue; Discarder.Discard D = new Discarder.Discard(R.Replay, r, p); string FileName = String.Format("./{0:s}/{1:s}_{2:d}_{3:d}.png", Dir, R.Replay.Hash, r, p); string HandFileName = String.Format("./{0:s}/{1:s}_{2:d}_{3:d}_hand.png", Dir, R.Replay.Hash, r, p); D.RiichiLimit = RiichiLimit; D.HighlightNaki = NakiHL; D.HighlightTsumogiri = TsumogiriHL; D.Generate(); D.Save(FileName); if (ShowHand) { Discarder.HandOutput HO = new Discarder.HandOutput(R.Replay, r, p); HO.Generate(); HO.Save(HandFileName); } } } } }
static void CreateDiscard(string Hash, List<Argument> ArgList, List<Search.Result> Results) { int Round = -1; int Player = -1; bool RiichiLimit = false; bool NakiHL = false; bool TsumogiriHL = false; bool ShowHand = false; string FN = null; string Dir = "discard"; if (Hash.CompareTo("") == 0) { Console.WriteLine("Error: Hash not defined."); return; } Hash = new Tenhou.TenhouHash(Hash).DecodedHash; // Parse options foreach (Argument A in ArgList) { switch (A.Name) { case "tileset": Paifu.PaifuTileImage.TilesDirectory = A.Value; break; case "dir": Dir = A.Value; break; case "round": Round = Convert.ToInt32(A.Value); break; case "player": Player = Convert.ToInt32(A.Value); break; case "filename": FN = A.Value; break; case "riichi": RiichiLimit = true; break; case "naki": NakiHL = true; break; case "tsumogiri": TsumogiriHL = true; break; case "hand": ShowHand = true; break; default: break; } } Mahjong.Replay R = new Mahjong.Replay(); R.LoadXml(Hash); for (int i = 0; i < R.Rounds.Count; i++) { if ((Round != -1) && (Round != i)) continue; for (int p = 0; p < R.PlayerCount; p++) { if ((Player != -1) && (Player != p)) continue; Discarder.Discard D = new Discarder.Discard(R, i, p); string FileName, HandFileName; if (FN == null) { if (!Directory.Exists(Dir)) Directory.CreateDirectory(Dir); FileName = String.Format("./{0:s}/{1:s}_{2:d}_{3:d}.png", Dir, Hash, Round, p); HandFileName = String.Format("./{0:s}/{1:s}_{2:d}_{3:d}_hand.png", Dir, Hash, Round, p); } else { FileName = (Round == -1) ? String.Format("{0:s}_{1:d}_{2:d}.png", FN, i, p) : String.Format("{0:s}.png", FN); HandFileName = (Round == -1) ? String.Format("{0:s}_{1:d}_{2:d}_hand.png", FN, i, p) : String.Format("{0:s}_hand.png", FN); } D.RiichiLimit = RiichiLimit; D.HighlightNaki = NakiHL; D.HighlightTsumogiri = TsumogiriHL; D.Generate(); D.Save(FileName); if (ShowHand) { Discarder.HandOutput HO = new Discarder.HandOutput(R, i, p); HO.Generate(); HO.Save(HandFileName); } } } }