示例#1
0
        private async void submitbtn_Click(object sender, RoutedEventArgs e)
        {
            var fileContent = File.ReadAllText(@"Scripts\" + _scriptFile);

            if (fileContent.Contains("using System"))
            {
                if (Nametxtbx.Text != string.Empty && Authortxtbx.Text != string.Empty && Forapptxtbx.Text != string.Empty && Reqforetxtbx.Text != string.Empty && Descriptiontxtbx.Text != string.Empty && Commandstxtbx.Text != string.Empty && Passwordbox.Text != String.Empty && Storebadgebox.Text != string.Empty && Headerimagebox.Text != String.Empty)
                {
                    try
                    {
                        var builder = new StringBuilder();
                        builder.AppendLine(Nametxtbx.Text);
                        builder.AppendLine(Authortxtbx.Text);
                        builder.AppendLine(Forapptxtbx.Text);
                        builder.AppendLine(Reqforetxtbx.Text);
                        builder.AppendLine(Descriptiontxtbx.Text);
                        builder.AppendLine(Headerimagebox.Text);
                        builder.AppendLine(Storebadgebox.Text);
                        builder.AppendLine(Passwordbox.Text);
                        builder.AppendLine(Commandstxtbx.Text);
                        builder.AppendLine(fileContent);
                        if (_upload)
                        {
                            var data = Bit.CompressString(builder.ToString());
                            Kernel.ScriptUploaderWindow.Content = new UploadScriptProgress("Compressed " + builder.Length / 1024 + "kb into " + data.Length / 1024 + "kb using BitCompress!");
                            await Kernel.Channel.UploadScriptAsync(builder.ToString(), "");

                            if (fileContent.Contains("Socket") || fileContent.Contains("Listen"))
                            {
                                MessageBox.Show("Your script is potentially harmful so it will be manually reviewed and will only show up as Potentially Harmful Script in the meantime.", "Success!");
                            }
                            else
                            {
                                MessageBox.Show("Your script has been uploaded successfully.\n\nIf you can't instantly see it in the Gallery, the Filename was in use. Please rename your Script and Upload it again\nor use the correct password to update it!", "Success!");
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        IoQueue.Add(ex);
                        MessageBox.Show("The server f**ed up. Please try again later...", "Oh shit.");
                    }
                }
                else
                {
                    MessageBox.Show("You need to fill out every field!", "Lol nope.");
                }
            }
            else
            {
                MessageBox.Show("You need to add 'using System; //VOTC LEGACY' to the top your Script!", "Lol nope.");
            }
        }