コード例 #1
0
        protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector)
        {
            _moduleName = pluginConfiguration.ModuleName;
            BasicConfigurator.Configure();

            var defaultPattern = new PatternLayout { ConversionPattern = LogPattern };
            defaultPattern.ActivateOptions();

            var rollingFileAppender = new RollingFileAppender
            {
                Name = "RollingFileAppender",
                File = "Log/" + _moduleName + ".log",
                AppendToFile = true,
                RollingStyle = RollingFileAppender.RollingMode.Size,
                MaxSizeRollBackups = 15,
                MaximumFileSize = "100MB",
                StaticLogFileName = true,
                Layout = defaultPattern
            };
            rollingFileAppender.ActivateOptions();
            rollingFileAppender.ImmediateFlush = true;
            rollingFileAppender.LockingModel= new FileAppender.InterProcessLock();

            var root = ((Hierarchy)global::log4net.LogManager.GetRepository()).Root;
            root.AddAppender(rollingFileAppender);
            root.Level = Level.Debug;
            root.Repository.Configured = true;
        }
コード例 #2
0
ファイル: Db4oPlugin.cs プロジェクト: benjamimjr/Labs
        protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector)
        {
            var assembly = pluginConfiguration.InfrastructureAssembly;
            var file = string.Format("\\db{0}.db", pluginConfiguration.ModuleName);

            db = Db4oFactory.OpenFile(AppDomain.CurrentDomain.BaseDirectory + file);
        }
コード例 #3
0
ファイル: AutofacPlugin.cs プロジェクト: benjamimjr/Labs
        protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector)
        {
            if (_container != null) return;

            var builder = new ContainerBuilder();

            _container = builder.Build();
        }
コード例 #4
0
        protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector)
        {
            var key = String.Format("{0}.Db4oPlugin.DbFileLocation", pluginConfiguration.ModuleName);
            var value = ConfigurationManager.AppSettings[key];

            _path = value ??
            Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Format("db{0}.db", pluginConfiguration.ModuleName));
        }
コード例 #5
0
ファイル: Twitter.cs プロジェクト: BKS7144/pecastarter5
 public Twitter()
 {
     info = new PluginInfo("Twitter",
         "Twitter",
         Assembly.GetExecutingAssembly().GetName().Version,
         true);
     configuration = new PluginConfiguration(0);
 }
コード例 #6
0
ファイル: Logger.cs プロジェクト: BKS7144/pecastarter5
 public Logger()
 {
     info = new PluginInfo(
         name: "Logger",
         displayName: "ログ出力",
         version: Assembly.GetExecutingAssembly().GetName().Version,
         hasSettingsDialog: true);
     configuration = new PluginConfiguration(10);
 }
コード例 #7
0
ファイル: Plugin.cs プロジェクト: xantilas/videobrowser
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration<PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();

            kernel.MetadataProviderFactories.Add(new MetadataProviderFactory(typeof(DvrmsMetadataProvider)));

            Logger.ReportInfo(Name + " (version " + Version + ") Loaded.");
        }
コード例 #8
0
ファイル: HotkeyAble.cs プロジェクト: Wercho/TweakScale
 public Hotkeyable(OSD osd, string name, string tempDisableDefault, string toggleDefault, bool state)
 {
     _config = HotkeyManager.Instance.Config;
     _osd = osd;
     _name = name;
     _tempDisable = new Hotkey("Disable " + name, tempDisableDefault);
     _toggle = new Hotkey("Toggle " + name, toggleDefault);
     _state = state;
     Load();
 }
コード例 #9
0
        protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector)
        {
            var assembly = pluginConfiguration.InfrastructureAssembly;

            var dbContextType = Array.Find(assembly.GetExportedTypes(), t => t.IsSubclassOf(typeof(DbContext)));
            if (dbContextType != null)
            {
                _dbContext = (DbContext) dbContextType.Assembly.CreateInstance(dbContextType.FullName);
            }
        }
コード例 #10
0
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration<PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();

            var trailers = kernel.ItemRepository.RetrieveItem(TrailersGuid) ?? new ITunesTrailerFolder();
            trailers.Path = "";
            trailers.Id = TrailersGuid;
            kernel.RootFolder.AddVirtualChild(trailers);
        }
コード例 #11
0
 protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector)
 {
     var assembly = pluginConfiguration.InfrastructureAssembly;
     foreach (var validator in from tipo in assembly.GetExportedTypes()
                               where tipo.BaseType != null && tipo.BaseType.IsGenericType && tipo.BaseType.GetGenericTypeDefinition() == typeof(ValidationRuleSet<>)
                               select tipo.Assembly.CreateInstance(tipo.FullName))
     {
         AddValidator(validator);
         pluginInspector.Log("Adding validator for {0}", validator.GetType().Name);
     }
 }
コード例 #12
0
 protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector)
 {
     var assembly = pluginConfiguration.InfrastructureAssembly;
     foreach (var mapRule in from tipo in assembly.GetExportedTypes()
                               where tipo.BaseType == typeof(MapRule)
                               select tipo.Assembly.CreateInstance(tipo.FullName))
     {
         AddMapRule((MapRule) mapRule);
         pluginInspector.Log("Adding MapRule for {0}", mapRule.GetType().Name);
     }
 }
コード例 #13
0
ファイル: KerbalGIS.cs プロジェクト: Gnonthgol/KerbalGIS
        public void Update()
        {
            if (config == null) {
                config = PluginConfiguration.CreateForType<KerbalGIS> ();
                config.load ();
            }
            if (server == null) {
                server = new HTTPServer ();
            }

            server.Update ();
        }
コード例 #14
0
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration<PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();

            FilmTrailerFolder trailers = (FilmTrailerFolder)kernel.ItemRepository.RetrieveItem(TrailersGuid) ?? new FilmTrailerFolder();
            trailers.Path = "";
            trailers.Id = TrailersGuid;

            kernel.RootFolder.AddVirtualChild(trailers);
            Logger.ReportInfo("Film Trailer Plug-in (version " + Version + ") Loaded.  Using feed from " + Plugin.PluginOptions.Instance.TrailerSource + " (" + trailers.Feed + ")");
        }
コード例 #15
0
        protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector)
        {
            var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, DefaultPath);
            Directory.CreateDirectory(path);

            var logFile = Path.ChangeExtension(pluginConfiguration.ModuleName, DefaultExtension);
            logFile = Path.Combine(path, logFile);

            _arquivo = new FileInfo(logFile);

            pluginInspector.Log("Logging to {0}", _arquivo.FullName);
        }
コード例 #16
0
        protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector)
        {
            var assembly = pluginConfiguration.InfrastructureAssembly;
            pluginInspector.Log("Configuring assembly {0}", assembly.GetName().Name);

            foreach (var instance in assembly.GetExportedTypes().Where(tipo => tipo.BaseType == typeof(Profile)).Select(tipo => (Profile)tipo.Assembly.CreateInstance(tipo.FullName)))
            {
                Mapper.AddProfile(instance);
                pluginInspector.Log("Adding profile instance {0}", instance.GetType());
            }

            Mapper.AssertConfigurationIsValid();
        }
