示例#1
0
 private void InitSettings()
 {
     pluginDesc = TextHelper.GetString("Info.Description");
     dataPath   = Path.Combine(PathHelper.DataDir, "ASCompletion");
     if (!Directory.Exists(dataPath))
     {
         Directory.CreateDirectory(dataPath);
     }
     else if (PluginBase.MainForm.RefreshConfig)
     {
         CleanData(dataPath);
     }
     settingsFile  = Path.Combine(dataPath, "Settings.fdb");
     settingObject = new GeneralSettings();
     if (!File.Exists(settingsFile))
     {
         // default settings
         settingObject.JavadocTags    = GeneralSettings.DEFAULT_TAGS;
         settingObject.PathToFlashIDE = CallFlashIDE.FindFlashIDE();
         SaveSettings();
     }
     else
     {
         Object obj = ObjectSerializer.Deserialize(settingsFile, settingObject);
         settingObject = (GeneralSettings)obj;
     }
 }
        /// <summary>
        /// Explore the possible locations for the Macromedia Flash IDE classpath
        /// </summary>
        static public string FindAuthoringConfigurationPath(string flashPath)
        {
            if (flashPath == null)
            {
                flashPath = CallFlashIDE.FindFlashIDE(true);
                if (flashPath == null)
                {
                    return(null);
                }
            }
            string ext = Path.GetExtension(flashPath).ToLower();

            if (ext == ".exe" || ext == ".bat" || ext == ".cmd")
            {
                flashPath = Path.GetDirectoryName(flashPath);
            }
            string basePath = flashPath;

            string deflang = System.Globalization.CultureInfo.CurrentUICulture.Name;

            deflang = deflang.Substring(0, 2);

            // CS4+ default configuration
            if (Directory.Exists(basePath + "\\Common\\Configuration\\ActionScript 3.0"))
            {
                return(basePath + "\\Common\\Configuration\\");
            }

            // default language
            if (Directory.Exists(basePath + deflang + "\\Configuration\\ActionScript 3.0"))
            {
                return(basePath + deflang + "\\Configuration\\");
            }
            // look for other languages
            else if (Directory.Exists(basePath))
            {
                string[] dirs = Directory.GetDirectories(basePath);
                foreach (string dir in dirs)
                {
                    if (Directory.Exists(dir + "\\Configuration\\ActionScript 3.0"))
                    {
                        return(dir + "\\Configuration\\");
                    }
                }
            }
            return(null);
        }