2020-06-01 10:25:52 +00:00
|
|
|
|
using HeliosPlus.Shared;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Drawing.IconLib;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Security.Cryptography;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace HeliosPlus
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
class ShortcutRepository
|
|
|
|
|
{
|
|
|
|
|
#region Class Variables
|
|
|
|
|
// Common items to the class
|
2020-06-07 08:48:45 +00:00
|
|
|
|
private static List<ShortcutItem> _allShortcuts = new List<ShortcutItem>();
|
2020-06-01 10:25:52 +00:00
|
|
|
|
public static Version Version = new Version(1, 0, 0);
|
|
|
|
|
// Other constants that are useful
|
|
|
|
|
private static string _shortcutStorageJsonPath = Path.Combine(Program.AppDataPath, $"Shortcuts");
|
|
|
|
|
private static string _shortcutStorageJsonFileName = Path.Combine(_shortcutStorageJsonPath, $"Shortcuts_{Version.ToString(2)}.json");
|
|
|
|
|
private static uint _lastShortcutId;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Instance Variables
|
|
|
|
|
// Individual items per class instance
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Class Constructors
|
|
|
|
|
public ShortcutRepository()
|
|
|
|
|
{
|
|
|
|
|
// Load the Shortcuts from storage
|
|
|
|
|
if (LoadShortcuts() && ShortcutCount > 0)
|
|
|
|
|
{
|
|
|
|
|
// Work out the starting NextShortcutId value
|
2020-06-07 08:48:45 +00:00
|
|
|
|
long max = _allShortcuts.Max<ShortcutItem>(item => item.Id);
|
2020-06-01 10:25:52 +00:00
|
|
|
|
_lastShortcutId = Convert.ToUInt32(max);
|
|
|
|
|
} else
|
|
|
|
|
_lastShortcutId = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-07 08:48:45 +00:00
|
|
|
|
public ShortcutRepository(ShortcutItem shortcut) : this()
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
2020-06-07 08:48:45 +00:00
|
|
|
|
if (shortcut is ShortcutItem)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
AddShortcut(shortcut);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Class Properties
|
2020-06-07 08:48:45 +00:00
|
|
|
|
public static List<ShortcutItem> AllShortcuts
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_allShortcuts == null)
|
|
|
|
|
// Load the Shortcuts from storage
|
|
|
|
|
if (LoadShortcuts() && ShortcutCount > 0)
|
|
|
|
|
{
|
|
|
|
|
// Work out the starting NextShortcutId value
|
2020-06-07 08:48:45 +00:00
|
|
|
|
long max = _allShortcuts.Max<ShortcutItem>(item => item.Id);
|
2020-06-01 10:25:52 +00:00
|
|
|
|
_lastShortcutId = Convert.ToUInt32(max);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
_lastShortcutId = 0;
|
|
|
|
|
|
|
|
|
|
return _allShortcuts;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int ShortcutCount
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _allShortcuts.Count;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Class Methods
|
2020-06-07 08:48:45 +00:00
|
|
|
|
public static bool AddShortcut(ShortcutItem shortcut)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
2020-06-07 08:48:45 +00:00
|
|
|
|
if (!(shortcut is ShortcutItem))
|
2020-06-01 10:25:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// Doublecheck if it already exists
|
|
|
|
|
// Because then we just update the one that already exists
|
|
|
|
|
if (ContainsShortcut(shortcut))
|
|
|
|
|
{
|
|
|
|
|
// We update the existing Shortcut with the data over
|
2020-06-07 08:48:45 +00:00
|
|
|
|
ShortcutItem shortcutToUpdate = GetShortcut(shortcut.Id);
|
2020-06-01 10:25:52 +00:00
|
|
|
|
shortcut.CopyTo(shortcutToUpdate);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Add the shortcut to the list of shortcuts
|
|
|
|
|
_allShortcuts.Add(shortcut);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Doublecheck it's been added
|
|
|
|
|
if (ContainsShortcut(shortcut))
|
|
|
|
|
{
|
|
|
|
|
// Generate the Shortcut Icon ready to be used
|
|
|
|
|
SaveShortcutIconToCache(shortcut);
|
|
|
|
|
|
|
|
|
|
// Save the shortcuts JSON as it's different
|
|
|
|
|
SaveShortcuts();
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-07 08:48:45 +00:00
|
|
|
|
public static bool RemoveShortcut(ShortcutItem shortcut)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
2020-06-07 08:48:45 +00:00
|
|
|
|
if (!(shortcut is ShortcutItem))
|
2020-06-01 10:25:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// Remove the Shortcut Icons from the Cache
|
2020-06-07 08:48:45 +00:00
|
|
|
|
List<ShortcutItem> shortcutsToRemove = _allShortcuts.FindAll(item => item.Id.Equals(shortcut.Id));
|
|
|
|
|
foreach (ShortcutItem shortcutToRemove in shortcutsToRemove)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
File.Delete(shortcutToRemove.SavedShortcutIconCacheFilename);
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
// TODO check and report
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove the shortcut from the list.
|
|
|
|
|
int numRemoved = _allShortcuts.RemoveAll(item => item.Id.Equals(shortcut.Id));
|
|
|
|
|
|
|
|
|
|
if (numRemoved == 1)
|
|
|
|
|
{
|
|
|
|
|
SaveShortcuts();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (numRemoved == 0)
|
|
|
|
|
return false;
|
|
|
|
|
else
|
|
|
|
|
throw new ShortcutRepositoryException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static bool RemoveShortcut(string shortcutName)
|
|
|
|
|
{
|
|
|
|
|
if (String.IsNullOrWhiteSpace(shortcutName))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// Remove the Shortcut Icons from the Cache
|
2020-06-07 08:48:45 +00:00
|
|
|
|
List<ShortcutItem> shortcutsToRemove = _allShortcuts.FindAll(item => item.Name.Equals(shortcutName));
|
|
|
|
|
foreach (ShortcutItem shortcutToRemove in shortcutsToRemove)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
File.Delete(shortcutToRemove.SavedShortcutIconCacheFilename);
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
// TODO check and report
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove the shortcut from the list.
|
|
|
|
|
int numRemoved = _allShortcuts.RemoveAll(item => item.Name.Equals(shortcutName));
|
|
|
|
|
|
|
|
|
|
if (numRemoved == 1)
|
|
|
|
|
{
|
|
|
|
|
SaveShortcuts();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (numRemoved == 0)
|
|
|
|
|
return false;
|
|
|
|
|
else
|
|
|
|
|
throw new ShortcutRepositoryException();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool RemoveShortcut(uint shortcutId)
|
|
|
|
|
{
|
|
|
|
|
if (shortcutId == 0)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// Remove the Shortcut Icons from the Cache
|
2020-06-07 08:48:45 +00:00
|
|
|
|
List<ShortcutItem> shortcutsToRemove = _allShortcuts.FindAll(item => item.Id.Equals(shortcutId));
|
|
|
|
|
foreach (ShortcutItem shortcutToRemove in shortcutsToRemove)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
File.Delete(shortcutToRemove.SavedShortcutIconCacheFilename);
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
// TODO check and report
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove the shortcut from the list.
|
|
|
|
|
int numRemoved = _allShortcuts.RemoveAll(item => item.Id.Equals(shortcutId));
|
|
|
|
|
|
|
|
|
|
if (numRemoved == 1)
|
|
|
|
|
{
|
|
|
|
|
SaveShortcuts();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (numRemoved == 0)
|
|
|
|
|
return false;
|
|
|
|
|
else
|
|
|
|
|
throw new ShortcutRepositoryException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-06-07 08:48:45 +00:00
|
|
|
|
public static bool ContainsShortcut(ShortcutItem shortcut)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
2020-06-07 08:48:45 +00:00
|
|
|
|
if (!(shortcut is ShortcutItem))
|
2020-06-01 10:25:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
|
2020-06-07 08:48:45 +00:00
|
|
|
|
foreach (ShortcutItem testShortcut in _allShortcuts)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
|
|
|
|
if (testShortcut.Id.Equals(shortcut.Id))
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool ContainsShortcut(string shortcutName)
|
|
|
|
|
{
|
|
|
|
|
if (String.IsNullOrWhiteSpace(shortcutName))
|
|
|
|
|
return false;
|
|
|
|
|
|
2020-06-07 08:48:45 +00:00
|
|
|
|
foreach (ShortcutItem testShortcut in _allShortcuts)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
|
|
|
|
if (testShortcut.Name.Equals(shortcutName))
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool ContainsShortcut(uint shortcutId)
|
|
|
|
|
{
|
|
|
|
|
if (shortcutId == 0)
|
|
|
|
|
return true;
|
|
|
|
|
|
2020-06-07 08:48:45 +00:00
|
|
|
|
foreach (ShortcutItem testShortcut in _allShortcuts)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
|
|
|
|
if (testShortcut.Id.Equals(shortcutId))
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-06-07 08:48:45 +00:00
|
|
|
|
public static ShortcutItem GetShortcut(string shortcutName)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
|
|
|
|
if (String.IsNullOrWhiteSpace(shortcutName))
|
|
|
|
|
return null;
|
|
|
|
|
|
2020-06-07 08:48:45 +00:00
|
|
|
|
foreach (ShortcutItem testShortcut in _allShortcuts)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
|
|
|
|
if (testShortcut.Name.Equals(shortcutName))
|
|
|
|
|
return testShortcut;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-07 08:48:45 +00:00
|
|
|
|
public static ShortcutItem GetShortcut(uint shortcutId)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
|
|
|
|
if (shortcutId == 0)
|
|
|
|
|
return null;
|
|
|
|
|
|
2020-06-07 08:48:45 +00:00
|
|
|
|
foreach (ShortcutItem testShortcut in _allShortcuts)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
|
|
|
|
if (testShortcut.Id.Equals(shortcutId))
|
|
|
|
|
return testShortcut;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static uint GetNextAvailableShortcutId()
|
|
|
|
|
{
|
|
|
|
|
return ++_lastShortcutId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static bool LoadShortcuts()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (File.Exists(_shortcutStorageJsonFileName))
|
|
|
|
|
{
|
|
|
|
|
var json = File.ReadAllText(_shortcutStorageJsonFileName, Encoding.Unicode);
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(json))
|
|
|
|
|
{
|
2020-06-07 08:48:45 +00:00
|
|
|
|
List<ShortcutItem> shortcuts = new List<ShortcutItem>();
|
2020-06-01 10:25:52 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
2020-06-07 08:48:45 +00:00
|
|
|
|
_allShortcuts = JsonConvert.DeserializeObject<List<ShortcutItem>>(json, new JsonSerializerSettings
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
|
|
|
|
MissingMemberHandling = MissingMemberHandling.Ignore,
|
|
|
|
|
NullValueHandling = NullValueHandling.Ignore,
|
|
|
|
|
DefaultValueHandling = DefaultValueHandling.Include,
|
|
|
|
|
TypeNameHandling = TypeNameHandling.Auto
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
// ignored
|
|
|
|
|
Console.WriteLine($"Unable to load Shortcuts from JSON file {_shortcutStorageJsonFileName}: " + ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Lookup all the Profile Names in the Saved Profiles
|
2020-06-07 08:48:45 +00:00
|
|
|
|
foreach (ShortcutItem updatedShortcut in _allShortcuts)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
2020-06-07 08:48:45 +00:00
|
|
|
|
foreach (ProfileItem profile in ProfileItem.AllSavedProfiles)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (profile.Name.Equals(updatedShortcut.ProfileName))
|
|
|
|
|
{
|
|
|
|
|
// And assign the matching Profile if we find it.
|
|
|
|
|
updatedShortcut.ProfileToUse = profile;
|
|
|
|
|
updatedShortcut.IsPossible = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static bool SaveShortcuts()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (!Directory.Exists(_shortcutStorageJsonPath))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Directory.CreateDirectory(_shortcutStorageJsonPath);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine($"Unable to create Shortcut folder {_shortcutStorageJsonPath}: " + ex.Message);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var json = JsonConvert.SerializeObject(_allShortcuts, Formatting.Indented, new JsonSerializerSettings
|
|
|
|
|
{
|
|
|
|
|
NullValueHandling = NullValueHandling.Include,
|
|
|
|
|
DefaultValueHandling = DefaultValueHandling.Populate,
|
|
|
|
|
TypeNameHandling = TypeNameHandling.Auto
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(json))
|
|
|
|
|
{
|
|
|
|
|
File.WriteAllText(_shortcutStorageJsonFileName, json, Encoding.Unicode);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine($"Unable to save Shortcut JSON file {_shortcutStorageJsonFileName}: " + ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-07 08:48:45 +00:00
|
|
|
|
private static void SaveShortcutIconToCache(ShortcutItem shortcut)
|
2020-06-01 10:25:52 +00:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// Only add the rest of the options if the permanence is temporary
|
|
|
|
|
if (shortcut.Permanence == ShortcutPermanence.Temporary)
|
|
|
|
|
{
|
|
|
|
|
// Only add this set of options if the shortcut is to an standalone application
|
|
|
|
|
if (shortcut.Category == ShortcutCategory.Application)
|
|
|
|
|
{
|
|
|
|
|
// Work out the name of the shortcut we'll save.
|
|
|
|
|
shortcut.SavedShortcutIconCacheFilename = Path.Combine(_shortcutStorageJsonPath, String.Concat(@"executable-", Program.GetValidFilename(shortcut.Name).ToLower(CultureInfo.InvariantCulture), "-", Path.GetFileNameWithoutExtension(shortcut.ExecutableNameAndPath), @".ico"));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// Only add the rest of the options if the temporary switch radio button is set
|
|
|
|
|
// and if the game launching radio button is set
|
|
|
|
|
else if (shortcut.Permanence == ShortcutPermanence.Temporary)
|
|
|
|
|
{
|
|
|
|
|
// TODO need to make this work so at least one game library is installed
|
|
|
|
|
// i.e. if (!SteamGame.SteamInstalled && !UplayGame.UplayInstalled )
|
|
|
|
|
if (shortcut.GameLibrary == SupportedGameLibrary.Steam)
|
|
|
|
|
{
|
|
|
|
|
// Work out the name of the shortcut we'll save.
|
|
|
|
|
shortcut.SavedShortcutIconCacheFilename = Path.Combine(_shortcutStorageJsonPath, String.Concat(@"steam-", Program.GetValidFilename(shortcut.Name).ToLower(CultureInfo.InvariantCulture), "-", shortcut.GameAppId.ToString(), @".ico"));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (shortcut.GameLibrary == SupportedGameLibrary.Uplay)
|
|
|
|
|
{
|
|
|
|
|
// Work out the name of the shortcut we'll save.
|
|
|
|
|
shortcut.SavedShortcutIconCacheFilename = Path.Combine(_shortcutStorageJsonPath, String.Concat(@"uplay-", Program.GetValidFilename(shortcut.Name).ToLower(CultureInfo.InvariantCulture), "-", shortcut.GameAppId.ToString(), @".ico"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// Only add the rest of the options if the shortcut is permanent
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Work out the name of the shortcut we'll save.
|
|
|
|
|
shortcut.SavedShortcutIconCacheFilename = Path.Combine(_shortcutStorageJsonPath, String.Concat(@"permanent-", Program.GetValidFilename(shortcut.Name).ToLower(CultureInfo.InvariantCulture), @".ico"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MultiIcon shortcutIcon;
|
|
|
|
|
try
|
|
|
|
|
{
|
2020-06-07 08:48:45 +00:00
|
|
|
|
//shortcutIcon = new ProfileIcon(shortcut.ProfileToUse).ToIconOverlay(shortcut.OriginalIconPath);
|
|
|
|
|
shortcutIcon = shortcut.ToIconOverlay();
|
2020-06-01 10:25:52 +00:00
|
|
|
|
shortcutIcon.Save(shortcut.SavedShortcutIconCacheFilename, MultiIconFormat.ICO);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
// If we fail to create an icon based on the original executable or game
|
|
|
|
|
// Then we use the standard HeliosPlus profile one.
|
2020-06-07 08:48:45 +00:00
|
|
|
|
shortcutIcon = shortcut.ProfileToUse.ProfileIcon.ToIcon();
|
2020-06-01 10:25:52 +00:00
|
|
|
|
shortcutIcon.Save(shortcut.SavedShortcutIconCacheFilename, MultiIconFormat.ICO);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[global::System.Serializable]
|
|
|
|
|
public class ShortcutRepositoryException : Exception
|
|
|
|
|
{
|
|
|
|
|
public ShortcutRepositoryException() { }
|
|
|
|
|
public ShortcutRepositoryException(string message) : base(message) { }
|
|
|
|
|
public ShortcutRepositoryException(string message, Exception inner) : base(message, inner) { }
|
|
|
|
|
protected ShortcutRepositoryException(
|
|
|
|
|
System.Runtime.Serialization.SerializationInfo info,
|
|
|
|
|
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|