コード例 #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CyrusBuilt.MonoPluginFramework.UI.FormPluginSettingsDialog"/>
        /// class with the plugin to load and the parent window.
        /// </summary>
        /// <param name="plugin">
        /// The plugin to load info from.
        /// </param>
        /// <param name="parent">
        /// The window that is the parent of this dialog.
        /// </param>
        public FormPluginSettingsDialog(AvailablePlugin plugin, Window parent)
            : base()
        {
            if (parent != null) {
                this.Parent = parent;
            }

            if (plugin != null) {
                this._name = plugin.Instance.Name;
                this._config = plugin.Instance.GetConfiguration();
                Assembly asm = Assembly.ReflectionOnlyLoadFrom(plugin.AssemblyPath);
                this._asmName = asm.GetName().Name;
            }
        }
コード例 #18
0
        void Awake()
        {
            if (instance != null) {
                Destroy (this);
                return;
            }

            if (config == null) {
                config = PluginConfiguration.CreateForType<KeepItStraight> ();
            }
            config.load ();
            camera = FlightCamera.fetch;
            GameEvents.onFlightReady.Add (FlightReady);
            GameEvents.onPartCouple.Add (onPartCouple);
        }
コード例 #19
0
        public static void LoadConfigs()
        {
            config = KSP.IO.PluginConfiguration.CreateForType<FAREditorGUI>();
            config.load();
            FARDebugValues.displayForces = Convert.ToBoolean(config.GetValue("displayForces", "false"));
            FARDebugValues.displayCoefficients = Convert.ToBoolean(config.GetValue("displayCoefficients", "false"));
            FARDebugValues.displayShielding = Convert.ToBoolean(config.GetValue("displayShielding", "false"));

            FAREditorGUI.windowPos = config.GetValue("windowPos", new Rect());
            FAREditorGUI.minimize = config.GetValue("EditorGUIBool", true);
            if (FAREditorGUI.windowPos.y < 75)
                FAREditorGUI.windowPos.y = 75;

            FARPartClassification.LoadClassificationTemplates();
            FARAeroUtil.LoadAeroDataFromConfig();
        }
コード例 #20
0
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration<PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();
            if (PluginOptions.Instance.ClearBadFiles)
            {
                foreach (var badFile in PluginOptions.Instance.BadFiles)
                {
                    if (!PluginOptions.Instance.FormerBadFiles.Contains(badFile)) PluginOptions.Instance.FormerBadFiles.Add(badFile);
                }
                PluginOptions.Instance.BadFiles.Clear();
                PluginOptions.Instance.ClearBadFiles = false;
                PluginOptions.Save();
            }

            int.TryParse(PluginOptions.Instance.ServiceTimeout, out ServiceTimeout);
            kernel.MetadataProviderFactories.Add(MetadataProviderFactory.Get<MediaInfoProvider>());
        }
コード例 #21
0
        public override void OnLoad(ConfigNode node)
        {
            //print("###OnLoad");
            PluginConfiguration config = PluginConfiguration.CreateForType <Biomatic>();

            config.load();

            try
            {
                windowPos = config.GetValue <Rect>("Window Position");

                if (listIgnore == null)
                {
                    listIgnore = new List <string>();
                }
                else
                {
                    listIgnore.Clear();
                }

                int count = config.GetValue <int>("List items");
                for (int i = 0; i < count; i++)
                {
                    listIgnore.Add(config.GetValue <string>("Item" + i.ToString()));
                }

                deWarp          = config.GetValue <bool>("DeWarp");
                includeAlt      = config.GetValue <bool>("Use altitude");
                showDescription = config.GetValue <bool>("Show description");
                string s = config.GetValue <string>("Toolbar");
                s = s.ToLower();
                useStockToolBar = !(s.Contains("blizzy"));
            }
            catch (Exception ex)
            {
                // likely a line is missing.
            }

            windowPos.width = fixedwidth;
        }
コード例 #22
0
        // ReSharper disable once TooManyArguments
        private void PlaybackPaused(PlaybackProgressEventArgs e, PluginConfiguration config, SavedProfile profile)
        {
            logger.Info("Samsung Smart Things Reports Playback Paused...");

            logger.Info($"Samsung Smart Things Found Session Device: { profile.DeviceName }");

            if (!ScheduleAllowScene(profile))
            {
                logger.Info($"Samsung Smart Things profile not allowed to run at this time: { profile.DeviceName }");
                return;
            }

            var sceneName = string.Empty;

            switch (e.MediaInfo.Type)
            {
            case "Movie":
                sceneName = profile.MoviesPlaybackPaused;
                break;

            case "TvChannel":
                sceneName = profile.LiveTvPlaybackPaused;
                break;

            case "Series":
                sceneName = profile.TvPlaybackPaused;
                break;

            case "Season":
                sceneName = profile.TvPlaybackPaused;
                break;

            case "Episode":
                sceneName = profile.TvPlaybackPaused;
                break;
            }

            logger.Info($"Samsung Smart Things will trigger Paused: { profile.DeviceName }");
            RunScene(sceneName, config);
        }
コード例 #23
0
        public override void OnLoad(ConfigNode node)
        {
            PluginConfiguration config = PluginConfiguration.CreateForType <Proximity>();

            config.load();
            windowPos        = config.GetValue <Rect>("Window Position");
            beepIndex        = config.GetValue <int>("Beep type");
            beepLength       = config.GetValue <int>("Beep length");
            visualIndex      = config.GetValue <int>("Visual type");
            ActivationHeight = config.GetValue <int>("Activation height");
            DSThreshold      = config.GetValue <int>("Distance Speed threshold");
            showsettings     = config.GetValue <bool>("Show settings");
            pitchIndex       = config.GetValue <int>("Pitch type");
            beepAscent       = config.GetValue <bool>("On Ascent");

            if (ActivationHeight < 500)
            {
                ActivationHeight = 2000;
            }

            if (DSThreshold < 50)
            {
                DSThreshold = 200;
            }

            if (ActivationHeight > 10000)
            {
                ActivationHeight = 10000;
            }

            if (DSThreshold > 2000)
            {
                DSThreshold = 2000;
            }

            if (beepLength < 1)
            {
                beepLength = 1;
            }
        }
コード例 #24
0
ファイル: GraphWindow.cs プロジェクト: RA2lover/CorrectCoL
        public void save_settings()
        {
            if (conf == null)
            {
                conf = PluginConfiguration.CreateForType <CorrectCoL>();
            }
            Debug.Log("[CorrectCoL]: serializing");
            if (wnd_rect != null)
            {
                conf.SetValue("x", wnd_rect.x.ToString());
                conf.SetValue("y", wnd_rect.y.ToString());
            }
            conf.SetValue("range", aoa_range.ToString());
            conf.save();

            // clear lock
            if (locked)
            {
                EditorLogic.fetch.Unlock("CorrectCoLWindow");
                locked = false;
            }
        }
