Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.10.3-beta #237

Merged
merged 3 commits into from
Jun 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.

**Log file**
Please upload the latest log file (Help -> Export latest log)
22 changes: 0 additions & 22 deletions .github/ISSUE_TEMPLATE/icon-pack-submission.md

This file was deleted.

16 changes: 0 additions & 16 deletions .github/ISSUE_TEMPLATE/icon-pack-update.md

This file was deleted.

29 changes: 0 additions & 29 deletions .github/ISSUE_TEMPLATE/plugin-submission.md

This file was deleted.

4 changes: 3 additions & 1 deletion ActionButton/ActionButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ private void UpdateBindingState(Variables.Variable variable)
}
}

public string Guid { get; set; } = System.Guid.NewGuid().ToString();

public event EventHandler StateChanged;
public event EventHandler IconChanged;
public long ButtonId { get; set; }

private bool _state = false;
public bool State
Expand Down Expand Up @@ -181,6 +181,8 @@ public string IconOn

public ButtonLabel LabelOff { get; set; } = new ButtonLabel();
public ButtonLabel LabelOn { get; set; } = new ButtonLabel();
public Color BackColorOff = Color.FromArgb(35, 35, 35);
public Color BackColorOn = Color.FromArgb(35, 35, 35);
public int Position_X { get; set; } = -1;
public int Position_Y { get; set; } = -1;
public string StateBindingVariable { get; set; } = string.Empty;
Expand Down
4 changes: 2 additions & 2 deletions ActionButton/Plugin/ActionButtonPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ namespace SuchByte.MacroDeck.ActionButton
{
public class ActionButtonPlugin : MacroDeckPlugin
{
public override string Name => LanguageManager.Strings.PluginActionButton;
public override string Author => "Macro Deck";
internal override string Name => LanguageManager.Strings.PluginActionButton;
internal override string Author => "Macro Deck";
public override void Enable()
{
this.Actions = new List<PluginAction>()
Expand Down
9 changes: 5 additions & 4 deletions Backup/BackupManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,12 @@ public static void CreateBackup()
archive.CreateEntryFromFile(Path.Combine(MacroDeck.PluginCredentialsPath, file.Name), Path.Combine(pluginCredentialsDirectoryInfo.Name, file.Name));
}
DirectoryInfo iconPackDirectoryInfo = new DirectoryInfo(MacroDeck.IconPackDirectoryPath);
foreach (FileInfo file in iconPackDirectoryInfo.GetFiles("*"))
foreach (DirectoryInfo dir in iconPackDirectoryInfo.GetDirectories())
{
archive.CreateEntryFromFile(Path.Combine(MacroDeck.IconPackDirectoryPath, file.Name), Path.Combine(iconPackDirectoryInfo.Name, file.Name));
foreach (FileInfo iconPackFile in dir.GetFiles())
{
archive.CreateEntryFromFile(Path.Combine(MacroDeck.IconPackDirectoryPath, dir.Name, iconPackFile.Name), Path.Combine(iconPackDirectoryInfo.Name, dir.Name, iconPackFile.Name));
}
}

MacroDeckLogger.Info("Backup successfully created: " + backupFileName);
Expand Down Expand Up @@ -289,7 +292,5 @@ public static void DeleteBackup(string fileName)
}
}
}


}
}
26 changes: 5 additions & 21 deletions Device/DeviceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public static void SaveKnownDevices()
{
serializer.Serialize(writer, _macroDeckDevices);
}

if (OnDevicesChange != null)
{
OnDevicesChange(null, EventArgs.Empty);
}
}
catch (Exception ex)
{
Expand All @@ -58,11 +63,6 @@ public static void AddKnownDevice(MacroDeckDevice macroDeckDevice)
_macroDeckDevices.Add(macroDeckDevice);
}
SaveKnownDevices();

if (OnDevicesChange != null)
{
OnDevicesChange(macroDeckDevice, EventArgs.Empty);
}
}

public static bool IsKnownDevice(string clientId)
Expand Down Expand Up @@ -111,10 +111,6 @@ public static void SetProfile(MacroDeckDevice macroDeckDevice, MacroDeckProfile
if (macroDeckDevice.Available)
{
MacroDeckServer.SetProfile(MacroDeckServer.GetMacroDeckClient(macroDeckDevice.ClientId), macroDeckProfile);
}
if (OnDevicesChange != null)
{
OnDevicesChange(macroDeckDevice, EventArgs.Empty);
}
}

Expand All @@ -129,10 +125,6 @@ public static void SetBlocked(MacroDeckDevice macroDeckDevice, bool blocked)
{
MacroDeckServer.GetMacroDeckClient(macroDeckDevice.ClientId).SocketConnection.Close();
}
if (OnDevicesChange != null)
{
OnDevicesChange(macroDeckDevice, EventArgs.Empty);
}
}

public static void RenameMacroDeckDevice(MacroDeckDevice macroDeckDevice, string displayName)
Expand All @@ -142,10 +134,6 @@ public static void RenameMacroDeckDevice(MacroDeckDevice macroDeckDevice, string
macroDeckDevice.DisplayName = displayName;
SaveKnownDevices();
}
if (OnDevicesChange != null)
{
OnDevicesChange(macroDeckDevice, EventArgs.Empty);
}
}

public static void RemoveKnownDevice(MacroDeckDevice macroDeckDevice)
Expand All @@ -155,10 +143,6 @@ public static void RemoveKnownDevice(MacroDeckDevice macroDeckDevice)
_macroDeckDevices.Remove(macroDeckDevice);
SaveKnownDevices();
}
if (OnDevicesChange != null)
{
OnDevicesChange(macroDeckDevice, EventArgs.Empty);
}
}

