Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
V1.0 final!
Browse files Browse the repository at this point in the history
Woot it's done!
  • Loading branch information
MrSquirrely committed Apr 20, 2019
1 parent 3646a70 commit 0905bc8
Show file tree
Hide file tree
Showing 18 changed files with 421 additions and 79 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,4 @@ ASALocalRun/
# MFractors (Xamarin productivity tool) working folder
.mfractor/
Image Converter/Code/Github.cs
Image Converter/gif2webp.exe
24 changes: 20 additions & 4 deletions Image Converter/Code/Converter.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -45,12 +46,27 @@ private static void WebPConvert() {
magickImage.Settings.SetDefine(WEBP, "-quality", $"{Properties.Settings.Default.WebP_Quality}");
magickImage.Format = WEBP;
magickImage.Write($"{image}.webp");

RemoveImage($"{info.FileName}{info.FileType}", info.FileLocation);
}
else if (info.FileType != ".webp") {
//Todo: add gif conversion
Process gifProcess = new Process() {
StartInfo = {
FileName = "cmd.exe",
RedirectStandardInput = true,
RedirectStandardOutput = true,
CreateNoWindow = true,
UseShellExecute = false
}
};

gifProcess.Start();
gifProcess.StandardInput.WriteLine($"cd {Environment.CurrentDirectory}");
//process.StandardInput.WriteLine($"gif2webp.exe {Options.GetWebPQuality()} \"{Image}\" -o \"{infos.FileDirectory()}\\{infos.FileNameWithoutExtension()}.webp\"");
gifProcess.StandardInput.WriteLine($"gif2webp.exe {Properties.Settings.Default.WebP_Quality} \"{imageExt}\" -o \"{image}.webp\"");
gifProcess.StandardInput.Flush();
gifProcess.StandardInput.Close();
gifProcess.WaitForExit();
}
RemoveImage($"{info.FileName}{info.FileType}", info.FileLocation);
}
catch (Exception ex) {
Logger.Instance.LogError(ex);
Expand All @@ -63,7 +79,7 @@ private static void JpegConvert() {
string imageExt = $"{info.FileLocation}\\{info.FileName}{info.FileType}";
string image = $"{info.FileLocation}\\{info.FileName}";

try{
try {
if (info.FileType != ".jpg" && info.FileType != ".jpeg" && info.FileType != ".gif") {
MagickImage magickImage = new MagickImage(imageExt);
magickImage.Settings.SetDefine(JPEG, "-quality", $"{Properties.Settings.Default.Jpeg_Quality}");
Expand Down
6 changes: 4 additions & 2 deletions Image Converter/Code/Utilities.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using MaterialDesignThemes.Wpf;
using MahApps.Metro.Controls;
using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
Expand All @@ -17,6 +18,7 @@ public class Utilities {
static readonly string[] SizeSuffixes = { "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" };

public static SnackbarMessageQueue messageQueue { get; set; }
public static Flyout flyout { get; set; }

public static string SizeSuffix(long value, int decimalPlaces = 1) {
if (value < 0) {
Expand Down Expand Up @@ -64,7 +66,7 @@ public static void PopulateList(string[] droppedFiles) {
"“Begin with the end in mind.” – Steven Covey",
"“Much of the stress that people feel doesn’t come from having too much to do. It comes from not finishing what they started.” – David Allen",
"“It’s not enough to be busy, so are the ants. The question is, what are we busy about?” – Henry David Thoreau",
"“You’ve got to think about big things while you’re doing small things, so that all the small things go in the right direction.” – Alvin Toffler"
"“You’ve got to think about big things while you’re doing small things, so that all the small things go in the right direction.” – Alvin Toffler",
"“In the long run, we shape our lives, and we shape ourselves. The process never ends until we die. And the choices we make are ultimately our own responsibility.” ― Eleanor Roosevelt"
};

Expand Down
20 changes: 9 additions & 11 deletions Image Converter/Image Converter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
<WarningLevel>4</WarningLevel>
<LangVersion>preview</LangVersion>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="ControlzEx, Version=3.0.2.4, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net462\ControlzEx.dll</HintPath>
Expand All @@ -62,9 +65,6 @@
<Reference Include="MahApps.Metro, Version=1.6.5.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.6.5\lib\net47\MahApps.Metro.dll</HintPath>
</Reference>
<Reference Include="Markdig, Version=0.16.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Markdig.0.16.0\lib\net40\Markdig.dll</HintPath>
</Reference>
<Reference Include="MaterialDesignColors, Version=1.1.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialDesignColors.1.1.3\lib\net45\MaterialDesignColors.dll</HintPath>
</Reference>
Expand All @@ -80,9 +80,6 @@
<Reference Include="Microsoft.WindowsAPICodePack.Shell, Version=1.1.3.3, Culture=neutral, PublicKeyToken=8985beaab7ea3f04, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft-WindowsAPICodePack-Shell.1.1.3.3\lib\net452\Microsoft.WindowsAPICodePack.Shell.dll</HintPath>
</Reference>
<Reference Include="Neo.Markdig.Xaml, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Neo.Markdig.Xaml.1.0.5\lib\net47\Neo.Markdig.Xaml.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.6.2\lib\net45\NLog.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -179,20 +176,15 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.de.resx" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="MarkdigXaml.licenseheader" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="README.md">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
Expand All @@ -208,6 +200,12 @@
<Content Include="finished.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="gif2webp.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Resource Include="icon.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
14 changes: 7 additions & 7 deletions Image Converter/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@

<metro:MetroWindow.RightWindowCommands>
<metro:WindowCommands>
<Button Name="BugButton" Content="{materialDesign:PackIcon Kind=BugReport}" Click="BugButton_Click"/>
<Button Name="SettingsButton" Click="SettingsButton_Click" ToolTip="Opens settings menu">
<Button Name="BugButton" Content="{materialDesign:PackIcon Kind=BugReport}" Click="BugButton_Click" ToolTip="{x:Static loc:Resources.BugsTooltip}"/>
<Button Name="SettingsButton" Click="SettingsButton_Click" ToolTip="{x:Static loc:Resources.SettingsTooltip}">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Width="24" Height="24" Kind="Cog"/>
<TextBlock Margin="4 0 0 0" VerticalAlignment="Center" Text="{x:Static loc:Resources.Settings}" />
</StackPanel>
</Button>
<Button Name="AboutButton" Content="{materialDesign:PackIcon Kind=Help}" Click="AboutButton_Click"/>
<Button Name="AboutButton" Content="{materialDesign:PackIcon Kind=Help}" Click="AboutButton_Click" ToolTip="{x:Static loc:Resources.AboutTooltip}"/>
</metro:WindowCommands>
</metro:MetroWindow.RightWindowCommands>

Expand All @@ -41,9 +41,9 @@
<Button Name="FileButton" Click="FileButton_Click" ToolTip="File" Content="{x:Static loc:Resources.File}">
<Button.ContextMenu>
<ContextMenu>
<MenuItem Name="OpenFolderMenu" Header="{x:Static loc:Resources.OpenFolderMenu}" Click="OpenFolderMenu_Click"/>
<MenuItem Name="OpenFileMenu" Header="{x:Static loc:Resources.OpenFileMenu}" Click="OpenFileMenu_Click"/>
<MenuItem Name="ExitMenu" Header="{x:Static loc:Resources.ExitMenu}" Click="ExitMenu_Click"/>
<MenuItem Name="OpenFolderMenu" Header="{x:Static loc:Resources.OpenFolderMenu}" ToolTip="{x:Static loc:Resources.OpenFolderTooltip}" Click="OpenFolderMenu_Click"/>
<MenuItem Name="OpenFileMenu" Header="{x:Static loc:Resources.OpenFileMenu}" ToolTip="{x:Static loc:Resources.OpenFileTooltip}" Click="OpenFileMenu_Click"/>
<MenuItem Name="ExitMenu" Header="{x:Static loc:Resources.ExitMenu}" ToolTip="{x:Static loc:Resources.ExitTooltip}" Click="ExitMenu_Click"/>
</ContextMenu>
</Button.ContextMenu>
</Button>
Expand Down Expand Up @@ -79,7 +79,7 @@
<ComboBoxItem Content="PNG"/>
<ComboBoxItem Content="JPEG"/>
</ComboBox>
<Button Name="ConvertButton" Content="{x:Static loc:Resources.Convert}" Height="Auto" Margin="0,0,10,10" Click="ConvertButton_Click" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
<Button Name="ConvertButton" Content="{x:Static loc:Resources.Convert}" ToolTip="{x:Static loc:Resources.ConvertTooltip}" Height="Auto" Margin="0,0,10,10" Click="ConvertButton_Click" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
<materialDesign:Snackbar MessageQueue="{materialDesign:MessageQueue}" x:Name="SnackbarToaster" />
</Grid>
</metro:MetroWindow>
3 changes: 2 additions & 1 deletion Image Converter/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ public MainWindow() {
InitializeComponent();
Utilities.ImageListView = ImageList;
Utilities.messageQueue = SnackbarToaster.MessageQueue;
Utilities.flyout = FlyoutControl;
}

private void SettingsButton_Click(object sender, RoutedEventArgs e) => OpenFlyout(new SettingsContent(), Properties.Resources.Settings);
private void AboutButton_Click(object sender, RoutedEventArgs e) => OpenFlyout(new AboutContent(), Properties.Resources.About);
private void BugButton_Click(object sender, RoutedEventArgs e) => OpenFlyout(new BugContent(), "Bugs or Features");
private void BugButton_Click(object sender, RoutedEventArgs e) => OpenFlyout(new BugContent(), Properties.Resources.BugsOrFeatures);

private void OpenFlyout(UserControl content, string header) {
content.Width = FlyoutWidth;
Expand Down
6 changes: 3 additions & 3 deletions Image Converter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Image Converter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("A simple and easy to use image converter")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP Inc.")]
[assembly: AssemblyCompany("MrSquirrely.net")]
[assembly: AssemblyProduct("Image Converter")]
[assembly: AssemblyCopyright("Copyright © HP Inc. 2019")]
[assembly: AssemblyCopyright("Copyright © James<MrSquirrely.net> 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down
Loading

0 comments on commit 0905bc8

Please sign in to comment.