예제 #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);
            });
        }
예제 #2
0
 void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     this.BeginInvoke((MethodInvoker) delegate {
         string downloaded      = FileSize.FormatBytes(e.BytesReceived);
         string toDownload      = FileSize.FormatBytes(e.TotalBytesToReceive);
         downloadLabel.Text     = "Downloaded " + downloaded + " of " + toDownload;
         downloadProgress.Value = int.Parse(e.ProgressPercentage.ToString());
     });
 }
예제 #3
0
 private void SettingsForm_Load(object sender, EventArgs e)
 {
     this.propertiesName.Text = this.Text;
     if (this.Text.Replace(" Properties", "") == "CKPL Launcher")
     {
         this.uninstall.Enabled = false;
         this.diskUsage.Text    = FileSize.FormatBytes(FileSize.DirSize(new DirectoryInfo(Application.StartupPath)));
     }
     else
     {
         if (Directory.Exists(Application.StartupPath + "\\apps\\" + this.Text.Replace(" Properties", "")))
         {
             this.diskUsage.Text = FileSize.FormatBytes(FileSize.DirSize(new DirectoryInfo(Application.StartupPath + "\\apps\\" + this.Text.Replace(" Properties", ""))));
         }
         else
         {
             this.diskUsage.Text = "None";
             //this.uninstall.Enabled = false;
             this.browseGameFiles.Enabled = false;
         }
     }
 }
예제 #4
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);
            }
        }
예제 #5
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;
            }
        }
예제 #6
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);
     }
 }