Skip to content

Commit 997ab4d

Browse files
committed
Update 34d libraries
1 parent c238cf2 commit 997ab4d

File tree

5 files changed

+42
-48
lines changed

5 files changed

+42
-48
lines changed

src/AiZoom/AiZoom.csproj

+12-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net5.0-windows</TargetFramework>
5+
<TargetFramework>net6.0-windows</TargetFramework>
66
<UseWPF>true</UseWPF>
77
<Version>1.0.0</Version>
88
<ApplicationIcon>icon.ico</ApplicationIcon>
@@ -12,17 +12,17 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Autofac" Version="6.3.0" />
16-
<PackageReference Include="CliWrap" Version="3.3.3" />
17-
<PackageReference Include="MahApps.Metro" Version="2.4.7" />
18-
<PackageReference Include="MahApps.Metro.IconPacks" Version="4.10.0" />
19-
<PackageReference Include="MaterialDesignThemes.MahApps" Version="0.1.9" />
20-
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.0" />
21-
<PackageReference Include="NLog" Version="4.7.11" />
22-
<PackageReference Include="Ookii.Dialogs.Wpf" Version="4.0.0" />
23-
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" />
24-
<PackageReference Include="TG.INI" Version="1.3.1" />
25-
<PackageReference Include="WPFLocalizeExtension" Version="3.9.0" />
15+
<PackageReference Include="Autofac" Version="6.4.0" />
16+
<PackageReference Include="CliWrap" Version="3.5.0" />
17+
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
18+
<PackageReference Include="MahApps.Metro" Version="2.4.9" />
19+
<PackageReference Include="MahApps.Metro.IconPacks" Version="4.11.0" />
20+
<PackageReference Include="MaterialDesignThemes.MahApps" Version="0.2.5" />
21+
<PackageReference Include="NLog" Version="5.0.4" />
22+
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
23+
<PackageReference Include="PropertyChanged.Fody" Version="4.0.3" />
24+
<PackageReference Include="TG.INI" Version="1.3.3" />
25+
<PackageReference Include="WPFLocalizeExtension" Version="3.9.4" />
2626
</ItemGroup>
2727

2828
<ItemGroup>

src/AiZoom/ViewModel/AboutViewModel.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
using Microsoft.Toolkit.Mvvm.ComponentModel;
1+
using CommunityToolkit.Mvvm.ComponentModel;
22
using System.Reflection;
33

44
namespace AiZoom.ViewModel
55
{
6-
public class AboutViewModel: ObservableObject
6+
public class AboutViewModel : ObservableObject
77
{
88
public string CurrentVersion => $"Version - {Assembly.GetExecutingAssembly().GetName().Version.ToString()}";
99
}

src/AiZoom/ViewModel/HomeViewModel.cs

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using AiZoom.Models;
22
using Autofac;
33
using CliWrap;
4+
using CommunityToolkit.Mvvm.ComponentModel;
5+
using CommunityToolkit.Mvvm.Input;
46
using MahApps.Metro.Controls.Dialogs;
5-
using Microsoft.Toolkit.Mvvm.ComponentModel;
6-
using Microsoft.Toolkit.Mvvm.Input;
77
using System;
88
using System.IO;
99
using System.Threading.Tasks;
@@ -21,7 +21,7 @@ class HomeViewModel : ObservableObject
2121
public IAsyncRelayCommand OpenSourceImageCmd { get; set; }
2222
public IAsyncRelayCommand OpenResultImageCmd { get; set; }
2323

24-
24+
2525
#endregion
2626
#region Fields
2727

@@ -43,7 +43,7 @@ public HomeViewModel()
4343
_dialog = Locator.Container.Resolve<IDialogCoordinator>();
4444

4545
OpenImageCmd = new RelayCommand(OnOpenImageCmd);
46-
StartCmd = new AsyncRelayCommand(async()=> await OnStartCmd());
46+
StartCmd = new AsyncRelayCommand(async () => await OnStartCmd());
4747
OpenSourceImageCmd = new AsyncRelayCommand(OnOpenSourceImageCmd);
4848
OpenResultImageCmd = new AsyncRelayCommand(OnOpenResultImageCmd);
4949

@@ -88,9 +88,9 @@ private async Task OnStartCmd()
8888
var sourceImageFile = new FileInfo(SourceImage);
8989
var sourceImageName = Path.GetFileNameWithoutExtension(sourceImageFile.Name);
9090

91-
9291

93-
92+
93+
9494

9595
var engine = @"realesrgan\realesrgan-ncnn-vulkan.exe";
9696

@@ -102,9 +102,9 @@ private async Task OnStartCmd()
102102
}
103103

104104
var outputFileFullName = $"{settings.OutputDirectory}\\{outputFileName}.{settings.OutputFormat}";
105-
105+
106106
var arg = $" -i \"{SourceImage}\" -o \"{outputFileFullName}\" -n {settings.Module} -f {settings.OutputFormat} -s 4 -g auto -j 2:2:2 -v";
107-
107+
108108
var result = await Cli.Wrap(engine)
109109
.WithArguments(arg)
110110
.WithWorkingDirectory(AppContext.BaseDirectory)
@@ -118,40 +118,40 @@ private void ProcessImage(string output)
118118
var isDone = output.IndexOf("done", 0);
119119