コード例 #25
0
        /// <summary>
        /// Get the title in configured language
        /// </summary>
        /// <param name="language"></param>
        /// <returns></returns>
        public string GetPreferredTitle(string language)
        {
            PluginConfiguration config = Plugin.Instance.Configuration;

            if (config.TitlePreference == TitlePreferenceType.Localized)
            {
                if (language == "en")
                {
                    return(this.title.english);
                }
                if (language == "jap")
                {
                    return(this.title.native);
                }
            }
            if (config.TitlePreference == TitlePreferenceType.Japanese)
            {
                return(this.title.native);
            }

            return(this.title.romaji);
        }
コード例 #26
0
        /** Called once at startup */
        public void Awake()
        {
            debugPrint("Awake()");

            /** Config loading setup */
            PluginConfiguration config = PluginConfiguration.CreateForType <ExperimentTracker>();

            config.load();
            expGUI        = config.GetValue <bool>("expGUI");
            expListRect.x = config.GetValue <int>("expListRectX");
            expListRect.y = config.GetValue <int>("expListRectY");
            infGUI        = config.GetValue <bool>("infGUI");
            infRect.x     = config.GetValue <int>("infRectX");
            infRect.y     = config.GetValue <int>("infRectY");
            resetWindowPos();

            /** Register for events */
            //GameEvents.onGUIApplicationLauncherReady.Add(setupButton);
            setupButton();
            GameEvents.onHideUI.Add(onHideUI);
            GameEvents.onShowUI.Add(onShowUI);
        }
コード例 #27
0
        public void Start()
        {
            v                      = null;
            CurrentSMA             = -1e6;
            CurrentBodySynchronous = -1e6;
            TargetString           = "0";
            Exponent               = 6;

            //load config instead of hardcoding these
            PluginConfiguration Config = PluginConfiguration.CreateForType <StationKeeping> ();

            Config.load();
            RealSMA   = Config.GetValue <bool> ("RealSMA", false);
            Tolerance = Config.GetValue <double> ("Tolerance", 0.01);
            double WindowX = Config.GetValue <double> ("WindowX", 500);
            double WindowY = Config.GetValue <double> ("WindowY", 500);

            WindowRect = new Rect((float)WindowX, (float)WindowY, 200, 125);

            GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
            GameEvents.onPlanetariumTargetChanged.Add(OnMapTargetChange);
        }
コード例 #28
0
        public override void OnSave(ConfigNode node)
        {
            //print("@@@OnSave");
            PluginConfiguration config = PluginConfiguration.CreateForType <Proximity>();

            config.SetValue("Window Position", windowPos);
            config.SetValue("Beep type", beepIndex);
            config.SetValue("Beep length", beepLength);
            config.SetValue("Visual type", visualIndex);
            config.SetValue("Activation height", ActivationHeight);
            config.SetValue("Distance Speed threshold", DSThreshold);
            config.SetValue("Show settings", UseToolbar ? ToolbarShowSettings: GUIShowSettings);
            config.SetValue("Pitch type", pitchIndex);
            config.SetValue("Off if parachute", deactivateOnParachute);
            config.SetValue("Off if rover", deactivateIfRover);
            config.SetValue("Volume", (int)(volume * 100));
#if PERSONAL_VERSION
            config.SetValue("Autodeploy parachute", autoParachute);
            config.SetValue("Autodeploy landing legs", autoExtendLandingLegs);
#endif
            config.save();
        }
コード例 #29
0
        /// <summary>
        /// Callback for object destruction.
        /// </summary>
        public void OnDestroy()
        {
            ControlUnlock();

            PluginConfiguration config = PluginConfiguration.CreateForType <KartographSettings> ();

            config.load();
            config.SetValue("VesselWindowPos", _windowPos);
            config.SetValue("KrakenWarn", _krakenWarn);
            config.save();

            GameEvents.onVesselDestroy.Remove(VesselDestroyed);
            GameEvents.onHideUI.Remove(Hide);
            GameEvents.onShowUI.Remove(UnHide);
            GameEvents.onGamePause.Remove(Hide);
            GameEvents.onGameUnpause.Remove(UnHide);

            if (_instance == this)
            {
                _instance = null;
            }
        }
コード例 #30
0
ファイル: Configuration.cs プロジェクト: TheDutchDevil/KerLog
        public Configuration()
        {
            _plugConf = PluginConfiguration.CreateForType<Configuration>();
            _plugConf.load();
            PropertyChanged += Configuration_PropertyChanged;
            string rawPersistedFlights = _plugConf.GetValue<string>("persistedFlights");
            _iP = _plugConf.GetValue<string>("iP");
            _port = _plugConf.GetValue<int>("port",-1);
            _persistedFlightsLock = new object();

            if(_port == -1)
            {
                log.Debug("Port was not found in the configuration");
                Port = 10000;
            }

            if (_iP == null)
            {
                log.Debug("IP was not found in the configuration");
                IP = "192.168.1.7";
            }
            if (rawPersistedFlights == null)
            {
                log.Debug("Persisted flights was not found in the configuration");
                PersistedFlights = new List<string>();
            }
            else
            {
                try
                {
                    _persistedFlights = rawPersistedFlights.Split('|').Reverse().ToList<string>();
                }
                catch (Exception ex)
                {
                    log.Info(string.Format("Could not format persisted flights into an array, resetting it to default value. Persistedflights value is {0}", rawPersistedFlights), ex);
                    PersistedFlights = new List<string>();
                }
            }
        }
コード例 #31
0
        internal void OnDestroy()
        {
            toolbarControl.OnDestroy();
            Destroy(toolbarControl);

            #if DEBUG
            // don't save configs because KramaxReload screws up PluginConfiguration
            #else
            PluginConfiguration config = PluginConfiguration.CreateForType <AutoAsparagus> ();
            config.SetValue("vizualize", vizualize);
            config.SetValue("stageParachutes", stageParachutes);
            config.SetValue("stageLaunchClamps", stageLaunchClamps);
            config.SetValue("launchClampsStage", launchClampsStage);
            config.SetValue("stagesepratrons", stagesepratrons);
            config.SetValue("useSmartStage", useSmartStage);
            config.SetValue("windowRectX", (int)windowRect.x);
            config.SetValue("windowRectY", (int)windowRect.y);
            config.save();
                        #endif

            GameEvents.onEditorShipModified.Remove(onCraftChange);
        }
