Skip to content

Commit 4e959bf

Browse files
author
Martin Fischer
committed
Merge branch 'dev'
2 parents 536e521 + 27c328b commit 4e959bf

15 files changed

+7262
-474
lines changed

PEunion/App.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<Setter.Value>
3737
<DataTemplate>
3838
<StackPanel>
39-
<TextBlock Text="{Binding}" MaxWidth="200" TextWrapping='Wrap' />
39+
<TextBlock Text="{Binding}" MaxWidth="200" TextWrapping="Wrap" />
4040
</StackPanel>
4141
</DataTemplate>
4242
</Setter.Value>

PEunion/BytecodeApi.dll

141 KB
Binary file not shown.

PEunion/BytecodeApi.xml

Lines changed: 6829 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PEunion/Classes/Project/Project.cs

Lines changed: 47 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,21 @@ namespace PEunion
1212
{
1313
public class Project : ObservableObject
1414
{
15-
private string _SaveLocation;
16-
private bool _IsDirty;
17-
private BuildPlatform _Platform;
18-
private BuildManifest _Manifest;
19-
private string _IconPath;
20-
private string _AssemblyTitle;
21-
private string _AssemblyProduct;
22-
private string _AssemblyCopyright;
23-
private string _AssemblyVersion;
24-
private BuildObfuscationType _Obfuscation;
25-
private bool _StringEncryption;
26-
private bool _StringLiteralEncryption;
27-
private bool _DeleteZoneID;
28-
private bool _Melt;
29-
private ObservableCollection<ProjectItem> _Items;
30-
private ValidationError[] _ValidationErrors;
31-
private int _ValidationErrorCount;
32-
private int _ValidationWarningCount;
33-
private int _ValidationMessageCount;
34-
3515
public string SaveLocation
3616
{
37-
get => _SaveLocation;
17+
get => Get(() => SaveLocation);
3818
set
3919
{
40-
Set(() => SaveLocation, ref _SaveLocation, value);
20+
Set(() => SaveLocation, value);
4121
RaisePropertyChanged(() => ProjectName);
4222
}
4323
}
4424
public bool IsDirty
4525
{
46-
get => _IsDirty;
26+
get => Get(() => IsDirty);
4727
set
4828
{
49-
Set(() => IsDirty, ref _IsDirty, value);
29+
Set(() => IsDirty, value);
5030
WindowMain.Singleton.Title = ProjectName + (value ? " *" : null) + " - PEunion";
5131
WindowMain.Singleton.txtProjectTabIsDirty.SetVisibility(value);
5232

@@ -58,7 +38,7 @@ public bool IsDirty
5838
else
5939
{
6040
WindowMain.Singleton.ctrlBrowseIcon.Text = Path.GetFileName(IconPath);
61-
WindowMain.Singleton.ctrlBrowseIcon.IconImageSource = File.Exists(IconPath) ? new FileInfo(IconPath).GetFileIcon(true).ToBitmapSource() : Utility.GetImageResource("ImageMissingIcon");
41+
WindowMain.Singleton.ctrlBrowseIcon.IconImageSource = File.Exists(IconPath) ? FileEx.GetIcon(IconPath, true).ToBitmapSource() : Utility.GetImageResource("ImageMissingIcon");
6242
}
6343
WindowMain.Singleton.ctrlBrowseIcon.IsResetButtonEnabled = IconPath != null;
6444

@@ -67,144 +47,144 @@ public bool IsDirty
6747
}
6848
public BuildPlatform Platform
6949
{
70-
get => _Platform;
50+
get => Get(() => Platform);
7151
set
7252
{
73-
Set(() => Platform, ref _Platform, value);
53+
Set(() => Platform, value);
7454
IsDirty = true;
7555
}
7656
}
7757
public BuildManifest Manifest
7858
{
79-
get => _Manifest;
59+
get => Get(() => Manifest);
8060
set
8161
{
82-
Set(() => Manifest, ref _Manifest, value);
62+
Set(() => Manifest, value);
8363
IsDirty = true;
8464
}
8565
}
8666
public string IconPath
8767
{
88-
get => _IconPath;
68+
get => Get(() => IconPath);
8969
set
9070
{
91-
Set(() => IconPath, ref _IconPath, value);
71+
Set(() => IconPath, value);
9272
IsDirty = true;
9373
}
9474
}
9575
public string AssemblyTitle
9676
{
97-
get => _AssemblyTitle;
77+
get => Get(() => AssemblyTitle);
9878
set
9979
{
100-
Set(() => AssemblyTitle, ref _AssemblyTitle, value);
80+
Set(() => AssemblyTitle, value);
10181
IsDirty = true;
10282
}
10383
}
10484
public string AssemblyProduct
10585
{
106-
get => _AssemblyProduct;
86+
get => Get(() => AssemblyProduct);
10787
set
10888
{
109-
Set(() => AssemblyProduct, ref _AssemblyProduct, value);
89+
Set(() => AssemblyProduct, value);
11090
IsDirty = true;
11191
}
11292
}
11393
public string AssemblyCopyright
11494
{
115-
get => _AssemblyCopyright;
95+
get => Get(() => AssemblyCopyright);
11696
set
11797
{
118-
Set(() => AssemblyCopyright, ref _AssemblyCopyright, value);
98+
Set(() => AssemblyCopyright, value);
11999
IsDirty = true;
120100
}
121101
}
122102
public string AssemblyVersion
123103
{
124-
get => _AssemblyVersion;
104+
get => Get(() => AssemblyVersion);
125105
set
126106
{
127-
Set(() => AssemblyVersion, ref _AssemblyVersion, value);
107+
Set(() => AssemblyVersion, value);
128108
IsDirty = true;
129109
}
130110
}
131111
public BuildObfuscationType Obfuscation
132112
{
133-
get => _Obfuscation;
113+
get => Get(() => Obfuscation);
134114
set
135115
{
136-
Set(() => Obfuscation, ref _Obfuscation, value);
116+
Set(() => Obfuscation, value);
137117
RaisePropertyChanged(() => ObfuscationExample);
138118
IsDirty = true;
139119
}
140120
}
141121
public bool StringEncryption
142122
{
143-
get => _StringEncryption;
123+
get => Get(() => StringEncryption);
144124
set
145125
{
146-
Set(() => StringEncryption, ref _StringEncryption, value);
126+
Set(() => StringEncryption, value);
147127
IsDirty = true;
148128
}
149129
}
150130
public bool StringLiteralEncryption
151131
{
152-
get => _StringLiteralEncryption;
132+
get => Get(() => StringLiteralEncryption);
153133
set
154134
{
155-
Set(() => StringLiteralEncryption, ref _StringLiteralEncryption, value);
135+
Set(() => StringLiteralEncryption, value);
156136
IsDirty = true;
157137
}
158138
}
159139
public bool DeleteZoneID
160140
{
161-
get => _DeleteZoneID;
141+
get => Get(() => DeleteZoneID);
162142
set
163143
{
164-
Set(() => DeleteZoneID, ref _DeleteZoneID, value);
144+
Set(() => DeleteZoneID, value);
165145
IsDirty = true;
166146
}
167147
}
168148
public bool Melt
169149
{
170-
get => _Melt;
150+
get => Get(() => Melt);
171151
set
172152
{
173-
Set(() => Melt, ref _Melt, value);
153+
Set(() => Melt, value);
174154
IsDirty = true;
175155
}
176156
}
177157
public ObservableCollection<ProjectItem> Items
178158
{
179-
get => _Items;
159+
get => Get(() => Items);
180160
set
181161
{
182-
if (_Items != null) _Items.CollectionChanged -= _Items_CollectionChanged;
183-
Set(() => Items, ref _Items, value);
184-
if (_Items != null) _Items.CollectionChanged += _Items_CollectionChanged;
162+
if (Get(() => Items) != null) Get(() => Items).CollectionChanged -= Items_CollectionChanged;
163+
Set(() => Items, value);
164+
if (value != null) value.CollectionChanged += Items_CollectionChanged;
185165
RaisePropertyChanged(() => ProjectName);
186166
IsDirty = true;
187167
}
188168
}
189169
public ValidationError[] ValidationErrors
190170
{
191-
get => _ValidationErrors;
192-
set => Set(() => ValidationErrors, ref _ValidationErrors, value);
171+
get => Get(() => ValidationErrors);
172+
set => Set(() => ValidationErrors, value);
193173
}
194174
public int ValidationErrorCount
195175
{
196-
get => _ValidationErrorCount;
197-
set => Set(() => ValidationErrorCount, ref _ValidationErrorCount, value);
176+
get => Get(() => ValidationErrorCount);
177+
set => Set(() => ValidationErrorCount, value);
198178
}
199179
public int ValidationWarningCount
200180
{
201-
get => _ValidationWarningCount;
202-
set => Set(() => ValidationWarningCount, ref _ValidationWarningCount, value);
181+
get => Get(() => ValidationWarningCount);
182+
set => Set(() => ValidationWarningCount, value);
203183
}
204184
public int ValidationMessageCount
205185
{
206-
get => _ValidationMessageCount;
207-
set => Set(() => ValidationMessageCount, ref _ValidationMessageCount, value);
186+
get => Get(() => ValidationMessageCount);
187+
set => Set(() => ValidationMessageCount, value);
208188
}
209189

210190
public string ObfuscationExample => Lookups.ObfuscationExamples[Obfuscation];
@@ -518,8 +498,8 @@ public ValidationError[] ValidateBuild()
518498
}
519499
else
520500
{
521-
string originalExtension = PathEx.GetExtension(file.FullName);
522-
string newExtension = PathEx.GetExtension(file.Name);
501+
string originalExtension = Path.GetExtension(file.FullName).TrimStart('.');
502+
string newExtension = Path.GetExtension(file.Name).TrimStart('.');
523503
if (newExtension == "")
524504
{
525505
errors.Add(ValidationError.CreateWarning(file.SourceFileName, "'" + file.Name.Trim() + "' has no extension (suggested: " + originalExtension + ")"));
@@ -529,7 +509,7 @@ public ValidationError[] ValidateBuild()
529509
errors.Add(ValidationError.CreateWarning(file.SourceFileName, "'" + file.Name.Trim() + "' has a different extension than the original file (" + originalExtension + ")"));
530510
}
531511

532-
if (PathEx.GetExtension(file.Name, true).EqualsAny(unintendedFileExtensions))
512+
if (Path.GetExtension(file.Name).TrimStart('.').ToLower().EqualsAny(unintendedFileExtensions))
533513
{
534514
errors.Add(ValidationError.CreateWarning(file.SourceFileName, "File extension '" + Path.GetExtension(file.Name) + "' - Possibly unintended file"));
535515
}
@@ -569,11 +549,11 @@ public ValidationError[] ValidateBuild()
569549
}
570550
else
571551
{
572-
if (PathEx.GetExtension(url.Name) == "")
552+
if (Path.GetExtension(url.Name).TrimStart('.') == "")
573553
{
574554
errors.Add(ValidationError.CreateWarning(source, "'" + url.Name.Trim() + "' has no extension"));
575555
}
576-
if (PathEx.GetExtension(url.Name, true).EqualsAny(unintendedFileExtensions))
556+
if (Path.GetExtension(url.Name).TrimStart('.').ToLower().EqualsAny(unintendedFileExtensions))
577557
{
578558
errors.Add(ValidationError.CreateWarning(source, "File extension '" + Path.GetExtension(url.Name) + "' - Possibly unintended file"));
579559
}
@@ -608,7 +588,7 @@ public ValidationError[] ValidateBuild()
608588
return errors.ToArray();
609589
}
610590

611-
private void _Items_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
591+
private void Items_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
612592
{
613593
RaisePropertyChanged(() => ProjectName);
614594
}

0 commit comments

Comments
 (0)