Esempio n. 1
0
        void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            this.BeginInvoke((MethodInvoker) delegate
            {
                if (Directory.Exists(Application.StartupPath + "\\apps\\" + gameName.Text))
                {
                    Directory.Delete(Application.StartupPath + "\\apps\\" + gameName.Text, true);
                }

                string zipPath     = Application.StartupPath + "\\downloads\\" + gameName.Text + ".zip";
                string extractPath = Application.StartupPath + "\\apps\\" + gameName.Text + "\\";

                ZipFile.ExtractToDirectory(zipPath, extractPath);

                File.Delete(Application.StartupPath + "\\downloads\\" + gameName.Text + ".zip");

                if (File.Exists(Application.StartupPath + "\\appData\\" + gameName.Text + ".xml"))
                {
                    File.Delete(Application.StartupPath + "\\appData\\" + gameName.Text + ".xml");
                }

                File.Copy(Application.StartupPath + "\\temp\\" + gameName.Text + ".xml", Application.StartupPath + "\\appData\\" + gameName.Text + ".xml");
                launchGame.Text    = "Launch";
                downloadLabel.Text = "Completed";
                Version.Text       = FileSize.xmlData(gameName.Text, "/app/Version", false);
            });
        }
Esempio n. 2
0
        private void projectFilesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string target = FileSize.xmlData(gameName.Text, "/app/ProjectFiles", true);

            try
            {
                System.Diagnostics.Process.Start(target);
            }
            catch
            (
                System.ComponentModel.Win32Exception noBrowser)
            {
                if (noBrowser.ErrorCode == -2147467259)
                {
                    MessageBox.Show(noBrowser.Message);
                }
            }
            catch (System.Exception other)
            {
                MessageBox.Show(other.Message);
            }
        }
Esempio n. 3
0
        private void gamesList_SelectedIndexChanged(object sender, EventArgs e)
        {
            gameName.Text   = gamesList.SelectedItem.ToString();
            Version.Text    = FileSize.xmlData(gameName.Text, "/app/Version", false);
            Developers.Text = FileSize.xmlData(gameName.Text, "/app/Developer", true);
            desc.Text       = FileSize.xmlData(gameName.Text, "/app/Description", true);
            string path = Application.StartupPath + "\\apps\\" + gameName.Text;

            if (File.Exists(path + "\\image.jpg"))
            {
                gameImage.Image = Image.FromFile(path);
            }
            else
            {
                gameImage.Image = Properties.Resources.NotAvailable;
            }

            if (gameName.Text == "CKPL Launcher")
            {
                launchWarning.Text = "This app cannot be launched from itself.";
                launchGame.Enabled = false;
            }
            else
            {
                launchWarning.Text = "";
                launchGame.Enabled = true;

                if (FileSize.xmlData(gameName.Text, "/app/Version", true) != FileSize.xmlData(gameName.Text, "/app/Version", false))
                {
                    launchGame.Text = "Update";
                }
                else if (File.Exists(path + "\\" + FileSize.xmlData(gameName.Text, "/app/Executable", false)))
                {
                    launchGame.Text = "Launch";
                }
                else
                {
                    launchGame.Text = "Download";
                }
            }

            string check = FileSize.xmlData(gameName.Text, "/app/SourceCode", true);

            if (check != null && check != "")
            {
                sourceCodeToolStripMenuItem.Enabled = true;
            }
            else
            {
                sourceCodeToolStripMenuItem.Enabled = false;
            }

            check = FileSize.xmlData(gameName.Text, "/app/ProjectFiles", true);

            if (check != null && check != "")
            {
                projectFilesToolStripMenuItem.Enabled = true;
            }
            else
            {
                projectFilesToolStripMenuItem.Enabled = false;
            }
        }
Esempio n. 4
0
 private void launchGame_Click(object sender, EventArgs e)
 {
     if (launchGame.Text == "Launch")
     {
         System.Diagnostics.Process.Start(Application.StartupPath + "\\apps\\" + gameName.Text + "\\" + FileSize.xmlData(gameName.Text, "/app/Executable", false));
     }
     else if (launchGame.Text == "Download")
     {
         string fileName = gameName.Text + ".zip";
         startDownload("http://ckplproductions.co.uk/apps/" + fileName, "downloads\\" + fileName);
     }
     else if (launchGame.Text == "Update")
     {
         string fileName = gameName.Text + ".zip";
         startDownload("http://ckplproductions.co.uk/apps/" + fileName, "downloads\\" + fileName);
     }
 }