Example #1
0
        private void UploadMenuClick(object sender, EventArgs e)
        {
            if (UploadDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    var bytes = File.ReadAllBytes(UploadDialog.FileName);
                    if (bytes.Length == 0 || bytes.Length > (short.MaxValue * 2) || bytes.Length % 2 != 0)
                    {
                        Interface.ShowMessage("Upload", "Invalid file size.");
                        return;
                    }

                    var shorts = new short[bytes.Length / 2];
                    Buffer.BlockCopy(bytes, 0, shorts, 0, bytes.Length);

                    var uploadPacket = new Network.Packets.Upload();
                    uploadPacket.Program = shorts;
                    Client.Send(uploadPacket);
                }
                catch (Exception er)
                {
                    Interface.ShowMessage("Upload", string.Format("Failed to upload program: {0}", er));
                }
            }
        }
Example #2
0
 private void OnDisable()
 {
     if (this.m_PackageController.IsUploading)
     {
         UploadDialog.CreateInstance(this.m_PackageController);
     }
     EditorApplication.update -= new EditorApplication.CallbackFunction(this.PackageControllerUpdatePump);
     AssetStoreManager.isOpen  = false;
 }
Example #3
0
        public void BeginUploads()
        {
            Log<UploadAction>.Debug ("Queue has {0} items", QueueLength);

            Services.Application.RunOnMainThread ( () => {
                dialog = new UploadDialog ();
                dialog.TotalUploads = QueueLength;
                dialog.Show ();
            });

            // Create and start a separate thread for each worker
            for (int i = 0; i < WorkerCount; i++)
                (uploaders [i] = new Thread (Consume)).Start ();
        }
Example #4
0
 private static void PackageControllerUpdatePump()
 {
     UploadDialog.packageController.Update();
     if (!UploadDialog.packageController.IsUploading)
     {
         UploadDialog.FinishInstance();
     }
     else
     {
         float getUploadProgress = UploadDialog.packageController.GetUploadProgress;
         if (EditorUtility.DisplayCancelableProgressBar(string.Format("Uploading {1}... {0}%", (getUploadProgress * 100f).ToString("N0"), UploadDialog.packageController.SelectedPackage.Name), "Closing this window will stop the ongoing upload process", getUploadProgress))
         {
             UploadDialog.packageController.OnClickUpload();
             UploadDialog.FinishInstance();
         }
     }
 }
Example #5
0
    private void _screenRecorder_Completed(object sender, ScreenRecordCompletedEventArgs e)
    {
        Gtk.Application.Invoke(delegate
        {
            FileInfo info = new FileInfo(e.FileName);

            elapsedLabel.Text   = _screenRecorder.Elapsed.ToString("c");
            fileSizeLabel.Text  = GetFileSize(info.Length);
            recordStopBtn.Label = "Record";

            if (uploadOnStop.Active)
            {
                switch (_uploader.CheckRequirementStatus(e.FileName))
                {
                case UploadRequirementStatus.Success:
                    {
                        UploadDialog dialog = new UploadDialog(_uploader, e.FileName);
                        dialog.Run();
                    }
                    break;

                case UploadRequirementStatus.FileNotFound:
                    {
                        string msg           = string.Format("The file \"{0}\" was not found", e.FileName);
                        MessageDialog dialog = new MessageDialog(
                            this,
                            DialogFlags.Modal,
                            MessageType.Info,
                            ButtonsType.Ok,
                            msg
                            );
                        dialog.Run();
                        dialog.Destroy();
                    }
                    break;

                case UploadRequirementStatus.FileNull:
                    {
                        MessageDialog dialog = new MessageDialog(
                            this,
                            DialogFlags.Modal,
                            MessageType.Info,
                            ButtonsType.Ok,
                            "File not set"
                            );
                        dialog.Run();
                        dialog.Destroy();
                    }
                    break;

                case UploadRequirementStatus.FileTooLarge:
                    {
                        string msg = string.Format(
                            "{0} service can upload files up to {1}, but the file {2} has a size of {3} which exceeds the service limit.",
                            _uploader.Name,
                            GetFileSize(_uploader.MaxFileSize),
                            e.FileName,
                            GetFileSize(info.Length)
                            );
                        MessageDialog dialog = new MessageDialog(
                            this,
                            DialogFlags.Modal,
                            MessageType.Info,
                            ButtonsType.Ok,
                            msg
                            );
                        dialog.Run();
                        dialog.Destroy();
                    }
                    break;

                default:
                    {
                        throw new Exception("Unknown requirement");
                    }
                }
            }
            else
            {
                string msg = string.Format(
                    "File location:{0}{0}{1}",
                    Environment.NewLine,
                    e.FileName
                    );
                MessageDialog dialog = new MessageDialog(
                    this,
                    DialogFlags.Modal,
                    MessageType.Info,
                    ButtonsType.Ok,
                    msg
                    );
                dialog.Run();
                dialog.Destroy();
            }
        });
    }