コード例 #32
0
        /// <summary>
        /// Find a PluginConfiguration item in 'configs' using 'name' as an identifier
        /// Searches all subpluginconfigurations also
        /// </summary>
        /// <param name="name"></param>
        /// <param name="configs"></param>
        /// <returns></returns>
        private PluginConfiguration FindPluginConfiguration(IClientPlugin plugin, List <PluginConfiguration> configs)
        {
            PluginConfiguration result = null;

            foreach (var config in configs)
            {
                // See if root is a match
                if (config.Name == plugin.Title &&
                    config.Parent == plugin.ParentPlugin &&
                    config.Category == plugin.ParentPluginCategory
                    )
                {
                    result = config;
                }
                // if root is not a match, then search subconfigs
                else
                {
                    if (config.SubCategories != null)
                    {
                        foreach (var subcategory in config.SubCategories)
                        {
                            var subConfig = FindPluginConfiguration(plugin, subcategory.PluginConfigurations);
                            if (subConfig != null)
                            {
                                result = subConfig;
                                break;
                            }
                        }
                    }
                }

                if (result != null)
                {
                    break;
                }
            }

            return(result);
        }
コード例 #33
0
        private void SelectPage(ListButton lb)
        {
            foreach (var olb in Pages)
            {
                if (olb == lb)
                {
                    olb.IsSelected = true;
                }
                else
                {
                    olb.IsSelected = false;
                }
            }

            foreach (var category in SubCategories)
            {
                var config = category.PluginConfigurations.Find(x => GetPluginName(x.Name) == GetPluginName(lb.Text));
                if (config != null)
                {
                    currentPage = config;
                    break;
                }
            }

            // Set Page as PageContent
            PageContent = lb.DataObject as UserControl;

            // Save selected page
            int index = Pages.ToList().FindIndex(x => x == lb);

            if (index >= 0)
            {
                Properties.Settings.Default.DashboardSelectedPage = index;
                Properties.Settings.Default.Save();
            }

            // Load Saved Zoom Level
            ZoomLevel = MainWindow.LoadSavedPageZoomValue(lb.DataObject as IPage);
        }
コード例 #34
0
ファイル: Program.cs プロジェクト: ThomasKeller/TK
        static void Main(string[] args)
        {
            TK.Logging.ILogger logger = LoggerFactory.CreateLoggerFor("main");

            /*var scheduler = new SimpleSchedulerWrapper();
             *
             * scheduler.AddJob("0/60 * * * * ?", MyTask, new Dictionary<string, object>(), false);
             * scheduler.AddJob("0/1 * * * * ?", MyTask, new Dictionary<string, object>(), true);
             *
             * scheduler.Start();
             * Console.ReadLine();
             * return;
             */

            List <PluginConfiguration> configs = new List <PluginConfiguration>(PluginConfiguration.LoadPluginsConfig());
            var pluginLoader = new PluginLoader(AppDomain.CurrentDomain.BaseDirectory, "*Plugin.dll");

            foreach (string name in pluginLoader.PluginNames)
            {
                PluginBase plugin = pluginLoader[name];
                Console.WriteLine(string.Format("{0} {1}", plugin.PluginName(), plugin.PluginVersion()));
                var pluginConfig = configs.Where(c => c.PluginName == plugin.PluginName())
                                   .FirstOrDefault();

                plugin.Initialize(pluginConfig.Paramters);
                var defaultParameter = plugin.GetParameters();
                foreach (string key in defaultParameter.Keys.ToArray())
                {
                    Console.WriteLine(string.Format("Parameter: {0}, Value: {1}", key, defaultParameter[key]));
                }
                plugin.Start();
            }
            Console.ReadKey();

            foreach (string name in pluginLoader.PluginNames)
            {
                pluginLoader[name].Stop();
            }
        }
コード例 #35
0
ファイル: Plugin.cs プロジェクト: hamzaet2003/videobrowser
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration <PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();
            if (PluginOptions.Instance.ClearBadFiles)
            {
                foreach (var badFile in PluginOptions.Instance.BadFiles)
                {
                    if (!PluginOptions.Instance.FormerBadFiles.Contains(badFile))
                    {
                        PluginOptions.Instance.FormerBadFiles.Add(badFile);
                    }
                }
                PluginOptions.Instance.BadFiles.Clear();
                PluginOptions.Instance.ClearBadFiles = false;
                PluginOptions.Save();
            }

            int.TryParse(PluginOptions.Instance.ServiceTimeout, out ServiceTimeout);
            kernel.MetadataProviderFactories.Add(MetadataProviderFactory.Get <MediaInfoProvider>());
            Logger.ReportInfo("MediaInfoProvider plugin version (" + Version + ") loaded.");
        }
コード例 #36
0
        private void LoadConfig()
        {
            try
            {
                var config = PluginConfiguration.CreateForType <Config>();
                config.load();

                foreach (var key in keys.Values)
                {
                    var value = config[key.StringKey];
                    if (value != null)
                    {
                        key.Value = value;
                        UnityEngine.Debug.Log(string.Format("kOS: Loading Config: {0} Value: {1}", key.StringKey, value));
                    }
                }
            }
            catch (Exception ex)
            {
                UnityEngine.Debug.Log("kOS: Exception Loading Config: " + ex.Message);
            }
        }
コード例 #37
0
ファイル: OrbitGauge.cs プロジェクト: bssthu/SteamGauges-Fork
 public override void save(PluginConfiguration config)
 {
     config.SetValue("OrbitPosition", windowPosition);
     config.SetValue("OrbitMinimized", isMinimized);
     config.SetValue("OrbitNegativePe", showNegativePe);
     config.SetValue("OrbitGreenAlt", greenAlt);
     config.SetValue("OrbitCircleThresh", circleThresh);
     config.SetValue("OribtScale", (double)Scale);
     config.SetValue("OrbitWindow", burnWindow);
     config.SetValue("MunSafe", MunSafe);
     config.SetValue("MinmusSafe", MinimusSafe);
     config.SetValue("MohoSafe", MohoSafe);
     config.SetValue("GillySafe", GillySafe);
     config.SetValue("IkeSafe", IkeSafe);
     config.SetValue("DresSafe", DresSafe);
     config.SetValue("VallSafe", VallSafe);
     config.SetValue("TyloSafe", TyloSafe);
     config.SetValue("BopSafe", BopSafe);
     config.SetValue("PolSafe", PolSafe);
     config.SetValue("EelooSafe", EelooSafe);
     config.SetValue("DefaultSafe", DefaultSafe);
 }
