//Upload update private void button5_Click(object sender, EventArgs e) { try { JObject info = JObject.Parse(Networking.GetUploadUpdateInfo(form, currentScriptID)); form.Opacity = 0.5; new UploadScript(tableLayoutPanel2.Tag.ToString(), info).ShowDialog(); form.Opacity = 1; UpdateList(Main.sf.streamlabsPath); } catch (Exception ex) { Protocol.AddToProtocol("Could not upload update: " + ex.StackTrace, Types.Error); } }
//Delete script from server private void button7_Click(object sender, EventArgs e) { try { if (MetroMessageBox.Show(form, "Warning! You are about to delete your script '" + label3.Text + "' from the server!\nThe script will still be available for the user that have downloaded it.\nDo you want to continue?", "Delete script from server", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button3, 146) == DialogResult.Yes) { string result = Networking.DeleteScript(form, currentScriptID); if (result.Contains("true")) { MetroMessageBox.Show(form, "Your script has been successfully deleted!", "Delete script from server", MessageBoxButtons.OK, MessageBoxIcon.Information, 102); Main.sf.accountScripts.RemoveAt(Main.sf.accountScripts.IndexOf(currentScriptID)); Main.sf.Save(); string[] lines = File.ReadAllLines(tableLayoutPanel2.Tag.ToString()); using (StreamWriter writer = new StreamWriter(tableLayoutPanel2.Tag.ToString())) { bool f = false; for (int i = 0; i < lines.Length; i++) { if (lines[i].ToLower().Contains("scriptbrowserid") && !f) { f = true; } else { writer.WriteLine(lines[i]); } } } UpdateList(Main.sf.streamlabsPath); } else { MetroMessageBox.Show(form, "There was an unexpected error!\nCould not delete your script!", "Delete script from server", MessageBoxButtons.OK, MessageBoxIcon.Error, 124); Protocol.AddToProtocol("Could not delete script from Server (ID:" + button7.Tag.ToString() + ") - Webresult: " + result, Types.Error); } } } catch (Exception ex) { Protocol.AddToProtocol("Could not delete script from Server! " + ex.StackTrace, Types.Error); } }