public int CompareTo(object other) { if (other.GetType() == typeof(RobloxDeployLog)) { RobloxDeployLog otherLog = (RobloxDeployLog)other; return(DeployTime.CompareTo(otherLog.DeployTime)); } return(0); }
public override bool Equals(object obj) { if (obj.GetType() == typeof(RobloxDeployLog)) { RobloxDeployLog log = (RobloxDeployLog)obj; return(VersionGuid == log.VersionGuid); } return(false); }
private async void UpdateLogs(object sender = null, EventArgs e = null) { Text = "(Refreshing)"; await Task.Delay(500); List <string> newLogs = new List <string>(); RegistryKey savedLogs = Program.OpenSubKey("LogHistory"); foreach (string branchName in branches) { RobloxDeployLogBranch branch = currentLogs[branchName]; List <string> newBranchLogs = await RobloxDeployLog.UpdateDeployLogs(branch); if (newBranchLogs.Count > 0) { string prefix = "[" + branch.Name + "] "; newBranchLogs.ForEach(log => { newLogs.Add(prefix + log); }); branch.Source = string.Join("\n", newBranchLogs.ToArray()); savedLogs.SetValue(branch.Name, branch.Source); } if (branch.Dirty) { UpdateStatusPage(branch); UpdateHistoryPage(branch); branch.Dirty = false; } } if (newLogs.Count > 0) { updateNotifier.Tag = string.Join("\n", newLogs.ToArray()); updateNotifier.ShowBalloonTip(10000); } Text = "Roblox Version Monitor"; }
public static void AddDeployLogs(RobloxDeployLogBranch branch, List <string> deployLogs) { foreach (string log in deployLogs) { Match match = Regex.Match(log, MatchPattern); string[] data = match.Groups.Cast <Group>() .Select(group => group.Value) .Where(value => value.Length != 0) .ToArray(); RobloxDeployLog deployLog = new RobloxDeployLog(); string deployType = data[1]; if (Enum.TryParse(deployType, out deployLog.DeployType)) { deployLog.SourceLog = data[0]; deployLog.VersionGuid = data[2]; deployLog.DeployTime = DateTime.Parse(data[3], CultureInfo.InvariantCulture); if (data.Length > 4) { RobloxVersionInfo versionInfo = new RobloxVersionInfo { Available = true }; int.TryParse(data[5], out versionInfo.Generation); int.TryParse(data[6], out versionInfo.Version); int.TryParse(data[7], out versionInfo.Patch); int.TryParse(data[8], out versionInfo.Commit); deployLog.VersionInfo = versionInfo; } branch.Logs.Add(deployLog); } } }
private void UpdateStatusPage(RobloxDeployLogBranch deployBranch) { string branch = deployBranch.Name; List <RobloxDeployLog> deployLogs = deployBranch.Logs; TabPage page = deployBranch.StatusPage; Label statusLbl = (Label)page.Controls[branch + "_Status"]; string newText = "Version Deploy Info:\n\n"; foreach (RobloxDeployType deployType in Enum.GetValues(typeof(RobloxDeployType))) { RobloxDeployLog latest = deployLogs.Where(log => log.DeployType == deployType).Last(); string[] lines = new string[] { " Latest " + deployType.ToString() + ":", " Version: " + latest.VersionInfo, " GUID: " + latest.VersionGuid, " Updated: " + latest.DeployTime }; newText += string.Join("\n", lines) + "\n\n"; } statusLbl.Text = newText; }