コード例 #38
0
ファイル: OrbitGauge.cs プロジェクト: bssthu/SteamGauges-Fork
 public override void load(PluginConfiguration config)
 {
     windowPosition = config.GetValue <Rect>("OrbitPosition");
     isMinimized    = config.GetValue <bool>("OrbitMinimized", true);
     showNegativePe = config.GetValue <bool>("OrbitNegativePe", true);
     greenAlt       = config.GetValue <double>("OrbitGreenAlt", 1.2);
     circleThresh   = config.GetValue <double>("OrbitCircleThresh", 0.1);
     Scale          = (float)config.GetValue <double>("OribtScale", 0.5);
     burnWindow     = config.GetValue <int>("OrbitWindow", 30);
     MunSafe        = config.GetValue <int>("MunSafe", 7100);
     MinimusSafe    = config.GetValue <int>("MinimusSafe", 5750);
     MohoSafe       = config.GetValue <int>("MohoSafe", 6850);
     GillySafe      = config.GetValue <int>("GillySafe", 6400);
     IkeSafe        = config.GetValue <int>("IkeSafe", 12750);
     DresSafe       = config.GetValue <int>("DresSafe", 5700);
     VallSafe       = config.GetValue <int>("VallSafe", 8000);
     TyloSafe       = config.GetValue <int>("TyloSafe", 11300);
     BopSafe        = config.GetValue <int>("BopSafe", 21800);
     PolSafe        = config.GetValue <int>("PolSafe", 5600);
     EelooSafe      = config.GetValue <int>("EelooSafe", 3900);
     DefaultSafe    = config.GetValue <int>("DefaultSafe", 7000);
 }
コード例 #39
0
        public void Context_current_is_initial_merged_with_target(ColumnSet configColumnSet)
        {
            var testHelper    = new TestHelper();
            var pluginContext = testHelper.PluginExecutionContext;

            pluginContext.MessageName.Returns(PluginMessage.Update);
            pluginContext.Stage.Returns((int)SdkMessageProcessingStepStage.Preoperation);

            var id     = Guid.NewGuid();
            var target = new Entity("lead")
            {
                Id             = id,
                ["new_number"] = 1
            };

            pluginContext.InputParameters.Returns(new ParameterCollection());
            pluginContext.InputParameters["Target"] = target;

            var initial = new Entity("lead")
            {
                Id                = id,
                ["new_number"]    = 15,
                ["new_optionset"] = new OptionSetValue(12),
                ["new_money"]     = new Money(1234m)
            };

            testHelper.Service.Retrieve(Arg.Any <string>(), Arg.Any <Guid>(), Arg.Any <ColumnSet>()).Returns(initial);

            var config = new PluginConfiguration <Entity>
            {
                ColumnSet = configColumnSet
            };
            var context = testHelper.ServiceProvider.ToTransactionContext(config);

            Assert.Equal(target.Id, context.Current.Id);
            Assert.Equal(target["new_number"], context.Current["new_number"]);
            Assert.Equal(initial["new_optionset"], context.Current["new_optionset"]);
            Assert.Equal(initial["new_money"], context.Current["new_money"]);
        }
コード例 #40
0
        /// <inheritdoc />
        public void Initialize(PluginConfiguration configuration, Action <Action <ISystemController, IRaceController> > queueCommand)
        {
            _components  = new List <IPluginComponent>();
            _initialized = false;

            //TODO: maybe use the container or child container for this?
            ISensor sensor;

            if (_simulated)
            {
                sensor = new SimulatedWindSensor(_logger, this);
            }
            else
            {
                if (string.IsNullOrWhiteSpace(_deviceAddress))
                {
                    throw new ArgumentNullException("deviceAddress");
                }

                var bmas = new BlendMicroAnemometerSensor(_logger, _clock, _maximumDataAge, this, _btAdapterName, _deviceAddress, _connection, _windAngleOffset);
                bmas.Start();
                sensor = bmas;
            }

            _components.Add(sensor);
            configuration.Sensors.Add(sensor);

            var trueCalculator = new TrueWindCalculator(_logger, this);

            _components.Add(trueCalculator);
            configuration.Calculators.Add(trueCalculator);

            var mastBendCalculator = new MastBendCalculator(_logger, this);

            _components.Add(mastBendCalculator);
            configuration.Calculators.Add(mastBendCalculator);

            _initialized = true;
        }
コード例 #41
0
ファイル: BonVoyage.cs プロジェクト: ayan4m1/KSP-BonVoyage
        public void Awake()
        {
            if (Instance != null)
            {
                Destroy(this);
                return;
            }
            Instance = this;

            guiVisible   = false;
            globalHidden = false;
            guiId        = GUIUtility.GetControlID(FocusType.Passive);
            config       = PluginConfiguration.CreateForType <BonVoyage>();
            config.load();
            autoDewarp   = config.GetValue <bool>("autoDewarp", false);
            activeRovers = new List <ActiveRover>();

            Rect sample = new Rect();

            sample.width  = 700;
            sample.height = 500;
            sample.center = new Vector2(Screen.width / 2, Screen.height / 2);
            guiRect       = config.GetValue <Rect>("guiRect", new Rect(sample));
            config.save();
            lastUpdated = DateTime.Now;
            mainWindowScrollPosition = new Vector2(0, 0);

            labelRect  = new Rect(0, 0, Screen.width, Screen.height / 2);
            labelStyle = new GUIStyle();
            labelStyle.stretchWidth     = true;
            labelStyle.stretchHeight    = true;
            labelStyle.alignment        = TextAnchor.MiddleCenter;
            labelStyle.fontSize         = Screen.height / 20;
            labelStyle.fontStyle        = FontStyle.Bold;
            labelStyle.normal.textColor = Color.red;

//			mapMarker = GameDatabase.Instance.GetTexture("BonVoyage/Textures/map-marker", false);
        }
コード例 #42
0
        public void Can_get_current_on_update()
        {
            var test     = new TestHelper();
            var id       = Guid.NewGuid();
            var dbEntity = new Entity("entity")
            {
                Id = id
            };

            dbEntity.Set("new_money", new Money(1250m));
            dbEntity.Set("new_int", 234);
            test.Service.Retrieve(Arg.Any <string>(), Arg.Any <Guid>(), Arg.Any <ColumnSet>())
            .Returns(dbEntity);

            var entity = new Entity("entity")
            {
                Id          = id,
                ["new_int"] = null
            };

            test.PluginExecutionContext.Stage.Returns((int)SdkMessageProcessingStepStage.Preoperation);
            test.PluginExecutionContext.MessageName.Returns(PluginMessage.Update);
            test.PluginExecutionContext.InputParameters["Target"] = entity;

            var plugin    = Substitute.For <IPluginBase>();
            var container = Substitute.For <IContainer>();
            var config    = new PluginConfiguration <Entity>(plugin, container)
            {
                ColumnSet = new ColumnSet("new_money")
            };
            var context = new TransactionContext <Entity>(test.ServiceProvider, config);

            var reference = context.Current.Entity;

            Assert.Equal(dbEntity.ToEntityReference(), reference.ToEntityReference());
            Assert.Equal(1250m, reference.Get <Money>("new_money").Value);
            Assert.Null(reference.Get <int?>("new_int"));
        }
