GetApplicationAssemblyLocation() public static method

Gets the location of the applications assembly (lulz, assembly.exe)
public static GetApplicationAssemblyLocation ( ) : string
return string
示例#1
0
        public static void UpdateJumplists()
        {
            var jump = new JumpList();

            JumpList.SetJumpList(Application.Current, jump);

            if (App.MetroIdeStorage.MetroIdeSettings.ApplicationRecents != null)
            {
                for (int i = 0; i < 10; i++)
                {
                    if (i > App.MetroIdeStorage.MetroIdeSettings.ApplicationRecents.Count - 1)
                    {
                        break;
                    }

                    var task      = new JumpTask();
                    int iconIndex = -200;
                    switch (App.MetroIdeStorage.MetroIdeSettings.ApplicationRecents[i].FileType)
                    {
                    case Settings.RecentFileType.Blf:
                        iconIndex = -200;
                        break;

                    case Settings.RecentFileType.Cache:
                        iconIndex = -201;
                        break;

                    case Settings.RecentFileType.MapInfo:
                        iconIndex = -202;
                        break;
                    }

                    task.ApplicationPath = VariousFunctions.GetApplicationAssemblyLocation();
                    task.Arguments       = string.Format("assembly://open \"{0}\"",
                                                         App.MetroIdeStorage.MetroIdeSettings.ApplicationRecents[i].FilePath);
                    task.WorkingDirectory = VariousFunctions.GetApplicationLocation();

                    task.IconResourcePath  = VariousFunctions.GetApplicationLocation() + "AssemblyIconLibrary.dll";
                    task.IconResourceIndex = iconIndex;

                    task.CustomCategory = "Recent";
                    task.Title          = App.MetroIdeStorage.MetroIdeSettings.ApplicationRecents[i].FileName + " - " +
                                          App.MetroIdeStorage.MetroIdeSettings.ApplicationRecents[i].FileGame;
                    task.Description = string.Format("Open {0} in Assembly. ({1})",
                                                     App.MetroIdeStorage.MetroIdeSettings.ApplicationRecents[i].FileName,
                                                     App.MetroIdeStorage.MetroIdeSettings.ApplicationRecents[i].FilePath);

                    jump.JumpItems.Add(task);
                }
            }

            // Show Recent and Frequent categories :D
            jump.ShowFrequentCategory = false;
            jump.ShowRecentCategory   = false;

            // Send to the Windows Shell
            jump.Apply();
        }
示例#2
0
        public static void UpdateFileDefaults()
        {
            string assemblyPath = VariousFunctions.GetApplicationAssemblyLocation();
            bool   changed      = false;

            // Assign open commands
            changed |= RegisterOpenCommand("assembly.xboxchaos.map", App.MetroIdeStorage.MetroIdeSettings.DefaultMap,
                                           "Blam Cache File", string.Format("\"{0}\" open \"%1\"", assemblyPath));
            changed |= RegisterOpenCommand("assembly.xboxchaos.blf", App.MetroIdeStorage.MetroIdeSettings.DefaultBlf,
                                           "Blam BLF File", string.Format("\"{0}\" open \"%1\"", assemblyPath));
            changed |= RegisterOpenCommand("assembly.xboxchaos.mif", App.MetroIdeStorage.MetroIdeSettings.DefaultMif,
                                           "Blam Map Information File", string.Format("\"{0}\" open \"%1\"", assemblyPath));
            changed |= RegisterOpenCommand("assembly.xboxchaos.cif", App.MetroIdeStorage.MetroIdeSettings.DefaultCif,
                                           "Blam Campaign File", string.Format("\"{0}\" open \"%1\"", assemblyPath));
            changed |= RegisterOpenCommand("assembly.xboxchaos.amp", App.MetroIdeStorage.MetroIdeSettings.DefaultAmp,
                                           "MetroIde Patch File", string.Format("\"{0}\" open \"%1\"", assemblyPath));

            // Assign Valid apptypes
            changed |= RegisterExtension(".map", App.MetroIdeStorage.MetroIdeSettings.DefaultMap,
                                         "assembly.xboxchaos.map",
                                         "assembly/map", "");
            changed |= RegisterExtension(".blf", App.MetroIdeStorage.MetroIdeSettings.DefaultBlf,
                                         "assembly.xboxchaos.blf",
                                         "assembly/blf", "");
            changed |= RegisterExtension(".mapinfo", App.MetroIdeStorage.MetroIdeSettings.DefaultMif,
                                         "assembly.xboxchaos.mif",
                                         "assembly/mapinfo", "");
            changed |= RegisterExtension(".campaign", App.MetroIdeStorage.MetroIdeSettings.DefaultCif,
                                         "assembly.xboxchaos.cif",
                                         "assembly/campaign", "");
            changed |= RegisterExtension(".asmp", App.MetroIdeStorage.MetroIdeSettings.DefaultAmp,
                                         "assembly.xboxchaos.amp",
                                         "assembly/patch", "");

            if (changed)
            {
                ShellChanges.SHChangeNotify(HChangeNotifyEventID.SHCNE_ASSOCCHANGED, HChangeNotifyFlags.SHCNF_IDLIST,
                                            IntPtr.Zero,
                                            IntPtr.Zero);
            }
        }