public void AutoAnalyze(string branch, string data, string revName) { Branch b = (Branch)Enum.Parse(typeof(Branch), branch); RevDb db = RevDBs[b]; db.OpenRevision(revName); foreach (string s in data.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(); } RevDb.SaveDatabase(RevDBs[CurrentBranchOLD], Constants.BranchFileNames[CurrentBranchOLD]); }
private void LoadBot() { foreach (Branch b in Enum.GetValues(typeof(Branch))) { RevDBs[b] = RevDb.LoadDatabase(Constants.BranchFileNames[b]); } AllBranches.AddRange((Branch[])Enum.GetValues(typeof(Branch))); CurBranch = AllBranches.DefaultIfEmpty(AllBranches.First()) .Where(b => b == Branch.Live) .First(); }
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 CloseRevisionOLD(IrcCommand command) { RevDBs[CurrentBranchOLD].CloseRevision(); RevDb.SaveDatabase(RevDBs[CurrentBranchOLD], Constants.BranchFileNames[CurrentBranchOLD]); return("Done"); }