diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index dc8bb5a..d8793b3 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -1,33 +1,39 @@ name: Debug on: - push: - branches: - - dev + push: + branches: + - dev jobs: - debug-build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-latest, ubuntu-latest, macos-latest] - - steps: - - uses: actions/checkout@v3 - - - name: Setup .NET Core - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '7.0.x' - - - name: Build - run: dotnet build src/TYM.csproj - - - name: Publish - run: dotnet publish src/TYM.csproj /p:PublishProfile=src/Properties/PublishProfiles/${{ matrix.os }}.pubxml - - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.os }} - path: src/pub/ \ No newline at end of file + debug-build: + name: Debug build + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: windows-latest + target: win + + - os: ubuntu-latest + target: linux + + - os: macos-latest + target: osx + + steps: + - uses: actions/checkout@v3 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '7.0.x' + + - name: Build + run: dotnet build src/TYM.csproj + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: debug-${{ matrix.target }} + path: src/bin/ \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bee2e6b..800cd29 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,97 +1,83 @@ -name: Build and draft release +name: Release on: - push: - branches: - - main + push: + branches: + - main jobs: - - draft-release: - name: Draft new release - runs-on: ubuntu-latest + draft_release: + name: Draft new release + runs-on: ubuntu-latest + + outputs: + release_tag: ${{ steps.project_version.outputs.TAG }} + + steps: - outputs: - upload_url: ${{ steps.draft_release.outputs.upload_url }} - - steps: - - name: Fetch source code - uses: actions/checkout@v3 - - - name: Install XML tools - run: sudo apt install xmlstarlet - - - name: Fetch version string - run: echo "TAG=$(xmlstarlet select --template --value-of /Project/PropertyGroup/AssemblyVersion ./src/TYM.csproj)" >> $GITHUB_OUTPUT - id: version - - - name: Draft release - uses: actions/create-release@v1 - id: draft_release - env: - GITHUB_TOKEN: ${{ secrets.G_TOKEN }} - with: - tag_name: ${{ steps.version.outputs.TAG }} - release_name: TYM v${{ steps.version.outputs.TAG }} - draft: true - prerelease: false - - - release-assets: - name: Build and upload release assets - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [windows-latest, ubuntu-latest, macos-latest] - - steps: - - name: Fetch source code - uses: actions/checkout@v3 - - - name: Setup .NET Core - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '7.0.x' - - - name: Fetch version string (win) - run: echo "TAG=$(./src/pub/TYM.exe --version | cut -c5- )" >> $GITHUB_OUTPUT - id: version - shell: bash - if: matrix.os == 'windows-latest' - - - name: Fetch version string (*nix) - run: echo "TAG=$(./src/pub/TYM --version | cut -c5- )" >> $GITHUB_OUTPUT - id: version - shell: bash - if: - matrix.os == 'macos-latest' - matrix.os == 'ubuntu-latest' - - - name: Build - run: dotnet build src/TYM.csproj - - - name: Publish - run: dotnet publish src/TYM.csproj /p:PublishProfile=src/Properties/PublishProfiles/${{ matrix.os }}.pubxml - - - name: Upload release assets (win) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.G_TOKEN }} - with: - upload_url: ${{ needs.create_release.outputs.upload_url }} - asset_name: TYM-${{ steps.version.outputs.TAG }}-${{ matrix.os }} - asset_path: ./src/pub/TYM.exe - asset_content_type: application/octet-stream - if: matrix.os == 'windows-latest' - - - name: Upload release assets (*nix) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.G_TOKEN }} - with: - upload_url: ${{ needs.create_release.outputs.upload_url }} - asset_name: TYM-${{ steps.version.outputs.TAG }}-${{ matrix.os }} - asset_path: ./src/pub/TYM - asset_content_type: application/octet-stream - if: matrix.os == 'windows-latest' \ No newline at end of file + - name: Fetch source code + uses: actions/checkout@v3 + + - name: Install XML tools + run: sudo apt install xmlstarlet + + - name: Fetch version string + run: echo "TAG=$(xmlstarlet select --template --value-of /Project/PropertyGroup/AssemblyVersion ./src/TYM.csproj)" >> $GITHUB_OUTPUT + id: project_version + + - name: Draft release + uses: softprops/action-gh-release@v1 + id: draft + env: + GITHUB_TOKEN: ${{ secrets.G_TOKEN }} + with: + tag_name: ${{ steps.project_version.outputs.TAG }} + name: TYM v${{ steps.project_version.outputs.TAG }} + draft: true + prerelease: false + body_path: CHANGELOG.md + + + build_artifacts: + name: Build release assets + runs-on: ${{ matrix.os }} + needs: draft_release + + strategy: + matrix: + include: + - os: windows-latest + target: win + bin-extension: ".exe" + + - os: ubuntu-latest + target: linux + bin-extension: "" + + - os: macos-latest + target: osx + bin-extension: "" + + steps: + + - name: Fetch source code + uses: actions/checkout@v3 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '7.0.x' + + - name: Build + run: dotnet build src/TYM.csproj + + - name: Publish + run: dotnet publish src/TYM.csproj -a x64 --os ${{ matrix.target }} -c Release -p:PublishProfile=Properties/PublishProfiles/PublishConfig.pubxml + + - name: Rename output files + run: mv src/pub/TYM${{ matrix.bin-extension }} TYM-${{ needs.draft_release.outputs.release_tag }}-${{ matrix.target }}-bin${{ matrix.bin-extension }} + + - name: Upload artifact + run: gh release upload ${{ needs.draft_release.outputs.release_tag }} TYM-${{ needs.draft_release.outputs.release_tag }}-${{ matrix.target }}-bin${{ matrix.bin-extension }} + env: + GH_TOKEN: ${{ secrets.G_TOKEN }} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..eef98fa --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,13 @@ +# Changelog + +## General + +- [x] Optimize code and fragment info methods +- [x] Fix workflows (publishing) +- [x] Move settings to embedded resource +- [x] Optimize web requests +- [x] Create console logging utility + +## CLI Args + +- [x] Clear web download cache diff --git a/Changelog.md b/Changelog.md deleted file mode 100644 index b84eea2..0000000 --- a/Changelog.md +++ /dev/null @@ -1,15 +0,0 @@ -# Changelog - -## General - -- [x] Codebase -- [x] Create release workflow (submit release on merge to main branch) -- [x] Support for downloading and rendering files directly from network - -## CLI Args - -- [x] Resampler list and selection -- [x] Size option -- [x] Starting point on screen -- [x] Resize method (fit, stretch, crop) -- [x] Full screen option \ No newline at end of file diff --git a/README.md b/README.md index 6bfcbf1..71b8653 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 🍉 TYM -[![Debug build](https://github.com/Segilmez06/tym/actions/workflows/debug.yml/badge.svg)](https://github.com/Segilmez06/EFI-Runner/actions/workflows/debug.yml) -[![Release build](https://github.com/Segilmez06/tym/actions/workflows/release.yml/badge.svg)](https://github.com/Segilmez06/EFI-Runner/actions/workflows/release.yml) +[![Debug build](https://github.com/Segilmez06/tym/actions/workflows/debug.yml/badge.svg)](https://github.com/Segilmez06/tym/actions/workflows/debug.yml) +![GitHub release](https://img.shields.io/github/v/release/Segilmez06/tym?label=Release) TYM is a cross-platform tool that renders image files in your terminal. It uses VT100 escape codes to display 24-bit true color images. diff --git a/TODO.md b/TODO.md index 3e974f0..34c7454 100644 --- a/TODO.md +++ b/TODO.md @@ -2,7 +2,10 @@ ## General -- [ ] Optimize code and fragment info methods +- [x] Optimize code and fragment info methods +- [ ] Localization +- [ ] ~~Add web link caching with hash checking~~ ## CLI Args +- [ ] Open web cache directory in explorer \ No newline at end of file diff --git a/src/App.config b/src/App.config new file mode 100644 index 0000000..31fce36 --- /dev/null +++ b/src/App.config @@ -0,0 +1,15 @@ + + + + +
+ + + + + + jpeg;bmp;gif;png;tiff;webp + + + + \ No newline at end of file diff --git a/src/App.cs b/src/App.cs index 19e9e29..817f918 100644 --- a/src/App.cs +++ b/src/App.cs @@ -1,12 +1,13 @@ using CommandLine; - +using Newtonsoft.Json; using SixLabors.ImageSharp.Processing.Processors.Transforms; -using System.Linq; -using System.Net; +using System.Net.Http.Headers; using System.Reflection; +using TYM.Properties; using static TYM.BlockChars; +using static TYM.Logger; namespace TYM { @@ -49,7 +50,7 @@ public class Options [Option('m', "resize-method", Required = false, Default = "Contain", HelpText = "Resizing mode. Available options: Contain, Cover (Crop), Stretch")] - public string ResizeMethod { get; set; } + public string? ResizeMethod { get; set; } @@ -57,6 +58,64 @@ public class Options [Option('f', "fullscreen", Required = false, Default = false, HelpText = "Use fullscreen. This overrides margin and size arguments!")] public bool UseFullscreen { get; set; } + + + [Option('c', "clear", Required = false, Default = false, HelpText = "Clear downloaded cache folder.")] + public bool ClearCache { get; set; } + } + + public static class Logger + { + public enum LogLevel + { + Info, + Warn, + Error + } + + private static readonly Dictionary LevelColors = new() + { + { LogLevel.Info, 4 }, // Blue + { LogLevel.Warn, 3 }, // Yellow + { LogLevel.Error, 1 } // Red + }; + + private static readonly Dictionary LevelPrefix= new() + { + { LogLevel.Info, Messages.LogCategory_Info }, + { LogLevel.Warn, Messages.LogCategory_Warning }, + { LogLevel.Error, Messages.LogCategory_Error } + }; + + private static readonly Dictionary LevelExitCodes = new() + { + { LogLevel.Info, 0 }, + { LogLevel.Warn, 0 }, + { LogLevel.Error, 1 } + }; + + public static void LogMsg(LogLevel Level, string Message) + { + Console.WriteLine($"\u001b[3{LevelColors[Level]}m{LevelPrefix[Level]}:\u001b[37m {Message}\u001b[39m"); + } + + public static void LogExit(LogLevel Level, string Message) + { + LogMsg(Level, Message); + Environment.Exit(LevelExitCodes[Level]); + } + + public static void LogExit(LogLevel Level, string Message, string Argument) + { + LogMsg(Level, Message.Replace("%s", Argument)); + Environment.Exit(LevelExitCodes[Level]); + } + + public static void LogExit(LogLevel Level, string Message, int Argument) + { + LogMsg(Level, Message.Replace("%s", Argument.ToString())); + Environment.Exit(LevelExitCodes[Level]); + } } public class App @@ -70,6 +129,12 @@ public App(string[] Arguments) private void Run(Options CommandLineOptions) { + Assembly ExecutingAssembly = Assembly.GetExecutingAssembly(); + Stream SettingsStream = ExecutingAssembly.GetManifestResourceStream("TYM.settings.json"); + string SettingsContent = new StreamReader(SettingsStream).ReadToEnd(); + + dynamic Settings = JsonConvert.DeserializeObject(SettingsContent); + if (CommandLineOptions.ListResamplers) { Console.WriteLine("\u001b[32mAvailable resampling algorithms:"); @@ -80,77 +145,86 @@ private void Run(Options CommandLineOptions) Environment.Exit(0); } + string DownloadDirectory = Path.Combine(Path.GetTempPath(), (string)Settings["tempDirectoryName"]); + if (CommandLineOptions.ClearCache) + { + Directory.Delete(DownloadDirectory, true); + } + string? ImagePath = CommandLineOptions.FilePath; if (Path.Exists(ImagePath)) { ProcessImageFile(CommandLineOptions, ImagePath); } - else + else if (Uri.IsWellFormedUriString(ImagePath, UriKind.Absolute)) { - if (Uri.IsWellFormedUriString(ImagePath, UriKind.Absolute)) + if (Uri.TryCreate(ImagePath, UriKind.Absolute, out Uri? WebURI)) { - Uri WebURI; - if (Uri.TryCreate(ImagePath, UriKind.Absolute, out WebURI)) + if (WebURI.Scheme == Uri.UriSchemeHttps) { - if (WebURI.Scheme == Uri.UriSchemeHttps) + HttpClient Client = new(); + + List SupportedMimeTypes = ((string[])Settings["supportedImageFormats"]).ToList(); + SupportedMimeTypes.ForEach(x => Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(x))); + + Task GetTask = Client.GetAsync(WebURI); + GetTask.Wait(); + HttpResponseMessage Response = GetTask.Result; + + if (Response.IsSuccessStatusCode) { - WebClient Client = new(); - Client.Headers.Add("Accept", "image/*"); - - string DownloadDirectory = Path.Combine(Path.GetTempPath(), "TYM-Web-Downloads"); - Directory.CreateDirectory(DownloadDirectory); - - string TempFile = Path.Combine(DownloadDirectory, Guid.NewGuid().ToString()); - byte[] Data = Client.DownloadData(WebURI.ToString()); - bool IsMimeValid = new List() { - "image/jpeg", - "image/bmp", - "image/gif", - "image/png", - "image/tiff", - "image/webp" - }.Any(x => Client.ResponseHeaders["Content-Type"].Contains(x)); - if (IsMimeValid) + string ResponseMimeType = Response.Content.Headers.ContentType.MediaType; + + if (SupportedMimeTypes.Any(x => x == ResponseMimeType)) { + Directory.CreateDirectory(DownloadDirectory); + + string TempFile = Path.Combine(DownloadDirectory, Guid.NewGuid().ToString()); + + Task ReadTask = Response.Content.ReadAsByteArrayAsync(); + ReadTask.Wait(); + byte[] Data = ReadTask.Result; + File.WriteAllBytes(TempFile, Data); ProcessImageFile(CommandLineOptions, TempFile); } else { - Console.WriteLine($"\x1b[31mError:\x1b[37m Server returned invalid mime type \"{Client.ResponseHeaders["Content-Type"]}\"!"); - Environment.Exit(1); + LogExit(LogLevel.Error, Messages.Error_InvalidMimeType, ResponseMimeType); } } else { - Console.WriteLine("\x1b[31mError:\x1b[37m Only HTTPS scheme supported!"); - Environment.Exit(1); + LogExit(LogLevel.Error, Messages.Error_ResponseCode, (int)Response.StatusCode); } } else { - Console.WriteLine("\x1b[31mError:\x1b[37m Can't parse URL!"); - Environment.Exit(1); + LogExit(LogLevel.Error, Messages.Error_UnsupportedProtocol); } } - Console.WriteLine("\x1b[31mError:\x1b[37m Can't open file!"); - Environment.Exit(1); + else + { + LogExit(LogLevel.Error, Messages.Error_URLParseError); + } + } + else + { + LogExit(LogLevel.Error, Messages.Error_FileError); } } - private void ProcessImageFile(Options CommandLineOptions, string ImagePath) + private static void ProcessImageFile(Options CommandLineOptions, string ImagePath) { PropertyInfo? ResamplerProperty = typeof(KnownResamplers).GetProperty(CommandLineOptions.ResamplerName); if (ResamplerProperty == null) { - Console.WriteLine("\x1b[31mError:\x1b[37m Invalid resampler specified.\x1b[39m"); - Environment.Exit(1); + LogExit(LogLevel.Error, Messages.Error_InvalidResampler); } - IResampler Resampler = (IResampler)ResamplerProperty.GetValue(typeof(KnownResamplers)); + IResampler? Resampler = (IResampler)ResamplerProperty.GetValue(typeof(KnownResamplers)); if (Resampler == null) { - Console.WriteLine("\x1b[31mError:\x1b[37m Error occured while fetching resampler.\x1b[39m"); - Environment.Exit(1); + LogExit(LogLevel.Error, Messages.Error_ResamplerError); } Dictionary AvailableResizeModes = new(){ @@ -162,8 +236,7 @@ private void ProcessImageFile(Options CommandLineOptions, string ImagePath) }; if (!AvailableResizeModes.ContainsKey(CommandLineOptions.ResizeMethod)) { - Console.WriteLine("\x1b[31mError:\x1b[37m Invalid resize mode.\x1b[39m"); - Environment.Exit(1); + LogExit(LogLevel.Error, Messages.Error_InvalidResizeMode); } ResizeMode SelectedResizeMode = AvailableResizeModes.GetValueOrDefault(CommandLineOptions.ResizeMethod); diff --git a/src/Program.cs b/src/Program.cs index 93cd2b4..396998e 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -4,9 +4,7 @@ class Program { static void Main() { - _ = new App(Environment.GetCommandLineArgs()); - } } } \ No newline at end of file diff --git a/src/Properties/Messages.en.Designer.cs b/src/Properties/Messages.en.Designer.cs new file mode 100644 index 0000000..fbf22c7 --- /dev/null +++ b/src/Properties/Messages.en.Designer.cs @@ -0,0 +1,252 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace TYM.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Messages { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Messages() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TYM.Properties.Messages", typeof(Messages).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Path to the image file. Also supports web links. (DANGER: USE WEB LINKS AT YOUR OWN RISK!). + /// + internal static string Args_FilePath { + get { + return ResourceManager.GetString("Args.FilePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Output height as pixels. 1 char height = 2 pixels. Set to 0 for auto size.. + /// + internal static string Args_Height { + get { + return ResourceManager.GetString("Args.Height", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to List available resampling algorithms.. + /// + internal static string Args_ListResamplers { + get { + return ResourceManager.GetString("Args.ListResamplers", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Left margin size as characters. Shifts the output from cursor start to right by specified character count. 1 char width = 1 pixel.. + /// + internal static string Args_MarginX { + get { + return ResourceManager.GetString("Args.MarginX", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Top margin size as characters. Shifts the output from cursor start to bottom by specified character count. 1 char height = 2 pixels.. + /// + internal static string Args_MarginY { + get { + return ResourceManager.GetString("Args.MarginY", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resampling algorithm for downsizing.. + /// + internal static string Args_ResamplerName { + get { + return ResourceManager.GetString("Args.ResamplerName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resizing mode. Available options: Contain, Cover (Crop), Stretch. + /// + internal static string Args_ResizeMethod { + get { + return ResourceManager.GetString("Args.ResizeMethod", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Use fullscreen. This overrides margin and size arguments!. + /// + internal static string Args_UseFullscreen { + get { + return ResourceManager.GetString("Args.UseFullscreen", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Output width as pixels. 1 char width = 1 pixel. Set to 0 for auto size.. + /// + internal static string Args_Width { + get { + return ResourceManager.GetString("Args.Width", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to open the specified file!. + /// + internal static string Error_FileError { + get { + return ResourceManager.GetString("Error.FileError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Server returned invalid mime type "%s"!. + /// + internal static string Error_InvalidMimeType { + get { + return ResourceManager.GetString("Error.InvalidMimeType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid resampler specified!. + /// + internal static string Error_InvalidResampler { + get { + return ResourceManager.GetString("Error.InvalidResampler", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid resize mode specified!. + /// + internal static string Error_InvalidResizeMode { + get { + return ResourceManager.GetString("Error.InvalidResizeMode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to fetch resampler!. + /// + internal static string Error_ResamplerError { + get { + return ResourceManager.GetString("Error.ResamplerError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Server returned code %1!. + /// + internal static string Error_ResponseCode { + get { + return ResourceManager.GetString("Error.ResponseCode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Only HTTPS protocol is supported!. + /// + internal static string Error_UnsupportedProtocol { + get { + return ResourceManager.GetString("Error.UnsupportedProtocol", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to parse the specified URL!. + /// + internal static string Error_URLParseError { + get { + return ResourceManager.GetString("Error.URLParseError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ERROR. + /// + internal static string LogCategory_Error { + get { + return ResourceManager.GetString("LogCategory.Error", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to INFO. + /// + internal static string LogCategory_Info { + get { + return ResourceManager.GetString("LogCategory.Info", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WARNING. + /// + internal static string LogCategory_Warning { + get { + return ResourceManager.GetString("LogCategory.Warning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Available resampling algorithms:. + /// + internal static string Message_AvailableResamplers { + get { + return ResourceManager.GetString("Message.AvailableResamplers", resourceCulture); + } + } + } +} diff --git a/src/Properties/Messages.en.resx b/src/Properties/Messages.en.resx new file mode 100644 index 0000000..ce867fa --- /dev/null +++ b/src/Properties/Messages.en.resx @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Clear downloaded cache folder. + + + Path to the image file. Also supports web links. (DANGER: USE WEB LINKS AT YOUR OWN RISK!) + + + Output height as pixels. 1 char height = 2 pixels. Set to 0 for auto size. + + + List available resampling algorithms. + + + Left margin size as characters. Shifts the output from cursor start to right by specified character count. 1 char width = 1 pixel. + + + Top margin size as characters. Shifts the output from cursor start to bottom by specified character count. 1 char height = 2 pixels. + + + Resampling algorithm for downsizing. + + + Resizing mode. Available options: Contain, Cover (Crop), Stretch + + + Use fullscreen. This overrides margin and size arguments! + + + Output width as pixels. 1 char width = 1 pixel. Set to 0 for auto size. + + + Failed to open the specified file! + + + Server returned invalid mime type "%s"! + + + Invalid resampler specified! + + + Invalid resize mode specified! + + + Failed to fetch resampler! + + + Server returned code %s! + + + Only HTTPS protocol is supported! + + + Failed to parse the specified URL! + + + ERROR + + + INFO + + + WARNING + + + Available resampling algorithms: + + \ No newline at end of file diff --git a/src/Properties/Messages.tr.Designer.cs b/src/Properties/Messages.tr.Designer.cs new file mode 100644 index 0000000..2635c53 --- /dev/null +++ b/src/Properties/Messages.tr.Designer.cs @@ -0,0 +1,252 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace TYM.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Messages___Copy { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Messages___Copy() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TYM.Properties.Messages - Copy", typeof(Messages___Copy).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Path to the image file. Also supports web links. (DANGER: USE WEB LINKS AT YOUR OWN RISK!). + /// + internal static string Args_FilePath { + get { + return ResourceManager.GetString("Args.FilePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Output height as pixels. 1 char height = 2 pixels. Set to 0 for auto size.. + /// + internal static string Args_Height { + get { + return ResourceManager.GetString("Args.Height", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to List available resampling algorithms.. + /// + internal static string Args_ListResamplers { + get { + return ResourceManager.GetString("Args.ListResamplers", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Left margin size as characters. Shifts the output from cursor start to right by specified character count. 1 char width = 1 pixel.. + /// + internal static string Args_MarginX { + get { + return ResourceManager.GetString("Args.MarginX", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Top margin size as characters. Shifts the output from cursor start to bottom by specified character count. 1 char height = 2 pixels.. + /// + internal static string Args_MarginY { + get { + return ResourceManager.GetString("Args.MarginY", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resampling algorithm for downsizing.. + /// + internal static string Args_ResamplerName { + get { + return ResourceManager.GetString("Args.ResamplerName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resizing mode. Available options: Contain, Cover (Crop), Stretch. + /// + internal static string Args_ResizeMethod { + get { + return ResourceManager.GetString("Args.ResizeMethod", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Use fullscreen. This overrides margin and size arguments!. + /// + internal static string Args_UseFullscreen { + get { + return ResourceManager.GetString("Args.UseFullscreen", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Output width as pixels. 1 char width = 1 pixel. Set to 0 for auto size.. + /// + internal static string Args_Width { + get { + return ResourceManager.GetString("Args.Width", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to open the specified file!. + /// + internal static string Error_FileError { + get { + return ResourceManager.GetString("Error.FileError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Server returned invalid mime type "%s"!. + /// + internal static string Error_InvalidMimeType { + get { + return ResourceManager.GetString("Error.InvalidMimeType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid resampler specified!. + /// + internal static string Error_InvalidResampler { + get { + return ResourceManager.GetString("Error.InvalidResampler", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid resize mode specified!. + /// + internal static string Error_InvalidResizeMode { + get { + return ResourceManager.GetString("Error.InvalidResizeMode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to fetch resampler!. + /// + internal static string Error_ResamplerError { + get { + return ResourceManager.GetString("Error.ResamplerError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Server returned code %1!. + /// + internal static string Error_ResponseCode { + get { + return ResourceManager.GetString("Error.ResponseCode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Only HTTPS protocol is supported!. + /// + internal static string Error_UnsupportedProtocol { + get { + return ResourceManager.GetString("Error.UnsupportedProtocol", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to parse the specified URL!. + /// + internal static string Error_URLParseError { + get { + return ResourceManager.GetString("Error.URLParseError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ERROR. + /// + internal static string LogCategory_Error { + get { + return ResourceManager.GetString("LogCategory.Error", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to INFO. + /// + internal static string LogCategory_Info { + get { + return ResourceManager.GetString("LogCategory.Info", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WARNING. + /// + internal static string LogCategory_Warning { + get { + return ResourceManager.GetString("LogCategory.Warning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Available resampling algorithms:. + /// + internal static string Message_AvailableResamplers { + get { + return ResourceManager.GetString("Message.AvailableResamplers", resourceCulture); + } + } + } +} diff --git a/src/Properties/Messages.tr.resx b/src/Properties/Messages.tr.resx new file mode 100644 index 0000000..2b96bdc --- /dev/null +++ b/src/Properties/Messages.tr.resx @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Resim önbelleği klasörünü temizle. + + + Resim dosyasının konumu. Ağ bağlantıları da desteklenmektedir. (HARİCİ BAĞLANTILARI KULLANIRKEN DİKKATLİ OLUN!) + + + Pixel cinsinden çıktının yüksekliği. 1 karakter yüksekliği = 2 pixel. Otomatik boyutlandırma için 0'a ayarlayın. + + + Ölçeklendirme algoritmalarını listele. + + + Karakter cinsinden sol kenara olan uzaklık. Çıktıyı imleç konumundan belirtilen karakter sayısı kadar sağa kaydırır. 1 karakter genişliği = 1 pixel. + + + Karakter cinsinden üst kenara olan uzaklık. Çıktıyı imleç konumundan belirtilen karakter sayısı kadar aşağı kaydırır. 1 karakter genişliği = 2 pixel. + + + Kullanılan ölçeklendirme algoritması. + + + Boyutlandırma modu: Kullanılabilecek seçenekler: Contain, Cover (Crop), Stretch + + + Tam ekran modu. Bu, boyut ve konum argümanlarını devre dışı bırakır. + + + Pixel cinsinden çıktının genişliği. 1 karakter genişliği = 1 pixel. Otomatik boyutlandırma için 0'a ayarlayın. + + + Belirtilen dosya açılamadı! + + + Sunucu geçersiz MIME türü ile yanıtladı: "%s"! + + + Geçersiz ölçeklendirme algoritması belirtildi! + + + Geçersiz boyutlandırma modu belirtildi! + + + Ölçeklendirici getirilemedi! + + + Sunucu %s kodu gönderd! + + + Sadece HTTPS protokolü desteklenmektedir! + + + Belitrilen URL ayrıştırılamadı! + + + HATA + + + BILGI + + + UYARI + + + Kullanılabilecek ölçeklendirme algoritmaları: + + \ No newline at end of file diff --git a/src/Properties/PublishProfiles/macos-latest.pubxml b/src/Properties/PublishProfiles/PublishConfig.pubxml similarity index 61% rename from src/Properties/PublishProfiles/macos-latest.pubxml rename to src/Properties/PublishProfiles/PublishConfig.pubxml index f055cdd..f42694f 100644 --- a/src/Properties/PublishProfiles/macos-latest.pubxml +++ b/src/Properties/PublishProfiles/PublishConfig.pubxml @@ -4,14 +4,11 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - Release - x64 pub\ FileSystem - <_TargetId>Folder net7.0 - osx-x64 true - false + true + false \ No newline at end of file diff --git a/src/Properties/PublishProfiles/macos-arm64.pubxml b/src/Properties/PublishProfiles/macos-arm64.pubxml deleted file mode 100644 index 2633340..0000000 --- a/src/Properties/PublishProfiles/macos-arm64.pubxml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Release - ARM64 - pub\ - FileSystem - <_TargetId>Folder - net7.0 - osx-arm64 - true - false - - \ No newline at end of file diff --git a/src/Properties/PublishProfiles/ubuntu-arm64.pubxml b/src/Properties/PublishProfiles/ubuntu-arm64.pubxml deleted file mode 100644 index 286f71b..0000000 --- a/src/Properties/PublishProfiles/ubuntu-arm64.pubxml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Release - ARM64 - pub\ - FileSystem - <_TargetId>Folder - net7.0 - linux-arm64 - true - false - - \ No newline at end of file diff --git a/src/Properties/PublishProfiles/ubuntu-latest.pubxml b/src/Properties/PublishProfiles/ubuntu-latest.pubxml deleted file mode 100644 index 0e87cf8..0000000 --- a/src/Properties/PublishProfiles/ubuntu-latest.pubxml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Release - x64 - pub\ - FileSystem - <_TargetId>Folder - net7.0 - linux-x64 - true - false - - \ No newline at end of file diff --git a/src/Properties/PublishProfiles/windows-arm64.pubxml b/src/Properties/PublishProfiles/windows-arm64.pubxml deleted file mode 100644 index 1424797..0000000 --- a/src/Properties/PublishProfiles/windows-arm64.pubxml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Release - ARM64 - pub\ - FileSystem - <_TargetId>Folder - net7.0 - win-arm64 - true - false - true - - \ No newline at end of file diff --git a/src/Properties/PublishProfiles/windows-latest.pubxml b/src/Properties/PublishProfiles/windows-latest.pubxml deleted file mode 100644 index 020cbae..0000000 --- a/src/Properties/PublishProfiles/windows-latest.pubxml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Release - x64 - pub\ - FileSystem - <_TargetId>Folder - net7.0 - win-x64 - true - false - true - - \ No newline at end of file diff --git a/src/TYM.csproj b/src/TYM.csproj index 4498cb4..f9193c0 100644 --- a/src/TYM.csproj +++ b/src/TYM.csproj @@ -6,9 +6,8 @@ enable enable AnyCPU;x64;x86;ARM32;ARM64 - true TYM.Program - True + False False TYM ZyexSoftware.TYM @@ -21,61 +20,75 @@ en GPL-3.0-only True - 1.0.0 + 1.0.1 $(AssemblyVersion) res\icon.ico res\project_icon.png $(AssemblyName) View your images in the terminal with true color + False - - embedded - + - - embedded - + - - embedded - + - - embedded - + - - embedded - + - - embedded - + - - embedded - + - - embedded - + - - embedded - + - - embedded - + + + + + + + + + + + + + Messages.tr.resx + True + True + + + True + True + Messages.en.resx + + + + + + Messages.tr.Designer.cs + ResXFileCodeGenerator + + + ResXFileCodeGenerator + Messages.en.Designer.cs + + + diff --git a/src/settings.json b/src/settings.json new file mode 100644 index 0000000..92ed3c3 --- /dev/null +++ b/src/settings.json @@ -0,0 +1,11 @@ +{ + "supportedImageFormats": [ + "image/jpeg", + "image/bmp", + "image/gif", + "image/png", + "image/tiff", + "image/webp" + ], + "tempDirectoryName": "TYMwebfetch" +} \ No newline at end of file