Exemplo n.º 1
0
 public void CopyHTMLLink()
 {
     if (IsItemSelected)
     {
         CopyTexts(SelectedItems.Where(x => x.IsURLExist).Select(x => parser.Parse(x.Info, UploadInfoParser.HTMLLink)));
     }
 }
Exemplo n.º 2
0
        public AfterUploadForm(TaskInfo info)
        {
            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            Info = info;

            if (Info.TaskSettings.AdvancedSettings.AutoCloseAfterUploadForm)
            {
                tmrClose.Start();
            }

            bool isFileExist = !string.IsNullOrEmpty(info.FilePath) && File.Exists(info.FilePath);

            if (info.DataType == EDataType.Image)
            {
                if (isFileExist)
                {
                    pbPreview.LoadImageFromFileAsync(info.FilePath);
                }
                else
                {
                    pbPreview.LoadImageFromURLAsync(info.Result.URL);
                }
            }

            Text = "ShareX - " + (isFileExist ? info.FilePath : info.FileName);

            lvClipboardFormats.Groups.Add(lvgForums);
            lvClipboardFormats.Groups.Add(lvgHtml);
            lvClipboardFormats.Groups.Add(lvgWiki);
            lvClipboardFormats.Groups.Add(lvgLocal);
            lvClipboardFormats.Groups.Add(lvgCustom);

            foreach (LinkFormatEnum type in Helpers.GetEnums <LinkFormatEnum>())
            {
                if (!FileHelpers.IsImageFile(Info.Result.URL) &&
                    (type == LinkFormatEnum.HTMLImage || type == LinkFormatEnum.HTMLLinkedImage ||
                     type == LinkFormatEnum.ForumImage || type == LinkFormatEnum.ForumLinkedImage ||
                     type == LinkFormatEnum.WikiImage || type == LinkFormatEnum.WikiLinkedImage))
                {
                    continue;
                }

                AddFormat(type.GetLocalizedDescription(), GetUrlByType(type));
            }

            if (FileHelpers.IsImageFile(Info.Result.URL))
            {
                foreach (ClipboardFormat cf in Program.Settings.ClipboardContentFormats)
                {
                    AddFormat(cf.Description, parser.Parse(Info, cf.Format), lvgCustom);
                }
            }
        }