mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2025-12-12 16:58:29 +00:00
Refactoring
This commit is contained in:
parent
0b6ba617ac
commit
089cada426
@ -1,4 +1,6 @@
|
|||||||
using System.Drawing;
|
// ReSharper disable VirtualMemberNeverOverriden.Global
|
||||||
|
|
||||||
|
using System.Drawing;
|
||||||
using CUE.NET.Helper;
|
using CUE.NET.Helper;
|
||||||
|
|
||||||
namespace CUE.NET.Brushes
|
namespace CUE.NET.Brushes
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
// ReSharper disable UnusedMemberInSuper.Global
|
||||||
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
namespace CUE.NET.Brushes
|
namespace CUE.NET.Brushes
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
// ReSharper disable MemberCanBePrivate.Global
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
// ReSharper disable ReturnTypeCanBeEnumerable.Global
|
// ReSharper disable ReturnTypeCanBeEnumerable.Global
|
||||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using CUE.NET.Gradients;
|
using CUE.NET.Gradients;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
// ReSharper disable MemberCanBePrivate.Global
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
using System;
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using CUE.NET.Helper;
|
using CUE.NET.Helper;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
|
// ReSharper disable UnusedMethodReturnValue.Global
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
// ReSharper disable MemberCanBePrivate.Global
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using CUE.NET.Devices.Generic;
|
// ReSharper disable UnusedMemberInSuper.Global
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
|
using CUE.NET.Devices.Generic;
|
||||||
using CUE.NET.Devices.Generic.Enums;
|
using CUE.NET.Devices.Generic.Enums;
|
||||||
|
|
||||||
namespace CUE.NET.Devices
|
namespace CUE.NET.Devices
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using CUE.NET.Devices.Generic.Enums;
|
// ReSharper disable UnusedMemberInSuper.Global
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
|
using CUE.NET.Devices.Generic.Enums;
|
||||||
|
|
||||||
namespace CUE.NET.Devices
|
namespace CUE.NET.Devices
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
// ReSharper disable MemberCanBePrivate.Global
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using CUE.NET.Devices.Keyboard.Enums;
|
using CUE.NET.Devices.Keyboard.Enums;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
// ReSharper disable UnusedMemberInSuper.Global
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using CUE.NET.Brushes;
|
using CUE.NET.Brushes;
|
||||||
using CUE.NET.Devices.Generic;
|
using CUE.NET.Devices.Generic;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
// ReSharper disable MemberCanBePrivate.Global
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using CUE.NET.Devices.Keyboard.Enums;
|
using CUE.NET.Devices.Keyboard.Enums;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
// ReSharper disable MemberCanBePrivate.Global
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
// ReSharper disable UnusedMember.Global
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
// ReSharper disable MemberCanBePrivate.Global
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
// ReSharper disable UnusedMember.Global
|
||||||
|
// ReSharper disable UnusedMemberInSuper.Global
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using CUE.NET.Brushes;
|
using CUE.NET.Brushes;
|
||||||
using CUE.NET.Devices.Generic;
|
using CUE.NET.Devices.Generic;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
using System.Drawing;
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace CUE.NET.Gradients
|
namespace CUE.NET.Gradients
|
||||||
|
|||||||
@ -1,4 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
@ -10,17 +14,16 @@ namespace CUE.NET.Profiles
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
|
private Dictionary<string, CueProfileDevice> _devices;
|
||||||
|
|
||||||
public string Id { get; }
|
public string Id { get; }
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
|
|
||||||
private Dictionary<string, CueProfileDevice> _devices;
|
|
||||||
|
|
||||||
public IEnumerable<string> Modes
|
public IEnumerable<string> Modes
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
string device = _devices.Keys.FirstOrDefault();
|
string device = _devices.Keys.FirstOrDefault();
|
||||||
|
|
||||||
CueProfileDevice cpd;
|
CueProfileDevice cpd;
|
||||||
return (device != null && _devices.TryGetValue(device, out cpd)) ? cpd.Modes : new string[0];
|
return (device != null && _devices.TryGetValue(device, out cpd)) ? cpd.Modes : new string[0];
|
||||||
}
|
}
|
||||||
@ -66,7 +69,8 @@ namespace CUE.NET.Profiles
|
|||||||
.ToDictionary(x => x.Name)
|
.ToDictionary(x => x.Name)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
catch // I have no idea how the factory pattern should handle such a case - time to read :p
|
// ReSharper disable once CatchAllClause - I have no idea how the factory pattern should handle such a case - time to read :p
|
||||||
|
catch
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,7 +59,8 @@ namespace CUE.NET.Profiles
|
|||||||
.ToDictionary(x => x.Name)
|
.ToDictionary(x => x.Name)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
catch // I have no idea how the factory pattern should handle such a case - time to read :p
|
// ReSharper disable once CatchAllClause - I have no idea how the factory pattern should handle such a case - time to read :p
|
||||||
|
catch
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,8 @@ namespace CUE.NET.Profiles
|
|||||||
.ToDictionary(x => x.key, x => x.color)
|
.ToDictionary(x => x.key, x => x.color)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
catch (Exception ex) // I have no idea how the factory pattern should handle such a case - time to read :p
|
// ReSharper disable once CatchAllClause - I have no idea how the factory pattern should handle such a case - time to read :p
|
||||||
|
catch
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
using System;
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -67,7 +69,8 @@ namespace CUE.NET.Profiles
|
|||||||
{
|
{
|
||||||
return XDocument.Load(CONFIG_FILE).Root?.Elements("value").FirstOrDefault(x => string.Equals(x.Attribute("name")?.Value, "InitialProfile", StringComparison.OrdinalIgnoreCase))?.Value;
|
return XDocument.Load(CONFIG_FILE).Root?.Elements("value").FirstOrDefault(x => string.Equals(x.Attribute("name")?.Value, "InitialProfile", StringComparison.OrdinalIgnoreCase))?.Value;
|
||||||
}
|
}
|
||||||
catch // This shouldn't happen but you never know ...
|
// ReSharper disable once CatchAllClause - This shouldn't happen but you never know ...
|
||||||
|
catch
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -90,7 +93,8 @@ namespace CUE.NET.Profiles
|
|||||||
_profileNameMapping.Add(name, id);
|
_profileNameMapping.Add(name, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch // This shouldn't happen but you never know ...
|
// ReSharper disable once CatchAllClause - This shouldn't happen but you never know ...
|
||||||
|
catch
|
||||||
{
|
{
|
||||||
_profileNameMapping.Clear();
|
_profileNameMapping.Clear();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user