コード例 #43
0
        //Save persistant data to the config file
        public void SaveMe()
        {
            PluginConfiguration config = PluginConfiguration.CreateForType <SteamGauges>();

            //Save main info
            config.SetValue("WindowPosition", _windowPosition);
            config.SetValue("WindowMinimized", isMinimized);
            config.SetValue("GlobalAlpha", (double)Alpha);
            config.SetValue("AdvancedMinimized", advMinimized);
            config.SetValue("AdvancedPosition", _advwindowPosition);
            config.SetValue("DrawBezels", drawBezels);
            config.SetValue("WindowLock", windowLock);
            config.SetValue("AllToolbar", _allToolbar);
            config.SetValue("EnableAirGauge", enableAirGauge);
            config.SetValue("EnableElecGauge", enableElectricalGauge);
            config.SetValue("EnableFuelGauge", enableFuelGauge);
            config.SetValue("EnableCompass", enableCompass);
            config.SetValue("EnableHUD", enableHUDGauge);
            config.SetValue("EnableNodeGauge", enableNodeGauge);
            config.SetValue("EnableOrbitGauge", enableOrbitGauge);
            config.SetValue("EnableRadarAltimeter", enableRadarAltimeter);
            config.SetValue("EnableRZGauge", enableRZGauge);
            config.SetValue("EnableNavGauge", enableNavGauge);
            config.SetValue("EnableTempGAuge", enableTempGauge);
            //Save individual gauges
            radarAltimeter.save(config);
            compassGauge.save(config);
            electricalGauge.save(config);
            fuelGauge.save(config);
            orbitGauge.save(config);
            rzGauge.save(config);
            nodeGauge.save(config);
            hudGauge.save(config);
            airGauge.save(config);
            navGauge.save(config);
            tempGauge.save(config);
            config.save();
        }
コード例 #44
0
        public void Awake()
        {
            instance = this;
            PluginConfiguration config = PluginConfiguration.CreateForType <PrefLoader>();

            config.load();


            //float.TryParse(config.GetValue("buoyancyMultiplicator", Preferences.buoyancyMultiplicator.ToString()), out Preferences.buoyancyMultiplicator);

            //config.TryGetFloat("buoyancyMultiplicator", ref Preferences.buoyancyMultiplicator);

            config.TryGetBool("showVolumeInfoInEditor", ref Preferences.showVolumeInfoInEditor);
            config.TryGetBool("showVolumeInfoInFlight", ref Preferences.showVolumeInfoInFlight);

            config.TryGetBool("showTemperatureInEditor", ref Preferences.showTemperatureInEditor);
            //config.TryGetBool("showTemperatureInFlight", ref Preferences.showTemperatureInFlight);

            config.TryGetBool("showAbsPressureInEditor", ref Preferences.showAbsPressureInEditor);
            config.TryGetBool("showAbsPressureInFlight", ref Preferences.showAbsPressureInFlight);

            config.TryGetBool("showBuoyancyInEditor", ref Preferences.showBuoyancyInEditor);
            config.TryGetBool("showBuoyancyInFlight", ref Preferences.showBuoyancyInFlight);

            config.TryGetBool("showVesselBuoyancyInEditor", ref Preferences.showVesselBuoyancyInEditor);
            config.TryGetBool("showVesselBuoyancyInFlight", ref Preferences.showVesselBuoyancyInFlight);

            config.TryGetBool("showVesselMassInEditor", ref Preferences.showVesselMassInEditor);
            config.TryGetBool("showVesselMassInFlight", ref Preferences.showVesselMassInFlight);

            config.TryGetBool("showGravPullInEditor", ref Preferences.showGravPullInEditor);
            config.TryGetBool("showGravPullInFlight", ref Preferences.showGravPullInFlight);

            config.TryGetUInt("debugLevel", ref Preferences.debugLevel);

            //config.TryGetBool("pressureDestruction", ref Preferences.pressureDestruction);
            //config.TryGetBool("alwaysControllable", ref Preferences.alwaysControllable);
        }
コード例 #45
0
        public override void Initialize()
        {
            var config = PluginConfiguration.Load <SDWConfig>();

            Terraria.WorldGen.Hooks.OnWorldGenConfigProcess += (ref WorldGenConfiguration _) =>
            {
                TShock.Log.Info("Generating world with seed: {0}", Terraria.WorldGen.currentWorldSeed);
                TShock.Log.Info("Feature configuration: {0}", PluginConfiguration.Stringify(config));

                if (Main.maxTilesY > 1200 && config.DrunkTerrain && config.WorthyTerrain)
                {
                    TShock.Log.Warn("DrunkWorld and ForTheWorthy are very likely to crash worldgen when used together for medium or large maps");
                }

                WorldGen.drunkWorldGen |= config.DrunkTerrain;
                Main.drunkWorld        |= config.DrunkFlag;

                WorldGen.getGoodWorldGen |= config.WorthyTerrain;
                Main.getGoodWorld        |= config.WorthyFlag;

                WorldGen.notTheBees |= config.NotTheBees;
            };
        }
コード例 #46
0
        /// <summary>
        /// Called when destroying this instance.
        /// </summary>
        public void OnDestroy()
        {
            ControlUnlock();
            PluginConfiguration config = PluginConfiguration.CreateForType <KartographSettings> ();

            config.load();
            config.SetValue("AutoHide", _autoHide);
            config.SetValue("KrakenDisable", _disableKraken);
            config.SetValue("UseKspSkin", _useKspSkin);
            config.SetValue("UseToolbar", _useToolbar);
            config.SetValue("SettingsWindowPos", _windowPos);
            config.save();

            GameEvents.onHideUI.Remove(Hide);
            GameEvents.onShowUI.Remove(UnHide);
            GameEvents.onGamePause.Remove(Hide);
            GameEvents.onGameUnpause.Remove(UnHide);

            if (_instance == this)
            {
                _instance = null;
            }
        }
コード例 #47
0
        /// <summary>
        /// Executed once after Awake
        /// </summary>
        public void Start()
        {
            guiVisible   = false;
            globalHidden = false;
            gamePaused   = false;
            refresh      = true;

            guiId  = GUIUtility.GetControlID(FocusType.Passive);
            config = PluginConfiguration.CreateForType <Warpotron9000> ();
            config.load();

            windowRect = config.GetValue <Rect> ("windowRect", new Rect(0, 0, 300, 400));
            useToolbar = config.GetValue <bool> ("useToolbar", false);
            maximized  = config.GetValue <bool> ("maximized", false);

            GameEvents.onGUIApplicationLauncherReady.Add(onGUIApplicationLauncherReady);
            GameEvents.onLevelWasLoaded.Add(onLevelWasLoaded);
            GameEvents.onVesselChange.Add(onVesselChange);
            GameEvents.onHideUI.Add(onHideUI);
            GameEvents.onShowUI.Add(onShowUI);
            GameEvents.onGamePause.Add(onGamePause);
            GameEvents.onGameUnpause.Add(onGameUnpause);
        }
コード例 #48
0
        private string ParseTitle(XmlReader reader, string preferredMetadataLangauge)
        {
            var titles = new List <Title>();

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element && reader.Name == "title")
                {
                    var language = reader.GetAttribute("xml:lang");
                    var type     = reader.GetAttribute("type");
                    var name     = reader.ReadElementContentAsString();

                    titles.Add(new Title
                    {
                        Language = language,
                        Type     = type,
                        Name     = name
                    });
                }
            }

            return(titles.Localize(PluginConfiguration.Instance().TitlePreference, preferredMetadataLangauge).Name);
        }