120120
// process
121-
if(isPercentage != -1)
121+
if (isPercentage != -1)
122122
{
123123
ProgressString = output;
124-
ProgressValue = Double.Parse(output.Remove(output.Length-1,1));
124+
ProgressValue = Double.Parse(output.Remove(output.Length - 1, 1));
125125
}
126126

127127
// done
128-
if(isDone != -1)
128+
if (isDone != -1)
129129
{
130130
ProgressString = "100%";
131131
ProgressValue = 100;
132132

133133
// get final output file here. if the source images has alpha channel, the original file extension is preserved
134134
var startIndex = output.IndexOf(" -> ", 0);
135135

136-
var tail = output.Substring(startIndex+4);
136+
var tail = output.Substring(startIndex + 4);
137137
ResultImage = tail.Substring(0, tail.Length - 5);
138138
}
139139

140140

141-
141+
142142
}
143143

144144
private void OnOpenImageCmd()
145145
{
146-
var dialog = new Ookii.Dialogs.Wpf.VistaOpenFileDialog() { Filter= "jpeg (*.jpg)|*.jpg|PNG (*.png)|*.png|webp (*.webp)|*.webp"};
146+
var dialog = new Ookii.Dialogs.Wpf.VistaOpenFileDialog() { Filter = "jpeg (*.jpg)|*.jpg|PNG (*.png)|*.png|webp (*.webp)|*.webp" };
147147

148148
bool? success = dialog.ShowDialog();
149149
if (success == true)
150150
{
151151
SourceImage = dialog.FileName;
152152
ResultImage = null;
153153
}
154-
154+
155155
}
156156
}
157157
}

src/AiZoom/ViewModel/MainViewModel.cs.cs

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using Autofac;
2+
using CommunityToolkit.Mvvm.ComponentModel;
3+
using CommunityToolkit.Mvvm.Input;
4+
using MahApps.Metro.Controls.Dialogs;
5+
using System;
36
using System.Diagnostics;
4-
using System.Linq;
5-
using System.Reflection;
67
using System.Threading.Tasks;
7-
using AiZoom.Services.Interfaces;
8-
using Autofac;
9-
using MahApps.Metro.Controls.Dialogs;
10-
using Microsoft.Toolkit.Mvvm.ComponentModel;
11-
using Microsoft.Toolkit.Mvvm.Input;
128

139
namespace AiZoom.ViewModel
1410
{
@@ -33,23 +29,23 @@ public class MainViewModel : ObservableObject
3329

3430
public string Title { get; set; }
3531

36-
32+
3733

3834
#endregion
3935

4036

4137
public MainViewModel()
4238
{
43-
ExitCmd = new RelayCommand(()=> { Environment.Exit(0); });
39+
ExitCmd = new RelayCommand(() => { Environment.Exit(0); });
4440
SaveCmd = new AsyncRelayCommand(OnSaveCmd);
4541
ContentRenderedCmd = new AsyncRelayCommand(async () => await OnContentRenderedCmd());
4642
_dialog = Locator.Container.Resolve<IDialogCoordinator>();
47-
43+
4844
}
4945

5046
private async Task OnContentRenderedCmd()
5147
{
52-
48+
5349
}
5450

5551

src/AiZoom/ViewModel/SettingViewModel.cs

+4-6
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22
using AiZoom.Models;
33
using AiZoom.Services.Interfaces;
44
using Autofac;
5+
using CommunityToolkit.Mvvm.ComponentModel;
6+
using CommunityToolkit.Mvvm.Input;
57
using MahApps.Metro.Controls.Dialogs;
6-
using Microsoft.Toolkit.Mvvm.ComponentModel;
7-
using Microsoft.Toolkit.Mvvm.Input;
88
using System;
99
using System.Collections.Generic;
1010
using System.Globalization;
1111
using System.IO;
1212
using System.Linq;
13-
using System.Text;
1413
using System.Threading;
15-
using System.Threading.Tasks;
1614
using TG.INI;
1715
using TG.INI.Serialization;
1816
using WPFLocalizeExtension.Engine;
@@ -42,7 +40,7 @@ public class SettingViewModel : ObservableObject
4240
public List<LocaleModel> Locales { get; set; }
4341
public LocaleModel SelectedLocale { get; set; }
4442

45-
public List<string> Modules { get; set; }
43+
public List<string> Modules { get; set; }
4644
public string SelectedModule { get; set; }
4745

4846
public string FileNameSuffix { get; set; }
@@ -83,7 +81,7 @@ private void OnBrowseFolderCmd()
8381

8482
private void OnRestoreCmd()
8583
{
86-
SelectedLocale = Locales.First(x=>x.Code == "en");
84+
SelectedLocale = Locales.First(x => x.Code == "en");
8785
SelectedModule = "realesrgan-x4plus";
8886
FileNameSuffix = "";
8987
SelectedOutputFormat = "jpg";

0 commit comments

Comments
 (0)