Skip to content

fix: Conversion to use ImageSharp rather than System.Drawing.Common #880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 67 additions & 67 deletions src/ElectronNET.API/App.cs

Large diffs are not rendered by default.

70 changes: 35 additions & 35 deletions src/ElectronNET.API/AutoUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ public bool AutoDownload
taskCompletionSource.SetResult((bool)result);
});

BridgeConnector.Socket.Emit("autoUpdater-autoDownload-get");
_ = BridgeConnector.Socket.Emit("autoUpdater-autoDownload-get");

return taskCompletionSource.Task;
}).Result;
}
set
{
BridgeConnector.Socket.Emit("autoUpdater-autoDownload-set", value);
_ = BridgeConnector.Socket.Emit("autoUpdater-autoDownload-set", value);
}
}

/// <summary>
/// Whether to automatically install a downloaded update on app quit (if `QuitAndInstall` was not called before).
///
///
/// Applicable only on Windows and Linux.
/// </summary>
public bool AutoInstallOnAppQuit
Expand All @@ -60,21 +60,21 @@ public bool AutoInstallOnAppQuit
taskCompletionSource.SetResult((bool)result);
});

BridgeConnector.Socket.Emit("autoUpdater-autoInstallOnAppQuit-get");
_ = BridgeConnector.Socket.Emit("autoUpdater-autoInstallOnAppQuit-get");

return taskCompletionSource.Task;
}).Result;
}
set
{
BridgeConnector.Socket.Emit("autoUpdater-autoInstallOnAppQuit-set", value);
_ = BridgeConnector.Socket.Emit("autoUpdater-autoInstallOnAppQuit-set", value);
}
}

/// <summary>
/// *GitHub provider only.* Whether to allow update to pre-release versions.
/// *GitHub provider only.* Whether to allow update to pre-release versions.
/// Defaults to "true" if application version contains prerelease components (e.g. "0.12.1-alpha.1", here "alpha" is a prerelease component), otherwise "false".
///
///
/// If "true", downgrade will be allowed("allowDowngrade" will be set to "true").
/// </summary>
public bool AllowPrerelease
Expand All @@ -91,19 +91,19 @@ public bool AllowPrerelease
taskCompletionSource.SetResult((bool)result);
});

BridgeConnector.Socket.Emit("autoUpdater-allowPrerelease-get");
_ = BridgeConnector.Socket.Emit("autoUpdater-allowPrerelease-get");

return taskCompletionSource.Task;
}).Result;
}
set
{
BridgeConnector.Socket.Emit("autoUpdater-allowPrerelease-set", value);
_ = BridgeConnector.Socket.Emit("autoUpdater-allowPrerelease-set", value);
}
}

/// <summary>
/// *GitHub provider only.*
/// *GitHub provider only.*
/// Get all release notes (from current version to latest), not just the latest (Default is false).
/// </summary>
public bool FullChangelog
Expand All @@ -120,14 +120,14 @@ public bool FullChangelog
taskCompletionSource.SetResult((bool)result);
});

BridgeConnector.Socket.Emit("autoUpdater-fullChangelog-get");
_ = BridgeConnector.Socket.Emit("autoUpdater-fullChangelog-get");

return taskCompletionSource.Task;
}).Result;
}
set
{
BridgeConnector.Socket.Emit("autoUpdater-fullChangelog-set", value);
_ = BridgeConnector.Socket.Emit("autoUpdater-fullChangelog-set", value);
}
}

Expand All @@ -150,14 +150,14 @@ public bool AllowDowngrade
taskCompletionSource.SetResult((bool)result);
});

BridgeConnector.Socket.Emit("autoUpdater-allowDowngrade-get");
_ = BridgeConnector.Socket.Emit("autoUpdater-allowDowngrade-get");

return taskCompletionSource.Task;
}).Result;
}
set
{
BridgeConnector.Socket.Emit("autoUpdater-allowDowngrade-set", value);
_ = BridgeConnector.Socket.Emit("autoUpdater-allowDowngrade-set", value);
}
}

Expand All @@ -178,7 +178,7 @@ public string UpdateConfigPath
taskCompletionSource.SetResult(result.ToString());
});

BridgeConnector.Socket.Emit("autoUpdater-updateConfigPath-get");
_ = BridgeConnector.Socket.Emit("autoUpdater-updateConfigPath-get");

return taskCompletionSource.Task;
}).Result;
Expand All @@ -202,15 +202,15 @@ public Task<SemVer> CurrentVersionAsync
SemVer version = ((JObject)result).ToObject<SemVer>();
taskCompletionSource.SetResult(version);
});
BridgeConnector.Socket.Emit("autoUpdater-currentVersion-get");
_ = BridgeConnector.Socket.Emit("autoUpdater-currentVersion-get");

return taskCompletionSource.Task;
});
}
}

/// <summary>
/// Get the update channel. Not applicable for GitHub.
/// Get the update channel. Not applicable for GitHub.
/// Doesn’t return channel from the update configuration, only if was previously set.
/// </summary>
[Obsolete("Use the asynchronous version ChannelAsync instead")]
Expand All @@ -223,7 +223,7 @@ public string Channel
}

