static void Main(string[] args) { #if TEST string analysis = PS2Analyzer.AnalyzePS2(@"E:\SteamGames\SteamApps\common\PlanetSide 2"); string revName = "test"; RevDb db = new RevDb(); db.OpenRevision(revName); foreach (string s in analysis.Split('\n')) { if (s == "") { continue; } string[] revdata = s.Split('\t'); db.CalculateRevision(revdata[0], ulong.Parse(revdata[2]), int.Parse(revdata[1])); } db.CheckForRemovedFile(); db.CloseRevision(); Revision r = db.GetRevisionByName(revName); string d = db.GetFilesForRevision(r); using (StreamWriter wr = new StreamWriter("output/RevisionReports/" + r.name + "Changes.txt")) { wr.Write(d); wr.Flush(); wr.Close(); } #else #if DEV string name = "lebot_dev"; #else string name = "lebot"; #endif logWriter = new StreamWriter("log.txt"); bot = new PS2StatBot("irc.planetside-universe.com", new IrcUser(name, name + "1")); bot.ConnectionComplete += new EventHandler(bot_ConnectionComplete); bot.RawMessageRecieved += new EventHandler <RawMessageEventArgs>(bot_RawMessage); bot.RawMessageSent += new EventHandler <RawMessageEventArgs>(bot_RawMessage); bot.Run(); while (true) { ; } #endif }
public string AnalyzeChanges(IrcBotFramework.IrcCommand command) { string branch = command.Parameters[0]; Branch b = (Branch)Enum.Parse(typeof(Branch), branch); string analysis = PS2Analyzer.AnalyzePS2(Constants.Directories[b]); string revName = branch + DateTime.Now.ToString("yyyy-MM-dd"); AutoAnalyze(branch, analysis, revName); return("Done: " + string.Format("http://www.testoutfit.info/lebot/RevisionReports/{0}", revName + "Changes.txt")); }
public void StartTimers() { Timer t = new Timer(1000 * 60 * Constants.UpdateInterval); t.Elapsed += new ElapsedEventHandler(t_Elapsed); t.Enabled = true; if (!System.IO.File.Exists(TrackedManifestFile)) { using (JsonTextWriter wr = new JsonTextWriter(new System.IO.StreamWriter(TrackedManifestFile))) { JsonSerializer ser = new JsonSerializer(); wr.Formatting = Formatting.Indented; ser.Serialize(wr, ManifestTrackList); } } using (JsonTextReader r = new JsonTextReader(new System.IO.StreamReader(TrackedManifestFile))) { JsonSerializer ser = new JsonSerializer(); ManifestTrackList = ser.Deserialize <List <TrackData> >(r); } EventTypes["NotifyPublic"] = (data) => { string message = "SOE Patched " + data.Name + " on " + data.LastUpdated.ToString(); SendMessage("#ps-universe", message); SendMessage("#REside", message); SystemMessage(message); }; EventTypes["NotifyPrivate"] = (data) => { string message = " Tracked Manifest " + data.Name + " was modified on " + data.LastUpdated.ToString(); SendMessage("#reside_priv", message); }; EventTypes["DumpManifestToFile"] = (data) => { string[] filename = DumpManifestToFile(data.Manifest, "Manifests/Tracked/" + data.Name + "/", string.Format("{0}{1}.txt", data.Manifest.Substring(data.Manifest.LastIndexOf("/") + 1), DateTime.Now.ToString("yyyy-MM-dd"))); foreach (string s in filename) { this.SendMessage("#reside_priv", string.Format("http://testoutfit.info/lebot/{0}", s)); } }; EventTypes["DateManifest"] = (data) => { using (System.IO.StreamWriter wr = new System.IO.StreamWriter(System.IO.File.Open("output/Manifests/Tracked/" + data.Name + "UpdateDates.txt", System.IO.FileMode.Append))) { wr.WriteLine(data.LastUpdated.ToString()); this.SendMessage("#reside_priv", string.Format("Updated http://testoutfit.info/lebot/Manifests/Tracked/{0}", data.Name + "UpdateDates.txt")); } }; EventTypes["SeeTheFuture"] = (data) => { string message = ""; if (data.Name == "livenext") { message = "I predict a Live patch is going to happen in the near future"; } if (data.Name == "testnext") { message = "I predict a Test patch is going to happen in the near future"; } SendMessage("#ps-universe", message); SendMessage("#REside", message); }; EventTypes["QueueLiveDownload"] = (data) => { DateTime now = DateTime.Now; SendMessage("#reside_priv", "Live has started downloading"); string[] manifests = new string[] { "http://manifest.patch.station.sony.com/patch/sha/manifest/planetside2/planetside2-live/live/planetside2-live.sha.soe", "http://manifest.patch.station.sony.com/patch/sha/manifest/planetside2/planetside2-livecommon/live/planetside2-livecommon.sha.soe", }; foreach (string manifest in manifests) { JObject thisManifest = Downloader.GetJobjectFromManifest(manifest); PS2Downloader.DownloadPS2Job(thisManifest, null, "Live", dateTime => { SendMessage("#reside_priv", "Live has finished Downloading"); Branch b = Branch.Live; string analysis = PS2Analyzer.AnalyzePS2(Constants.Directories[b]); string branchName = "Live-" + now.ToString("yyyy-MM-dd"); AutoAnalyze("Live", analysis, branchName); SendMessage("#reside", "Live Changes: " + string.Format("http://www.testoutfit.info/lebot/RevisionReports/{0}", branchName + "Changes.txt")); SendMessage("#ps-universe", "Live Changes: " + string.Format("http://www.testoutfit.info/lebot/RevisionReports/{0}", branchName + "Changes.txt")); SendMessage("#reside_priv", "Live Changes: " + string.Format("http://www.testoutfit.info/lebot/RevisionReports/{0}", branchName + "Changes.txt")); }, "LiveDownload"); } }; EventTypes["QueueTestDownload"] = (data) => { DateTime now = DateTime.Now; SendMessage("#reside_priv", "Test has started downloading"); string[] manifests = new string[] { "http://manifest.patch.station.sony.com/patch/sha/manifest/planetside2/planetside2-test/live/planetside2-test.sha.soe", "http://manifest.patch.station.sony.com/patch/sha/manifest/planetside2/planetside2-testcommon/live/planetside2-testcommon.sha.soe", }; foreach (string manifest in manifests) { JObject thisManifest = Downloader.GetJobjectFromManifest(manifest); PS2Downloader.DownloadPS2Job(thisManifest, null, "Test", dateTime => { SendMessage("#reside_priv", "Test has finished Downloading"); Branch b = Branch.Test; string analysis = PS2Analyzer.AnalyzePS2(Constants.Directories[b]); string branchName = "Test-" + now.ToString("yyyy-MM-dd"); AutoAnalyze("Test", analysis, branchName); SendMessage("#reside", "Test Changes: " + string.Format("http://www.testoutfit.info/lebot/RevisionReports/{0}", branchName + "Changes.txt")); SendMessage("#ps-universe", "Test Changes: " + string.Format("http://www.testoutfit.info/lebot/RevisionReports/{0}", branchName + "Changes.txt")); SendMessage("#reside_priv", "Test Changes: " + string.Format("http://www.testoutfit.info/lebot/RevisionReports/{0}", branchName + "Changes.txt")); }, "TestDownload"); } }; EventTypes["QueueEQNLDownload"] = (data) => { DateTime now = DateTime.Now; SendMessage("#reside_priv", "EQNLandmark has started downloading"); string[] manifests = new string[] { "http://manifest.patch.station.sony.com/patch/eqnext/test/digest/play/test64-cdn.soe", "http://manifest.patch.station.sony.com/patch/eqnext/test/digest/play/shared-cdn.soe", "http://manifest.patch.station.sony.com/patch/eqnext/test/digest/common/shared-cdn.soe", "http://manifest.patch.station.sony.com/patch/eqnext/test/digest/common/test-cdn.soe", }; foreach (string manifest in manifests) { JObject thisManifest = Downloader.GetJobjectFromManifest(manifest); EQNDownloader.DownloadPS2Job(thisManifest, null, "EQNLandmark", dateTime => { SendMessage("#reside_priv", "EQNLandmark has finished Downloading"); Branch b = Branch.EQNLandmark; string analysis = PS2Analyzer.AnalyzePS2(Constants.Directories[b]); string branchName = "EQNLandmark-" + now.ToString("yyyy-MM-dd"); AutoAnalyze("EQNLandmark", analysis, branchName); SendMessage("#reside", "EQNLandmark Changes: " + string.Format("http://www.testoutfit.info/lebot/RevisionReports/{0}", branchName + "Changes.txt")); SendMessage("#ps-universe", "EQNLandmark Changes: " + string.Format("http://www.testoutfit.info/lebot/RevisionReports/{0}", branchName + "Changes.txt")); SendMessage("#reside_priv", "EQNLandmark Changes: " + string.Format("http://www.testoutfit.info/lebot/RevisionReports/{0}", branchName + "Changes.txt")); }, "EQNLDownload"); } }; }