예제 #1
0
        private void Submission_Load(object sender, EventArgs e)
        {
            string staN = Path.GetFileNameWithoutExtension(RecInstance) == "" ? "" : Path.GetFileNameWithoutExtension(RecInstance);

            if (staN.Length > 30 && staN != "")
            {
                reclabel.Text = new string(staN.Take(30).ToArray()) + "..  .aoe2record";
            }
            else
            {
                reclabel.Text = staN + ".aoe2record";
            }

            RecINFO nfo  = new RecINFO();
            string  JSON = JsonConvert.SerializeObject(nfo);

            File.WriteAllText("rec.json", JSON);
        }
예제 #2
0
        private async void subreview_Click(object sender, EventArgs e)
        {
            subreview.Enabled = false;
            int chk = await Checkers();

            Core    rep = new Core();
            RecINFO nfo = new RecINFO();

            if (ticketcode.Text != "")
            {
                rep.trimKEY = EnSerial(ticketcode.Text);
                nfo.DeciKey = DecryptTicket(rep.trimKEY, "DERM8Z70");
                if (nfo.DeciKey == "")
                {
                    MessageBox.Show("Wrong ticket Key! Enter valid key!");
                    subreview.Enabled = true;
                    return;
                }


                string[] extPAR = nfo.DeciKey.Split(new string[] { "<+>AOE2BUILDS" }, StringSplitOptions.None);
                nfo.USERprem  = extPAR[0];
                nfo.SecretId  = extPAR[0] + ">" + extPAR[1];
                nfo.TicketKey = true;
            }

            //Uploading Replay
            //Fetch destination
            progressBar2.Value = 10;
            string RECname = Path.GetFileName(RecInstance).Replace(".aoe2record", ".derm");
            //string RECLic = Path.GetFileName(RecInstance).Replace(".aoe2record", ".pro");
            string RECDesc = Path.GetFileName(RecInstance).Replace(".aoe2record", ".json");
            string RECpath = System.IO.Path.GetTempPath() + @"\" + RECname;

            nfo.Title       = titlerec.Text;
            nfo.Description = subody.Text;
            nfo.Recname     = RECname;
            nfo.Nickname    = textBoxX1.Text;
            //Serialization
            string JSON = JsonConvert.SerializeObject(nfo);
            //Rec check

            bool IsAvail = await rep.IsRecExists(RECname);

            if (RECpath != null)
            {
                //Encode rec
                Core.CompressFileLZMA(RecInstance, System.IO.Path.GetTempPath() + Path.GetFileName(RecInstance).Replace(".aoe2record", ".derm"));
                //Upload rec
                var dbxz = new DropboxClient(rep._key);
                await Core.Upload(dbxz, "/derm", RECname, RECpath);

                progressBar2.Value = 50;
                //Upload License
                //if(nfo.SecretId != null && nfo.USERprem != null)
                //        await Core.UploadLic(dbxz, "/derm", RECLic, nfo.SecretId);
                //        progressBar2.Value = 70;
                //Upload Description

                await Core.UploadLic(dbxz, "/derm", RECDesc, JSON);

                progressBar2.Value = 100;
                //Mission complete?
                subreview.Enabled  = true;
                progressBar2.Value = 0;
                MessageBox.Show("Successfully Submitted!", "Success");
                this.Close();
            }
            else
            {
                MessageBox.Show("Replay magically disappeared! Try again."); subreview.Enabled = true;
            }
        }