/// <summary>
/// Get the update channel. Not applicable for GitHub.
/// Get the update channel. Not applicable for GitHub.
/// Doesn’t return channel from the update configuration, only if was previously set.
/// </summary>
public Task<string> ChannelAsync
Expand All @@ -239,7 +239,7 @@ public Task<string> ChannelAsync
BridgeConnector.Socket.Off("autoUpdater-channel-get-reply");
taskCompletionSource.SetResult(result.ToString());
});
BridgeConnector.Socket.Emit("autoUpdater-channel-get");
_ = BridgeConnector.Socket.Emit("autoUpdater-channel-get");

return taskCompletionSource.Task;
});
Expand All @@ -264,7 +264,7 @@ public Task<Dictionary<string, string>> RequestHeadersAsync
Dictionary<string, string> result = ((JObject)headers).ToObject<Dictionary<string, string>>();
taskCompletionSource.SetResult(result);
});
BridgeConnector.Socket.Emit("autoUpdater-requestHeaders-get");
_ = BridgeConnector.Socket.Emit("autoUpdater-requestHeaders-get");
return taskCompletionSource.Task;
});
}
Expand All @@ -277,7 +277,7 @@ public Dictionary<string, string> RequestHeaders
{
set
{
BridgeConnector.Socket.Emit("autoUpdater-requestHeaders-set", JObject.FromObject(value, _jsonSerializer));
_ = BridgeConnector.Socket.Emit("autoUpdater-requestHeaders-set", JObject.FromObject(value, _jsonSerializer));
}
}

Expand All @@ -295,7 +295,7 @@ public event Action<string> OnError
_error(message.ToString());
});

BridgeConnector.Socket.Emit("register-autoUpdater-error-event", GetHashCode());
_ = BridgeConnector.Socket.Emit("register-autoUpdater-error-event", GetHashCode());
}
_error += value;
}
Expand Down Expand Up @@ -324,7 +324,7 @@ public event Action OnCheckingForUpdate
_checkingForUpdate();
});

BridgeConnector.Socket.Emit("register-autoUpdater-checking-for-update-event", GetHashCode());
_ = BridgeConnector.Socket.Emit("register-autoUpdater-checking-for-update-event", GetHashCode());
}
_checkingForUpdate += value;
}
Expand All @@ -340,7 +340,7 @@ public event Action OnCheckingForUpdate
private event Action _checkingForUpdate;

/// <summary>
/// Emitted when there is an available update.
/// Emitted when there is an available update.
/// The update is downloaded automatically if AutoDownload is true.
/// </summary>
public event Action<UpdateInfo> OnUpdateAvailable
Expand All @@ -354,7 +354,7 @@ public event Action<UpdateInfo> OnUpdateAvailable
_updateAvailable(JObject.Parse(updateInfo.ToString()).ToObject<UpdateInfo>());
});

BridgeConnector.Socket.Emit("register-autoUpdater-update-available-event", GetHashCode());
_ = BridgeConnector.Socket.Emit("register-autoUpdater-update-available-event", GetHashCode());
}
_updateAvailable += value;
}
Expand Down Expand Up @@ -383,7 +383,7 @@ public event Action<UpdateInfo> OnUpdateNotAvailable
_updateNotAvailable(JObject.Parse(updateInfo.ToString()).ToObject<UpdateInfo>());
});

BridgeConnector.Socket.Emit("register-autoUpdater-update-not-available-event", GetHashCode());
_ = BridgeConnector.Socket.Emit("register-autoUpdater-update-not-available-event", GetHashCode());
}
_updateNotAvailable += value;
}
Expand Down Expand Up @@ -412,7 +412,7 @@ public event Action<ProgressInfo> OnDownloadProgress
_downloadProgress(JObject.Parse(progressInfo.ToString()).ToObject<ProgressInfo>());
});

BridgeConnector.Socket.Emit("register-autoUpdater-download-progress-event", GetHashCode());
_ = BridgeConnector.Socket.Emit("register-autoUpdater-download-progress-event", GetHashCode());
}
_downloadProgress += value;
}
Expand Down Expand Up @@ -441,7 +441,7 @@ public event Action<UpdateInfo> OnUpdateDownloaded
_updateDownloaded(JObject.Parse(updateInfo.ToString()).ToObject<UpdateInfo>());
});

BridgeConnector.Socket.Emit("register-autoUpdater-update-downloaded-event", GetHashCode());
_ = BridgeConnector.Socket.Emit("register-autoUpdater-update-downloaded-event", GetHashCode());
}
_updateDownloaded += value;
}
Expand Down Expand Up @@ -512,14 +512,14 @@ public Task<UpdateCheckResult> CheckForUpdatesAsync()
taskCompletionSource.SetException(new Exception(message));
});

