static void Main(string[] args) { Trace.Listeners.Add(new ConsoleTraceListener()); var sitePath = GlobalConst.SiteDiskPath; if (args.Length > 0) sitePath = args[0]; //var ar = new ZeroKWeb.AutoRegistrator(sitePath); //ar.Main(); var spg = new SteamDepotGenerator(sitePath, Path.Combine(sitePath,"..","steamworks","tools","ContentBuilder","content")); spg.Generate(); spg.RunBuild(); }
void Downloader_PackagesChanged(object sender, EventArgs e) { try { Trace.TraceInformation("Autoregistrator packages changed"); foreach (var ver in Downloader.PackageDownloader.Repositories.SelectMany(x => x.VersionsByTag.Keys)) { if (ver == "zk:stable" || ver == "zk:test") { Downloader.GetResource(DownloadType.MOD, ver)?.WaitHandle.WaitOne(); } } var waiting = false; do { var downs = Downloader.Downloads.ToList().Where(x => x.IsComplete == null && !x.IsAborted).ToList(); if (downs.Any()) { waiting = true; var d = downs.First(); Trace.TraceInformation("Autoregistrator Waiting for: {0} - {1} {2}", d.Name, d.TotalProgress, d.TimeRemaining); } else waiting = false; if (waiting) Thread.Sleep(10000); } while (waiting); Trace.TraceInformation("Autoregistrator rescanning"); Scanner.Rescan(); do { if (Scanner.GetWorkCost() > 0) { waiting = true; Trace.TraceInformation("Autoregistrator Waiting for scanner: {0}", Scanner.GetWorkCost()); } else waiting = false; if (waiting) Thread.Sleep(10000); } while (waiting); Trace.TraceInformation("Autoregistrator waiting done"); UpdateRapidTagsInDb(); Trace.TraceInformation("Autoregistrator rapid tags updated"); lock (Locker) { foreach (var id in new ZkDataContext(false).Missions.Where(x => !x.IsScriptMission && x.ModRapidTag != "" && !x.IsDeleted) .Select(x => x.MissionID) .ToList()) { using (var db = new ZkDataContext(false)) { var mis = db.Missions.Single(x => x.MissionID == id); try { if (!string.IsNullOrEmpty(mis.ModRapidTag)) { var latestMod = Downloader.PackageDownloader.GetByTag(mis.ModRapidTag); if (latestMod != null && (mis.Mod != latestMod.InternalName || !mis.Resources.Any())) { mis.Mod = latestMod.InternalName; Trace.TraceInformation("Autoregistrator Updating mission {0} {1} to {2}", mis.MissionID, mis.Name, mis.Mod); var mu = new MissionUpdater(); mis.Revision++; mu.UpdateMission(db, mis, Scanner); db.SaveChanges(); } } } catch (Exception ex) { Trace.TraceError("Autoregistrator Failed to update mission {0}: {1}", mis.MissionID, ex); } } } try { var newName = Downloader.PackageDownloader.GetByTag("zk:stable").InternalName; if (lastStableVersion != newName) { Trace.TraceInformation("Autoregistrator Generating steam stable package"); lastStableVersion = newName; var pgen = new SteamDepotGenerator(sitePath, Path.GetFullPath(Path.Combine(sitePath, "..", "steamworks", "tools", "ContentBuilder", "content"))); pgen.Generate(); pgen.RunBuild(); } } catch (Exception ex) { Trace.TraceError("Autoregistrator Error building steam package: {0}", ex); } } Trace.TraceInformation("Autoregistrator all done"); } catch (Exception ex) { Trace.TraceError("Autoregistrator Error updating packages: {0}", ex); } }
private void OnRapidChanged() { try { Trace.TraceInformation("Autoregistrator packages changed"); foreach (var ver in Downloader.PackageDownloader.Repositories.SelectMany(x => x.VersionsByTag.Keys)) if ((ver == "zk:stable") || (ver == "zk:test")) { Trace.TraceInformation("Autoregistrator downloading {0}", ver); Downloader.GetResource(DownloadType.RAPID, ver)?.WaitHandle.WaitOne(); } Trace.TraceInformation("Autoregistrator rescanning"); UnitSyncer.Scan(); Trace.TraceInformation("Autoregistrator scanning done"); UpdateRapidTagsInDb(); Trace.TraceInformation("Autoregistrator rapid tags updated"); lock (Locker) { // UpdateMissions(); var newName = Downloader.PackageDownloader.GetByTag("zk:stable").InternalName; if (MiscVar.LastRegisteredZkVersion != newName) { MiscVar.LastRegisteredZkVersion = newName; if (GlobalConst.Mode == ModeType.Live) { Trace.TraceInformation("Autoregistrator Generating steam stable package"); try { var pgen = new SteamDepotGenerator(sitePath, Path.GetFullPath(Path.Combine(sitePath, "..", "steamworks", "tools", "ContentBuilder", "content"))); pgen.Generate(); pgen.RunBuild(); } catch (Exception ex) { Trace.TraceError("Autoregistrator Error building steam package: {0}", ex); } } NewZkStableRegistered(this, newName); } } Trace.TraceInformation("Autoregistrator all done"); } catch (Exception ex) { Trace.TraceError("Autoregistrator Error updating packages: {0}", ex); } }