public void MakeAppShortcut(string Name) { dynamic _appinfo = DynamicJson.Parse(System.IO.File.ReadAllText(Consts.AppData + "\\Applications\\" + Name + "\\app_info.dwarf")); if (_appinfo.IsDefined("desktopicon")) { string deskDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); WshShell shell = (WshShell)Activator.CreateInstance(System.Type.GetTypeFromCLSID(new Guid("72C24DD5-D70A-438B-8A42-98424B88AFB8"))); IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(deskDir + "\\" + (string)_appinfo.name + ".lnk"); shortcut.TargetPath = Consts.GetInstallLocation() + "\\DWARF.exe"; shortcut.Arguments = "\"" + Consts.AppData + "\\Applications\\" + (string)_appinfo.name + "\\app_info.dwarf" + "\""; shortcut.Description = "Launch " + (string)_appinfo.name; shortcut.IconLocation = Consts.AppData + "\\Applications\\" + (string)_appinfo.name + "\\" + _appinfo.desktopicon; shortcut.Save(); } }
void LoadApps() { dynamic apps = null; dynamic plugins = null; try { apps = DynamicJson.Parse(System.IO.File.ReadAllText(Consts.AppData + "\\DWARFAppMan\\Applications.json")); } catch { System.Windows.Forms.MessageBox.Show("Error! Unable to load Application list, shutting down..."); Environment.Exit(0); } try { plugins = DynamicJson.Parse(System.IO.File.ReadAllText(Consts.AppData + "\\DWARFAppMan\\Plugins.json")); } catch { System.Windows.Forms.MessageBox.Show("Error! Unable to load Plugin list, shutting down..."); Environment.Exit(0); } foreach (dynamic plugin in plugins) { dynamic _plugininfo = DynamicJson.Parse(System.IO.File.ReadAllText(Consts.AppData + "\\Plugins\\" + plugin.name + "\\plugin_info.json")); InstalledPlugins.Add((int)plugin.id, new Plugin((string)_plugininfo.name, (string)_plugininfo.author, (int)plugin.id, (double)_plugininfo.version)); } foreach (dynamic app in apps) { dynamic _appinfo = DynamicJson.Parse(System.IO.File.ReadAllText(Consts.AppData + "\\Applications\\" + app.name + "\\app_info.dwarf")); InstalledApplications.Add((int)app.id, new Application((string)_appinfo.name, (string)_appinfo.author, (int)app.id, (double)_appinfo.version, GetInstalledApplicationPlugins((string)_appinfo.name, true), _appinfo.IsDefined("desktopicon"))); if (_appinfo.IsDefined("runonstartup") && (bool)_appinfo.runonstartup) { System.Diagnostics.Process.Start(Consts.GetInstallLocation() + "\\DWARF.exe", "\"" + Consts.AppData + "\\Applications\\" + app.name + "\\app_info.dwarf" + "\""); } } }