From 4d23f6d335003f2d1a514298dfedb444e973d96a Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sat, 12 Jan 2019 01:24:07 +0100 Subject: [PATCH] Misc --- ArchiSteamFarm/ASF.cs | 7 +++++ ArchiSteamFarm/Plugins/Core.cs | 3 +- ArchiSteamFarm/RuntimeCompatibility.cs | 39 ++++++++++++++------------ 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/ArchiSteamFarm/ASF.cs b/ArchiSteamFarm/ASF.cs index 785cb2284..a09f226b4 100644 --- a/ArchiSteamFarm/ASF.cs +++ b/ArchiSteamFarm/ASF.cs @@ -659,6 +659,13 @@ namespace ArchiSteamFarm { Directory.CreateDirectory(directory); } + // We're not interested in extracting placeholder files (but we still want directories created for them, done above) + switch (zipFile.Name) { + case ".gitkeep": + + continue; + } + zipFile.ExtractToFile(file); } diff --git a/ArchiSteamFarm/Plugins/Core.cs b/ArchiSteamFarm/Plugins/Core.cs index 2654851c7..b79e49f94 100644 --- a/ArchiSteamFarm/Plugins/Core.cs +++ b/ArchiSteamFarm/Plugins/Core.cs @@ -105,7 +105,8 @@ namespace ArchiSteamFarm.Plugins { try { assembly = Assembly.LoadFrom(assemblyPath); } catch (Exception e) { - ASF.ArchiLogger.LogGenericException(e); + ASF.ArchiLogger.LogGenericError(string.Format(Strings.ErrorIsInvalid, assemblyPath)); + ASF.ArchiLogger.LogGenericWarningException(e); continue; } diff --git a/ArchiSteamFarm/RuntimeCompatibility.cs b/ArchiSteamFarm/RuntimeCompatibility.cs index 57863eeb7..6ab5dd7b9 100644 --- a/ArchiSteamFarm/RuntimeCompatibility.cs +++ b/ArchiSteamFarm/RuntimeCompatibility.cs @@ -31,14 +31,15 @@ using System.Threading; #endif namespace ArchiSteamFarm { - internal static class RuntimeCompatibility { + [PublicAPI] + public static class RuntimeCompatibility { #if NETFRAMEWORK private static readonly DateTime SavedProcessStartTime = DateTime.UtcNow; #endif - internal static bool IsRunningOnMono => Type.GetType("Mono.Runtime") != null; + public static bool IsRunningOnMono => Type.GetType("Mono.Runtime") != null; - internal static DateTime ProcessStartTime { + public static DateTime ProcessStartTime { get { #if NETFRAMEWORK if (IsRunningOnMono) { @@ -53,8 +54,9 @@ namespace ArchiSteamFarm { } #pragma warning disable 1998 - internal static class File { - internal static async Task AppendAllTextAsync([NotNull] string path, string contents) => + [PublicAPI] + public static class File { + public static async Task AppendAllTextAsync([NotNull] string path, string contents) => #if NETFRAMEWORK System.IO.File.AppendAllText(path, contents); #else @@ -62,7 +64,7 @@ namespace ArchiSteamFarm { #endif [ItemNotNull] - internal static async Task ReadAllBytesAsync([NotNull] string path) => + public static async Task ReadAllBytesAsync([NotNull] string path) => #if NETFRAMEWORK System.IO.File.ReadAllBytes(path); #else @@ -70,14 +72,14 @@ namespace ArchiSteamFarm { #endif [ItemNotNull] - internal static async Task ReadAllTextAsync([NotNull] string path) => + public static async Task ReadAllTextAsync([NotNull] string path) => #if NETFRAMEWORK System.IO.File.ReadAllText(path); #else await System.IO.File.ReadAllTextAsync(path).ConfigureAwait(false); #endif - internal static async Task WriteAllTextAsync([NotNull] string path, string contents) => + public static async Task WriteAllTextAsync([NotNull] string path, string contents) => #if NETFRAMEWORK System.IO.File.WriteAllText(path, contents); #else @@ -86,8 +88,9 @@ namespace ArchiSteamFarm { } #pragma warning restore 1998 - internal static class HashCode { - internal static int Combine(T1 value1, T2 value2, T3 value3) => + [PublicAPI] + public static class HashCode { + public static int Combine(T1 value1, T2 value2, T3 value3) => #if NETFRAMEWORK (value1, value2, value3).GetHashCode(); #else @@ -95,9 +98,10 @@ namespace ArchiSteamFarm { #endif } - internal static class Path { + [PublicAPI] + public static class Path { [NotNull] - internal static string GetRelativePath([NotNull] string relativeTo, [NotNull] string path) { + public static string GetRelativePath([NotNull] string relativeTo, [NotNull] string path) { #if NETFRAMEWORK if (!path.StartsWith(relativeTo, StringComparison.Ordinal)) { throw new NotImplementedException(); @@ -115,19 +119,18 @@ namespace ArchiSteamFarm { } #if NETFRAMEWORK - internal static void Deconstruct(this KeyValuePair kv, out T1 key, out T2 value) { + public static void Deconstruct(this KeyValuePair kv, out T1 key, out T2 value) { key = kv.Key; value = kv.Value; } - internal static async Task ReceiveAsync([NotNull] this WebSocket webSocket, [NotNull] byte[] buffer, CancellationToken cancellationToken) => await webSocket.ReceiveAsync(new ArraySegment(buffer), cancellationToken).ConfigureAwait(false); - internal static async Task SendAsync([NotNull] this WebSocket webSocket, [NotNull] byte[] buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken) => await webSocket.SendAsync(new ArraySegment(buffer), messageType, endOfMessage, cancellationToken).ConfigureAwait(false); + public static async Task ReceiveAsync([NotNull] this WebSocket webSocket, [NotNull] byte[] buffer, CancellationToken cancellationToken) => await webSocket.ReceiveAsync(new ArraySegment(buffer), cancellationToken).ConfigureAwait(false); + public static async Task SendAsync([NotNull] this WebSocket webSocket, [NotNull] byte[] buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken) => await webSocket.SendAsync(new ArraySegment(buffer), messageType, endOfMessage, cancellationToken).ConfigureAwait(false); [NotNull] - internal static string[] Split([NotNull] this string text, char separator, StringSplitOptions options = StringSplitOptions.None) => text.Split(new[] { separator }, options); + public static string[] Split([NotNull] this string text, char separator, StringSplitOptions options = StringSplitOptions.None) => text.Split(new[] { separator }, options); - [PublicAPI] - internal static void TrimExcess(this Dictionary _) { } // no-op + public static void TrimExcess(this Dictionary _) { } // no-op #endif } }