BridgeConnector.Socket.Emit("autoUpdaterCheckForUpdates", guid);
_ = BridgeConnector.Socket.Emit("autoUpdaterCheckForUpdates", guid);

return taskCompletionSource.Task;
}

/// <summary>
/// Asks the server whether there is an update.
///
///
/// This will immediately download an update, then install when the app quits.
/// </summary>
/// <returns></returns>
Expand Down Expand Up @@ -554,23 +554,23 @@ public Task<UpdateCheckResult> CheckForUpdatesAndNotifyAsync()
taskCompletionSource.SetException(new Exception(message));
});

BridgeConnector.Socket.Emit("autoUpdaterCheckForUpdatesAndNotify", guid);
_ = BridgeConnector.Socket.Emit("autoUpdaterCheckForUpdatesAndNotify", guid);

return taskCompletionSource.Task;
}

/// <summary>
/// Restarts the app and installs the update after it has been downloaded.
/// It should only be called after `update-downloaded` has been emitted.
///
///
/// Note: QuitAndInstall() will close all application windows first and only emit `before-quit` event on `app` after that.
/// This is different from the normal quit event sequence.
/// </summary>
/// <param name="isSilent">*windows-only* Runs the installer in silent mode. Defaults to `false`.</param>
/// <param name="isForceRunAfter">Run the app after finish even on silent install. Not applicable for macOS. Ignored if `isSilent` is set to `false`.</param>
public void QuitAndInstall(bool isSilent = false, bool isForceRunAfter = false)
{
BridgeConnector.Socket.Emit("autoUpdaterQuitAndInstall", isSilent, isForceRunAfter);
_ = BridgeConnector.Socket.Emit("autoUpdaterQuitAndInstall", isSilent, isForceRunAfter);
}

/// <summary>
Expand All @@ -588,7 +588,7 @@ public Task<string> DownloadUpdateAsync()
taskCompletionSource.SetResult(downloadedPath.ToString());
});

BridgeConnector.Socket.Emit("autoUpdaterDownloadUpdate", guid);
_ = BridgeConnector.Socket.Emit("autoUpdaterDownloadUpdate", guid);

return taskCompletionSource.Task;
}
Expand All @@ -608,7 +608,7 @@ public Task<string> GetFeedURLAsync()
taskCompletionSource.SetResult(downloadedPath.ToString());
});

BridgeConnector.Socket.Emit("autoUpdaterGetFeedURL", guid);
_ = BridgeConnector.Socket.Emit("autoUpdaterGetFeedURL", guid);

return taskCompletionSource.Task;
}
Expand Down
18 changes: 9 additions & 9 deletions src/ElectronNET.API/BrowserView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
namespace ElectronNET.API
{
/// <summary>
/// A BrowserView can be used to embed additional web content into a BrowserWindow.
/// It is like a child window, except that it is positioned relative to its owning window.
/// A BrowserView can be used to embed additional web content into a BrowserWindow.
/// It is like a child window, except that it is positioned relative to its owning window.
/// It is meant to be an alternative to the webview tag.
/// </summary>
public class BrowserView
Expand All @@ -28,7 +28,7 @@ public class BrowserView

/// <summary>
/// Resizes and moves the view to the supplied bounds relative to the window.
///
///
/// (experimental)
/// </summary>
public Rectangle Bounds
Expand All @@ -45,21 +45,21 @@ public Rectangle Bounds
taskCompletionSource.SetResult((Rectangle)result);
});

BridgeConnector.Socket.Emit("browserView-getBounds", Id);
_ = BridgeConnector.Socket.Emit("browserView-getBounds", Id);

return taskCompletionSource.Task;
}).Result;
}
set
{
BridgeConnector.Socket.Emit("browserView-setBounds", Id, JObject.FromObject(value, _jsonSerializer));
_ = BridgeConnector.Socket.Emit("browserView-setBounds", Id, JObject.FromObject(value, _jsonSerializer));
}
}

/// <summary>
/// BrowserView
/// </summary>
internal BrowserView(int id)
internal BrowserView(int id)
{
Id = id;

Expand All @@ -74,18 +74,18 @@ internal BrowserView(int id)
/// <param name="options"></param>
public void SetAutoResize(AutoResizeOptions options)
{
BridgeConnector.Socket.Emit("browserView-setAutoResize", Id, JObject.FromObject(options, _jsonSerializer));
_ = BridgeConnector.Socket.Emit("browserView-setAutoResize", Id, JObject.FromObject(options, _jsonSerializer));
}

/// <summary>
/// Color in #aarrggbb or #argb form. The alpha channel is optional.
///
///
/// (experimental)
/// </summary>
/// <param name="color">Color in #aarrggbb or #argb form. The alpha channel is optional.</param>
public void SetBackgroundColor(string color)
{
BridgeConnector.Socket.Emit("browserView-setBackgroundColor", Id, color);
_ = BridgeConnector.Socket.Emit("browserView-setBackgroundColor", Id, color);
}

private JsonSerializer _jsonSerializer = new JsonSerializer()
Expand Down
Loading