Пример #1
0
        //Build configuration
        public void buildConfigPath()
        {
            //Set configuration file name
            String configFileName  = "AdvancedConnect.xml";
            String configDirectory = String.Empty;

            //Check if portable / admin configuration is available
            if (File.Exists(Path.Combine(ExecutableDirectory.GetExecutableDirectory(), configFileName)))
            {
                //Set directory in installation path (portable configuration)
                configDirectory             = ExecutableDirectory.GetExecutableDirectory();
                this.pathToPluginConfigFile = Path.Combine(configDirectory, configFileName);
            }
            else if (File.Exists(Path.Combine(Directory.GetCurrentDirectory(), configFileName)))
            {
                //Set directory in installation path (portable configuration)
                configDirectory             = Directory.GetCurrentDirectory();
                this.pathToPluginConfigFile = Path.Combine(configDirectory, configFileName);
            }
            else
            {
                //Set and create directory within appdata roaming (user configuration)
                configDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "KeePass/");
                System.IO.Directory.CreateDirectory(configDirectory);
                this.pathToPluginConfigFile = Path.Combine(configDirectory, configFileName);
            }
        }
Пример #2
0
 private void SetDefaultValues()
 {
     if (Mappings == null)
     {
         Mappings = "Mappings" + Path.DirectorySeparatorChar + Mode;
         if (ExecutableDirectory.ToLower().EndsWith("bin\\debug"))
         {
             string projectFolder = Path.GetFullPath(".." + Path.DirectorySeparatorChar + ".." + Path.DirectorySeparatorChar);
             Mappings        = projectFolder + Mappings;
             HelperDirectory = projectFolder + HelperDirectory;
             Libraries       = projectFolder + Libraries;
         }
         Mappings        = Path.Combine(ExecutableDirectory, Mappings);
         HelperDirectory = Path.Combine(ExecutableDirectory, HelperDirectory);
         Libraries       = Path.Combine(ExecutableDirectory, Libraries);
         if (Solution == null)
         {
             Solution = Path.GetFileName(InputFolder);
         }
         LoadTranslateXml();
         if (ReferenceFolder == null)
         {
             ReferenceFolder = "Lib";
         }
     }
 }