Example #1
0
        private void Load(string filename)
        {
            TabsManager.Load(filename);
            Filename = filename;

            DlgSearch.SearchReset();

            try
            {
                string programFilesX64 = Environment.ExpandEnvironmentVariables("%ProgramW6432%");
                string programFilesX86 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);

                bool isProg = filename.StartsWith(programFilesX64, StringComparison.InvariantCultureIgnoreCase) ||
                              filename.StartsWith(programFilesX86, StringComparison.InvariantCultureIgnoreCase);
                bool isAdmin = (new WindowsPrincipal(WindowsIdentity.GetCurrent())).IsInRole(WindowsBuiltInRole.Administrator);

                if (isProg && !isAdmin)
                {
                    DlgMessage.Show("This file is located under 'program files' and hence protected by Windows.\n" +
                                    "So KML will not be able to overwrite it, when you choose to save your changes.\n\n" +
                                    "Please run KML as administrator or manually pick the changed file from 'program data'\n" +
                                    "and put it back to original place.", "Permission warning", (new GuiIcons16()).Warning);
                }
            }
            catch
            {
                ; // something went wrong with reading env-var or admin flag
            }
        }
Example #2
0
 private void Load(string filename)
 {
     TabsManager.Load(filename);
     Filename = filename;
 }