Skip to content

Commit 656b0c4

Browse files
committed
Updated to use shorter construction syntax
1 parent fc7e4ba commit 656b0c4

File tree

72 files changed

+335
-346
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+335
-346
lines changed

VidCoder/Controls/EnhancedListView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace VidCoder.Controls;
1111

1212
public class EnhancedListView : ListView
1313
{
14-
private readonly List<IListItemViewModel> selectedItems = new List<IListItemViewModel>();
14+
private readonly List<IListItemViewModel> selectedItems = new();
1515

1616
protected override void OnSelectionChanged(SelectionChangedEventArgs e)
1717
{

VidCoder/DragDrop/DraggedAdorner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected override int VisualChildrenCount
6969

7070
public override GeneralTransform GetDesiredTransform(GeneralTransform transform)
7171
{
72-
GeneralTransformGroup result = new GeneralTransformGroup();
72+
GeneralTransformGroup result = new();
7373
result.Children.Add(base.GetDesiredTransform(transform));
7474
result.Children.Add(new TranslateTransform(this.left, this.top));
7575

VidCoder/EnumDisplayer.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ public class EnumDisplayer : IValueConverter
1616
private Type type;
1717
private IDictionary displayValues;
1818
private IDictionary reverseValues;
19-
private static Dictionary<string, string> overriddenDisplayEntries = new Dictionary<string, string>
19+
private static Dictionary<string, string> overriddenDisplayEntries = new()
2020
{
2121
{ "Off", EnumsRes.Off },
2222
{ "Default", EnumsRes.Default },
2323
{ "Custom", EnumsRes.Custom },
2424
};
25-
private static Dictionary<string, string> resourceAliases = new Dictionary<string, string>
25+
private static Dictionary<string, string> resourceAliases = new()
2626
{
2727
{ "VCAnamorphic", "Anamorphic" },
2828
{ "VCDeinterlace", "Deinterlace" },
2929
{ "VCDecomb", "Decomb" },
3030
};
3131

32-
private static ResourceManager enumResourceManager = new ResourceManager(typeof(EnumsRes));
32+
private static ResourceManager enumResourceManager = new(typeof(EnumsRes));
3333

3434
public EnumDisplayer()
3535
{
@@ -107,7 +107,7 @@ private string GetAttributeDisplayString(DisplayAttribute[] attributes)
107107
DisplayAttribute displayAttribute = attributes[0];
108108
if (displayAttribute.ResourceType != null)
109109
{
110-
ResourceManager resourceManager = new ResourceManager(displayAttribute.ResourceType);
110+
ResourceManager resourceManager = new(displayAttribute.ResourceType);
111111
return resourceManager.GetString(displayAttribute.Name);
112112
}
113113

VidCoder/EnumStringConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private string GetDisplayStringValue(DisplayAttribute[] a)
4141

4242
if (displayAttribute.ResourceType != null)
4343
{
44-
ResourceManager resourceManager = new ResourceManager(displayAttribute.ResourceType);
44+
ResourceManager resourceManager = new(displayAttribute.ResourceType);
4545
return resourceManager.GetString(displayAttribute.Name);
4646
}
4747

VidCoder/Extensions/PresetExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace VidCoder.Extensions;
66

77
public static class PresetExtensions
88
{
9-
private static ResourceManager manager = new ResourceManager(typeof(MainRes));
9+
private static ResourceManager manager = new(typeof(MainRes));
1010

1111
public static string GetDisplayName(this Preset preset)
1212
{

VidCoder/Model/Config/ConfigObservable.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ namespace VidCoder.Model;
99
public class ConfigObservable<T> : IObservable<T>
1010
{
1111
private string key;
12-
private List<IObserver<T>> observers = new List<IObserver<T>>();
13-
private readonly object disposeLock = new object();
12+
private List<IObserver<T>> observers = new();
13+
private readonly object disposeLock = new();
1414

1515
public ConfigObservable(string key)
1616
{

VidCoder/Model/Database.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ public static class Database
2323
{
2424
private const string BackupFolderName = "Backups";
2525

26-
private static ThreadLocal<SQLiteConnection> threadLocalConnection = new ThreadLocal<SQLiteConnection>(trackAllValues: true);
26+
private static ThreadLocal<SQLiteConnection> threadLocalConnection = new(trackAllValues: true);
2727

2828
private static long mainThreadId;
2929

30-
private static Lazy<string> lazyDatabaseFile = new Lazy<string>(GetDatabaseFilePath);
30+
private static Lazy<string> lazyDatabaseFile = new(GetDatabaseFilePath);
3131

3232
public static void Initialize()
3333
{
@@ -231,14 +231,14 @@ private static void BackupDatabaseFile(int databaseVersion)
231231
/// <returns>The best version match.</returns>
232232
private static int FindBackupDatabaseFile()
233233
{
234-
DirectoryInfo backupDirectoryInfo = new DirectoryInfo(BackupDatabaseFolder);
234+
DirectoryInfo backupDirectoryInfo = new(BackupDatabaseFolder);
235235
if (!backupDirectoryInfo.Exists)
236236
{
237237
return -1;
238238
}
239239

240240
FileInfo[] backupFiles = backupDirectoryInfo.GetFiles();
241-
Regex regex = new Regex(@"^VidCoder-v(?<version>\d+)\.sqlite$");
241+
Regex regex = new(@"^VidCoder-v(?<version>\d+)\.sqlite$");
242242

243243
int bestCandidate = -1;
244244
foreach (FileInfo backupFile in backupFiles)

VidCoder/Model/HardwarePool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class HardwarePool
1515
/// <summary>
1616
/// The jobs that are currently using this hardware.
1717
/// </summary>
18-
private readonly List<EncodeJobViewModel> jobs = new List<EncodeJobViewModel>();
18+
private readonly List<EncodeJobViewModel> jobs = new();
1919

2020
public HardwarePool(string name, int slotCount)
2121
{

VidCoder/Model/Picker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public string Name
7878
/// </summary>
7979
public string WordSeparator { get; set; } = " ";
8080

81-
private List<string> wordBreakCharacters = new List<string> { " ", "_" };
81+
private List<string> wordBreakCharacters = new() { " ", "_" };
8282

8383
/// <summary>
8484
/// The characters to use to separate words in titles.

VidCoder/Model/PresetStorage.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static class PresetStorage
3232

3333
private static readonly string UserPresetsFolder = Path.Combine(CommonUtilities.AppFolder, "UserPresets");
3434
private static readonly string BuiltInPresetsPath = "BuiltInPresets.json";
35-
private static object userPresetSync = new object();
35+
private static object userPresetSync = new();
3636

3737
// This field holds the copy of the preset list that has been most recently queued for saving.
3838
private static volatile List<Preset> pendingSavePresetList;
@@ -64,7 +64,7 @@ public static List<Preset> UserPresets
6464
{
6565
var clonedList = value.Select(p =>
6666
{
67-
Preset newPreset = new Preset();
67+
Preset newPreset = new();
6868
newPreset.InjectFrom<CloneInjection>(p);
6969

7070
return newPreset;
@@ -184,7 +184,7 @@ public static void UpgradeEncodingProfile(VCProfile profile, int oldDatabaseVers
184184
return;
185185
}
186186

187-
List<EncodingProfileUpgrade> upgrades = new List<EncodingProfileUpgrade>
187+
List<EncodingProfileUpgrade> upgrades = new()
188188
{
189189
new EncodingProfileUpgrade(44, UpgradeEncodingProfileTo44),
190190
new EncodingProfileUpgrade(48, UpgradeEncodingProfileTo48),

0 commit comments

Comments
 (0)