Пример #1
0
 public Completion(SimpleIni config, Settings settings)
 {
     this.settings = settings;
     lang = ScintillaControl.Configuration.GetLanguage("css");
     InitProperties(GetSection(config, "Properties"));
     InitLists(GetSection(config, "Lists"));
 }
Пример #2
0
        /// <summary>
        /// Loads the plugin settings
        /// </summary>
        public void LoadSettings()
        {
            this.settingObject = new Settings();
            if (!File.Exists(this.settingFilename))
            {
                this.SaveSettings();
            }
            else
            {
                Object obj = ObjectSerializer.Deserialize(this.settingFilename, this.settingObject);
                this.settingObject = (Settings)obj;
            }

            enabledLanguages = new Dictionary <string, CssFeatures>();
            config           = ConfigHelper.Parse(PathHelper.ResolvePath("tools/css/completion.ini"), false);
            foreach (var def in config)
            {
                var section = def.Value;
                if (section.ContainsKey("ext"))
                {
                    string[] exts     = section["ext"].Trim().Split(',');
                    var      features = new CssFeatures(def.Key, section);
                    foreach (string ext in exts)
                    {
                        enabledLanguages.Add("." + ext, features);
                    }
                }
            }
        }
Пример #3
0
 public Completion(SimpleIni config, Settings settings)
 {
     this.settings = settings;
     lang          = ScintillaControl.Configuration.GetLanguage("css");
     InitProperties(GetSection(config, "Properties"));
     InitLists(GetSection(config, "Lists"));
 }
Пример #4
0
        public bool NeedRunAsAdmin()
        {
            var simpleIniFile   = SimpleIni.ResolveFile();
            var items           = simpleIniFile.TryLoadIniFileItems("SimpleTrace.ini");
            var runAsAdminValue = simpleIniFile.GetValue(items, "Entry", "RunAsAdmin");
            var runAsAdmin      = runAsAdminValue == null ? "false" : runAsAdminValue.ToString().Trim();

            bool.TryParse(runAsAdmin, out var needRunAsAdmin);
            return(needRunAsAdmin);
        }
Пример #5
0
 private Dictionary <string, string> GetSection(SimpleIni config, string name)
 {
     foreach (var def in config)
     {
         if (def.Key == name)
         {
             return(def.Value);
         }
     }
     return(null);
 }
Пример #6
0
        private void ScopedConnectionForm_Load(object sender, EventArgs e)
        {
            var simpleIniFile = SimpleIni.ResolveFile();
            var items         = simpleIniFile.TryLoadIniFileItems("config.ini");
            var scopedConfig  = new ScopedConfig();

            simpleIniFile.SetProperties(items, scopedConfig, "Scoped");
            var hubUri = string.Format("{0}?ScopeGroupId={1}&ClientId={2}", scopedConfig.HubUri, scopedConfig.ScopeGroupId, scopedConfig.ClientId);

            this.txtHubUri.Text = hubUri;
        }
Пример #7
0
        public Form CreateEntryForm()
        {
            var simpleIniFile      = SimpleIni.ResolveFile();
            var items              = simpleIniFile.TryLoadIniFileItems("SimpleTrace.ini");
            var entryFormNameValue = simpleIniFile.GetValue(items, "Entry", "FormName");
            var entryFormName      = entryFormNameValue == null ? string.Empty : entryFormNameValue.ToString().Trim();

            if (entryFormName.IsSameName(KnownFormNames.CallApiForm))
            {
                return(Container.GetService <CallApis.CallApiForm>());
            }

            if (entryFormName.IsSameName(KnownFormNames.ServiceManageForm))
            {
                return(Container.GetService <ServiceManages.ServiceManageForm>());
            }

            //default
            return(Container.GetService <Demos.DemoForm>());
        }