コード例 #49
0
        /// <summary>
        /// Called when this object is destroyed.
        /// </summary>
        public void OnDestroy()
        {
            ControlUnlock();

            PluginConfiguration config = PluginConfiguration.CreateForType <KartographSettings> ();

            config.load();
            config.SetValue("AppLaunchPos", _windowPos);
            config.save();

            DestroyButtons();

            GameEvents.onGUIApplicationLauncherReady.Remove(OnAppLaunchReady);
            GameEvents.onHideUI.Remove(Hide);
            GameEvents.onShowUI.Remove(UnHide);
            GameEvents.onGamePause.Remove(Hide);
            GameEvents.onGameUnpause.Remove(UnHide);

            if (_instance == this)
            {
                _instance = null;
            }
        }
コード例 #50
0
    public void Start()
    {
        PluginConfiguration cfg = KSP.IO.PluginConfiguration.CreateForType <NavBallDockingAlignmentIndicator>();

        cfg.load();
        Vector3 tmp = cfg.GetValue <Vector3>("alignmentmarkercolor", new Vector3(1f, 0f, 0f));                  //default: red
        Color   alignmentmarkercolor   = new Color(tmp.x, tmp.y, tmp.z);
        Vector2 alignmentmarkertexture = cfg.GetValue <Vector2>("alignmentmarkertexture", new Vector2(0f, 2f)); //default: prograde marker

        cfg.save();
        float texturescalefactor = 1f / 3f;

        //get navball object
        GameObject navBall = GameObject.Find("NavBall");
        Transform  navBallVectorsPivotTransform = navBall.transform.FindChild("vectorsPivot");

        navBallBehaviour = navBall.GetComponent <NavBall>();

        //get indicator texture (use the prograde marker, since it has a clear 'upwards' direction)
        ManeuverGizmo       maneuverGizmo       = MapView.ManeuverNodePrefab.GetComponent <ManeuverGizmo>();
        ManeuverGizmoHandle maneuverGizmoHandle = maneuverGizmo.handleNormal;
        Transform           transform           = maneuverGizmoHandle.flag;
        Renderer            renderer            = transform.renderer;
        Material            maneuverTexture     = renderer.sharedMaterial;

        //create alignment indicator game object
        indicator = Create2DObject(
            name: "navballalignmentindicator",
            size: 0.025f,             //the same size as all other markers
            col: alignmentmarkercolor,
            texture: maneuverTexture,
            textureScale: Vector2.one * texturescalefactor,
            textureOffset: alignmentmarkertexture * texturescalefactor,
            parentTransform: navBallVectorsPivotTransform,
            layer: 12             //the navball layer
            );
    }
コード例 #51
0
    private void OnServerInitialized()
    {
        _config      = Config.ReadObject <PluginConfiguration>();
        PathToResult = Path.Combine(_config.ResultPath.FullPath,
                                    $"Map-{ConVar.Server.seed}-{ConVar.Server.worldsize}.png");

        var commands = GetLibrary <Command>();

        commands.AddConsoleCommand(COMMAND_DRAW, this, DrawMapConsoleCommand);

        if (File.Exists(PathToResult))
        {
            Interface.CallHook("OnGeneratorMapCreate");
            return;
        }

        var timer = new PluginTimers(this);

        timer.Once(_config.DrawDelay, () =>
        {
            DrawMap();
            Interface.CallHook("OnGeneratorMapCreate");
        });
    }
コード例 #52
0
 protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector)
 {
     var storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
     _blobClient = storageAccount.CreateCloudBlobClient();
 }
コード例 #53
0
ファイル: Values.cs プロジェクト: RealGrep/NavHud
 private void SetColor(PluginConfiguration config, string text, Color color)
 {
     config.SetValue(text + "R", (double)color.r);
     config.SetValue(text + "G", (double)color.g);
     config.SetValue(text + "B", (double)color.b);
     config.SetValue(text + "A", (double)color.a);
 }
コード例 #54
0
ファイル: Values.cs プロジェクト: RealGrep/NavHud
 private Color GetColor(PluginConfiguration config, string text)
 {
     float r = (float)config.GetValue<double>(text + "R");
     float g = (float)config.GetValue<double>(text + "G");
     float b = (float)config.GetValue<double>(text + "B");
     float a = (float)config.GetValue<double>(text + "A", 1.0d);
     return new Color(r, g, b, a);
 }
コード例 #55
0
ファイル: Values.cs プロジェクト: RealGrep/NavHud
 public void Save(PluginConfiguration config)
 {
     SetColor(config, "hudTextColor", _hudTextColor);
     SetColor(config, "upperHalfColor", _upperHalfColor);
     SetColor(config, "lowerHalfColor", _lowerHalfColor);
     SetColor(config, "horizonColor", _horizonColor);
     SetColor(config, "azimuthColor", _azimuthColor);
     SetColor(config, "northColor", _northColor);
     SetColor(config, "eastColor", _eastColor);
     SetColor(config, "southColor", _southColor);
     SetColor(config, "westColor", _westColor);
     SetColor(config, "headingColor", _headingColor);
     SetColor(config, "alignmentColor", _alignmentColor);
     SetColor(config, "progradeColor", _progradeColor);
     SetColor(config, "normalColor", _normalColor);
     SetColor(config, "radialColor", _radialColor);
     SetColor(config, "targetColor", _targetColor);
     SetColor(config, "maneuverColor", _maneuverColor);
     config.SetValue("numberZenithLinesHalf", _numberZenithLinesHalf);
     config.SetValue("numberAzimuthLinesQuarter", _numberAzimuthLinesQuarter);
     config.SetValue("numberZenithVerts", _numberZenithVerts);
     config.SetValue("numberAzimuthVerts", _numberAzimuthVerts);
     config.SetValue("vectorSize", (double)_vectorSize);
     config.SetValue("lineWidth", (double)_lineWidth);
     config.SetValue("distance", (double)_distance);
 }
