Skip to content

Commit

Permalink
Fixed warnings in UpdateInstaller and UpdateModule
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemK123 committed Oct 20, 2020
1 parent 7d76209 commit 2cf721d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 15 deletions.
1 change: 1 addition & 0 deletions Custom.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA1101" Action="None" />
<Rule Id="SA1633" Action="None" />
<Rule Id="SA0001" Action="None" />
</Rules>
</RuleSet>
14 changes: 9 additions & 5 deletions PixiEditor.UpdateInstaller/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly)

// ResourceDictionaryLocation.None - where theme specific resource dictionaries are located
// (used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,

// ResourceDictionaryLocation.SourceAssembly - where the generic resource dictionary is located
// (used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
]
10 changes: 5 additions & 5 deletions PixiEditor.UpdateInstaller/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ namespace PixiEditor.UpdateInstaller
{
public static class Extensions
{
private static readonly int MaxPath = 255;

[DllImport("kernel32.dll")]
private static extern uint GetModuleFileName(IntPtr hModule, StringBuilder lpFilename, int nSize);
private const int MaxPath = 255;

public static string GetExecutablePath()
{
Expand All @@ -21,7 +18,10 @@ public static string GetExecutablePath()
return sb.ToString();
}

return Process.GetCurrentProcess().MainModule.FileName;
return Process.GetCurrentProcess().MainModule?.FileName;
}

[DllImport("kernel32.dll")]
private static extern uint GetModuleFileName(IntPtr hModule, StringBuilder lpFilename, int nSize);
}
}
6 changes: 3 additions & 3 deletions PixiEditor.UpdateInstaller/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
namespace PixiEditor.UpdateInstaller
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// Interaction logic for MainWindow.xaml.
/// </summary>
public partial class MainWindow : Window
public partial class MainWindow
{
public MainWindow()
{
Expand All @@ -19,7 +19,7 @@ public MainWindow()

private async void Window_Loaded(object sender, RoutedEventArgs e)
{
var vmm = (ViewModelMain) DataContext;
var vmm = (ViewModelMain)DataContext;
await Task.Run(() =>
{
try
Expand Down
7 changes: 5 additions & 2 deletions PixiEditor.UpdateInstaller/ViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ namespace PixiEditor.UpdateInstaller
{
public class ViewModelBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged = delegate { };
public event PropertyChangedEventHandler PropertyChanged = (sender, e) => { };

protected void RaisePropertyChanged(string property)
{
if (property != null) PropertyChanged(this, new PropertyChangedEventArgs(property));
if (property != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(property));
}
}
}
}
1 change: 1 addition & 0 deletions PixiEditor.UpdateInstaller/ViewModelMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public ViewModelMain()
}

public ViewModelMain Current { get; }

public UpdateModule.UpdateInstaller Installer { get; set; }

public string UpdateDirectory { get; }
Expand Down

0 comments on commit 2cf721d

Please sign in to comment.