mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
defaults wip
This commit is contained in:
parent
04497a10e5
commit
390e93b6b6
@ -629,6 +629,7 @@
|
|||||||
<Resource Include="Resources\logo-disabled.ico" />
|
<Resource Include="Resources\logo-disabled.ico" />
|
||||||
<Resource Include="Resources\Dota2\dotaGamestateConfiguration.txt" />
|
<Resource Include="Resources\Dota2\dotaGamestateConfiguration.txt" />
|
||||||
<Resource Include="Resources\Entypo.ttf" />
|
<Resource Include="Resources\Entypo.ttf" />
|
||||||
|
<EmbeddedResource Include="Resources\Keyboards\default-profiles.zip" />
|
||||||
<None Include="Resources\LogitechLED.dll" />
|
<None Include="Resources\LogitechLED.dll" />
|
||||||
<Resource Include="Resources\Keyboards\k65.png" />
|
<Resource Include="Resources\Keyboards\k65.png" />
|
||||||
<Resource Include="Resources\Keyboards\k70.png" />
|
<Resource Include="Resources\Keyboards\k70.png" />
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using Artemis.DeviceProviders;
|
using Artemis.DeviceProviders;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
@ -12,7 +13,8 @@ namespace Artemis.DAL
|
|||||||
{
|
{
|
||||||
public static class ProfileProvider
|
public static class ProfileProvider
|
||||||
{
|
{
|
||||||
private static Logger _logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
private static readonly string ProfileFolder =
|
private static readonly string ProfileFolder =
|
||||||
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis\profiles";
|
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis\profiles";
|
||||||
|
|
||||||
@ -70,6 +72,7 @@ namespace Artemis.DAL
|
|||||||
private static List<ProfileModel> ReadProfiles()
|
private static List<ProfileModel> ReadProfiles()
|
||||||
{
|
{
|
||||||
CheckProfiles();
|
CheckProfiles();
|
||||||
|
InstallDefaults();
|
||||||
var profiles = new List<ProfileModel>();
|
var profiles = new List<ProfileModel>();
|
||||||
|
|
||||||
// Create the directory structure
|
// Create the directory structure
|
||||||
@ -83,7 +86,7 @@ namespace Artemis.DAL
|
|||||||
{
|
{
|
||||||
using (var file = new StreamReader(path))
|
using (var file = new StreamReader(path))
|
||||||
{
|
{
|
||||||
var prof = (ProfileModel)deserializer.Deserialize(file);
|
var prof = (ProfileModel) deserializer.Deserialize(file);
|
||||||
if (prof.GameName?.Length > 1 && prof.KeyboardSlug?.Length > 1 && prof.Name?.Length > 1)
|
if (prof.GameName?.Length > 1 && prof.KeyboardSlug?.Length > 1 && prof.Name?.Length > 1)
|
||||||
profiles.Add(prof);
|
profiles.Add(prof);
|
||||||
}
|
}
|
||||||
@ -92,12 +95,25 @@ namespace Artemis.DAL
|
|||||||
{
|
{
|
||||||
_logger.Error("Failed to load profile: {0} - {1}", path, e.InnerException.Message);
|
_logger.Error("Failed to load profile: {0} - {1}", path, e.InnerException.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return profiles;
|
return profiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unpacks the default profiles into the profile directory
|
||||||
|
/// </summary>
|
||||||
|
private static void InstallDefaults()
|
||||||
|
{
|
||||||
|
var test = Assembly.GetExecutingAssembly().GetManifestResourceNames();
|
||||||
|
//var stream =
|
||||||
|
// Assembly.GetExecutingAssembly()
|
||||||
|
// .GetManifestResourceStream("Artemis.Properties.Resources.logo.jpg");
|
||||||
|
|
||||||
|
//Resources.
|
||||||
|
//ZipPackage.Open(Re.defaultProfiles)
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Makes sure the profile directory structure is in order and places default profiles
|
/// Makes sure the profile directory structure is in order and places default profiles
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
10
Artemis/Artemis/Properties/Resources.Designer.cs
generated
10
Artemis/Artemis/Properties/Resources.Designer.cs
generated
@ -120,6 +120,16 @@ namespace Artemis.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Byte[].
|
||||||
|
/// </summary>
|
||||||
|
internal static byte[] defaultProfiles {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("defaultProfiles", resourceCulture);
|
||||||
|
return ((byte[])(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to "Artemis"
|
/// Looks up a localized string similar to "Artemis"
|
||||||
///{
|
///{
|
||||||
|
|||||||
@ -175,4 +175,7 @@
|
|||||||
<data name="blackwidow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="blackwidow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\Keyboards\blackwidow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\Keyboards\blackwidow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="defaultProfiles" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Keyboards\default-profiles.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
BIN
Artemis/Artemis/Resources/Keyboards/default-profiles.zip
Normal file
BIN
Artemis/Artemis/Resources/Keyboards/default-profiles.zip
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user