コード例 #1
0
        private void btndonecustomizing_Click(object sender, EventArgs e)
        {
            bool ContinueUpload = true;
            //Create new package and assign values
            var pkg     = PackageToEdit;
            var OldName = pkg.Name.Replace(" ", "_");

            pkg.Name        = txtpackagename.Text;
            pkg.Description = txtpackagedescription.Text;
            if (cbsell.Checked == true)
            {
                try
                {
                    pkg.Cost = Convert.ToDecimal(Convert.ToDecimal(txtprice.Text).ToString("#.#####"));
                }
                catch (Exception ex)
                {
                    ContinueUpload = false;
                    API.CreateInfoboxSession("Error", "You have entered an incorrect price value.", infobox.InfoboxMode.Info);
                }
            }
            else
            {
                pkg.Cost = 0;
            }
            pkg.PkgIconPath = "";
            if (ContinueUpload == true)
            {
                if (!Directory.Exists(Paths.Mod_Temp + "newapm"))
                {
                    Directory.CreateDirectory(Paths.Mod_Temp + "newapm");
                }
                else
                {
                    Directory.Delete(Paths.Mod_Temp + "newapm", true);
                    Directory.CreateDirectory(Paths.Mod_Temp + "newapm");
                }

                //Copy app SAA and icon to package folder
                if (SAAFile != null)
                {
                    File.Copy(SAAFile, Paths.Mod_Temp + "newapm" + OSInfo.DirectorySeparator + "app.saa");
                }
                else
                {
                    var wc = new WebClient();
                    wc.DownloadFile("http://playshiftos.ml/appscape/packages/" + OldName + ".stp", Paths.Mod_Temp + "newapm" + OSInfo.DirectorySeparator + "app.saa");
                }
                Properties.Resources.iconShiftnet.Save(Paths.Mod_Temp + "newapm" + OSInfo.DirectorySeparator + "Icon.bmp");

                //Create AL meta file for package (so it will display in the app launcher)
                var al = new ModApplauncherItem();
                al.Display      = true;
                al.Icon         = "Icon.bmp";
                al.Name         = pkg.Name;
                al.ShiftCode    = "runSAA:app.saa";
                al.AppDirectory = al.Name;

                //Serialize AL meta file and copy to package
                var json = JsonConvert.SerializeObject(al);
                File.WriteAllText(Paths.Mod_Temp + "newapm" + OSInfo.DirectorySeparator + "applauncher", json);

                //Package file to .stp and upload to Appscape
                ZipFile.CreateFromDirectory(Paths.Mod_Temp + "newapm", Paths.Mod_Temp + pkg.Name.Replace(" ", "_") + ".stp");
                LoungeClient.UploadPackage(pkg, File.ReadAllBytes(Paths.Mod_Temp + pkg.Name.Replace(" ", "_") + ".stp"));
                btnapps_Click(sender, e);

                SetupLounge();
                pnllounge.BringToFront();
            }
        }
コード例 #2
0
        private void btndone_Click(object sender, EventArgs e)
        {
            bool ContinueUpload = true;
            //Create new package and assign values
            var pkg = new AppscapePackage();

            pkg.Name        = txtpackagename.Text;
            pkg.DevKey      = MyProfile.DevKey;
            pkg.Description = txtpackagedescription.Text;
            if (cbsell.Checked == true)
            {
                try
                {
                    pkg.Cost = Convert.ToDecimal(Convert.ToDecimal(txtprice.Text).ToString("#.#####"));
                }
                catch (Exception ex)
                {
                    ContinueUpload = false;
                    API.CreateInfoboxSession("Error", "You have entered an incorrect price value.", infobox.InfoboxMode.Info);
                }
            }
            else
            {
                pkg.Cost = 0;
            }
            pkg.SetupFile   = pkg.Name.Replace(" ", "_");
            pkg.PkgIconPath = "";
            if (AppScreenshot != null)
            {
                pkg.ScreenshotPath = new FileInfo(AppScreenshot).Name.Replace(" ", "_");
            }
            else
            {
                pkg.ScreenshotPath = "none.jpg";
            }
            if (ContinueUpload == true)
            {
                //Upload the package meta file

                if (!Directory.Exists(Paths.Mod_Temp + "newapm"))
                {
                    Directory.CreateDirectory(Paths.Mod_Temp + "newapm");
                }
                else
                {
                    Directory.Delete(Paths.Mod_Temp + "newapm", true);
                    Directory.CreateDirectory(Paths.Mod_Temp + "newapm");
                }

                //Copy app SAA and icon to package folder
                File.Copy(SAAFile, Paths.Mod_Temp + "newapm" + OSInfo.DirectorySeparator + "app.saa");
                if (AppIcon != null)
                {
                    File.Copy(AppIcon, Paths.Mod_Temp + "newapm" + OSInfo.DirectorySeparator + "Icon.bmp");
                }
                else
                {
                    Properties.Resources.iconShiftnet.Save(Paths.Mod_Temp + "newapm" + OSInfo.DirectorySeparator + "Icon.bmp");
                }

                //Create AL meta file for package (so it will display in the app launcher)
                var al = new ModApplauncherItem();
                al.Display      = true;
                al.Icon         = "Icon.bmp";
                al.Name         = pkg.Name;
                al.ShiftCode    = "runSAA:app.saa";
                al.AppDirectory = al.Name;

                //Serialize AL meta file and copy to package
                var json = JsonConvert.SerializeObject(al);
                File.WriteAllText(Paths.Mod_Temp + "newapm" + OSInfo.DirectorySeparator + "applauncher", json);

                //Package file to .stp and upload to Appscape
                ZipFile.CreateFromDirectory(Paths.Mod_Temp + "newapm", Paths.Mod_Temp + pkg.Name.Replace(" ", "_") + ".stp");
                Repo.UploadPackage(pkg, File.ReadAllBytes(Paths.Mod_Temp + pkg.Name.Replace(" ", "_") + ".stp"));



                result = "finished";
                this.Close();
            }
        }