Пример #8
0
        /// <summary>
        /// Loads the plugin settings
        /// </summary>
        public void LoadSettings()
        {
            this.settingObject = new Settings();
            if (!File.Exists(this.settingFilename)) this.SaveSettings();
            else
            {
                Object obj = ObjectSerializer.Deserialize(this.settingFilename, this.settingObject);
                this.settingObject = (Settings)obj;
            }

            enabledLanguages = new Dictionary<string, CssFeatures>();
            config = ConfigHelper.Parse(PathHelper.ResolvePath("tools/css/completion.ini"), false);
            foreach (var def in config)
            {
                var section = def.Value;
                if (section.ContainsKey("ext"))
                {
                    string[] exts = section["ext"].Trim().Split(',');
                    var features = new CssFeatures(def.Key, section);
                    foreach (string ext in exts)
                        enabledLanguages.Add("." + ext, features);
                }
            }
        }
Пример #9
0
 private Dictionary<string, string> GetSection(SimpleIni config, string name)
 {
     foreach (var def in config)
         if (def.Key == name) return def.Value;
     return null;
 }
Пример #10
0
        private IList <SimpleProcessInfo> GetProcessInfos(string iniFileName)
        {
            var processInfos = new List <SimpleProcessInfo>();

            var simpleIniFile = SimpleIni.ResolveFile();
            var fullPath      = Path.GetFullPath(AppDomain.CurrentDomain.Combine(iniFileName));

            if (!File.Exists(fullPath))
            {
                LogInfo("IniFile Not Exist: " + fullPath);
                return(processInfos);
            }

            var traceIniItems = simpleIniFile.TryLoadIniFileItems(fullPath);

            if (traceIniItems == null)
            {
                LogInfo(fullPath + " has no items value ");
                return(processInfos);
            }

            LogInfo(string.Format("-----{0}----", iniFileName));
            foreach (var item in traceIniItems)
            {
                LogInfo(string.Format("{0}: {1}", item.Key, item.Value));
            }

            var processesValue = simpleIniFile.GetValue(traceIniItems, "Daemon", "Processes");

            if (processesValue == null)
            {
                LogInfo("[Daemon]Processes is null!");
                return(processInfos);
            }

            var processSections = processesValue.ToString().Trim().Split(new[] { ',', ',' }, StringSplitOptions.RemoveEmptyEntries)
                                  .Select(x => x.Trim())
                                  .ToList();

            foreach (var processSection in processSections)
            {
                //[TraceApi]
                //ProcessName="SimpleTrace.Api"
                //ExePath="TraceApi\SimpleTrace.Api.exe"
                //ExeArgs=

                var processNameValue = simpleIniFile.GetValue(traceIniItems, processSection, "ProcessName");
                var exePathValue     = simpleIniFile.GetValue(traceIniItems, processSection, "ExePath");
                var exeArgsValue     = simpleIniFile.GetValue(traceIniItems, processSection, "ExeArgs");

                var processName = processNameValue == null ? string.Empty : processNameValue.ToString();
                var exePath     = exePathValue == null ? string.Empty : exePathValue.ToString();
                var exeArgs     = exeArgsValue == null ? string.Empty : exeArgsValue.ToString();

                if (string.IsNullOrWhiteSpace(processName))
                {
                    LogInfo(string.Format("SimpleTrace.ini => [{0}]ProcessName is null!", processSection));
                    continue;
                }

                if (string.IsNullOrWhiteSpace(exePath))
                {
                    LogInfo(string.Format("SimpleTrace.ini => [{0}]ExePath is null!", processSection));
                    continue;
                }

                var fullExePath = Path.GetFullPath(AppDomain.CurrentDomain.Combine(exePath));
                var processInfo = SimpleProcessInfo.Create(processName, fullExePath, exeArgs);
                LogInfo(string.Format("----{0}----", processSection));
                LogInfo(MyModelHelper.MakeIniString(processInfo));
                processInfos.Add(processInfo);
            }
            return(processInfos);
        }