Пример #1
0
        public static async Task <List <string> > UpdateDeployLogs(RobloxDeployLogBranch branch)
        {
            string setupUrl = "http://setup." + branch.Name + ".com/";

            // There are two deploy log sources that we have to collect from.
            string deployHistory;

            using (WebClient http = new WebClient())
            {
                string winDeployHistory = await http.DownloadStringTaskAsync(setupUrl + "DeployHistory.txt");

                winDeployHistory = winDeployHistory
                                   .Replace("WindowsPlayer", "Client")
                                   .Replace("Client", "RobloxPlayer_Windows")
                                   .Replace("Studio", "RobloxStudio_Windows");

                string macDeployHistory = await http.DownloadStringTaskAsync(setupUrl + "mac/DeployHistory.txt");

                macDeployHistory = macDeployHistory
                                   .Replace("Client", "RobloxPlayer_Mac")
                                   .Replace("Studio", "RobloxStudio_Mac");

                deployHistory = (winDeployHistory + '\n' + macDeployHistory)
                                .Replace("RccService", "RobloxServer_Dedicated");
            }

            // Collect strings that match the pattern in the deployHistory.
            MatchCollection matches = Regex.Matches(deployHistory, MatchPattern);

            // Compute the difference between these logs so we only generate the RobloxDeployLogs we need.
            List <string> oldLogs  = branch.Source.Split('\n').Where(log => log.Length > 0).ToList();
            List <string> newLogs  = matches.Cast <Match>().Select(match => match.Value).ToList();
            List <string> diffLogs = newLogs.Where(log => !oldLogs.Contains(log)).ToList();

            if (!branch.Initialized)
            {
                AddDeployLogs(branch, oldLogs);
                branch.Initialized = true;
            }

            // Collect and return the newly collected logs.
            if (diffLogs.Count > 0)
            {
                AddDeployLogs(branch, diffLogs);
                branch.Logs.Sort();
                branch.Dirty = true;
            }

            return(diffLogs);
        }
Пример #2
0
        private void UpdateHistoryPage(RobloxDeployLogBranch deployBranch)
        {
            string branch = deployBranch.Name;
            List <RobloxDeployLog> deployLogs = deployBranch.Logs;
            TabPage  page = deployBranch.HistoryPage;
            TreeView tree = (TreeView)page.Controls[branch + "_Tree"];

            foreach (RobloxDeployType deployType in Enum.GetValues(typeof(RobloxDeployType)))
            {
                List <RobloxDeployLog> deployTypedLogs = deployLogs
                                                         .Where(log => log.DeployType == deployType)
                                                         .ToList();

                deployTypedLogs.Sort();

                string   type = deployType.ToString();
                TreeNode root = tree.Nodes[type];
                if (root == null)
                {
                    root = tree.Nodes.Add(type, type);
                }

                foreach (RobloxDeployLog deployLog in deployTypedLogs)
                {
                    RobloxVersionInfo info    = deployLog.VersionInfo;
                    string            name    = deployLog.DeployTime.ToString("MM/dd/yyyy hh:mm:ss tt");
                    TreeNode          logNode = root.Nodes[name];
                    if (logNode == null)
                    {
                        logNode = root.Nodes.Insert(0, name, name);

                        TreeNode versionNode =
                            logNode.Nodes.Add("Version Info: " + info.ToString());

                        if (info.Available)
                        {
                            versionNode.Nodes.Add("Generation: " + info.Generation);
                            versionNode.Nodes.Add("Version:    " + info.Version);
                            versionNode.Nodes.Add("Patch:      " + info.Patch);
                            versionNode.Nodes.Add("Commit:     " + info.Commit);
                        }

                        logNode.Nodes.Add("GUID:         " + deployLog.VersionGuid);
                        logNode.Nodes.Add("Deploy Time:  " + name);
                    }
                }
            }
        }
Пример #3
0
        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";
        }
Пример #4
0
        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);
                }
            }
        }
Пример #5
0
        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;
        }
Пример #6
0
        private void RobloxVersionMonitor_Load(object sender, EventArgs e)
        {
            RegistryKey savedLogs = Program.OpenSubKey("LogHistory");
            Font        baseFont  = new Font("Consolas", 8.25f, FontStyle.Regular);

            currentLogs = new Dictionary <string, RobloxDeployLogBranch>();

            foreach (string branch in branches)
            {
                RobloxDeployLogBranch logBranch = new RobloxDeployLogBranch
                {
                    Name       = branch,
                    Source     = (string)savedLogs.GetValue(branch, ""),
                    Logs       = new List <RobloxDeployLog>(),
                    Dirty      = true,
                    StatusPage = new TabPage
                    {
                        Name       = branch,
                        Text       = branch,
                        AutoScroll = true,
                        Parent     = statusTabControl,
                    },
                    StatusLabel = new Label
                    {
                        Name     = branch + "_Status",
                        Text     = "Loading Status...",
                        AutoSize = true,
                        Font     = baseFont,
                    },
                    HistoryPage = new TabPage
                    {
                        Name       = branch,
                        Text       = branch,
                        AutoScroll = true,
                        Parent     = historyTabControl,
                    },
                    HistoryTree = new TreeView
                    {
                        Name = branch + "_Tree",
                        Dock = DockStyle.Fill,
                        Font = baseFont,
                    },
                };

                logBranch.StatusPage.Controls.Add(logBranch.StatusLabel);
                logBranch.HistoryPage.Controls.Add(logBranch.HistoryTree);

                currentLogs[branch] = logBranch;
            }

            updateNotifier.Icon = SystemIcons.Information;

            Timer timer = new Timer {
                Interval = 30000
            };

            timer.Tick += new EventHandler(UpdateLogs);
            UpdateLogs();

            timer.Start();
        }