Beispiel #1
0
    // Token: 0x0600003E RID: 62 RVA: 0x00007C60 File Offset: 0x00005E60
    public static async void smethod_3(object object_0, JSExtInvokeArgs jsextInvokeArgs_0)
    {
        Class5.Class7 @class = new Class5.Class7();
        @class.object_0 = object_0;
        try
        {
            Class5.Class8 class2 = new Class5.Class8();
            class2.class7_0       = @class;
            class2.notification_0 = Notification.smethod_0("Update Downloading (0%)", "You may continue to use the bot.", (Notification.GEnum0) 2, false);
            Notification.bool_0   = true;
            WebClient webClient = new WebClient();
            webClient.DownloadProgressChanged += class2.method_0;
            await webClient.DownloadFileTaskAsync((string)Class5.jobject_0["Update"]["Download"], Class5.string_0);

            Notification.bool_0 = false;
            Notification.smethod_0("Update downloaded", "Restart bot to install", (Notification.GEnum0) 0, false);
        }
        catch (WebException)
        {
            Notification.bool_0 = false;
            MainWindow.webView_0.QueueScriptCall("swal('Error while downloading update', 'There was an error downloading the update, please check your connection and try again', 'error')");
        }
        catch
        {
            Notification.bool_0 = false;
            MainWindow.webView_0.QueueScriptCall("swal('Error while extracting update', 'There was an error extracting the update, please close any application that may be using the applications directory and try again', 'error')");
        }
    }
Beispiel #2
0
        // Token: 0x06000047 RID: 71 RVA: 0x00007D38 File Offset: 0x00005F38
        void IAsyncStateMachine.MoveNext()
        {
            int num2;
            int num = num2;

            try
            {
                Class5.Class7 @class;
                if (num != 0)
                {
                    @class          = new Class5.Class7();
                    @class.object_0 = object_0;
                }
                try
                {
                    TaskAwaiter taskAwaiter;
                    if (num != 0)
                    {
                        Class5.Class8 class2 = new Class5.Class8();
                        class2.class7_0       = @class;
                        class2.notification_0 = Notification.smethod_0("Update Downloading (0%)", "You may continue to use the bot.", (Notification.GEnum0) 2, false);
                        Notification.bool_0   = true;
                        WebClient webClient = new WebClient();
                        webClient.DownloadProgressChanged += class2.method_0;
                        taskAwaiter = webClient.DownloadFileTaskAsync((string)Class5.jobject_0["Update"]["Download"], Class5.string_0).GetAwaiter();
                        if (!taskAwaiter.IsCompleted)
                        {
                            num2 = 0;
                            TaskAwaiter taskAwaiter2 = taskAwaiter;
                            this.asyncVoidMethodBuilder_0.AwaitUnsafeOnCompleted <TaskAwaiter, Class5.Struct4>(ref taskAwaiter, ref this);
                            return;
                        }
                    }
                    else
                    {
                        TaskAwaiter taskAwaiter2;
                        taskAwaiter  = taskAwaiter2;
                        taskAwaiter2 = default(TaskAwaiter);
                        num2         = -1;
                    }
                    taskAwaiter.GetResult();
                    Notification.bool_0 = false;
                    Notification.smethod_0("Update downloaded", "Restart bot to install", (Notification.GEnum0) 0, false);
                }
                catch (WebException)
                {
                    Notification.bool_0 = false;
                    MainWindow.webView_0.QueueScriptCall("swal('Error while downloading update', 'There was an error downloading the update, please check your connection and try again', 'error')");
                }
                catch
                {
                    Notification.bool_0 = false;
                    MainWindow.webView_0.QueueScriptCall("swal('Error while extracting update', 'There was an error extracting the update, please close any application that may be using the applications directory and try again', 'error')");
                }
            }
            catch (Exception exception)
            {
                num2 = -2;
                this.asyncVoidMethodBuilder_0.SetException(exception);
                return;
            }
            num2 = -2;
            this.asyncVoidMethodBuilder_0.SetResult();
        }