public static bool IsDisplayNameAvailable(string displayName)
Expand Down
17 changes: 17 additions & 0 deletions Extension/IMacroDeckExtension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using SuchByte.MacroDeck.ExtensionStore;
using System;
using System.Collections.Generic;
using System.Text;

namespace SuchByte.MacroDeck.Extension
{
public interface IMacroDeckExtension
{
public ExtensionType ExtensionType { get; }
public string ExtensionTypeDisplayName { get; }
public object ExtensionObject { get; }
public bool Configurable { get; }
public void Uninstall();

}
}
27 changes: 27 additions & 0 deletions Extension/IconPackExtension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using SuchByte.MacroDeck.ExtensionStore;
using SuchByte.MacroDeck.Icons;
using SuchByte.MacroDeck.Language;
using System;
using System.Collections.Generic;
using System.Text;

namespace SuchByte.MacroDeck.Extension
{
public class IconPackExtension : IMacroDeckExtension
{
public ExtensionType ExtensionType => ExtensionType.IconPack;
public string ExtensionTypeDisplayName => LanguageManager.Strings.IconPack;
public object ExtensionObject { get; set; }
public bool Configurable => false;

public IconPackExtension(IconPack iconPack)
{
this.ExtensionObject = iconPack;
}

public void Uninstall()
{

}
}
}
28 changes: 28 additions & 0 deletions Extension/PluginExtension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using SuchByte.MacroDeck.ExtensionStore;
using SuchByte.MacroDeck.Language;
using SuchByte.MacroDeck.Plugins;
using System;
using System.Collections.Generic;
using System.Text;

namespace SuchByte.MacroDeck.Extension
{
public class PluginExtension : IMacroDeckExtension
{
public ExtensionType ExtensionType => ExtensionType.Plugin;
public string ExtensionTypeDisplayName => LanguageManager.Strings.Plugin;
public object ExtensionObject { get; set; }

public bool Configurable => this.ExtensionObject != null && (this.ExtensionObject as MacroDeckPlugin).CanConfigure;

public PluginExtension(MacroDeckPlugin macroDeckPlugin)
{
this.ExtensionObject = macroDeckPlugin;
}

public void Uninstall()
{

}
}
}
114 changes: 114 additions & 0 deletions ExtensionStore/ExtensionStoreHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
using SuchByte.MacroDeck.GUI.Dialogs;
using SuchByte.MacroDeck.Icons;
using SuchByte.MacroDeck.Model;
using SuchByte.MacroDeck.Plugins;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;

namespace SuchByte.MacroDeck.ExtensionStore
{
public class ExtensionStoreHelper
{
public static event EventHandler OnUpdateCheckFinished;

private static ExtensionStoreDownloader extensionStoreDownloader;

public static void InstallPluginById(string packageId)
{
InstallPackages(new List<ExtensionStoreDownloaderPackageInfoModel> { new ExtensionStoreDownloaderPackageInfoModel() { PackageId = packageId, ExtensionType = ExtensionType.Plugin } });
}

public static void InstallIconPackById(string packageId)
{
InstallPackages(new List<ExtensionStoreDownloaderPackageInfoModel> { new ExtensionStoreDownloaderPackageInfoModel() { PackageId = packageId, ExtensionType = ExtensionType.IconPack } });
}

internal static void InstallById(string packageId)
{
InstallPackages(new List<ExtensionStoreDownloaderPackageInfoModel> { new ExtensionStoreDownloaderPackageInfoModel() { PackageId = packageId } });
}

public static void InstallPackages(List<ExtensionStoreDownloaderPackageInfoModel> packages)
{
if (MacroDeck.MainWindow == null) return;
MacroDeck.MainWindow.Invoke(new Action(() =>
{
extensionStoreDownloader = new ExtensionStoreDownloader(packages)
{
Owner = MacroDeck.MainWindow,
};
extensionStoreDownloader.Show();
}));
}

public static string GetPackageId(MacroDeckPlugin macroDeckPlugin)
{
return new DirectoryInfo(PluginManager.PluginDirectories[macroDeckPlugin]).Name;
}

public static void SearchUpdatesAsync()
{
PluginManager.PluginsUpdateAvailable.Clear();
IconManager.IconPacksUpdateAvailable.Clear();
Task.Run(() =>
{
foreach (MacroDeckPlugin plugin in PluginManager.Plugins.Values)
{
PluginManager.SearchUpdate(plugin);
}
foreach (MacroDeckPlugin plugin in PluginManager.PluginsNotLoaded.Values)
{
PluginManager.SearchUpdate(plugin);
}
foreach (IconPack iconPack in IconManager.IconPacks.FindAll(iP => iP.ExtensionStoreManaged && !iP.Hidden))
{
IconManager.SearchUpdate(iconPack);
}

if (OnUpdateCheckFinished != null)
{
OnUpdateCheckFinished(null, EventArgs.Empty);
}
});
}



public static string InstalledIconPacksAsString
{
get
{
string installedPlugins = "";
foreach (var iconPack in IconManager.IconPacks.FindAll(x => x.ExtensionStoreManaged))
{
installedPlugins += $"{iconPack.PackageId.ToLower()}%20";
}

return installedPlugins;
}
}

public static string InstalledPluginsAsString
{
get
{
string installedPlugins = "";
foreach (var path in PluginManager.PluginDirectories.Values)
{
installedPlugins += $"{new DirectoryInfo(path).Name.ToLower()}%20";
}

return installedPlugins;
}
}
}

public enum ExtensionType
{
Plugin,
IconPack,
}
}
Loading