Ejemplo n.º 1
0
 public static void getUpdatesByGameID(string gameID)
 {
     searchGameID = gameID;
     WebManager.GetUpdateListByGameID(gameID);
 }
Ejemplo n.º 2
0
        private void checkUpdate()
        {
            for (int i = 0; i < treeGridView1.Nodes[currentNode].Cells.Count; i++)
            {
                treeGridView1.Nodes[currentNode].Cells[i].Style.BackColor = treeGridView1.Nodes[currentNode].Cells[i].Style.SelectionBackColor = System.Drawing.ColorTranslator.FromHtml("#dddddd");
            }

            string target = Application.StartupPath + "\\PS3 Game Updater Updates";

            if (hdPanel.Visible)
            {
                if (Config.Get("SaveUpdatesIn") == "Respective")
                {
                    target = treeGridView1.Nodes[currentNode].Cells[Utils.GetColumnId("treePath")].Value.ToString() + "\\PS3 Game Updater Updates";
                }
                else
                {
                    target = this.gameFolderPath.Text + "\\PS3 Game Updater Updates";
                }
            }
            else if (gameIDPanel.Visible)
            {
                target = Application.StartupPath + "\\PS3 Game Updater Updates";
            }
            else if (ftpPanel.Visible)
            {
                target = Application.StartupPath + "\\PS3 Game Updater Updates (FTP Scan)";
            }

            oldBytesDownloaded = 0;
            bytesDownloaded    = 0;

            if (treeGridView1.Nodes[currentNode].Nodes[currentSubNode].Level == 2 && treeGridView1.Nodes[currentNode].Nodes[currentSubNode].Cells[Utils.GetColumnId("treeUpdate")].GetType().ToString() != "System.Windows.Forms.DataGridViewTextBoxCell")
            {
                updateFileSize = treeGridView1.Nodes[currentNode].Nodes[currentSubNode].Cells[Utils.GetColumnId("treeUpdateSize")].Value.ToString();
                string[] gameDetails = treeGridView1.Nodes[currentNode].Cells[Utils.GetColumnId("treeGameDetails")].Value.ToString().Split(new string[] { " - " }, StringSplitOptions.None);
                if (Config.Get("FilenameFormat") == "NameAndVersion")
                {
                    updateFileName = Utils.GetValidFileName(gameDetails[1] + " - Version " + treeGridView1.Nodes[currentNode].Nodes[currentSubNode].Cells[Utils.GetColumnId("treeVersion")].Value.ToString()) + ".pkg";
                }
                else if (Config.Get("FilenameFormat") == "IDAndNameAndVersion")
                {
                    updateFileName = Utils.GetValidFileName(gameDetails[0] + " - " + gameDetails[1] + " - Version " + treeGridView1.Nodes[currentNode].Nodes[currentSubNode].Cells[Utils.GetColumnId("treeVersion")].Value.ToString()) + ".pkg";
                }
                else
                {
                    updateFileName = treeGridView1.Nodes[currentNode].Nodes[currentSubNode].Cells[Utils.GetColumnId("treeUpdateURL")].Value.ToString().Substring(treeGridView1.Nodes[currentNode].Nodes[currentSubNode].Cells[Utils.GetColumnId("treeUpdateURL")].Value.ToString().LastIndexOf("/") + 1);
                }

                if ((bool)treeGridView1.Nodes[currentNode].Nodes[currentSubNode].Cells[Utils.GetColumnId("treeUpdate")].Value == true)
                {
                    if (File.Exists(target + "\\" + updateFileName))
                    {
                        FileInfo fileInfo = new FileInfo(target + "\\" + updateFileName);
                        if (fileInfo.Length.ToString() != updateFileSize)
                        {
                            treeGridView1.Nodes[currentNode].Nodes[currentSubNode].Cells[Utils.GetColumnId("treeStatus")].Value = "Downloading";
                            WebManager.DownloadUpdate(treeGridView1.Nodes[currentNode].Nodes[currentSubNode].Cells[Utils.GetColumnId("treeUpdateURL")].Value.ToString(), target, gameDetails[0], gameDetails[1], treeGridView1.Nodes[currentNode].Nodes[currentSubNode].Cells[Utils.GetColumnId("treeVersion")].Value.ToString());
                        }
                        else
                        {
                            treeGridView1.Nodes[currentNode].Nodes[currentSubNode].Cells[Utils.GetColumnId("treeStatus")].Value = "Already Downloaded";
                            DownloadNextUpdate();
                        }
                    }
                    else
                    {
                        treeGridView1.Nodes[currentNode].Nodes[currentSubNode].Cells[Utils.GetColumnId("treeStatus")].Value = "Downloading";
                        WebManager.DownloadUpdate(treeGridView1.Nodes[currentNode].Nodes[currentSubNode].Cells[Utils.GetColumnId("treeUpdateURL")].Value.ToString(), target, gameDetails[0], gameDetails[1], treeGridView1.Nodes[currentNode].Nodes[currentSubNode].Cells[Utils.GetColumnId("treeVersion")].Value.ToString());
                    }
                }
                else
                {
                    treeGridView1.Nodes[currentNode].Nodes[currentSubNode].Cells[Utils.GetColumnId("treeStatus")].Value = "Skipped";
                    DownloadNextUpdate();
                }
            }
            else
            {
                DownloadNextUpdate();
            }
        }