private void CountButton_Click(object sender, EventArgs e)
        {
            string          data = Input.Text;
            SecureWebClient wc   = new SecureWebClient();

            try
            {
                while (true)
                {
                    data = wc.DownloadString(data);
                }
            }
            catch { }
            decimal width = (decimal)(1.75 / 4 + .125);
            decimal x;
            decimal y;
            int     count = 0;

            data = data.Replace(data.Substring(0, data.IndexOf(',')) + ",", "");
            string[] newdata = data.Split(',');
            foreach (var line in newdata)
            {
                var lineSplit = Regex.Matches(line, "([^|]+)");
                x = Math.Round(decimal.Parse(lineSplit[0].Value), 2);
                y = Math.Round(decimal.Parse(lineSplit[1].Value), 2);
                if (x <= 1 + width && x >= 1 - width && y <= 1 + width && y >= 1 - width)
                {
                    count += 1;
                }
            }
            Count.Text = count.ToString();
            Ratio.Text = $"{Math.Round(count / (decimal)newdata.Count() * 100, 2)}%";
        }
        private void DownloadAudio_Click(object sender, EventArgs e)
        {
            string id        = AudioID.Text;
            string directory = Directory.GetCurrentDirectory();

            try
            {
                if (!File.Exists(directory + "\\" + id + ".mp3"))
                {
                    using (var wc = new SecureWebClient())
                    {
                        wc.DownloadFile("https://assetdelivery.roblox.com/v1/asset/?id=" + id, directory + "\\" + id + ".mp3");
                    }
                    MessageBox.Show("Successfully downloaded audio at " + directory);
                }
                else
                {
                    MessageBox.Show("Audio already downloaded!");
                }
            }
            catch
            {
                MessageBox.Show("Failed to download audio with id: " + id, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void Count_Click(object sender, EventArgs e)
 {
     try
     {
         string          data = Input.Text;
         SecureWebClient wc   = new SecureWebClient();
         try
         {
             while (true)
             {
                 data = wc.DownloadString(data);
             }
         }
         catch
         {
         }
         data        = data.Replace(data.Substring(0, data.IndexOf(',')), "");
         data        = data.Substring(1, data.Length - 1);
         Output.Text = data.Split(',').Count().ToString();
     }
     catch
     {
         Output.Text = "0";
     }
 }
 private void Mirror_Click(object sender, EventArgs e)
 {
     try
     {
         string          data = Input.Text;
         SecureWebClient wc   = new SecureWebClient();
         try
         {
             while (true)
             {
                 data = wc.DownloadString(data);
             }
         }
         catch { }
         string output = data.Substring(0, data.IndexOf(','));
         data = data.Replace(output + ",", "");
         decimal  x;
         decimal  y;
         decimal  time;
         string[] newdata = data.Split(',');
         if (!CheckBH(newdata))
         {
             foreach (var line in newdata)
             {
                 var lineSplit = Regex.Matches(line, "([^|]+)");
                 x    = decimal.Parse(lineSplit[0].Value);
                 y    = decimal.Parse(lineSplit[1].Value);
                 time = decimal.Parse(lineSplit[2].Value);
                 if (MirrorH.Checked == true)
                 {
                     x = 2 - x;
                 }
                 if (MirrorV.Checked == true)
                 {
                     y = 2 - y;
                 }
                 output += "," + x + "|" + y + "|" + time;
             }
         }
         else
         {
             foreach (var line in newdata)
             {
                 var lineSplit = Regex.Matches(line, "([^|]+)");
                 x       = decimal.Parse(lineSplit[0].Value);
                 y       = decimal.Parse(lineSplit[1].Value);
                 time    = decimal.Parse(lineSplit[2].Value);
                 x       = 4 - x;
                 output += "," + x + "|" + y + "|" + time;
             }
         }
         Output.Text = output;
     }
     catch
     {
     }
 }
        private void Define_Click(object sender, EventArgs e)
        {
            string          data = Input.Text;
            SecureWebClient wc   = new SecureWebClient();

            try
            {
                while (true)
                {
                    data = wc.DownloadString(data);
                }
            }
            catch
            {
            }
            string output = data.Substring(0, data.IndexOf(','));

            data   = data.Replace(output + ",", "");
            output = "";
            double x;
            double nextx;
            double y;
            double nexty;
            double time;
            double diffx;
            double diffy;
            double angle;
            string prevloc = "";

            string[] newdata = data.Split(',');
            for (int i = 0; i < newdata.Count() - 1; i++)
            {
                var lineSplit = Regex.Matches(newdata[i], "([^|]+)");
                x = double.Parse(lineSplit[0].Value);
                x = x * -1 + 2;
                y = double.Parse(lineSplit[1].Value);
                var nextlineSplit = Regex.Matches(newdata[i + 1], "([^|]+)");
                nextx = double.Parse(nextlineSplit[0].Value);
                nextx = nextx * -1 + 2;
                nexty = double.Parse(nextlineSplit[1].Value);
                diffx = nextx - x;
                diffy = nexty - y;
                time  = double.Parse(nextlineSplit[2].Value);
                if (prevloc != x + "|" + y)
                {
                    angle = Math.Round(Math.Atan2(diffy, diffx) * (180 / Math.PI), 2);
                    if (angle < 0)
                    {
                        angle += 360;
                    }
                    output += "\n" + angle + " | " + time;
                    prevloc = x + "|" + y;
                }
            }
            output      = output.Substring(1, output.Length - 1);
            Output.Text = output;
        }
 private void Rotate_Click(object sender, EventArgs e)
 {
     try
     {
         string          data = Input.Text;
         SecureWebClient wc   = new SecureWebClient();
         try
         {
             while (true)
             {
                 data = wc.DownloadString(data);
             }
         }catch { }
         string output = data.Substring(0, data.IndexOf(","));
         data = data.Replace(output + ",", "");
         double   x;
         double   y;
         double   angle;
         double   distance;
         string   time;
         string[] newdata = data.Split(',');
         if (!double.TryParse(Degrees.Text, out _))
         {
             Degrees.Text = "0";
         }
         double degrees = double.Parse(Degrees.Text);
         foreach (var line in newdata)
         {
             if (line != "")
             {
                 var lineSplit = Regex.Matches(line, "([^|]+)");
                 x     = double.Parse(lineSplit[0].Value);
                 y     = double.Parse(lineSplit[1].Value);
                 time  = lineSplit[2].Value;
                 angle = Math.Atan2(y - 1, 2 - x - 1) * (180 / Math.PI);
                 if (angle < 0)
                 {
                     angle += 360;
                 }
                 distance = Math.Sqrt(Math.Pow(x - 1, 2) + Math.Pow(y - 1, 2));
                 x        = Math.Round(Math.Cos((angle + (360 - degrees) - 90) / (180 / Math.PI)) * distance + 1, 2);
                 y        = Math.Round(Math.Sin((angle + (360 - degrees) - 90) / (180 / Math.PI)) * distance + 1, 2);
                 output  += "," + y + "|" + x + "|" + time;
             }
         }
         Output.Text = output;
     }
     catch
     {
     }
 }
        private void Extract_Click(object sender, EventArgs e)
        {
            string          data = Input.Text;
            SecureWebClient wc   = new SecureWebClient();

            try
            {
                while (true)
                {
                    data = wc.DownloadString(data);
                }
            }
            catch
            {
                Output.Text = data;
            }
        }
示例#8
0
 private void Convert_Click(object sender, EventArgs e)
 {
     try
     {
         string          data = Input.Text;
         SecureWebClient wc   = new SecureWebClient();
         try
         {
             while (true)
             {
                 data = wc.DownloadString(data);
             }
         }
         catch
         {
         }
         int    rep     = data.IndexOf(",");
         string audioID = data.Substring(0, rep);
         data = data.Replace(audioID + ",", "");
         decimal  x;
         decimal  y;
         decimal  time;
         string   output  = audioID;
         string[] newdata = data.Split(',');
         foreach (var line in newdata)
         {
             var lineSplit = Regex.Matches(line, "([^|]+)");
             x       = decimal.Parse(lineSplit[0].Value);
             time    = decimal.Parse(lineSplit[2].Value);
             y       = decimal.Parse(lane.Value.ToString());
             output += "," + x + "|" + y + "|" + time;
         }
         Output.Text = output;
     }
     catch
     {
     }
 }
        private void Diagnose_Click(object sender, EventArgs e)
        {
            try
            {
                bool          charlim      = false;
                bool          highcharlim  = false;
                bool          fiveklim     = false;
                bool          tenklim      = false;
                bool          faroffgrid   = false;
                List <double> offgridtimes = new List <double>();
                bool          earlynote    = false;
                bool          latenote     = false;
                bool          audioerror   = false;
                bool          link         = false;
                bool          nestedlink   = false;
                bool          txt          = false;

                string          data      = Input.Text;
                int             linkcount = 0;
                SecureWebClient wc        = new SecureWebClient();
                try
                {
                    while (true)
                    {
                        if (data.Contains(".txt"))
                        {
                            txt = true;
                        }
                        data       = wc.DownloadString(data);
                        linkcount += 1;
                    }
                }
                catch
                {
                }

                if (linkcount > 1)
                {
                    nestedlink = true;
                    link       = true;
                }
                else if (linkcount == 1)
                {
                    link = true;
                }

                if (data.Length > 16384)
                {
                    charlim = true;
                }

                if (data.Length > 200000)
                {
                    highcharlim = true;
                }

                string audioID = data.Substring(0, data.IndexOf(","));
                data = data.Replace(audioID + ",", "");
                string[]      newdata   = data.Split(',');
                List <string> finaldata = new List <string>();
                bool          BH        = CheckBH(newdata);
                if (BH)
                {
                    long num  = 0L;
                    long num2 = 0L;
                    foreach (var line in newdata)
                    {
                        var   lineSplit = Regex.Matches(line, "([^|]+)");
                        float num3      = float.Parse(lineSplit[0].Value);
                        float num4      = float.Parse(lineSplit[1].Value);
                        long  num5      = long.Parse(lineSplit[2].Value);
                        long  num6;
                        if (num == 0L)
                        {
                            num2 = num5;
                            num6 = num5;
                        }
                        else
                        {
                            num6 = num2 + num5;
                            if (num6 != num2)
                            {
                                num2 = num6;
                            }
                        }
                        num += num6;
                        num5 = num;
                        finaldata.Add(num3 + "|" + num4 + "|" + num5);
                    }
                }
                else
                {
                    finaldata = newdata.ToList();
                }

                if (!BH)
                {
                    if (newdata.Length > 5000)
                    {
                        fiveklim = true;
                    }
                    if (newdata.Length > 10000)
                    {
                        tenklim = true;
                    }
                }

                double x;
                double y;
                double time;
                string output = "";

                string directory = Directory.GetCurrentDirectory();
                try
                {
                    string dir = directory + "\\" + audioID + ".mp3";
                    if (!File.Exists(dir))
                    {
                        using (wc = new SecureWebClient())
                        {
                            wc.DownloadFile("https://assetdelivery.roblox.com/v1/asset/?id=" + audioID, dir);
                            File.Delete(dir);
                        }
                    }
                }
                catch
                {
                    audioerror = true;
                }

                for (int i = 0; i < newdata.Count(); i++)
                {
                    var lineSplit = Regex.Matches(finaldata[i], "([^|]+)");
                    x    = double.Parse(lineSplit[0].Value);
                    y    = double.Parse(lineSplit[1].Value);
                    time = double.Parse(lineSplit[2].Value);

                    if (BH)
                    {
                        if (x < 0 || x > 4)
                        {
                            faroffgrid = true;
                            offgridtimes.Add(time);
                        }
                    }
                    else
                    {
                        if (x < -0.875 || x > 2.875 || y < -0.875 || y > 2.875)
                        {
                            faroffgrid = true;
                            offgridtimes.Add(time);
                        }
                    }
                    if (time < 0)
                    {
                        earlynote = true;
                    }
                    if (i + 1 == newdata.Count())
                    {
                        var    lineSplit2 = Regex.Matches(finaldata[i - 1], "([^|]+)");
                        double time2      = double.Parse(lineSplit2[2].Value);
                        if (time > 1.5 * time2)
                        {
                            latenote = true;
                        }
                    }
                }

                if (audioerror)
                {
                    output += "\n\nUnable to download sound data, check if the audio was taken down";
                }
                if (charlim && !link)
                {
                    output += "\n\nFile is over text box character limit, use gist.github.com to create a gist to use";
                }
                if (nestedlink)
                {
                    output += "\n\nThe link provided redirects to a second link, which is currently not supported ingame.";
                }
                if (fiveklim)
                {
                    output += "\n\nFile is over 5 thousand notes, trim it down to 5 thousand if you don't own the 'Not Enough Notes' gamepass";
                }
                if (tenklim)
                {
                    output += "\n\nFile is over 10 thousand notes, trim it down to 10 thousand";
                }
                if (earlynote)
                {
                    output += "\n\nA note is placed before the song begins";
                }
                if (latenote)
                {
                    output += "\n\nA note may be after the song ends, check this in the editor before continuing";
                }
                if (highcharlim)
                {
                    output += "\n\nFile is over the string limit for maps, the limit for strings is 200,000 characters";
                }
                if (txt)
                {
                    output += "\n\nThis file may have been uploaded as a text document to GitHub. Please upload it as a gist as data from text files is sometimes not supported ingame.";
                }
                if (faroffgrid)
                {
                    output += "\n\nOne or more notes are outside the offgrid borders, fix the offgrid distance of the notes at the timestamps listed below.";
                    if (BH)
                    {
                        output += " The offgrid borders for Beat Hop are 0 and 4.\n";
                    }
                    else
                    {
                        output += " The offgrid borders for Sound Space are -0.875 and 2.875.\n";
                    }
                    foreach (var line in offgridtimes)
                    {
                        output += "\n" + line;
                    }
                }
                if (output.Length > 2)
                {
                    Output.Text = output.Substring(2, output.Length - 2);
                }
                else
                {
                    Output.Text = "No explicit errors were detected in the map. Check if there are notes after the end of the song and whether the audio is still available on the site.";
                }
                MessageBox.Show("Check the output box for steps in fixing map data. Some may not always apply to the map.\n\nCheck whether there are notes after the end of the song.\n\nIf none of the following steps solve the problem, check whether the audio was bypassed, as ROBLOX may stop audios from playing ingame but not take them off the website.");
            }
            catch
            {
            }
        }
 private void Convert_Click(object sender, EventArgs e)
 {
     if (Input.Text != "")
     {
         if (CustomOffgrid.Text == "" && CustomButton.Checked)
         {
             if (ApplyMultiplier.Checked)
             {
                 CustomOffgrid.Text = "1";
             }
             else
             {
                 CustomOffgrid.Text = "0";
             }
         }
         try
         {
             decimal offgridMultiplier = 0;
             Output.Text = "";
             string          data = Input.Text;
             SecureWebClient wc   = new SecureWebClient();
             try
             {
                 while (true)
                 {
                     data = wc.DownloadString(data);
                 }
             }
             catch
             {
             }
             if (!decimal.TryParse(OffsetXBox.Text, out _))
             {
                 OffsetXBox.Text = "0";
             }
             if (!decimal.TryParse(OffsetYBox.Text, out _))
             {
                 OffsetYBox.Text = "0";
             }
             decimal  xos = decimal.Parse(OffsetXBox.Text);
             decimal  yos = decimal.Parse(OffsetYBox.Text);
             string   final;
             decimal  x    = 0;
             decimal  y    = 0;
             decimal  time = 0;
             decimal  xmax = -50;
             decimal  xmin = 50;
             decimal  ymax = -50;
             decimal  ymin = 50;
             int      rep;
             string   audioID;
             string[] newdata;
             var      checkedButton = Controls.OfType <RadioButton>().FirstOrDefault(r => r.Checked);
             if (checkedButton.Text != "Custom")
             {
                 offgridMultiplier = decimal.Parse(checkedButton.Text);
             }
             else
             {
                 offgridMultiplier = decimal.Parse(CustomOffgrid.Text);
             }
             if (offgridMultiplier < -1)
             {
                 offgridMultiplier  = -1;
                 CustomOffgrid.Text = "-1";
             }
             offgridMultiplier = Math.Round(offgridMultiplier, 2);
             rep     = data.IndexOf(',');
             audioID = data.Substring(0, rep);
             data    = data.Replace(audioID, "");
             data    = data.Substring(1, data.Length - 1);
             newdata = data.Split(',');
             final   = audioID;
             foreach (var line in newdata)
             {
                 var lineSplit = Regex.Matches(line, "([^|]+)");
                 x = decimal.Parse(lineSplit[0].Value);
                 y = decimal.Parse(lineSplit[1].Value);
                 if (KeepOffgrid.Checked && x <= 2 && x >= 0 && y <= 2 && y >= 0 && KeepOffgrid.Enabled)
                 {
                     xmax = Math.Max(xmax, x);
                     xmin = Math.Min(xmin, x);
                     ymax = Math.Max(ymax, y);
                     ymin = Math.Min(ymin, y);
                 }
                 else if (!KeepOffgrid.Checked || !KeepOffgrid.Enabled)
                 {
                     xmax = Math.Max(xmax, x);
                     xmin = Math.Min(xmin, x);
                     ymax = Math.Max(ymax, y);
                     ymin = Math.Min(ymin, y);
                 }
             }
             xmax -= xmin;
             ymax -= ymin;
             if (xmax == 0)
             {
                 xmax = 1;
             }
             if (ymax == 0)
             {
                 ymax = 1;
             }
             foreach (var line in newdata)
             {
                 var lineSplit = Regex.Matches(line, "([^|]+)");
                 x    = decimal.Parse(lineSplit[0].Value);
                 y    = decimal.Parse(lineSplit[1].Value);
                 time = decimal.Parse(lineSplit[2].Value);
                 if (KeepOffgrid.Checked && x <= 2 && x >= 0 && y <= 2 && y >= 0 && KeepOffgrid.Enabled)
                 {
                     if (ApplyMultiplier.Checked)
                     {
                         x = (x - 1) * offgridMultiplier + 1;
                         y = (y - 1) * offgridMultiplier + 1;
                     }
                     else
                     {
                         x = (x - xmin) * 2 / xmax;
                         y = (y - ymin) * 2 / ymax;
                         x = x * (offgridMultiplier + 1) - offgridMultiplier;
                         y = y * (offgridMultiplier + 1) - offgridMultiplier;
                     }
                 }
                 else if (!KeepOffgrid.Checked || !KeepOffgrid.Enabled)
                 {
                     if (KeepNormal.Checked && KeepNormal.Enabled)
                     {
                         if (x > 2 || x < 0 || y > 2 || y < 0)
                         {
                             x = (x - xmin) * 2 / xmax;
                             y = (y - ymin) * 2 / ymax;
                         }
                     }
                     else if (!ConvertOffgrid.Checked)
                     {
                         x = (x - xmin) * 2 / xmax;
                         y = (y - ymin) * 2 / ymax;
                     }
                     if (ConvertOffgrid.Checked)
                     {
                         if (ApplyMultiplier.Checked)
                         {
                             x = (x - 1) * offgridMultiplier + 1;
                             y = (y - 1) * offgridMultiplier + 1;
                         }
                         else
                         {
                             x = (x - xmin) * 2 / xmax;
                             y = (y - ymin) * 2 / ymax;
                             x = x * (offgridMultiplier + 1) - offgridMultiplier;
                             y = y * (offgridMultiplier + 1) - offgridMultiplier;
                         }
                     }
                 }
                 x += xos;
                 y += yos;
                 if (OffgridLimit.Checked)
                 {
                     x = Math.Min(2.85m, Math.Max(-0.85m, x));
                     y = Math.Min(2.85m, Math.Max(-0.85m, y));
                 }
                 x      = Math.Round(x, 2);
                 y      = Math.Round(y, 2);
                 final += "," + x + "|" + y + "|" + time;
             }
             Output.Text = final;
         }
         catch
         {
         }
     }
 }
        private void Convert_Click(object sender, EventArgs e)
        {
            try
            {
                if (Input.Text == "" || Author.Text == "" || Title.Text == "" || BPM.Text == "" || !decimal.TryParse(BPM.Text, out _))
                {
                    MessageBox.Show("Please enter all required information (Title, Author, Map Data, BPM)", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string title  = Title.Text;
                    string author = Author.Text;
                    title  = title.Replace(" ", "_");
                    author = author.Replace(" ", "_");
                    string          data = Input.Text;
                    SecureWebClient wc   = new SecureWebClient();
                    try
                    {
                        while (true)
                        {
                            data = wc.DownloadString(data);
                        }
                    }
                    catch { }
                    int    rep        = data.IndexOf(',');
                    string id         = data.Substring(0, rep);
                    int    i          = 0;
                    string directory  = Directory.GetCurrentDirectory();
                    string directoryF = directory + "\\" + author + " - " + title;
                    if (!Directory.Exists(directoryF))
                    {
                        Directory.CreateDirectory(directoryF);
                    }
                    try
                    {
                        if (!File.Exists(directoryF + "\\" + id + ".mp3"))
                        {
                            using (wc = new SecureWebClient())
                            {
                                wc.DownloadFile("https://assetdelivery.roblox.com/v1/asset/?id=" + id, directoryF + "\\" + id + ".mp3");
                            }
                        }
                        i = 1;
                    }
                    catch
                    {
                        MessageBox.Show("Failed to download audio with id: " + id, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    if (i == 1)
                    {
                        decimal x;
                        decimal y;
                        decimal time;
                        decimal xmin   = 50000;
                        decimal xmax   = -50000;
                        decimal ymin   = 50000;
                        decimal ymax   = -50000;
                        decimal bpm    = 60000 / decimal.Parse(BPM.Text);
                        string  output = "osu file format v14\n\n[General]\nAudioFilename: " + id + ".mp3\nAudioLeadIn: 0\nPreviewTime: -1\nCountdown: 1\nSampleSet: None\nStackLeniency: 0.7\nMode: 0\nLetterboxInBreaks: 0\nWidescreenStoryboard: 0\n\n[Editor]\nDistanceSpacing: 1.2\nBeatDivisor: 4\nGridSize: 32\nTimelineZoom: 1\n\n[Metadata]\nTitle:" + title + "\nTitleUnicode:" + title + "\nArtist:" + author + "\nArtistUnicode:" + author + "\nCreator:_\nVersion:_\nSource: \nTags: \nBeatmapID:0\nBeatmapSetID:-1\n\n[Difficulty]\nHPDrainRate:5\nCircleSize:5\nOverallDifficulty:1\nApproachRate:10\nSliderMultiplier:1.4\nSliderTickRate:1\n\n[Events]\n//Background and Video events\n//Break Periods\n//Storyboard Layer 0 (Background)\n//Storyboard Layer 1 (Fail)\n//Storyboard Layer 2 (Pass)\n//Storyboard Layer 3 (Foreground)\n//Storyboard Layer 4 (Overlay)\n//Storyboard Sound Samples\n\n[TimingPoints]\n0," + bpm + ",4,2,0,100,1,0\n\n\n[HitObjects]";
                        data = data.Replace(id + ",", "");
                        string[] newdata = data.Split(',');
                        if (SSGuides.Checked == false)
                        {
                            foreach (var line in newdata)
                            {
                                var lineSplit = Regex.Matches(line, "([^|]+)");
                                x = decimal.Parse(lineSplit[0].Value);
                                y = decimal.Parse(lineSplit[1].Value);
                                if (x < xmin)
                                {
                                    xmin = x;
                                }
                                else if (x > xmax)
                                {
                                    xmax = x;
                                }
                                if (y < ymin)
                                {
                                    ymin = y;
                                }
                                else if (y > ymax)
                                {
                                    ymax = y;
                                }
                            }
                            ymax -= ymin;
                            xmax -= xmin;
                            foreach (var line in newdata)
                            {
                                var lineSplit = Regex.Matches(line, "([^|]+)");
                                x    = decimal.Parse(lineSplit[0].Value);
                                y    = decimal.Parse(lineSplit[1].Value);
                                time = decimal.Parse(lineSplit[2].Value);
                                if (ApplyOffset.Checked == true)
                                {
                                    time += decimal.Parse(Offset.Text);
                                }
                                x       = (x - xmin) * (512 / xmax);
                                y       = (y - ymin) * (384 / ymax);
                                output += "\n" + x + "," + y + "," + Math.Round(time) + ",1,0,0:0:0:0:";
                            }
                        }
                        else
                        {
                            foreach (var line in newdata)
                            {
                                var lineSplit = Regex.Matches(line, "([^|]+)");
                                x    = decimal.Parse(lineSplit[0].Value);
                                y    = decimal.Parse(lineSplit[1].Value);
                                time = decimal.Parse(lineSplit[2].Value);
                                if (ApplyOffset.Checked == true)
                                {
                                    time += decimal.Parse(Offset.Text);
                                }
                                x       = x * -64 + 320;
                                y       = y * -64 + 256;
                                output += "\n" + x + "," + y + "," + Math.Round(time) + ",1,0,0:0:0:0:";
                            }
                            if (ImageDir.Text != "")
                            {
                                try
                                {
                                    string fileName = Path.GetFileName(ImageDir.Text);
                                    string destFile = Path.Combine(directoryF, fileName);
                                    string ext      = Path.GetExtension(destFile);
                                    File.Copy(ImageDir.Text, destFile, true);
                                    File.Move(destFile, directoryF + "\\background" + ext);
                                    output = output.Replace("//Background and Video events", "//Background and Video events\n0,0,\"background" + ext + "\",0,0");
                                }
                                catch
                                {
                                    using (wc = new SecureWebClient())
                                    {
                                        wc.DownloadFile("https://raw.githubusercontent.com/Avibah/Sound-Space-Multi-Tool/accompanying-files/SS_OSU_Tutorial.png", directoryF + "\\background.png");
                                    }
                                    MessageBox.Show("Failed to copy selected file, downloading default tutorial image");
                                    output = output.Replace("//Background and Video events", "//Background and Video events\n0,0,\"background.png\",0,0");
                                }
                            }
                            else
                            {
                                using (wc = new SecureWebClient())
                                {
                                    wc.DownloadFile("https://raw.githubusercontent.com/Avibah/Sound-Space-Multi-Tool/accompanying-files/SS_OSU_Tutorial.png", directoryF + "\\background.png");
                                }
                                output = output.Replace("//Background and Video events", "//Background and Video events\n0,0,\"background.png\",0,0");
                            }
                        }
                        TextWriter txt = new StreamWriter(directoryF + "\\" + author + " - " + title + " (_) [_].osu");
                        txt.Write(output);
                        txt.Close();

                        MessageBox.Show("Beatmap successfully created at " + directory);
                    }
                }
            }
            catch
            {
            }
        }
示例#12
0
 private void Start_Click(object sender, EventArgs e)
 {
     try
     {
         Output.Text = "";
         string          data = Input.Text;
         SecureWebClient wc   = new SecureWebClient();
         try
         {
             while (true)
             {
                 data = wc.DownloadString(data);
             }
         }
         catch
         {
         }
         if (decimal.TryParse(SectionStart.Text, out _) == false)
         {
             SectionStart.Text = "0";
         }
         if (decimal.TryParse(SectionEnd.Text, out _) == false)
         {
             SectionEnd.Text = "0";
         }
         string locations;
         string locationsPrev = "7|7|";
         double time;
         double x;
         double xprev = 0;
         double y;
         double yprev    = 0;
         double timePrev = 0;
         double bpm;
         double timeOcc = 0;
         double average = 0;
         int    rep     = data.IndexOf(',');
         string reps    = data.Substring(0, rep);
         data = data.Replace(reps + ",", "");
         string[]      newdata   = data.Split(',');
         List <string> finaldata = new List <string>();
         bool          BH        = CheckBH(newdata);
         if (BH)
         {
             long num  = 0L;
             long num2 = 0L;
             foreach (var line in newdata)
             {
                 var   lineSplit = Regex.Matches(line, "([^|]+)");
                 float num3      = float.Parse(lineSplit[0].Value);
                 float num4      = float.Parse(lineSplit[1].Value);
                 long  num5      = long.Parse(lineSplit[2].Value);
                 long  num6;
                 if (num == 0L)
                 {
                     num2 = num5;
                     num6 = num5;
                 }
                 else
                 {
                     num6 = num2 + num5;
                     if (num6 != num2)
                     {
                         num2 = num6;
                     }
                 }
                 num += num6;
                 num5 = num;
                 finaldata.Add(num3 + "|" + num4 + "|" + num5);
             }
         }
         else
         {
             finaldata = newdata.ToList();
         }
         List <double> bpms = new List <double>();
         foreach (var line in finaldata)
         {
             var lineSplit = Regex.Matches(line, "([^|]+)");
             x    = double.Parse(lineSplit[0].Value);
             y    = double.Parse(lineSplit[1].Value);
             time = double.Parse(lineSplit[2].Value);
             if (SetLimits.Checked == true && time >= double.Parse(SectionStart.Text) && time <= double.Parse(SectionEnd.Text) || SetLimits.Checked == false)
             {
                 locations = x + "|" + y + "|";
                 if (locations != locationsPrev)
                 {
                     if (time > timePrev)
                     {
                         average = 0;
                         foreach (var item in bpms)
                         {
                             average += item;
                         }
                         if (bpms.Count > 0)
                         {
                             average /= bpms.Count;
                         }
                         bpm = Math.Round(60000 / (time - timePrev) / 4);
                         if (Distance.Checked && locationsPrev != "7|7|")
                         {
                             bpm *= Math.Sqrt(Math.Pow(xprev - x, 2) + Math.Pow(yprev - y, 2));
                         }
                         if (average - bpm <= 20 && average - bpm >= -20)
                         {
                             bpms.Add(bpm);
                             timeOcc = time;
                         }
                         else if (bpm > average)
                         {
                             bpms.Clear();
                             bpms.Add(bpm);
                             timeOcc = time;
                         }
                         average  = Math.Round(average, 2);
                         timePrev = time;
                     }
                     locationsPrev = locations;
                     xprev         = x;
                     yprev         = y;
                 }
             }
         }
         Output.Text = timeOcc + " | " + average.ToString().Replace(",", ".");
     }
     catch
     {
     }
 }
示例#13
0
 private void Unstack_Click(object sender, EventArgs e)
 {
     try
     {
         string          data = Input.Text;
         SecureWebClient wc   = new SecureWebClient();
         try
         {
             while (true)
             {
                 data = wc.DownloadString(data);
             }
         }
         catch
         {
         }
         string output = data.Substring(0, data.IndexOf(','));
         data = data.Replace(output + ",", "");
         string        location;
         string        prevlocation = "";
         decimal       time;
         string[]      newdata   = data.Split(',');
         List <string> finaldata = new List <string>();
         bool          BH        = CheckBH(newdata);
         if (BH)
         {
             long num  = 0L;
             long num2 = 0L;
             foreach (var line in newdata)
             {
                 var   lineSplit = Regex.Matches(line, "([^|]+)");
                 float num3      = float.Parse(lineSplit[0].Value);
                 float num4      = float.Parse(lineSplit[1].Value);
                 long  num5      = long.Parse(lineSplit[2].Value);
                 long  num6;
                 if (num == 0L)
                 {
                     num2 = num5;
                     num6 = num5;
                 }
                 else
                 {
                     num6 = num2 + num5;
                     if (num6 != num2)
                     {
                         num2 = num6;
                     }
                 }
                 num += num6;
                 num5 = num;
                 finaldata.Add(num3 + "|" + num4 + "|" + num5);
             }
         }
         else
         {
             finaldata = newdata.ToList();
         }
         List <decimal> times     = new List <decimal>();
         List <decimal> timesf    = new List <decimal>();
         List <string>  locations = new List <string>();
         foreach (var line in finaldata)
         {
             var lineSplit = Regex.Matches(line, "([^|]+)");
             location = lineSplit[0].Value + "|" + lineSplit[1].Value;
             time     = decimal.Parse(lineSplit[2].Value);
             if (BH)
             {
                 if (location != prevlocation)
                 {
                     times.Add(time);
                     locations.Add(location);
                 }
             }
             else
             {
                 if (location != prevlocation)
                 {
                     output += "," + location + "|" + time;
                 }
             }
             prevlocation = location;
         }
         if (BH)
         {
             for (int i = 0; i < times.Count; i++)
             {
                 time = times[i];
                 if (i >= 1)
                 {
                     time -= 2 * times[i - 1];
                 }
                 if (i >= 2)
                 {
                     time += times[i - 2];
                 }
                 timesf.Add(time);
             }
             for (int i = 0; i < timesf.Count; i++)
             {
                 output += "," + locations[i] + "|" + timesf[i];
             }
         }
         Output.Text = output;
     }
     catch
     {
     }
 }
示例#14
0
 private void Convert_Click(object sender, EventArgs e)
 {
     try
     {
         string          data = Input.Text;
         SecureWebClient wc   = new SecureWebClient();
         try
         {
             while (true)
             {
                 data = wc.DownloadString(data);
             }
         }
         catch { }
         int    rep     = data.IndexOf(",");
         string audioID = data.Substring(0, rep);
         data = data.Replace(audioID + ",", "");
         decimal        x;
         decimal        y;
         int            timec = 0;
         decimal        location;
         decimal        time;
         string         output  = audioID;
         string[]       newdata = data.Split(',');
         List <decimal> times   = new List <decimal>();
         foreach (var line in newdata)
         {
             var lineSplit = Regex.Matches(line, "([^|]+)");
             time = decimal.Parse(lineSplit[2].Value);
             times.Add(time);
         }
         foreach (var line in newdata)
         {
             var lineSplit = Regex.Matches(line, "([^|]+)");
             x    = decimal.Parse(lineSplit[0].Value);
             y    = decimal.Parse(lineSplit[1].Value);
             time = times[timec];
             if (timec - 1 >= 0)
             {
                 time -= 2 * times[timec - 1];
             }
             if (timec - 2 >= 0)
             {
                 time += times[timec - 2];
             }
             location = x + y;
             if (location > 4)
             {
                 location = 4;
             }
             else if (location < 0)
             {
                 location = 0;
             }
             output += "," + location.ToString().Replace(",", ".") + "|0|" + time;
             timec  += 1;
         }
         Output.Text = output;
     }
     catch
     {
     }
 }
示例#15
0
 private void Start_Click(object sender, EventArgs e)
 {
     try
     {
         string          data = Input.Text;
         SecureWebClient wc   = new SecureWebClient();
         try
         {
             while (true)
             {
                 data = wc.DownloadString(data);
             }
         }
         catch
         {
         }
         data = data.Replace(data.Substring(0, data.IndexOf(',')), "");
         string[]      newdata   = data.Split(',');
         List <string> finaldata = new List <string>();
         bool          BH        = CheckBH(newdata);
         if (BH)
         {
             long num  = 0L;
             long num2 = 0L;
             foreach (var line in newdata)
             {
                 var   lineSplit = Regex.Matches(line, "([^|]+)");
                 float num3      = float.Parse(lineSplit[0].Value);
                 float num4      = float.Parse(lineSplit[1].Value);
                 long  num5      = long.Parse(lineSplit[2].Value);
                 long  num6;
                 if (num == 0L)
                 {
                     num2 = num5;
                     num6 = num5;
                 }
                 else
                 {
                     num6 = num2 + num5;
                     if (num6 != num2)
                     {
                         num2 = num6;
                     }
                 }
                 num += num6;
                 num5 = num;
                 finaldata.Add(num3 + "|" + num4 + "|" + num5);
             }
         }
         else
         {
             finaldata = newdata.ToList();
         }
         decimal total = 0;
         decimal time;
         decimal time2;
         decimal highest = 0;
         if (decimal.TryParse(SectionStart.Text, out _) == false)
         {
             SectionStart.Text = "0";
         }
         if (decimal.TryParse(SectionEnd.Text, out _) == false)
         {
             SectionEnd.Text = "0";
         }
         List <decimal> totals = new List <decimal>();
         for (int i = 1; i < finaldata.Count; i++)
         {
             if (i > 1)
             {
                 var lineSplit = Regex.Matches(finaldata[i], "([^|]+)");
                 time = decimal.Parse(lineSplit[2].Value);
                 var lineSplit2 = Regex.Matches(finaldata[i - 1], "([^|]+)");
                 time2 = decimal.Parse(lineSplit2[2].Value);
                 if (SetLimits.Checked == true)
                 {
                     if (time2 >= decimal.Parse(SectionStart.Text) && time <= decimal.Parse(SectionEnd.Text))
                     {
                         decimal diff = 1000 / (time - time2);
                         totals.Add(diff);
                         if (diff > highest)
                         {
                             highest = diff;
                         }
                     }
                 }
                 else
                 {
                     if (time2 != time)
                     {
                         decimal diff = 1000 / (time - time2);
                         totals.Add(diff);
                         if (diff > highest)
                         {
                             highest = diff;
                         }
                     }
                 }
             }
         }
         foreach (var item in totals)
         {
             total += item;
         }
         total /= totals.Count;
         if (AvgNPS.Checked == true)
         {
             Output.Text = Math.Round(total, 2).ToString();
         }
         else
         {
             Output.Text = Math.Round(highest, 2).ToString();
         }
     }
     catch
     {
         Output.Text = "0";
     }
 }
示例#16
0
 private void Stack_Click(object sender, EventArgs e)
 {
     if (Spacing.Text == "" || !double.TryParse(Spacing.Text, out _))
     {
         Spacing.Text = "0";
     }
     if (UseBPM.Checked && (BPM.Text == "" || !double.TryParse(BPM.Text, out _)))
     {
         BPM.Text = "100";
     }
     if (int.TryParse(Spacing.Text, out _))
     {
         try
         {
             string          data = Input.Text;
             SecureWebClient wc   = new SecureWebClient();
             try
             {
                 while (true)
                 {
                     data = wc.DownloadString(data);
                 }
             }
             catch
             {
             }
             string output = data.Substring(0, data.IndexOf(','));
             data = data.Replace(output + ",", "");
             decimal        x;
             decimal        y;
             decimal        time;
             string[]       newdata   = data.Split(',');
             List <string>  finaldata = new List <string>();
             List <decimal> times     = new List <decimal>();
             List <decimal> timesf    = new List <decimal>();
             List <string>  locations = new List <string>();
             bool           BH        = CheckBH(newdata);
             if (BH)
             {
                 long num  = 0L;
                 long num2 = 0L;
                 foreach (var line in newdata)
                 {
                     var   lineSplit = Regex.Matches(line, "([^|]+)");
                     float num3      = float.Parse(lineSplit[0].Value);
                     float num4      = float.Parse(lineSplit[1].Value);
                     long  num5      = long.Parse(lineSplit[2].Value);
                     long  num6;
                     if (num == 0L)
                     {
                         num2 = num5;
                         num6 = num5;
                     }
                     else
                     {
                         num6 = num2 + num5;
                         if (num6 != num2)
                         {
                             num2 = num6;
                         }
                     }
                     num += num6;
                     num5 = num;
                     finaldata.Add(num3 + "|" + num4 + "|" + num5);
                 }
             }
             else
             {
                 finaldata = newdata.ToList();
             }
             foreach (var line in finaldata)
             {
                 var lineSplit = Regex.Matches(line, "([^|]+)");
                 x    = decimal.Parse(lineSplit[0].Value);
                 y    = decimal.Parse(lineSplit[1].Value);
                 time = decimal.Parse(lineSplit[2].Value);
                 if (!BH)
                 {
                     for (int i = 0; i < StackSize.Value; i++)
                     {
                         if (UseBPM.Checked)
                         {
                             output += "," + x + "|" + y + "|" + Math.Round(time + i * (60000 / decimal.Parse(BPM.Text) * decimal.Divide(1, Divisor.Value)));
                         }
                         else
                         {
                             output += "," + x + "|" + y + "|" + (time + i * int.Parse(Spacing.Text));
                         }
                     }
                 }
                 else
                 {
                     for (int i = 0; i < StackSize.Value; i++)
                     {
                         times.Add(time + i * int.Parse(Spacing.Text));
                         locations.Add(x + "|" + y);
                     }
                 }
             }
             if (BH)
             {
                 for (int i = 0; i < times.Count; i++)
                 {
                     time = times[i];
                     if (i >= 1)
                     {
                         time -= 2 * times[i - 1];
                     }
                     if (i >= 2)
                     {
                         time += times[i - 2];
                     }
                     timesf.Add(time);
                 }
                 for (int i = 0; i < timesf.Count; i++)
                 {
                     output += "," + locations[i] + "|" + timesf[i];
                 }
             }
             Output.Text = output;
         }
         catch
         {
         }
     }
 }
示例#17
0
 private void Examine_Click(object sender, EventArgs e)
 {
     try
     {
         string          data = Input.Text;
         SecureWebClient wc   = new SecureWebClient();
         try
         {
             while (true)
             {
                 data = wc.DownloadString(data);
             }
         }
         catch
         {
         }
         int    rep = data.IndexOf(',');
         int    m;
         int    mavg;
         bool   cont = true;
         bool   blacklisted;
         string reps = data.Substring(0, rep);
         data = data.Replace(reps + ",", "");
         string[]      newdata        = data.Split(',');
         List <string> compare        = new List <string>();
         List <string> matches        = new List <string>();
         List <string> usednotes      = new List <string>();
         List <int>    indexblacklist = new List <int>();
         string        comparison;
         string        compares = "";
         foreach (var line in newdata)
         {
             rep  = line.LastIndexOf('|');
             reps = line.Substring(0, rep);
             compare.Add(reps);
             compares += "," + reps;
         }
         compares = compares.Substring(1, compares.Length - 1);
         for (int i = 0; i < compare.Count; i++)
         {
             if (!usednotes.Contains(compare[i]))
             {
                 List <int> indexlist = new List <int>();
                 for (int j = 0; j < compare.Count; j++)
                 {
                     if (j > i && compare[i] == compare[j])
                     {
                         indexlist.Add(j);
                     }
                 }
                 for (int l = 0; l < indexlist.Count; l++)
                 {
                     blacklisted = false;
                     for (int n = 0; n < indexblacklist.Count; n++)
                     {
                         if (indexblacklist[n] == indexlist[l])
                         {
                             blacklisted = true;
                         }
                     }
                     if (blacklisted == false)
                     {
                         comparison = compare[i];
                         cont       = true;
                         for (int j = indexlist[l]; j + 1 < compare.Count && cont == true; j++)
                         {
                             comparison += "," + compare[j + 1];
                             int count = 0;
                             int a     = 0;
                             while ((a = compares.IndexOf(comparison, a)) != -1)
                             {
                                 a += comparison.Length;
                                 count++;
                             }
                             if (count == 1)
                             {
                                 cont = false;
                                 matches.Add(comparison.Substring(0, comparison.Length - compare[j].Length));
                             }
                         }
                         indexblacklist.Add(l);
                     }
                 }
                 usednotes.Add(compare[i]);
             }
         }
         mavg        = 0;
         Output.Text = "";
         matches     = matches.Distinct().ToList();
         foreach (var item in matches)
         {
             mavg += item.Count(f => f == '|');
         }
         mavg /= matches.Count;
         m     = 0;
         foreach (var item in matches)
         {
             if (item.Count(f => f == '|') >= mavg)
             {
                 m += item.Count(f => f == '|');
             }
         }
         decimal percent = Math.Round(decimal.Divide(decimal.Divide(m, usednotes.Count), newdata.Count()) * 100, 2);
         if (percent > 100)
         {
             percent = 100;
         }
         Output.Text = "There is approximately a " + percent + "% chance there is some copy-and-paste in this map";
     }
     catch
     {
     }
 }
 private void Convert_Click(object sender, EventArgs e)
 {
     try
     {
         Output.Text = "";
         if (Speed.Text == "")
         {
             Speed.Text = "1";
         }
         string          data = Input.Text;
         SecureWebClient wc   = new SecureWebClient();
         try
         {
             while (true)
             {
                 data = wc.DownloadString(data);
             }
         }
         catch { }
         string  final;
         string  locations;
         decimal time;
         int     rep  = data.IndexOf(',');
         string  reps = data.Substring(0, rep);
         data  = data.Replace(reps + ",", "");
         final = reps;
         string         reps2;
         decimal        offset        = 0;
         string[]       newdata       = data.Split(',');
         List <string>  finaldata     = new List <string>();
         List <decimal> times         = new List <decimal>();
         List <decimal> timesf        = new List <decimal>();
         List <string>  locationslist = new List <string>();
         bool           BH            = CheckBH(newdata);
         if (BH)
         {
             long num  = 0L;
             long num2 = 0L;
             foreach (var line in newdata)
             {
                 var   lineSplit = Regex.Matches(line, "([^|]+)");
                 float num3      = float.Parse(lineSplit[0].Value);
                 float num4      = float.Parse(lineSplit[1].Value);
                 long  num5      = long.Parse(lineSplit[2].Value);
                 long  num6;
                 if (num == 0L)
                 {
                     num2 = num5;
                     num6 = num5;
                 }
                 else
                 {
                     num6 = num2 + num5;
                     if (num6 != num2)
                     {
                         num2 = num6;
                     }
                 }
                 num += num6;
                 num5 = num;
                 finaldata.Add(num3 + "|" + num4 + "|" + num5);
             }
         }
         else
         {
             finaldata = newdata.ToList();
         }
         if (LockOffset.Checked == true)
         {
             var lineSplit = Regex.Matches(newdata[0], "([^|]+)");
             offset = decimal.Parse(lineSplit[2].Value);
         }
         foreach (var line in finaldata)
         {
             rep       = line.LastIndexOf('|');
             reps      = line.Substring(0, rep + 1);
             locations = reps;
             reps2     = line.Replace(reps, "");
             reps2     = reps2.Replace("|", "");
             time      = decimal.Parse(reps2);
             time     -= offset;
             time     /= decimal.Parse(Speed.Text);
             time     += offset;
             time      = Math.Round(time);
             if (BH)
             {
                 locationslist.Add(locations);
                 times.Add(time);
             }
             else
             {
                 final += "," + locations + time;
             }
         }
         if (BH)
         {
             for (int i = 0; i < times.Count; i++)
             {
                 time = times[i];
                 if (i >= 1)
                 {
                     time -= 2 * times[i - 1];
                 }
                 if (i >= 2)
                 {
                     time += times[i - 2];
                 }
                 timesf.Add(time);
             }
             for (int i = 0; i < timesf.Count; i++)
             {
                 final += "," + locationslist[i] + timesf[i];
             }
         }
         Output.Text = final;
     }
     catch
     {
     }
 }
 private void Insert_Click(object sender, EventArgs e)
 {
     try
     {
         string          data = Input.Text;
         SecureWebClient wc   = new SecureWebClient();
         try
         {
             while (true)
             {
                 data = wc.DownloadString(data);
             }
         }
         catch
         {
         }
         string output = "";
         for (int k = 0; k < RepeatNumber.Value; k++)
         {
             if (output != "")
             {
                 data = output;
             }
             if (decimal.TryParse(SectionStart.Text, out _) == false)
             {
                 SectionStart.Text = "0";
             }
             if (decimal.TryParse(SectionEnd.Text, out _) == false)
             {
                 SectionEnd.Text = "0";
             }
             decimal x, y, time, x2 = 0, y2 = 0, time2 = 0, xf, yf, timef;
             output = data.Substring(0, data.IndexOf(','));
             data   = data.Replace(output + ",", "");
             string[]      newdata   = data.Split(',');
             List <string> finaldata = new List <string>();
             bool          BH        = CheckBH(newdata);
             if (BH)
             {
                 long num  = 0L;
                 long num2 = 0L;
                 foreach (var line in newdata)
                 {
                     var   lineSplit = Regex.Matches(line, "([^|]+)");
                     float num3      = float.Parse(lineSplit[0].Value);
                     float num4      = float.Parse(lineSplit[1].Value);
                     long  num5      = long.Parse(lineSplit[2].Value);
                     long  num6;
                     if (num == 0L)
                     {
                         num2 = num5;
                         num6 = num5;
                     }
                     else
                     {
                         num6 = num2 + num5;
                         if (num6 != num2)
                         {
                             num2 = num6;
                         }
                     }
                     num += num6;
                     num5 = num;
                     finaldata.Add(num3 + "|" + num4 + "|" + num5);
                 }
             }
             else
             {
                 finaldata = newdata.ToList();
             }
             List <decimal> times     = new List <decimal>();
             List <decimal> timesf    = new List <decimal>();
             List <string>  locations = new List <string>();
             for (int i = 0; i + 1 < newdata.Count(); i++)
             {
                 var lineSplit = Regex.Matches(newdata[i], "([^|]+)");
                 x    = decimal.Parse(lineSplit[0].Value);
                 y    = decimal.Parse(lineSplit[1].Value);
                 time = decimal.Parse(lineSplit[2].Value);
                 var lineSplit2 = Regex.Matches(newdata[i + 1], "([^|]+)");
                 x2    = decimal.Parse(lineSplit2[0].Value);
                 y2    = decimal.Parse(lineSplit2[1].Value);
                 time2 = decimal.Parse(lineSplit2[2].Value);
                 if (SetLimits.Checked == true)
                 {
                     if (time >= decimal.Parse(SectionStart.Text) && time2 <= decimal.Parse(SectionEnd.Text))
                     {
                         xf    = Math.Round((x2 + x) / 2, 2);
                         timef = Math.Round((time2 + time) / 2);
                         if (!BH)
                         {
                             yf      = Math.Round((y2 + y) / 2, 2);
                             output += "," + x + "|" + y + "|" + time + "," + xf + "|" + yf + "|" + timef;
                         }
                         else
                         {
                             locations.Add(x + "|" + y + "|");
                             times.Add(time);
                             locations.Add(xf + "|" + y + "|");
                             times.Add(timef);
                         }
                     }
                 }
                 else
                 {
                     xf    = Math.Round((x2 + x) / 2, 2);
                     timef = Math.Round((time2 + time) / 2);
                     if (!BH)
                     {
                         yf      = Math.Round((y2 + y) / 2, 2);
                         output += "," + x + "|" + y + "|" + time + "," + xf + "|" + yf + "|" + timef;
                     }
                     else
                     {
                         locations.Add(x + "|" + y + "|");
                         times.Add(time);
                         locations.Add(xf + "|" + y + "|");
                         times.Add(timef);
                     }
                 }
             }
             if (!BH)
             {
                 output += "," + x2 + "|" + y2 + "|" + time2;
             }
             else
             {
                 locations.Add(x2 + "|" + y2 + "|");
                 times.Add(time2);
                 for (int i = 0; i < times.Count; i++)
                 {
                     time = times[i];
                     if (i >= 1)
                     {
                         time -= 2 * times[i - 1];
                     }
                     if (i >= 2)
                     {
                         time += times[i - 2];
                     }
                     timesf.Add(time);
                 }
                 for (int i = 0; i < timesf.Count; i++)
                 {
                     output += "," + locations[i] + timesf[i];
                 }
             }
             if (k == RepeatNumber.Value - 1)
             {
                 Output.Text = output;
             }
         }
     }
     catch
     {
     }
 }
示例#20
0
 private void Randomize_Click(object sender, EventArgs e)
 {
     try
     {
         Output.Text = "";
         string          data = Input.Text;
         SecureWebClient wc   = new SecureWebClient();
         try
         {
             while (true)
             {
                 data = wc.DownloadString(data);
             }
         }
         catch { }
         decimal x;
         decimal y;
         decimal time;
         int     rep;
         string  reps;
         decimal offgridX = 0;
         decimal offgridY = 0;
         if (decimal.Parse(OffgridValue.Text) > decimal.Divide(85, 100))
         {
             OffgridValue.Text = "0.85";
         }
         if (decimal.Parse(OffgridValue.Text) < 0)
         {
             OffgridValue.Text = "0";
         }
         rep  = data.IndexOf(',');
         reps = data.Substring(0, rep);
         string   output = reps;
         string[] newdata;
         var      rand = new Random();
         data    = data.Replace(reps, "");
         data    = data.Substring(1, data.Length - 1);
         newdata = data.Split(',');
         if (!CheckBH(newdata))
         {
             foreach (var line in newdata)
             {
                 var lineSplit = Regex.Matches(line, "([^|]+)");
                 x    = decimal.Parse(lineSplit[0].Value);
                 y    = decimal.Parse(lineSplit[1].Value);
                 time = decimal.Parse(lineSplit[2].Value);
                 if (Quantum.Checked == true)
                 {
                     if (KeepOffgrid.Checked == true)
                     {
                         if (x < 0)
                         {
                             offgridX = -1 * x;
                         }
                         else if (x > 2)
                         {
                             offgridX = x - 2;
                         }
                         else
                         {
                             offgridX = 0;
                         }
                         if (y < 0)
                         {
                             offgridY = -1 * y;
                         }
                         else if (y > 2)
                         {
                             offgridY = y - 2;
                         }
                         else
                         {
                             offgridY = 0;
                         }
                     }
                     x = rand.Next(0, 2001);
                     x = decimal.Divide(x, 1000);
                     y = rand.Next(0, 2001);
                     y = decimal.Divide(y, 1000);
                     if (Offgrid.Checked == true)
                     {
                         x = (x * ((2 * decimal.Parse(OffgridValue.Text)) + 2) / 2) - decimal.Parse(OffgridValue.Text);
                         y = (y * ((2 * decimal.Parse(OffgridValue.Text)) + 2) / 2) - decimal.Parse(OffgridValue.Text);
                     }
                     if (KeepOffgrid.Checked == true)
                     {
                         if (x >= 1 && offgridX != 0)
                         {
                             x = 2 + offgridX;
                         }
                         else if (x < 1 && offgridX != 0)
                         {
                             x = 0 - offgridX;
                         }
                         if (y >= 1 && offgridY != 0)
                         {
                             y = 2 + offgridY;
                         }
                         else if (y < 1 && offgridY != 0)
                         {
                             y = 0 - offgridY;
                         }
                     }
                     x = Math.Round(x, 2);
                     y = Math.Round(y, 2);
                 }
                 else
                 {
                     if (KeepOffgrid.Checked == true)
                     {
                         if (x < 0)
                         {
                             offgridX = -1 * x;
                         }
                         else if (x > 2)
                         {
                             offgridX = x - 2;
                         }
                         else
                         {
                             offgridX = 0;
                         }
                         if (y < 0)
                         {
                             offgridY = -1 * y;
                         }
                         else if (y > 2)
                         {
                             offgridY = y - 2;
                         }
                         else
                         {
                             offgridY = 0;
                         }
                     }
                     x = rand.Next(0, 3);
                     y = rand.Next(0, 3);
                     if (Offgrid.Checked == true)
                     {
                         x = (x * ((2 * decimal.Parse(OffgridValue.Text)) + 2) / 2) - decimal.Parse(OffgridValue.Text);
                         y = (y * ((2 * decimal.Parse(OffgridValue.Text)) + 2) / 2) - decimal.Parse(OffgridValue.Text);
                     }
                     if (KeepOffgrid.Checked == true)
                     {
                         if (x >= 1 && offgridX != 0)
                         {
                             x = 2 + offgridX;
                         }
                         else if (x < 1 && offgridX != 0)
                         {
                             x = 0 - offgridX;
                         }
                         if (y >= 1 && offgridY != 0)
                         {
                             y = 2 + offgridY;
                         }
                         else if (y < 1 && offgridY != 0)
                         {
                             y = 0 - offgridY;
                         }
                     }
                 }
                 output += "," + x + "|" + y + "|" + time;
             }
         }
         else
         {
             foreach (var line in newdata)
             {
                 var lineSplit = Regex.Matches(line, "([^|]+)");
                 x    = decimal.Parse(lineSplit[0].Value);
                 y    = decimal.Parse(lineSplit[1].Value);
                 time = decimal.Parse(lineSplit[2].Value);
                 if (KeepOffgrid.Checked == true)
                 {
                     if (x < 0)
                     {
                         offgridX = -1 * x;
                     }
                     else if (x > 4)
                     {
                         offgridX = x - 4;
                     }
                     else
                     {
                         offgridX = 0;
                     }
                 }
                 if (Quantum.Checked)
                 {
                     x  = rand.Next(0, 4001);
                     x /= 1000;
                 }
                 else
                 {
                     x = rand.Next(0, 5);
                 }
                 if (x >= 2 && offgridX != 0)
                 {
                     x = 4 + offgridX;
                 }
                 else if (x < 2 && offgridX != 0)
                 {
                     x = 0 - offgridX;
                 }
                 if (Offgrid.Checked == true)
                 {
                     x = x * ((decimal.Parse(OffgridValue.Text) + 2) / 2) - decimal.Parse(OffgridValue.Text);
                 }
                 output += "," + x + "|" + y + "|" + time;
             }
         }
         Output.Text = output;
     }
     catch
     {
     }
 }
示例#21
0
        private void Convert_Click(object sender, EventArgs e)
        {
            try
            {
                Output.Text = "";
                string          data = Input.Text;
                SecureWebClient wc   = new SecureWebClient();
                try
                {
                    while (true)
                    {
                        data = wc.DownloadString(data);
                    }
                }
                catch { }
                decimal x;
                decimal y;
                string  xy;
                int     note    = 0;
                int     noteCap = 0;
                if (SetCap.Checked == true)
                {
                    if (Cap.Text == "")
                    {
                        noteCap = 0;
                    }
                    else
                    {
                        noteCap = int.Parse(Cap.Text);
                    }
                }
                int      rep;
                string   reps;
                string   letter = "";
                string   output = "";
                string[] newdata;
                rep     = data.IndexOf(',');
                reps    = data.Substring(0, rep);
                data    = data.Replace(reps, "");
                data    = data.Substring(1, data.Length - 1);
                newdata = data.Split(',');
                bool BH = CheckBH(newdata);
                foreach (var line in newdata)
                {
                    var lineSplit = Regex.Matches(line, "([^|]+)");
                    x = Math.Round(decimal.Parse(lineSplit[0].Value));
                    y = Math.Round(decimal.Parse(lineSplit[1].Value));
                    if (BH)
                    {
                        if (x < 0)
                        {
                            x = 0;
                        }
                        if (x > 4)
                        {
                            x = 4;
                        }
                    }
                    else
                    {
                        if (x < 0)
                        {
                            x = 0;
                        }
                        else if (x > 2)
                        {
                            x = 2;
                        }
                        if (y < 0)
                        {
                            y = 0;
                        }
                        else if (y > 2)
                        {
                            y = 2;
                        }
                    }
                    xy = x.ToString() + y.ToString();
                    if (SetCap.Checked == false || note < noteCap)
                    {
                        if (!BH)
                        {
                            switch (xy)
                            {
                            case "22":
                                letter = "Q";
                                break;

                            case "12":
                                letter = "W";
                                break;

                            case "02":
                                letter = "E";
                                break;

                            case "21":
                                letter = "A";
                                break;

                            case "11":
                                letter = "S";
                                break;

                            case "01":
                                letter = "D";
                                break;

                            case "20":
                                letter = "Z";
                                break;

                            case "10":
                                letter = "X";
                                break;

                            case "00":
                                letter = "C";
                                break;
                            }
                        }
                        else
                        {
                            switch (x)
                            {
                            case 0:
                                letter = "Q";
                                break;

                            case 1:
                                letter = "W";
                                break;

                            case 2:
                                letter = "E";
                                break;

                            case 3:
                                letter = "R";
                                break;

                            case 4:
                                letter = "T";
                                break;
                            }
                        }
                        output += letter;
                        if (Spaces.Checked == true)
                        {
                            output += " ";
                        }
                    }
                    note += 1;
                }
                if (Capitals.Checked != true)
                {
                    output = output.ToLower();
                }
                Output.Text = output;
            }
            catch
            {
            }
        }
 private void MP3_Click(object sender, EventArgs e)
 {
     if (audioID.Text != "")
     {
         string          data = audioID.Text;
         string          id;
         SecureWebClient wc = new SecureWebClient();
         if (data.Contains("."))
         {
             try
             {
                 while (true)
                 {
                     data = wc.DownloadString(data);
                 }
             }
             catch
             {
             }
         }
         if (data.Contains(","))
         {
             id = data.Substring(0, data.IndexOf(','));
         }
         else
         {
             id = data;
         }
         string filename;
         if (CatalogName.Checked == true)
         {
             string url      = "https://www.roblox.com/library/" + id;
             string finalurl = GetFinalRedirect(url);
             filename = finalurl.Substring(finalurl.LastIndexOf('/') + 1, finalurl.Length - finalurl.LastIndexOf('/') - 1);
             filename = filename.Replace("-", " ");
         }
         else
         {
             filename = FileName.Text;
         }
         string directory = Directory.GetCurrentDirectory();
         try
         {
             using (wc = new SecureWebClient())
             {
                 if (filename != "" && !File.Exists(directory + "\\" + filename + ".mp3"))
                 {
                     try
                     {
                         wc.DownloadFile("https://assetdelivery.roblox.com/v1/asset/?id=" + id, directory + "\\" + filename + ".mp3");
                     }
                     catch
                     {
                         wc.DownloadFile("https://assetdelivery.roblox.com/v1/asset/?id=" + id, directory + "\\" + id + ".mp3");
                     }
                     MessageBox.Show("Successfully downloaded audio at " + directory);
                 }
                 else if (!File.Exists(directory + "\\" + id + ".mp3"))
                 {
                     wc.DownloadFile("https://assetdelivery.roblox.com/v1/asset/?id=" + id, directory + "\\" + id + ".mp3");
                     MessageBox.Show("Successfully downloaded audio at " + directory);
                 }
                 else
                 {
                     MessageBox.Show("Audio already downloaded!");
                 }
             }
         }
         catch
         {
             MessageBox.Show("Failed to download audio with id: " + id, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
示例#23
0
 private void Quantize_Click(object sender, EventArgs e)
 {
     if (Input.Text != "" && BPM.Text != "")
     {
         string          data = Input.Text;
         SecureWebClient wc   = new SecureWebClient();
         try
         {
             while (true)
             {
                 data = wc.DownloadString(data);
             }
         }
         catch { }
         string  xs;
         string  ys;
         decimal time;
         decimal bpm      = decimal.Parse(BPM.Text);
         decimal?offset   = null;
         decimal final    = decimal.Parse(data.Replace(data.Substring(0, data.LastIndexOf("|") + 1), ""));
         decimal current  = 0;
         int     divisor  = Divisor.Value;
         decimal interval = 60000 / bpm / divisor;
         int     rep      = data.IndexOf(",");
         string  output   = data.Substring(0, rep);
         data = data.Replace(output + ",", "");
         string[]       newdata   = data.Split(',');
         List <string>  finaldata = new List <string>();
         List <decimal> times     = new List <decimal>();
         List <decimal> timesf    = new List <decimal>();
         List <string>  locations = new List <string>();
         bool           BH        = CheckBH(newdata);
         if (BH)
         {
             long num  = 0L;
             long num2 = 0L;
             foreach (var line in newdata)
             {
                 var   lineSplit = Regex.Matches(line, "([^|]+)");
                 float num3      = float.Parse(lineSplit[0].Value);
                 float num4      = float.Parse(lineSplit[1].Value);
                 long  num5      = long.Parse(lineSplit[2].Value);
                 long  num6;
                 if (num == 0L)
                 {
                     num2 = num5;
                     num6 = num5;
                 }
                 else
                 {
                     num6 = num2 + num5;
                     if (num6 != num2)
                     {
                         num2 = num6;
                     }
                 }
                 num += num6;
                 num5 = num;
                 finaldata.Add(num3 + "|" + num4 + "|" + num5);
             }
         }
         else
         {
             finaldata = newdata.ToList();
         }
         List <decimal> intervals = new List <decimal>();
         foreach (var line in newdata)
         {
             var lineSplit = Regex.Matches(line, "([^|]+)");
             Console.WriteLine(lineSplit[2].Value);
             time = decimal.Parse(lineSplit[2].Value);
             if (offset == null)
             {
                 offset = time;
             }
         }
         current += (decimal)offset;
         final   += (decimal)offset;
         intervals.Add((decimal)offset);
         while (current < final)
         {
             current += interval;
             intervals.Add(current);
         }
         foreach (var line in newdata)
         {
             var lineSplit = Regex.Matches(line, "([^|]+)");
             xs   = lineSplit[0].Value;
             ys   = lineSplit[1].Value;
             time = decimal.Parse(lineSplit[2].Value);
             time = Math.Round(intervals.Aggregate((x, y) => Math.Abs(x - time) < Math.Abs(y - time) ? x : y));
             if (BH)
             {
                 times.Add(time);
                 locations.Add(xs + "|" + ys + "|");
             }
             else
             {
                 output += "," + xs + "|" + ys + "|" + time;
             }
         }
         if (BH)
         {
             for (int i = 0; i < times.Count; i++)
             {
                 time = times[i];
                 if (i >= 1)
                 {
                     time -= 2 * times[i - 1];
                 }
                 if (i >= 2)
                 {
                     time += times[i - 2];
                 }
                 timesf.Add(time);
             }
             for (int i = 0; i < timesf.Count; i++)
             {
                 output += "," + locations[i] + timesf[i];
             }
         }
         Output.Text = output;
     }
 }
        private void Convert_Click(object sender, EventArgs e)
        {
            if (Offset.Text == "")
            {
                Offset.Text = "0";
            }
            if (Author.Text != "" && Title.Text != "" && BPM.Text != "" && Input.Text != "")
            {
                string          data = Input.Text;
                SecureWebClient wc   = new SecureWebClient();
                try
                {
                    while (true)
                    {
                        data = wc.DownloadString(data);
                    }
                }
                catch
                {
                }
                string id        = data.Substring(0, data.IndexOf(','));
                string directory = Directory.GetCurrentDirectory();
                data = data.Replace(id + ",", "");
                string[] newdata = data.Split(',');
                decimal  x;
                decimal  y;
                decimal  x2;
                decimal  y2;
                decimal  time;
                int      i    = 1;
                decimal  xmax = -50;
                decimal  xmin = 50;
                decimal  ymax = -50;
                decimal  ymin = 50;
                int      type;
                int      direction = 0;
                string   xyxy;
                string   filename = "\\" + Author.Text + " - " + Title.Text;
                var      rand     = new Random();
                decimal  offset   = decimal.Parse(Offset.Text);
                try
                {
                    if (!Directory.Exists(directory + filename))
                    {
                        Directory.CreateDirectory(directory + filename);
                    }
                    directory += filename;
                    if (!File.Exists(directory + "\\" + id + ".egg"))
                    {
                        using (wc = new SecureWebClient())
                        {
                            wc.DownloadFile("https://assetdelivery.roblox.com/v1/asset/?id=" + id, directory + "\\" + id + ".egg");
                        }
                    }
                    if (!File.Exists(directory + "\\cover.jpg"))
                    {
                        using (wc = new SecureWebClient())
                        {
                            wc.DownloadFile("https://raw.githubusercontent.com/Avibah/Sound-Space-Multi-Tool/accompanying-files/cover.jpeg", directory + "\\cover.jpg");
                        }
                    }
                    try
                    {
                        decimal bpm = decimal.Parse(BPM.Text);
                        if (bpm == 0)
                        {
                            bpm = 100;
                        }
                        foreach (var line in newdata)
                        {
                            var lineSplit = Regex.Matches(line, "([^|]+)");
                            x = decimal.Parse(lineSplit[0].Value);
                            y = decimal.Parse(lineSplit[1].Value);
                            if (x > xmax)
                            {
                                xmax = x;
                            }
                            if (x < xmin)
                            {
                                xmin = x;
                            }
                            if (y > ymax)
                            {
                                ymax = y;
                            }
                            if (y < ymin)
                            {
                                ymin = y;
                            }
                        }
                        xmax -= xmin;
                        ymax -= ymin;
                        if (xmax == 0)
                        {
                            xmax = 1;
                        }
                        if (ymax == 0)
                        {
                            ymax = 1;
                        }
                        string output = "{\"_version\":\"2.0.0\",\"_customData\":{\"_time\":0,\"_BPMChanges\":[],\"_bookmarks\":[]},\"_events\":[],\"_notes\":[";
                        foreach (var line in newdata)
                        {
                            if (i != 1)
                            {
                                output += ",";
                            }
                            var lineSplit = Regex.Matches(line, "([^|]+)");
                            x    = decimal.Parse(lineSplit[0].Value);
                            y    = decimal.Parse(lineSplit[1].Value);
                            time = decimal.Parse(lineSplit[2].Value);
                            if (ApplyOffset.Checked == true)
                            {
                                time += offset;
                            }
                            x -= xmin;
                            x  = x * 2 / xmax;
                            y -= ymin;
                            y  = y * 2 / ymax;
                            if (Directions.Checked == true)
                            {
                                if (i >= newdata.Length)
                                {
                                    xyxy = Math.Round(x).ToString() + Math.Round(y).ToString();
                                    var lineSplit2 = Regex.Matches(newdata[i - 2], "([^|]+)");
                                    x2    = decimal.Parse(lineSplit2[0].Value);
                                    y2    = decimal.Parse(lineSplit2[1].Value);
                                    xyxy += Math.Round(x2).ToString() + Math.Round(y2).ToString();
                                }
                                else
                                {
                                    xyxy = Math.Round(x).ToString() + Math.Round(y).ToString();
                                    var lineSplit2 = Regex.Matches(newdata[i], "([^|]+)");
                                    x2    = decimal.Parse(lineSplit2[0].Value);
                                    y2    = decimal.Parse(lineSplit2[1].Value);
                                    xyxy += Math.Round(x2).ToString() + Math.Round(y2).ToString();
                                }
                                switch (xyxy)
                                {
                                case "2000":
                                case "2010":
                                case "2101":
                                case "2111":
                                case "2202":
                                case "2212":
                                case "1000":
                                case "1101":
                                case "1202":
                                    direction = 2;
                                    break;

                                case "0001":
                                case "0002":
                                case "1011":
                                case "1012":
                                case "2021":
                                case "2022":
                                case "0102":
                                case "1112":
                                case "2122":
                                    direction = 1;
                                    break;

                                case "0200":
                                case "0201":
                                case "1210":
                                case "1211":
                                case "2220":
                                case "2221":
                                case "0100":
                                case "1110":
                                case "2120":
                                    direction = 0;
                                    break;

                                case "0210":
                                case "0220":
                                case "0211":
                                case "0221":
                                case "1120":
                                case "1221":
                                case "1220":
                                case "0110":
                                case "0120":
                                    direction = 5;
                                    break;

                                case "2200":
                                case "2201":
                                case "2211":
                                case "2210":
                                case "1100":
                                case "2100":
                                case "2110":
                                case "1200":
                                case "1201":
                                    direction = 4;
                                    break;

                                case "0010":
                                case "0020":
                                case "0111":
                                case "0121":
                                case "0212":
                                case "0222":
                                case "1020":
                                case "1121":
                                case "1222":
                                    direction = 3;
                                    break;

                                case "0000":
                                case "0101":
                                case "0202":
                                case "1010":
                                case "1111":
                                case "1212":
                                case "2020":
                                case "2121":
                                case "2222":
                                    direction = 8;
                                    break;

                                case "0011":
                                case "0021":
                                case "0012":
                                case "0022":
                                case "0112":
                                case "0122":
                                case "1021":
                                case "1022":
                                case "1122":
                                    direction = 7;
                                    break;

                                case "2011":
                                case "2001":
                                case "2012":
                                case "2002":
                                case "1001":
                                case "1002":
                                case "1102":
                                case "2112":
                                case "2102":
                                    direction = 6;
                                    break;
                                }
                            }
                            else
                            {
                                direction = 8;
                            }
                            x = x * -1 + 2;
                            if (rand.Next(0, 2) == 1)
                            {
                                x *= 2000;
                            }
                            else
                            {
                                x = x * 2000 + 1000;
                            }
                            if (i % 2 == 0)
                            {
                                type = 1;
                            }
                            else
                            {
                                type = 0;
                            }
                            y     = y * 1000 + 1000;
                            x     = Math.Round(x);
                            y     = Math.Round(y);
                            time /= 60000 / bpm;
                            time  = Math.Round(time, 6);

                            output += "{\"_time\":" + time + ",\"_lineIndex\":" + x + ",\"_lineLayer\":" + y + ",\"_type\":" + type + ",\"_cutDirection\":" + direction + "}";
                            i      += 1;
                        }
                        output += "],\"_obstacles\":[]}";
                        using (FileStream fs = File.Create(directory + "\\" + "Easy.dat"))
                        {
                            byte[] info = new UTF8Encoding(true).GetBytes(output);
                            fs.Write(info, 0, info.Length);
                        }
                        output = "{\n  \"_version\": \"2.0.0\",\n  \"_songName\": \"" + Title.Text + "\",\n  \"_songSubName\": \"\",\n  \"_songAuthorName\": \"" + Author.Text + "\",\n  \"_levelAuthorName\": \"djk\",\n  \"_beatsPerMinute\": " + BPM.Text + ",\n  \"_songTimeOffset\": 0,\n  \"_shuffle\": 0,\n  \"_shufflePeriod\": 0.5,\n  \"_previewStartTime\": 20,\n  \"_previewDuration\": 10,\n  \"_songFilename\": \"" + id + ".egg\",\n  \"_coverImageFilename\": \"cover.jpg\",\n  \"_environmentName\": \"BigMirrorEnvironment\",\n  \"_difficultyBeatmapSets\": [\n    {\n      \"_beatmapCharacteristicName\": \"Standard\",\n      \"_difficultyBeatmaps\": [\n        {\n          \"_difficulty\": \"Easy\",\n          \"_difficultyRank\": 1,\n          \"_beatmapFilename\": \"Easy.dat\",\n          \"_noteJumpMovementSpeed\": 18,\n          \"_noteJumpStartBeatOffset\": 0,\n          \"_customData\": {\n            \"_requirements\": [\n              \"Mapping Extensions\"\n            ]\n          }\n        }\n      ]\n    }\n  ]\n}";
                        using (FileStream fs = File.Create(directory + "\\" + "info.dat"))
                        {
                            byte[] info = new UTF8Encoding(true).GetBytes(output);
                            fs.Write(info, 0, info.Length);
                        }
                        string zipPath = directory.Replace(filename, "") + filename + ".zip";
                        if (File.Exists(directory.Replace(filename, "") + filename + ".zip"))
                        {
                            File.Delete(directory.Replace(filename, "") + filename + ".zip");
                        }
                        ZipFile.CreateFromDirectory(directory, zipPath);
                        Directory.Delete(directory, true);
                        MessageBox.Show("Map successfully converted!");
                    }
                    catch
                    {
                    }
                }
                catch
                {
                    MessageBox.Show("Failed to download audio with id: " + id, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Make sure to fill in every empty box with the appropriate information");
            }
        }
        private void Convert_Click(object sender, EventArgs e)
        {
            try
            {
                string          data = Input.Text;
                SecureWebClient wc   = new SecureWebClient();
                try
                {
                    while (true)
                    {
                        data = wc.DownloadString(data);
                    }
                }
                catch
                {
                }
                string output = data.Substring(0, data.IndexOf(','));
                data = data.Replace(output + ",", "");
                string[]      newdata   = data.Split(',');
                List <string> finaldata = new List <string>();
                decimal       x;
                decimal       y = 0;
                decimal       time;
                decimal       check;
                var           rand = new Random();
                long          num  = 0L;
                long          num2 = 0L;
                foreach (var line in newdata)
                {
                    var   lineSplit = Regex.Matches(line, "([^|]+)");
                    float num3      = float.Parse(lineSplit[0].Value);
                    float num4      = float.Parse(lineSplit[1].Value);
                    long  num5      = long.Parse(lineSplit[2].Value);
                    long  num6;
                    if (num == 0L)
                    {
                        num2 = num5;
                        num6 = num5;
                    }
                    else
                    {
                        num6 = num2 + num5;
                        if (num6 != num2)
                        {
                            num2 = num6;
                        }
                    }
                    num += num6;
                    num5 = num;
                    finaldata.Add(num3 + "|" + num4 + "|" + num5);
                }
                foreach (var line in finaldata)
                {
                    var lineSplit = Regex.Matches(line, "([^|]+)");
                    x    = decimal.Parse(lineSplit[0].Value);
                    time = decimal.Parse(lineSplit[2].Value);
                    x    = Math.Round(x);
                    if (x > 4)
                    {
                        x = 4;
                    }
                    if (x < 0)
                    {
                        x = 0;
                    }
                    switch (x)
                    {
                    case 0:
                        x = 0;
                        y = 0;
                        break;

                    case 1:
                        check = rand.Next(0, 2);
                        if (check == 0)
                        {
                            x = 1;
                            y = 0;
                        }
                        else
                        {
                            x = 0;
                            y = 1;
                        }
                        break;

                    case 2:
                        check = rand.Next(0, 3);
                        if (check == 0)
                        {
                            x = 2;
                            y = 0;
                        }
                        else if (check == 1)
                        {
                            x = 1;
                            y = 1;
                        }
                        else
                        {
                            x = 0;
                            y = 2;
                        }
                        break;

                    case 3:
                        check = rand.Next(0, 2);
                        if (check == 0)
                        {
                            x = 2;
                            y = 1;
                        }
                        else
                        {
                            x = 1;
                            y = 2;
                        }
                        break;

                    case 4:
                        x = 2;
                        y = 2;
                        break;
                    }
                    output += "," + x + "|" + y + "|" + time;
                }
                Output.Text = output;
            }
            catch
            {
            }
        }