Ejemplo n.º 1
0
        private void MainWindow_Load(object sender, EventArgs e)
        {
            storeManager = new StoreManager(this); storeUploader = new StoreUploader(this); storeOptions = new StoreOptions();

            // Defaults
            cmbox_VersionType.SelectedIndex = 1;
            isWindowLoaded = true;

            txtbox_Console.AppendText("Store Version Uploader 1.0.3" + Environment.NewLine);
        }
Ejemplo n.º 2
0
        public void Execute(StoreOptions options)
        {
            Utils.InvokeOn(window.txtbox_APIKey, () => options.ApiKey = window.txtbox_APIKey.Text);
            Utils.InvokeOn(window.txtbox_Changelog, () => options.Changelog = window.txtbox_Changelog.Text);
            Utils.InvokeOn(window.cmbox_VersionType, () => options.VersionType = window.cmbox_VersionType.Text);
            Utils.InvokeOn(window.txtbox_Version, () => options.Version = window.txtbox_Version.Text);
            Utils.InvokeOn(window.txtbox_ProductId, () => options.ProductId = Convert.ToInt32(window.txtbox_ProductId.Text));


            Task.Run(() => UploadProduct(options)); window.UploadButtonUpdate("^.^", false);
        }
Ejemplo n.º 3
0
        private void UploadProduct(StoreOptions options)
        {
            Log("Uploading...");

            try
            {
                using (var webclient = new WebClient())
                {
                    webclient.UploadProgressChanged += Webclient_UploadProgressChanged;
                    webclient.UploadStringCompleted += Webclient_UploadStringCompleted;

                    webclient.Headers[HttpRequestHeader.ContentType] = "application/json";
                    webclient.UploadString(new Uri("https://store.buddyauth.com/api/restapi/submitversion"), JsonConvert.SerializeObject(options));
                }

                Log("Product successfully uploaded, compiling...");
            }
            catch (WebException wex)
            {
                Log("Something went wrong!");

                if (wex.Status == WebExceptionStatus.ProtocolError && wex.Response.GetResponseStream() != null)
                {
                    var serializer = new JsonSerializer();

                    using (var sr = new StreamReader(wex.Response.GetResponseStream()))
                    using (var jsonTextReader = new JsonTextReader(sr))
                    {
                        serializer.Deserialize(jsonTextReader);
                    }
                }
                else
                {
                    // wex out
                }
            }
        }
Ejemplo n.º 4
0
        private void MainWindow_Load(object sender, EventArgs e)
        {
            storeManager = new StoreManager(this); storeUploader = new StoreUploader(this); storeOptions = new StoreOptions();

            // Defaults
            cmbox_VersionType.SelectedIndex = 1;
            isWindowLoaded = true;

            txtbox_Console.AppendText("Store Version Uploader 1.0.3" + Environment.NewLine);
        }