public override void Read(CGameCtnReplayRecord n, GameBoxReader r, GameBoxWriter unknownW) { var size = r.ReadInt32(); if (size > 0) { var trackGbx = r.ReadBytes(size); n.Challenge = Task.Run(() => { using (var ms = new MemoryStream(trackGbx)) return(GameBox.Parse <CGameCtnChallenge>(ms)); }); n.Challenge.ContinueWith(x => { #if DEBUG if (x.IsFaulted) { var e = x.Exception.InnerException; Debug.WriteLine(e.Message); Debug.WriteLine(e.StackTrace); } #endif }); } }
internal static GameBox <CGameCtnChallenge> LoadGBX(string fileName, out TimeSpan?time) { time = null; Log.Write("Validating the GBX..."); Log.Write(); bool isMap = false; using (var fs = File.OpenRead(fileName)) isMap = GameBox.ReadNodeType(fs) == typeof(GameBox <CGameCtnChallenge>); Log.Write(); if (!isMap) { Log.Write("Not a map GBX!", ConsoleColor.Red); return(null); } Log.Write("This GBX is a map!", ConsoleColor.Green); Log.Write(); var startMapLoad = DateTime.Now; var gbx = GameBox.Parse <CGameCtnChallenge>(fileName); if (gbx == null) { Log.Write("GBX failed to load!", ConsoleColor.Red); return(null); } time = DateTime.Now - startMapLoad; if (gbx.MainNode.Collection != "Island") { Log.Write("Not an Island map!", ConsoleColor.Red); return(null); } return(gbx); }
static void Main(string[] args) { var fileName = args.FirstOrDefault(); if (fileName == null) { return; } Log.OnLogEvent += Log_OnLogEvent; var gbx = GameBox.Parse(fileName); if (gbx is GameBox <CGameCtnChallenge> gbxMap) { gbxMap.MainNode.ExtractOriginalEmbedZip(gbxMap.FileName + ".zip"); } }
static void Main(string[] args) { var fileName = args.FirstOrDefault(); if (fileName == null) { return; } Log.OnLogEvent += Log_OnLogEvent; var gbx = GameBox.Parse(fileName); if (gbx is GameBox <CGameCtnReplayRecord> gbxReplay) { var map = gbxReplay.MainNode.Challenge.Result; map.Save(Formatter.Deformat(map.MainNode.MapName + ".Map.Gbx")); } }
static void Main(string[] args) { var fileName = args.FirstOrDefault(); if (fileName == null) { return; } Log.OnLogEvent += Log_OnLogEvent; var gbx = GameBox.Parse(fileName); if (gbx is GameBox <CGameCtnChallenge> gbxMap) { gbxMap.MainNode.CrackPassword(); gbxMap.Save(Path.GetFileName(fileName)); } }