private void eiCustomUploaders_ImportRequested(object obj)
        {
            CustomUploaderItem uploader = obj as CustomUploaderItem;

            uploader.CheckBackwardCompatibility();
            CustomUploaderAdd(uploader);
        }
        private void CustomUploaderUpdateFolder()
        {
            using (FolderSelectDialog fsd = new FolderSelectDialog())
            {
                if (fsd.ShowDialog())
                {
                    string   folderPath = fsd.FileName;
                    string[] files      = Directory.GetFiles(folderPath, "*.sxcu", SearchOption.TopDirectoryOnly);

                    int updated = 0;

                    if (files != null)
                    {
                        foreach (string filePath in files)
                        {
                            CustomUploaderItem cui = JsonHelpers.DeserializeFromFile <CustomUploaderItem>(filePath);

                            if (cui != null)
                            {
                                cui.CheckBackwardCompatibility();
                                CustomUploaderSerialize(cui, folderPath);
                                updated++;
                            }
                        }
                    }

                    MessageBox.Show($"{updated} custom uploader files updated.", "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
예제 #3
0
        private void CustomUploaderSettingsForm_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop, false))
            {
                string[] files = e.Data.GetData(DataFormats.FileDrop, false) as string[];

                if (files != null)
                {
                    foreach (string filePath in files.Where(x => !string.IsNullOrEmpty(x) && x.EndsWith(".sxcu")))
                    {
                        CustomUploaderItem cui = JsonHelpers.DeserializeFromFilePath <CustomUploaderItem>(filePath);

                        if (cui != null)
                        {
                            cui.CheckBackwardCompatibility();
                            CustomUploaderAdd(cui);
                        }
                    }

                    eiCustomUploaders_ImportCompleted();
                }
            }
        }