-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from 0x78654C/v1.8.2-exif
V1.8.2 exif
- Loading branch information
Showing
8 changed files
with
408 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using Core; | ||
using Core.SystemTools; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Runtime.Versioning; | ||
|
||
namespace Commands.TerminalCommands.ConsoleSystem | ||
{ | ||
[SupportedOSPlatform("windows")] | ||
public class Exif: ITerminalCommand | ||
{ | ||
public string Name => "exif"; | ||
private static List<string> s_imgExt = new List<string>() { | ||
".jpg", | ||
".jpeg", | ||
".jpe", | ||
".tiff", | ||
".png", | ||
".tff" | ||
}; | ||
private static string s_helpMessage = $@"Usage of exif command: | ||
exif <path_to_image_file>. | ||
Can be used with the following parameters: | ||
exif -h : Displays this message. | ||
Attention: Works only with the following extensions: {string.Join(", ",s_imgExt)}. | ||
"; | ||
public void Execute(string args) | ||
{ | ||
try | ||
{ | ||
if (args == $"{Name} -h") | ||
{ | ||
Console.WriteLine(s_helpMessage); | ||
return; | ||
} | ||
|
||
var pathFile = args.Replace($"{Name}","").Trim(); | ||
if (File.Exists(pathFile)) | ||
{ | ||
|
||
var fileInfo = new FileInfo(pathFile); | ||
if (s_imgExt.Contains(fileInfo.Extension.ToLower())) | ||
ExifLib.GetExifInfo(fileInfo.FullName); | ||
else | ||
FileSystem.ErrorWriteLine($"Format '{fileInfo.Extension}' unsupported! Use -h for check avaible formats."); | ||
} | ||
else | ||
{ | ||
FileSystem.ErrorWriteLine($"File does not exist: '{pathFile}'"); | ||
} | ||
} | ||
catch(Exception e) | ||
{ | ||
FileSystem.ErrorWriteLine(e.Message); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.