Improved the support for dragging and dropping images from a website, now also parsing HTML img src information, to be able to download that image. For this we need the HtmlAgilityPack.dll (#294)

Removed a lot of dead code, and remove the old OCR code as we don't even know if it still works.
This commit is contained in:
Robin Krom 2021-03-21 22:34:17 +01:00 committed by GitHub
parent 90cab1e8a3
commit 26fe579d31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
151 changed files with 1138 additions and 8174 deletions

View file

@ -29,10 +29,10 @@ using GreenshotPlugin.IniFile;
namespace GreenshotBoxPlugin {
/// <summary>
/// Description of ImgurUtils.
/// </summary>
public static class BoxUtils {
/// <summary>
/// Description of BoxUtils.
/// </summary>
public static class BoxUtils {
private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(typeof(BoxUtils));
private static readonly BoxConfiguration Config = IniConfig.GetIniSection<BoxConfiguration>();
private const string UploadFileUri = "https://upload.box.com/api/2.0/files/content";
@ -121,19 +121,7 @@ namespace GreenshotBoxPlugin {
/// A simple helper class for the DataContractJsonSerializer
/// </summary>
internal static class JsonSerializer {
/// <summary>
/// Helper method to serialize object to JSON
/// </summary>
/// <param name="jsonObject">JSON object</param>
/// <returns>string</returns>
public static string Serialize(object jsonObject) {
var serializer = new DataContractJsonSerializer(jsonObject.GetType());
using MemoryStream stream = new MemoryStream();
serializer.WriteObject(stream, jsonObject);
return Encoding.UTF8.GetString(stream.ToArray());
}
/// <summary>
/// <summary>
/// Helper method to parse JSON to object
/// </summary>
/// <typeparam name="T"></typeparam>
@ -141,7 +129,7 @@ namespace GreenshotBoxPlugin {
/// <returns></returns>
public static T Deserialize<T>(string jsonString) {
var deserializer = new DataContractJsonSerializer(typeof(T));
using MemoryStream stream = new MemoryStream();
using var stream = new MemoryStream();
byte[] content = Encoding.UTF8.GetBytes(jsonString);
stream.Write(content, 0, content.Length);
stream.Seek(0, SeekOrigin.Begin);