コード例 #56
0
ファイル: Values.cs プロジェクト: RealGrep/NavHud
 public void Load(PluginConfiguration config)
 {
     _hudTextColor = GetColor(config, "hudTextColor");
     _upperHalfColor = GetColor(config, "upperHalfColor");
     _lowerHalfColor = GetColor(config, "lowerHalfColor");
     _horizonColor = GetColor(config, "horizonColor");
     _azimuthColor = GetColor(config, "azimuthColor");
     _northColor = GetColor(config, "northColor");
     _eastColor = GetColor(config, "eastColor");
     _southColor = GetColor(config, "southColor");
     _westColor = GetColor(config, "westColor");
     _headingColor = GetColor(config, "headingColor");
     _alignmentColor = GetColor(config, "alignmentColor");
     _progradeColor = GetColor(config, "progradeColor");
     _normalColor = GetColor(config, "normalColor");
     _radialColor = GetColor(config, "radialColor");
     _targetColor = GetColor(config, "targetColor");
     _maneuverColor = GetColor(config, "maneuverColor");
     _numberZenithLinesHalf = config.GetValue<int>("numberZenithLinesHalf");
     _numberAzimuthLinesQuarter = config.GetValue<int>("numberAzimuthLinesQuarter");
     _numberZenithVerts = config.GetValue<int>("numberZenithVerts");
     _numberAzimuthVerts = config.GetValue<int>("numberAzimuthVerts");
     _vectorSize = (float)config.GetValue<double>("vectorSize");
     _lineWidth = (float)config.GetValue<double>("lineWidth");
     _distance = config.GetValue<double>("distance");
     _iChanged = true;
 }
コード例 #57
0
 protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector)
 {
 }
コード例 #58
0
        /// <summary>
        /// Load any saved configuration from file.
        /// </summary>
        private void loadConfig()
        {
            Debug.Log("Loading PreciseNode settings.");
            if(!configLoaded) {
                config = KSP.IO.PluginConfiguration.CreateForType<PreciseNode>(null);
                config.load();
                configLoaded = true;

                try {
                    options.conicsMode = config.GetValue<int>("conicsMode", 3);
                    options.mainWindowPos.x = config.GetValue<int>("mainWindowX", Screen.width / 10);
                    options.mainWindowPos.y = config.GetValue<int>("mainWindowY", 20);
                    options.optionsWindowPos.x = config.GetValue<int>("optWindowX", Screen.width / 3);
                    options.optionsWindowPos.y = config.GetValue<int>("optWindowY", 20);
                    options.keymapperWindowPos.x = config.GetValue<int>("keyWindowX", Screen.width / 5);
                    options.keymapperWindowPos.y = config.GetValue<int>("keyWindowY", 20);
                    options.clockWindowPos.x = config.GetValue<int>("clockWindowX", Screen.width / 3);
                    options.clockWindowPos.y = config.GetValue<int>("clockWindowY", Screen.height / 2);
                    options.conicsWindowPos.x = config.GetValue<int>("conicsWindowX", Screen.width / 5);
                    options.conicsWindowPos.y = config.GetValue<int>("conicsWindowY", Screen.height / 2);
                    options.tripWindowPos.x = config.GetValue<int>("tripWindowX", Screen.width / 5);
                    options.tripWindowPos.y = config.GetValue<int>("tripWindowY", Screen.height / 5);
                    options.showClock = config.GetValue<bool>("showClock", false);
                    options.showEAngle = config.GetValue<bool>("showEAngle", true);
                    options.showConicsAlways = config.GetValue<bool>("showConicsAlways", false);
                    options.showOrbitInfo = config.GetValue<bool>("showOrbitInfo", false);
                    options.showUTControls = config.GetValue<bool>("showUTControls", false);
                    options.showManeuverPager = config.GetValue<bool>("showManeuverPager", true);
                    options.removeUsedNodes = config.GetValue<bool>("removeUsedNodes", false);
                    options.usedNodeThreshold = config.GetValue<double>("usedNodeThreshold", 0.5);
                    options.largeUTIncrement = config.GetValue<bool>("largeUTIncrement", false);

                    string temp = config.GetValue<String>("progInc", "Keypad8");
                    options.progInc = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("progDec", "Keypad5");
                    options.progDec = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("normInc", "Keypad9");
                    options.normInc = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("normDec", "Keypad7");
                    options.normDec = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("radiInc", "Keypad6");
                    options.radiInc = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("radiDec", "Keypad4");
                    options.radiDec = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("timeInc", "Keypad3");
                    options.timeInc = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("timeDec", "Keypad1");
                    options.timeDec = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("pageIncrement", "Keypad0");
                    options.pageIncrement = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("pageConics", "KeypadEnter");
                    options.pageConics = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("hideWindow", "P");
                    options.hideWindow = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                    temp = config.GetValue<String>("addWidget", "O");
                    options.addWidget = (KeyCode)Enum.Parse(typeof(KeyCode), temp);
                } catch(ArgumentException) {
                    // do nothing here, the defaults are already set
                }
            }
        }
コード例 #59
0
        /// <summary>
        /// Save our configuration to file.
        /// </summary>
        private void saveConfig()
        {
            Debug.Log("Saving PreciseNode settings.");
            if(!configLoaded) {
                config = KSP.IO.PluginConfiguration.CreateForType<PreciseNode>(null);
            }

            config["conicsMode"] = options.conicsMode;
            config["progInc"] = options.progInc.ToString();
            config["progDec"] = options.progDec.ToString();
            config["normInc"] = options.normInc.ToString();
            config["normDec"] = options.normDec.ToString();
            config["radiInc"] = options.radiInc.ToString();
            config["radiDec"] = options.radiDec.ToString();
            config["timeInc"] = options.timeInc.ToString();
            config["timeDec"] = options.timeDec.ToString();
            config["pageIncrement"] = options.pageIncrement.ToString();
            config["pageConics"] = options.pageConics.ToString();
            config["hideWindow"] = options.hideWindow.ToString();
            config["addWidget"] = options.addWidget.ToString();
            config["mainWindowX"] = (int)options.mainWindowPos.x;
            config["mainWindowY"] = (int)options.mainWindowPos.y;
            config["optWindowX"] = (int)options.optionsWindowPos.x;
            config["optWindowY"] = (int)options.optionsWindowPos.y;
            config["keyWindowX"] = (int)options.keymapperWindowPos.x;
            config["keyWindowY"] = (int)options.keymapperWindowPos.y;
            config["clockWindowX"] = (int)options.clockWindowPos.x;
            config["clockWindowY"] = (int)options.clockWindowPos.y;
            config["conicsWindowX"] = (int)options.conicsWindowPos.x;
            config["conicsWindowY"] = (int)options.conicsWindowPos.y;
            config["tripWindowX"] = (int)options.tripWindowPos.x;
            config["tripWindowY"] = (int)options.tripWindowPos.y;
            config["showClock"] = options.showClock;
            config["showEAngle"] = options.showEAngle;
            config["showConicsAlways"] = options.showConicsAlways;
            config["showOrbitInfo"] = options.showOrbitInfo;
            config["showUTControls"] = options.showUTControls;
            config["showManeuverPager"] = options.showManeuverPager;
            config["removeUsedNodes"] = options.removeUsedNodes;
            config["usedNodeThreshold"] = options.usedNodeThreshold;
            config["largeUTIncrement"] = options.largeUTIncrement;

            config.save();
        }
コード例 #60
0
ファイル: Plugin.cs プロジェクト: arthurwayne/metavideoeditor
 public override void Init(Kernel kernel)
 {
     PluginOptions = new PluginConfiguration<PluginOptions>(kernel, this.GetType().Assembly);
     PluginOptions.Load();
 }