public void ReadFromConfig(ConfigFile config) { this.name = config.Get("Emulation.DeviceName", this.name.ToString()); string str1 = config.Get("Emulation.OSCategory", this.os.ToString()); string str2 = config.Get("Emulation.InputCategory", this.input.ToString()); string str3 = config.Get("Emulation.ScreenCategory", this.screen.ToString()); string str4 = config.Get("Emulation.ScreenDensityCategory", this.screenDensity.ToString()); Log.ConfigFile.Print("Reading Emulated Device: " + this.name + " from " + config.GetPath()); try { this.os = (OSCategory) Enum.Parse(typeof (OSCategory), str1); this.input = (InputCategory) Enum.Parse(typeof (InputCategory), str2); this.screen = (ScreenCategory) Enum.Parse(typeof (ScreenCategory), str3); this.screenDensity = (ScreenDensityCategory) Enum.Parse(typeof (ScreenDensityCategory), str4); } catch (ArgumentException ex) { string format = "Could not parse {0} in {1} as a valid device!"; object[] objArray = new object[2]; int index1 = 0; string str5 = this.name; objArray[index1] = (object) str5; int index2 = 1; string path = config.GetPath(); objArray[index2] = (object) path; // Blizzard.Log.Warning(format, objArray); } }
public SqliteDbProvider(ConfigFile configFile) { _connectionString = string.Format("Data Source={0};Version=3", configFile.Get(DbConstants.KEY_FILE_NAME)); _clientExec = configFile.Get(DbConstants.KEY_CLIENT_EXEC); _dbFileName = configFile.Get(DbConstants.KEY_FILE_NAME); }
public static ConfigFile Read(string path) { if (String.IsNullOrWhiteSpace(path)) { TShock.Log.ConsoleError("CTRS-Config: Invalid filepath given. Starting default configuration..."); return new ConfigFile(); } Directory.CreateDirectory(Path.GetDirectoryName(path)); try { ConfigFile file = new ConfigFile(); if (File.Exists(path)) { file = JsonConvert.DeserializeObject<ConfigFile>(File.ReadAllText(path)); } File.WriteAllText(path, JsonConvert.SerializeObject(file, Formatting.Indented)); return file; } catch (Exception e) { TShock.Log.ConsoleError("CTRS-Config: " + e.Message); TShock.Log.Error(e.ToString()); return new ConfigFile(); } }
public MySqlDbProvider(ConfigFile configFile) { if (configFile == null) { _connectionString = string.Empty; return; } if (!string.IsNullOrEmpty(configFile.Get(DbConstants.KEY_PWD))) { _connectionString = string.Format("SERVER={0};PORT={1};DATABASE={2};UID={3};PWD={4}", configFile.Get(DbConstants.KEY_HOST), configFile.Get(DbConstants.KEY_PORT), configFile.Get(DbConstants.KEY_DATABASE), configFile.Get(DbConstants.KEY_UID), configFile.Get(DbConstants.KEY_PWD)); } else { _connectionString = string.Format("SERVER={0};PORT={1};DATABASE={2};UID={3}", configFile.Get(DbConstants.KEY_HOST), configFile.Get(DbConstants.KEY_PORT), configFile.Get(DbConstants.KEY_DATABASE), configFile.Get(DbConstants.KEY_UID)); } _uid = configFile.Get(DbConstants.KEY_UID); _pwd = configFile.Get(DbConstants.KEY_PWD); _database = configFile.Get(DbConstants.KEY_DATABASE); _host = configFile.Get(DbConstants.KEY_HOST); _clientExec = configFile.Get(DbConstants.KEY_CLIENT_EXEC); _port = configFile.Get(DbConstants.KEY_PORT); }
public PowerNodeBuilding(string configName) : base(configName) { ConfigFile config = new ConfigFile(configName); m_MaxConnections = config.GetKey_Int("Power", "MaxConnections"); }
/// <summary> /// Go through our media/wheels/ directory and find all of the wheel definitions we have, then make dictionaries out of them /// and add them to our one big dictionary. /// </summary> public void ReadWheelsFromFiles() { // since we can run this whenever (like when we're tweaking files), we want to clear our dictionary first wheels.Clear(); // get all of the filenames of the files in media/wheels/ IEnumerable<string> files = Directory.EnumerateFiles("media/vehicles/", "*.wheel", SearchOption.AllDirectories); foreach (string filename in files) { // I forgot ogre had this functionality already built in ConfigFile cfile = new ConfigFile(); cfile.Load(filename, "=", true); // each .wheel file can have multiple [sections]. We'll use each section name as the wheel name ConfigFile.SectionIterator sectionIterator = cfile.GetSectionIterator(); while (sectionIterator.MoveNext()) { string wheelname = sectionIterator.CurrentKey; // make a dictionary var wheeldict = new Dictionary<string, float>(); // go over every property in the file and add it to the dictionary, parsing it as a float foreach (KeyValuePair<string, string> pair in sectionIterator.Current) { wheeldict.Add(pair.Key, float.Parse(pair.Value, culture)); } wheels[wheelname] = wheeldict; } cfile.Dispose(); sectionIterator.Dispose(); } }
/// <summary>Create <see cref="AddParameterDialog"/>.</summary> /// <param name="environment">Application environment.</param> /// <param name="configFile">Config file to use.</param> public AddParameterDialog(IWorkingEnvironment environment, ConfigFile configFile) : this(environment) { Verify.Argument.IsFalse(configFile != ConfigFile.System && configFile != ConfigFile.User, "configFile"); _configFile = configFile; }
public static ConfigFile ReadConfigFile(string path) { ConfigFile file = new ConfigFile(); XmlDocument doc = new XmlDocument(); doc.Load(path); if (doc.DocumentElement != null) { try { XmlNode node = doc.DocumentElement.SelectSingleNode("appSettings"); file.Email = node.ChildNodes[0].Attributes[VALUE].Value; file.User = node.ChildNodes[1].Attributes[VALUE].Value; file.Password = node.ChildNodes[2].Attributes[VALUE].Value; file.Sender = node.ChildNodes[3].Attributes[VALUE].Value; file.SmtpServer = node.ChildNodes[4].Attributes[VALUE].Value; file.SmtpPort = node.ChildNodes[5].Attributes[VALUE].Value; file.Delay = node.ChildNodes[6].Attributes[VALUE].Value; file.ConnString = node.ChildNodes[7].Attributes[VALUE].Value; } catch (Exception) { } } return file; }
/// <summary> /// Specify an XML file in S3 to merge with Hadoop's default configuration. /// </summary> /// <param name="file">The config file to merge with.</param> /// <param name="xmlPath">The path in S3 of the XML file.</param> public void AddXml(ConfigFile file, string xmlPath) { string arg = ""; switch (file) { case ConfigFile.Site: arg = "-S"; break; case ConfigFile.Default: arg = "-D"; break; case ConfigFile.Core: arg = "-C"; break; case ConfigFile.Hdfs: arg = "-H"; break; case ConfigFile.Mapred: arg = "-M"; break; } args.Add(arg); args.Add(xmlPath); }
/// <summary> /// Specify a key-value pair to merge with Hadoop's default configuration. /// </summary> /// <param name="file">The config file to merge with.</param> /// <param name="key">The config key.</param> /// <param name="value">The config value.</param> public void AddKeyValue(ConfigFile file, String key, String value) { String arg = ""; switch (file) { case ConfigFile.Site: arg = "-s"; break; case ConfigFile.Default: arg = "-d"; break; case ConfigFile.Core: arg = "-c"; break; case ConfigFile.Hdfs: arg = "-h"; break; case ConfigFile.Mapred: arg = "-m"; break; } args.Add(arg); args.Add(key + "=" + value); }
/// <summary> /// Specify a key-value pair to merge with Hadoop's default configuration. /// </summary> /// <param name="file">The config file to merge with.</param> /// <param name="key">The config key.</param> /// <param name="value">The config value.</param> /// <returns>A reference to this updated object so that method calls can be chained together.</returns> public ConfigureHadoop WithKeyValue(ConfigFile file, String key, String value) { String arg = ""; switch (file) { case ConfigFile.Site: arg = "-s"; break; case ConfigFile.Default: arg = "-d"; break; case ConfigFile.Core: arg = "-c"; break; case ConfigFile.Hdfs: arg = "-h"; break; case ConfigFile.Mapred: arg = "-m"; break; } args.Add(arg); args.Add(key + "=" + value); return this; }
/// <summary>Create <see cref="AddParameterDialog"/>.</summary> /// <param name="environment">Application environment.</param> /// <param name="repository">Related <see cref="Repository"/>.</param> public AddParameterDialog(IWorkingEnvironment environment, Repository repository) : this(environment) { Verify.Argument.IsNotNull(repository, "repository"); _repository = repository; _configFile = ConfigFile.Repository; }
/// <summary>Create <see cref="ConfigParameter"/>.</summary> /// <param name="repository">Related <see cref="Repository"/>.</param> /// <param name="name">Paramater name.</param> /// <param name="value">Parameter value.</param> internal ConfigParameter(IConfigAccessor configAccessor, ConfigFile configFile, string name, string value) : base(name) { Verify.Argument.IsNotNull(configAccessor, "configAccessor"); _configAccessor = configAccessor; _configFile = configFile; _value = value; }
public ShipyardBuilding(string configName) : base(configName) { ConfigFile configFile = new ConfigFile(configName); m_ShipCapacity = configFile.GetKey_Int("Shipyard", "ShipCapacity"); m_BuildCoolDown = configFile.GetKey_Float("Shipyard", "BuildCoolDown"); m_ShipConfig = configFile.GetKey_String("Shipyard", "ShipConfig"); }
public static void SetGlobalDiffToolToConfig(ConfigFile configFile, string diffTool) { if (GitCommandHelpers.VersionInUse.GuiDiffToolExist) { configFile.SetValue("diff.guitool", diffTool); return; } configFile.SetValue("diff.tool", diffTool); }
public CommandCenterBuilding(string configName) : base(configName) { ConfigFile config = new ConfigFile(configName); m_MaxPower = config.GetKey_Float("Power", "MaxEnergy"); m_IsPowered = true; }
public ConfigParameterData(string name, string value, ConfigFile configFile) { Verify.Argument.IsNeitherNullNorWhitespace(name, "name"); Verify.Argument.IsNotNull(value, "value"); Verify.Argument.AreNotEqual(ConfigFile.Other, configFile, "configFile", string.Empty); _name = name; _value = value; _configFile = configFile; }
public ConfigParameterData(string name, string value, ConfigFile configFile, string fileName) { Verify.Argument.IsNeitherNullNorWhitespace(name, "name"); Verify.Argument.IsNotNull(value, "value"); _name = name; _value = value; _configFile = configFile; _fileName = fileName; }
// Override resource sources (include Quake3 archives) public override void SetupResources() { ConfigFile cf = new ConfigFile(); cf.Load("quake3settings.cfg", "\t:=", true); quakePk3 = cf.GetSetting("Pak0Location"); quakeLevel = cf.GetSetting("Map"); base.SetupResources(); ResourceGroupManager.Singleton.AddResourceLocation(quakePk3, "Zip", ResourceGroupManager.Singleton.WorldResourceGroupName, true); }
public void WriteToConfig(ConfigFile config) { Log.ConfigFile.Print("Writing Emulated Device: " + this.name + " to " + config.GetPath()); config.Set("Emulation.DeviceName", this.name.ToString()); config.Set("Emulation.OSCategory", this.os.ToString()); config.Set("Emulation.InputCategory", this.input.ToString()); config.Set("Emulation.ScreenCategory", this.screen.ToString()); config.Set("Emulation.ScreenDensityCategory", this.screenDensity.ToString()); config.Save((string) null); }
/// <summary>Create <see cref="ConfigParameter"/>.</summary> /// <param name="repository">Related <see cref="Repository"/>.</param> /// <param name="name">Paramater name.</param> /// <param name="value">Parameter value.</param> internal ConfigParameter(IConfigAccessor configAccessor, string fileName, string name, string value) : base(name) { Verify.Argument.IsNotNull(configAccessor, "configAccessor"); _configAccessor = configAccessor; _configFile = Git.ConfigFile.Other; _fileName = fileName; _value = value; }
public void TestWithInvalidFileName() { { //TESTDATA //Write test config File.WriteAllText(GetConfigFileName(), GetDefaultConfigFileContent(), GitModule.SystemEncoding); } ConfigFile configFile = new ConfigFile(GetConfigFileName() + "\\", false); Assert.IsNotNull(configFile); }
private AutoFoto0(string configFilePath) { // open config file _configFile = new ConfigFile(configFilePath); // read parametrs ReadParametrs(); // initialize image window _imageWindow = new ImageWindow(); }
public void Init() { // Create root object mRoot = new Root(); // Define Resources ConfigFile cf = new ConfigFile(); cf.Load("resources.cfg", "\t:=", true); ConfigFile.SectionIterator seci = cf.GetSectionIterator(); String secName, typeName, archName; while (seci.MoveNext()) { secName = seci.CurrentKey; ConfigFile.SettingsMultiMap settings = seci.Current; foreach (KeyValuePair<string, string> pair in settings) { typeName = pair.Key; archName = pair.Value; ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName); } } // Setup RenderSystem RenderSystem rs = mRoot.GetRenderSystemByName("Direct3D9 Rendering Subsystem"); // or use "OpenGL Rendering Subsystem" mRoot.RenderSystem = rs; rs.SetConfigOption("Full Screen", "No"); rs.SetConfigOption("Video Mode", "800 x 600 @ 32-bit colour"); // Create Render Window mRoot.Initialise(false, "Main Ogre Window"); NameValuePairList misc = new NameValuePairList(); misc["externalWindowHandle"] = Handle.ToString(); mWindow = mRoot.CreateRenderWindow("Main RenderWindow", 800, 600, false, misc); // Init resources TextureManager.Singleton.DefaultNumMipmaps = 5; ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); // Create a Simple Scene SceneManager mgr = mRoot.CreateSceneManager(SceneType.ST_GENERIC); Camera cam = mgr.CreateCamera("Camera"); cam.AutoAspectRatio = true; mWindow.AddViewport(cam); Entity ent = mgr.CreateEntity("ninja", "ninja.mesh"); mgr.RootSceneNode.CreateChildSceneNode().AttachObject(ent); cam.Position = new Vector3(0, 200, -400); cam.LookAt(ent.BoundingBox.Center); }
public Kits(Main game) : base(game) { Order = 4; config = ConfigFile.Read(savepath); config.Write(savepath); Console.WriteLine( "End of pre initialize"); if (Initialized != null) Initialized(); }
public TurretBuilding(string configName) : base(configName) { ConfigFile config = new ConfigFile(configName); m_AlertRadius = config.GetKey_Float("Turret", "AlertRadius"); m_FireRadius = config.GetKey_Float("Turret", "FireRadius"); int numGuns = config.GetKey_Int("Turret", "NumGuns"); BaseShip_Weapon currWeapon = null; string gunGroup = "Gun"; string gunType = ""; for(int i = 0; i < numGuns; ++i) { gunGroup += (i+1).ToString(); gunType = config.GetKey_String(gunGroup, "Type"); currWeapon = new BaseShip_Weapon(); //currWeapon.CanRotate = ((config.GetKey_Int(gunGroup, "CanRotate") == 1) ? true : false); currWeapon.CoolDownRate = config.GetKey_Float(gunType , "CoolDown");; currWeapon.Position = config.GetKey_Vector2(gunGroup, "Pos"); currWeapon.WeaponSprite = new Sprite("Textures/" + config.GetKey_String(gunType, "Texture")); currWeapon.WeaponSprite.SetSpriteSize(currWeapon.WeaponSprite.GetTextureSize());//config.GetKey_Vector2(gunGroup, "Size")); currWeapon.WeaponSprite.SetSpritePos(Position); currWeapon.WeaponSprite.SetGeometrySize(currWeapon.WeaponSprite.GetSpriteSize() / 2); currWeapon.WeaponSprite.SetRotationCenter(currWeapon.WeaponSprite.GetGeometrySize() / 2.0f); currWeapon.WeaponSprite.SetDepth(Globals.WeaponsDepth); Globals.WorldView.SManager.AddSprite(currWeapon.WeaponSprite); gunType.ToLower(); if(gunType == "gatling") currWeapon.WeaponType = BaseShip_WeaponTypes.Gatling; else if(gunType == "rail") currWeapon.WeaponType = BaseShip_WeaponTypes.RailGun; else if(gunType == "missile") currWeapon.WeaponType = BaseShip_WeaponTypes.Missile; else currWeapon.WeaponType = BaseShip_WeaponTypes.Laser; m_Guns.Add(currWeapon); } Sprite.SetDepth(Globals.BuildingDepth); }
private bool LoadConfig(string path) { ConfigFile configFile = new ConfigFile(); if (!configFile.LightLoad(path)) return false; using (List<ConfigFile.Line>.Enumerator enumerator = configFile.GetLines().GetEnumerator()) { while (enumerator.MoveNext()) { ConfigFile.Line current = enumerator.Current; this.m_vars[current.m_fullKey] = current.m_value; } } return true; }
/*** Public Members ***/ // Generate a given level index public LevelManager(int LevelIndex) { // Construct the level based on the seed ConfigFile Info = new ConfigFile("Config/World/LevelsConfig"); // Get the level name String LevelName = Info.GetKey_String("Level" + LevelIndex, "Scene"); Application.LoadLevelAdditive(LevelName); // Level world size int LevelSize = Info.GetKey_Int("Level" + LevelIndex, "Size"); // Get full long-text level description Description = Info.GetKey_String("Level" + LevelIndex, "description"); WinText = Info.GetKey_String("Level" + LevelIndex, "win"); LoseText = Info.GetKey_String("Level" + LevelIndex, "lose"); }
public ConfigFile GetConf(string name, bool create) { Log.Info("FileClient", "GetConf: " + name); if (_Files.ContainsKey(name)) return _Files[name]; else { Log.Debug("FileClient", "The file does not exist!"); if (!create || name.Length <= 0) return null; else { string dir = GetClientDir(); ConfigFile F = new ConfigFile(name, dir, true); _Files.Add(name, F); return F; } } }
void LoadSettingsFromClass(ConfigFile configFile, Type settingsClass, string sectionName) { foreach (FieldInfo fieldInfo in settingsClass.GetFields()) { if (fieldInfo.FieldType == typeof(Dictionary<string, string>)) { Dictionary<string, string> dict = new Dictionary<string, string>(); var section = configFile.GetSection(sectionName); foreach (var property in section.GetProperties()) { var value = section.GetValue(property, ""); if (dict.ContainsKey(property)) { dict.Add(property, value); } else { dict[property] = value; } } fieldInfo.SetValue(null, dict); } else if (configFile.HasProperty(sectionName, fieldInfo.Name)) { string stringValue = configFile.GetValue(sectionName, fieldInfo.Name, ""); object value = StringConverter.Parse(stringValue, fieldInfo.FieldType); fieldInfo.SetValue(null, value); } } foreach (Type nestedType in settingsClass.GetNestedTypes()) { string newSectionName = sectionName; if (newSectionName.Length > 0) { newSectionName += "."; } newSectionName += nestedType.Name; LoadSettingsFromClass(configFile, nestedType, newSectionName); } }
public void TestWithNullSettings() { var file = new ConfigFile(GetConfigFileName(), true); Assert.Throws <ArgumentNullException>(() => file.GetValue(null, null)); }
private static void ConfigureKubernetesCluster(AzureResourceBag azureResources, ClusterOptions clusterOptions) { var componentOpts = new ComponentResourceOptions { DependsOn = azureResources.Cluster, Provider = azureResources.ClusterProvider }; var customOpts = new CustomResourceOptions { DependsOn = azureResources.Cluster, Provider = azureResources.ClusterProvider }; var aadPodIdentityDeployment = new ConfigFile("k8s-aad-pod-identity", new ConfigFileArgs { File = "https://raw.githubusercontent.com/Azure/aad-pod-identity/master/deploy/infra/deployment-rbac.yaml" }, componentOpts); var certManagerDeployment = new ConfigFile("k8s-cert-manager", new ConfigFileArgs { File = "https://raw.githubusercontent.com/jetstack/cert-manager/release-0.8/deploy/manifests/00-crds.yaml" }, componentOpts); var nginxDeployment = new ConfigFile("k8s-nginx-ingress", new ConfigFileArgs { File = "https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.34.1/deploy/static/provider/cloud/deploy.yaml" }, componentOpts); var clusterNamespace = new Namespace("k8s-namespace", new NamespaceArgs { Metadata = new ObjectMetaArgs { Name = clusterOptions.Namespace } }, customOpts); var clusterIssuer = new CustomResource("k8s-cert-manager-cluster-issuer", new CertManagerClusterIssuerResourceArgs { Metadata = new ObjectMetaArgs { Name = "letsencrypt-prod" }, Spec = new CertManagerClusterIssuerSpecArgs { Acme = new CertManagerClusterIssuerAcmeArgs { Email = clusterOptions.CertificateIssuerAcmeEmail, Server = "https://acme-v02.api.letsencrypt.org/directory", PrivateKeySecretRef = new CertManagerClusterIssuerAcmeSecretArgs { Name = "letsencrypt-prod" } } } }, customOpts); var certs = new CustomResource("k8s-cert-manager-domain-cert", new CertManagerCertificateResourceArgs { Metadata = new ObjectMetaArgs { Name = "tls-secret" }, Spec = new CertManagerCertificateSpecArgs { SecretName = "tls-secret", DnsNames = clusterOptions.Domain, Acme = new CertManagerCertificateAcmeArgs { Config = new CertManagerCertificateAcmeConfigArgs { Http = new CertManagerCertificateAcmeConfigHttpArgs { IngressClass = "nginx" }, Domains = clusterOptions.Domain } }, IssuerRef = new CertManagerCertificateIssuerRefArgs { Name = "letsencrypt-prod", Kind = "ClusterIssuer" } } }, customOpts); }
/// <summary> /// Initializes a new instance of the OxideMod class /// </summary> public void Load() { RootDirectory = Environment.CurrentDirectory; if (RootDirectory.StartsWith(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData))) { RootDirectory = AppDomain.CurrentDomain.BaseDirectory; } Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; JsonConvert.DefaultSettings = () => new JsonSerializerSettings { Culture = CultureInfo.InvariantCulture }; // Create the commandline CommandLine = new CommandLine(Environment.GetCommandLineArgs()); // Load the config var oxideConfig = Path.Combine(RootDirectory, "oxide.config.json"); if (!File.Exists(oxideConfig)) { throw new FileNotFoundException("Could not load the Oxide configuration file", oxideConfig); } config = ConfigFile.Load <OxideConfig>(oxideConfig); // Work out the instance directory for (var i = 0; i < config.InstanceCommandLines.Length; i++) { string varname, format; config.GetInstanceCommandLineArg(i, out varname, out format); if (string.IsNullOrEmpty(varname) || CommandLine.HasVariable(varname)) { InstanceDirectory = Path.Combine(RootDirectory, Utility.CleanPath(string.Format(format, CommandLine.GetVariable(varname)))); break; } } if (InstanceDirectory == null) { throw new Exception("Could not identify instance directory"); } // Clean and set directory paths ExtensionDirectory = Path.Combine(RootDirectory, Utility.CleanPath(config.ExtensionDirectory)); PluginDirectory = Path.Combine(InstanceDirectory, Utility.CleanPath("plugins")); DataDirectory = Path.Combine(InstanceDirectory, Utility.CleanPath("data")); LangDirectory = Path.Combine(InstanceDirectory, Utility.CleanPath("lang")); LogDirectory = Path.Combine(InstanceDirectory, Utility.CleanPath("logs")); ConfigDirectory = Path.Combine(InstanceDirectory, Utility.CleanPath(config.ConfigDirectory)); // Create directories if needed if (!Directory.Exists(ExtensionDirectory)) { throw new Exception("Could not identify extension directory"); } if (!Directory.Exists(InstanceDirectory)) { Directory.CreateDirectory(InstanceDirectory); } if (!Directory.Exists(PluginDirectory)) { Directory.CreateDirectory(PluginDirectory); } if (!Directory.Exists(DataDirectory)) { Directory.CreateDirectory(DataDirectory); } if (!Directory.Exists(LangDirectory)) { Directory.CreateDirectory(LangDirectory); } if (!Directory.Exists(LogDirectory)) { Directory.CreateDirectory(LogDirectory); } if (!Directory.Exists(ConfigDirectory)) { Directory.CreateDirectory(ConfigDirectory); } // Register the library path RegisterLibrarySearchPath(Path.Combine(ExtensionDirectory, IntPtr.Size == 8 ? "x64" : "x86")); // Set the default group DefaultGroup = config.DefaultGroup; // Create the loggers RootLogger = new CompoundLogger(); RootLogger.AddLogger(new RotatingFileLogger { Directory = LogDirectory }); if (debugCallback != null) { RootLogger.AddLogger(new CallbackLogger(debugCallback)); } // Log Oxide core loading LogInfo("Loading Oxide Core v{0}...", Version); // Create the managers RootPluginManager = new PluginManager(RootLogger) { ConfigPath = ConfigDirectory }; extensionManager = new ExtensionManager(RootLogger); // Initialize other things DataFileSystem = new DataFileSystem(DataDirectory); // Register core libraries extensionManager.RegisterLibrary("Covalence", covalence = new Covalence()); extensionManager.RegisterLibrary("Global", new Global()); extensionManager.RegisterLibrary("Lang", new Lang()); extensionManager.RegisterLibrary("Permission", new Permission()); extensionManager.RegisterLibrary("Plugins", new Libraries.Plugins(RootPluginManager)); extensionManager.RegisterLibrary("Time", new Time()); extensionManager.RegisterLibrary("Timer", libtimer = new Timer()); extensionManager.RegisterLibrary("WebRequests", new WebRequests()); // Load all extensions LogInfo("Loading extensions..."); extensionManager.LoadAllExtensions(ExtensionDirectory); // Initialize covalence library after extensions (as it depends on things from within an ext) covalence.Initialize(); // Remove old files Cleanup.Add(Path.Combine(Interface.Oxide.RootDirectory, "oxide.root.json")); Cleanup.Run(); // If no clock has been defined, make our own unreliable clock if (getTimeSinceStartup == null) { timer = new Stopwatch(); timer.Start(); getTimeSinceStartup = () => (float)timer.Elapsed.TotalSeconds; LogWarning("A reliable clock is not available, falling back to a clock which may be unreliable on certain hardware"); } // Load all watchers foreach (var ext in extensionManager.GetAllExtensions()) { ext.LoadPluginWatchers(PluginDirectory); } // Load all plugins LogInfo("Loading plugins..."); LoadAllPlugins(true); // Hook all watchers foreach (var watcher in extensionManager.GetPluginChangeWatchers()) { watcher.OnPluginSourceChanged += watcher_OnPluginSourceChanged; watcher.OnPluginAdded += watcher_OnPluginAdded; watcher.OnPluginRemoved += watcher_OnPluginRemoved; } // Check for 'load' variable and warn if (CommandLine.HasVariable("load")) { LogWarning("The 'load' variable is unused and can be removed"); } // Check for 'nolog' variable and warn if (CommandLine.HasVariable("nolog")) { LogWarning("Usage of the 'nolog' variable will prevent logging"); } }
protected override void LoadDefaultConfig() { PrintWarning("Loading default configuration file..."); _cFile = ConfigFile.DefaultConfig(); }
private void CheckIsNotEqual(ConfigFile configFile, string key, string expectedValue) { Assert.AreNotEqual(GetConfigValue(configFile.FileName, key), expectedValue, "git config --get"); Assert.AreNotEqual(expectedValue, configFile.GetValue(key, string.Empty), "ConfigFile"); }
/// <summary> /// (Re)loads this instance. /// </summary> public void Load() { ConfigFile.LoadFrom(this, "IFPV", true); Instance = this; }
public override bool Init() { base.Init(); GitHubApi = new GitHubAPI(); MarketProjects = new ObservableCollection <ProjectItem>(); dockableManager = MainFrmUI as IDockableManager; dataManager = MainFrmUI.PluginDictionary["DataManager"] as IDataManager; ProcessCollection = new ObservableCollection <IDataProcess>(); CurrentProcessTasks = new ObservableCollection <TaskBase>(); if (!MainDescription.IsUIForm) { return(true); } this.datatTimer = new DispatcherTimer(); var aboutAuthor = new BindingAction(GlobalHelper.Get("key_262"), d => { var view = PluginProvider.GetObjectInstance <ICustomView>(GlobalHelper.Get("key_263")); var window = new Window(); window.Title = GlobalHelper.Get("key_263"); window.Content = view; window.ShowDialog(); }) { Description = GlobalHelper.Get("key_264"), Icon = "information" }; var mainlink = new BindingAction(GlobalHelper.Get("key_265"), d => { var url = "https://github.com/ferventdesert/Hawk"; System.Diagnostics.Process.Start(url); }) { Description = GlobalHelper.Get("key_266"), Icon = "home" }; var helplink = new BindingAction(GlobalHelper.Get("key_267"), d => { var url = "https://ferventdesert.github.io/Hawk/"; System.Diagnostics.Process.Start(url); }) { Description = GlobalHelper.Get("key_268"), Icon = "question" }; var feedback = new BindingAction(GlobalHelper.Get("key_269"), d => { var url = "https://github.com/ferventdesert/Hawk/issues"; System.Diagnostics.Process.Start(url); }) { Description = GlobalHelper.Get("key_270"), Icon = "reply_people" }; var giveme = new BindingAction(GlobalHelper.Get("key_271"), d => { var url = "https://github.com/ferventdesert/Hawk/wiki/8-%E5%85%B3%E4%BA%8E%E4%BD%9C%E8%80%85%E5%92%8C%E6%8D%90%E8%B5%A0"; System.Diagnostics.Process.Start(url); }) { Description = GlobalHelper.Get("key_272"), Icon = "smiley_happy" }; var blog = new BindingAction(GlobalHelper.Get("key_273"), d => { var url = "http://www.cnblogs.com/buptzym/"; System.Diagnostics.Process.Start(url); }) { Description = GlobalHelper.Get("key_274"), Icon = "tower" }; var update = new BindingAction(GlobalHelper.Get("checkupgrade"), d => { AutoUpdater.Start("https://raw.githubusercontent.com/ferventdesert/Hawk/global/Hawk/autoupdate.xml"); }) { Description = GlobalHelper.Get("checkupgrade"), Icon = "arrow_up" }; var helpCommands = new BindingAction(GlobalHelper.Get("key_275")) { Icon = "magnify" }; helpCommands.ChildActions.Add(mainlink); helpCommands.ChildActions.Add(helplink); helpCommands.ChildActions.Add(feedback); helpCommands.ChildActions.Add(giveme); helpCommands.ChildActions.Add(blog); helpCommands.ChildActions.Add(aboutAuthor); helpCommands.ChildActions.Add(update); MainFrmUI.CommandCollection.Add(helpCommands); var hierarchy = (Hierarchy)LogManager.GetRepository(); var debugCommand = new BindingAction(GlobalHelper.Get("debug")) { ChildActions = new ObservableCollection <ICommand> { new BindingAction(GlobalHelper.Get("key_277")) { ChildActions = new ObservableCollection <ICommand> { new BindingAction("Debug", obj => hierarchy.Root.Level = Level.Debug), new BindingAction("Info", obj => hierarchy.Root.Level = Level.Info), new BindingAction("Warn", obj => hierarchy.Root.Level = Level.Warn), new BindingAction("Error", obj => hierarchy.Root.Level = Level.Error), new BindingAction("Fatal", obj => hierarchy.Root.Level = Level.Fatal) } } }, Icon = "" }; MainFrmUI.CommandCollection.Add(debugCommand); BindingCommands = new BindingAction(GlobalHelper.Get("key_279")); var sysCommand = new BindingAction(); sysCommand.ChildActions.Add( new Command( GlobalHelper.Get("key_280"), obj => { if ( MessageBox.Show(GlobalHelper.Get("key_281"), GlobalHelper.Get("key_99"), MessageBoxButton.OKCancel) == MessageBoxResult.OK) { ProcessCollection.RemoveElementsNoReturn(d => true, RemoveOperation); } }, obj => true, "clear")); sysCommand.ChildActions.Add( new Command( GlobalHelper.Get("key_282"), obj => { if ( MessageBox.Show(GlobalHelper.Get("key_283"), GlobalHelper.Get("key_99"), MessageBoxButton.OKCancel) == MessageBoxResult.OK) { SaveCurrentTasks(); } }, obj => true, "save")); BindingCommands.ChildActions.Add(sysCommand); var taskAction1 = new BindingAction(); taskAction1.ChildActions.Add(new Command(GlobalHelper.Get("key_284"), async obj => { var project = await GetRemoteProjectContent(); if (project != null) { foreach (var param in project.Parameters) { //TODO: how check if it is same? name? if (CurrentProject.Parameters.FirstOrDefault(d => d.Name == param.Name) == null) { CurrentProject.Parameters.Add(param); } } CurrentProject.ConfigSelector.SelectItem = project.ConfigSelector.SelectItem; } (obj as ProcessTask).Load(true); }, obj => obj is ProcessTask, "inbox_out")); BindingCommands.ChildActions.Add(taskAction1); var taskAction2 = new BindingAction(GlobalHelper.Get("key_287")); taskAction2.ChildActions.Add(new Command(GlobalHelper.Get("key_288"), obj => { var task = obj as TaskBase; task.Start(); }, obj => { var task = obj as TaskBase; return(task != null && task.IsStart == false); }, "play")); taskAction2.ChildActions.Add(new Command(GlobalHelper.Get("cancel_task"), obj => { var task = obj as TaskBase; if (task.IsStart) { task.Remove(); } task.Remove(); }, obj => { var task = obj as TaskBase; return(task != null); }, "cancel")); var runningTaskActions = new BindingAction(GlobalHelper.Get("key_290")); runningTaskActions.ChildActions.Add(new Command(GlobalHelper.Get("key_291"), d => GetSelectedTask(d).Execute(d2 => { d2.IsPause = true; d2.ShouldPause = true; }), d => true, "pause")); runningTaskActions.ChildActions.Add(new Command(GlobalHelper.Get("key_292"), d => GetSelectedTask(d).Execute(d2 => { d2.IsPause = false; d2.ShouldPause = false; }), d => ProcessTaskCanExecute(d, false), "play")); runningTaskActions.ChildActions.Add(new Command(GlobalHelper.Get("key_293"), d => { var selectedTasks = GetSelectedTask(d).ToList(); CurrentProcessTasks.Where(d2 => selectedTasks.Contains(d2)).ToList().Execute(d2 => d2.Remove()); }, d => ProcessTaskCanExecute(d, null), "delete")); runningTaskActions.ChildActions.Add(new Command(GlobalHelper.Get("property"), d => { var selectedTasks = GetSelectedTask(d).FirstOrDefault(); PropertyGridFactory.GetPropertyWindow(selectedTasks).ShowDialog(); }, d => ProcessTaskCanExecute(d, null), "settings")); BindingCommands.ChildActions.Add(runningTaskActions); BindingCommands.ChildActions.Add(runningTaskActions); var processAction = new BindingAction(); dynamic processview = (MainFrmUI as IDockableManager).ViewDictionary.FirstOrDefault(d => d.Name == GlobalHelper.Get("key_794")) .View; processView = processview.processListBox as ListBox; var tickInterval = ConfigFile.GetConfig().Get <int>("AutoSaveTime"); if (tickInterval > 0) { this.datatTimer.Tick += timeCycle; this.datatTimer.Interval = new TimeSpan(0, 0, 0, tickInterval); this.datatTimer.Start(); } ConfigFile.GetConfig().PropertyChanged += (s, e) => { if (e.PropertyName == "AutoSaveTime") { var tick = ConfigFile.GetConfig().Get <int>("AutoSaveTime"); if (tick <= 0) { tick = int.MaxValue; } this.datatTimer.Interval = new TimeSpan(0, 0, 0, tickInterval); } }; processAction.ChildActions.Add(new Command(GlobalHelper.Get("key_294"), obj => { if (obj != null) { foreach (var process in GetSelectedProcess(obj)) { if (process == null) { return; } var old = obj as IDataProcess; if (old == null) { return; } var name = process.GetType().ToString().Split('.').Last(); var item = GetOneInstance(name, true, true); (process as IDictionarySerializable).DictCopyTo(item as IDictionarySerializable); item.Init(); item.Name = process.Name + "_copy"; } } else { var plugin = GetOneInstance("SmartETLTool", true, true, true) as SmartETLTool; plugin.Init(); ControlExtended.DockableManager.ActiveModelContent(plugin); } }, obj => true, "add")); processAction.ChildActions.Add(new Command(GlobalHelper.Get("key_295"), obj => { if (obj == null) { var plugin = GetOneInstance("SmartCrawler", true, true, true) as SmartCrawler; plugin.Init(); ControlExtended.DockableManager.ActiveModelContent(plugin); } else { foreach (var process in GetSelectedProcess(obj)) { if (process == null) { return; } var name = process.GetType().ToString().Split('.').Last(); var item = GetOneInstance(name, true, true); (process as IDictionarySerializable).DictCopyTo(item as IDictionarySerializable); item.Init(); item.Name = process.Name + "_copy"; } } }, obj => true, "cloud_add")); processAction.ChildActions.Add(new Command(GlobalHelper.Get("key_296"), obj => { if (obj == null) { SaveCurrentTasks(); } else { foreach (var process in GetSelectedProcess(obj)) { SaveTask(process, false); } } }, obj => true, "save")); processAction.ChildActions.Add(new Command(GlobalHelper.Get("key_297"), obj => { var process = GetSelectedProcess(obj).FirstOrDefault(); if (process == null) { return; } var view = (MainFrmUI as IDockableManager).ViewDictionary.FirstOrDefault(d => d.Model == process); if (view == null) { LoadProcessView(process); } (MainFrmUI as IDockableManager).ActiveModelContent(process); process.Init(); }, obj => true, "tv")); processAction.ChildActions.Add(new Command(GlobalHelper.Get("key_298"), obj => { if (MessageBox.Show(GlobalHelper.Get("delete_confirm"), GlobalHelper.Get("key_99"), MessageBoxButton.OKCancel) == MessageBoxResult.Cancel) { return; } foreach (var process in GetSelectedProcess(obj)) { if (process == null) { return; } RemoveOperation(process); ProcessCollection.Remove(process); var tasks = CurrentProcessTasks.Where(d => d.Publisher == process).ToList(); if (tasks.Any()) { foreach (var item in tasks) { item.Remove(); XLogSys.Print.Warn(string.Format(GlobalHelper.Get("key_299"), process.Name, item.Name)); } } } }, obj => true, "delete")); processAction.ChildActions.Add(new Command(GlobalHelper.Get("key_300"), obj => { ControlExtended.DockableManager.ActiveThisContent(GlobalHelper.Get("ModuleMgmt")); }, obj => true, "home")); processAction.ChildActions.Add(new Command(GlobalHelper.Get("find_ref"), obj => { PrintReferenced(obj as IDataProcess); }, obj => true, "diagram")); processAction.ChildActions.Add(new Command(GlobalHelper.Get("property"), obj => { PropertyGridFactory.GetPropertyWindow(obj).ShowDialog(); }, obj => true, "settings")); BindingCommands.ChildActions.Add(processAction); BindingCommands.ChildActions.Add(taskAction2); var attributeactions = new BindingAction(GlobalHelper.Get("key_301")); attributeactions.ChildActions.Add(new Command(GlobalHelper.Get("key_302"), obj => { var attr = obj as XFrmWorkAttribute; if (attr == null) { return; } var process = GetOneInstance(attr.MyType.Name, newOne: true, isAddUI: true); process.Init(); }, icon: "add")); BindingCommands.ChildActions.Add(attributeactions); var marketAction = new BindingAction(); marketAction.ChildActions.Add(new Command(GlobalHelper.Get("connect_market"), async obj => { GitHubApi.Connect(); MarketProjects.Clear(); ControlExtended.SetBusy(ProgressBarState.Indeterminate, message: GlobalHelper.Get("get_remote_projects")); MarketProjects.AddRange(await GitHubApi.GetProjects()); ControlExtended.SetBusy(ProgressBarState.NoProgress); }, icon: "refresh")); marketAction.ChildActions.Add(new Command(GlobalHelper.Get("key_240"), obj => { var window = PropertyGridFactory.GetPropertyWindow(GitHubApi); window.ShowDialog(); }, icon: "settings")); BindingCommands.ChildActions.Add(marketAction); var marketProjectAction = new BindingAction(); marketProjectAction.ChildActions.Add(new Command(GlobalHelper.Get("key_307"), async obj => { var projectItem = obj as ProjectItem; var keep = MessageBoxResult.Yes; if (projectItem == null) { return; } if (NeedSave()) { keep = MessageBox.Show(GlobalHelper.Get("keep_old_datas"), GlobalHelper.Get("key_99"), MessageBoxButton.YesNoCancel); if (keep == MessageBoxResult.Cancel) { return; } } var proj = await this.GetRemoteProjectContent(projectItem); LoadProject(proj, keep == MessageBoxResult.Yes); }, icon: "config")); var config = ConfigFile.GetConfig <DataMiningConfig>(); if (config.Projects.Any()) { var project = config.Projects.FirstOrDefault(); if (project != null) { ControlExtended.SafeInvoke(() => { CurrentProject = LoadProject(project.SavePath); }, LogType.Info, GlobalHelper.Get("key_303")); } } BindingCommands.ChildActions.Add(marketProjectAction); if (MainDescription.IsUIForm) { ProgramNameFilterView = new ListCollectionView(PluginProvider.GetPluginCollection(typeof(IDataProcess)).ToList()); ProgramNameFilterView.GroupDescriptions.Clear(); ProgramNameFilterView.GroupDescriptions.Add(new PropertyGroupDescription("GroupName")); var taskView = PluginProvider.GetObjectInstance <ICustomView>(GlobalHelper.Get("key_304")); var userControl = taskView as UserControl; if (userControl != null) { userControl.DataContext = this; dynamic control = userControl; currentProcessTasksView = control.currentProcessTasksView; ((INotifyCollectionChanged)CurrentProcessTasks).CollectionChanged += (s, e) => { ControlExtended.UIInvoke(() => { if (e.Action == NotifyCollectionChangedAction.Add) { dockableManager.ActiveThisContent(GlobalHelper.Get("key_304")); } }); } ; dockableManager.AddDockAbleContent(taskView.FrmState, this, taskView, GlobalHelper.Get("key_304")); } ProcessCollectionView = new ListCollectionView(ProcessCollection); ProcessCollectionView.GroupDescriptions.Clear(); ProcessCollectionView.GroupDescriptions.Add(new PropertyGroupDescription("TypeName")); } var fileCommand = MainFrmUI.CommandCollection.FirstOrDefault(d => d.Text == GlobalHelper.Get("key_305")); fileCommand.ChildActions.Add(new BindingAction(GlobalHelper.Get("key_306"), obj => CreateNewProject()) { Icon = "add" }); fileCommand.ChildActions.Add(new BindingAction(GlobalHelper.Get("key_307"), obj => { var keep = MessageBoxResult.No; if (NeedSave()) { keep = MessageBox.Show(GlobalHelper.Get("keep_old_datas"), GlobalHelper.Get("key_99"), MessageBoxButton.YesNoCancel); if (keep == MessageBoxResult.Cancel) { return; } } LoadProject(keepLast: keep == MessageBoxResult.Yes); }) { Icon = "inbox_out" }); fileCommand.ChildActions.Add(new BindingAction(GlobalHelper.Get("key_308"), obj => SaveCurrentProject()) { Icon = "save" }); fileCommand.ChildActions.Add(new BindingAction(GlobalHelper.Get("key_309"), obj => SaveCurrentProject(false)) { Icon = "save" }); fileCommand.ChildActions.Add(new BindingAction(GlobalHelper.Get("generate_project_doc"), obj => { if (CurrentProject == null) { return; } var doc = this.GenerateRemark(this.ProcessCollection); var docItem = new DocumentItem() { Title = this.CurrentProject.Name, Document = doc }; PropertyGridFactory.GetPropertyWindow(docItem).ShowDialog(); }, obj => CurrentProject != null) { Icon = "help" }); fileCommand.ChildActions.Add(new BindingAction(GlobalHelper.Get("recent_file")) { Icon = "save", ChildActions = new ObservableCollection <ICommand>(config.Projects.Select(d => new BindingAction(d.SavePath, obj => { var keep = MessageBoxResult.No; if (NeedSave()) { keep = MessageBox.Show(GlobalHelper.Get("keep_old_datas"), GlobalHelper.Get("key_99"), MessageBoxButton.YesNoCancel); if (keep == MessageBoxResult.Cancel) { return; } } LoadProject(d.SavePath, keep == MessageBoxResult.Yes); }) { Icon = "folder" })) }); var languageMenu = new BindingAction(GlobalHelper.Get("key_lang")) { Icon = "layout" }; var files = Directory.GetFiles("Lang"); foreach (var f in files) { var ba = new BindingAction(f, obj => { AppHelper.LoadLanguage(f); }) { Icon = "layout" }; languageMenu.ChildActions.Add(ba); } // helpCommands.ChildActions.Add(languageMenu); return(true); }
private HashSet <ConfigFile> GenerateHeaders(IReadOnlyCollection <string> filesWithExtensions, IReadOnlyCollection <ConfigFile> configsWithIncludes, ConfigFile consumerConfig) { var headerGenerator = new CppHeaderGenerator(Logger, _isAssemblyNew, IntermediateOutputPath); var(cppHeadersUpdated, prolog) = headerGenerator.GenerateCppHeaders(Config, configsWithIncludes, filesWithExtensions); consumerConfig.IncludeProlog.Add(prolog); return(cppHeadersUpdated); }
protected override void LoadConfig() { base.LoadConfig(); cFile = Config.ReadObject <ConfigFile>(); }
/// <summary> /// Run CodeGenerator /// </summary> public void Run() { Logger.Progress(0, "Starting code generation..."); try { var consumerConfig = new ConfigFile { Id = ConsumerBindMappingConfigId }; var(filesWithIncludes, filesWithExtensions) = Config.GetFilesWithIncludesAndExtensionHeaders(); var configsWithIncludes = new HashSet <ConfigFile>(); foreach (var config in Config.ConfigFilesLoaded) { if (filesWithIncludes.Contains(config.Id)) { configsWithIncludes.Add(config); } } var sdkResolver = new SdkResolver(Logger); foreach (var config in Config.ConfigFilesLoaded) { foreach (var sdk in config.Sdks) { config.IncludeDirs.AddRange(sdkResolver.ResolveIncludeDirsForSdk(sdk)); } } var cppHeadersUpdated = GenerateHeaders(filesWithExtensions, configsWithIncludes, consumerConfig); if (Logger.HasErrors) { Logger.Fatal("Failed to generate C++ headers."); } CppModule group; var groupFileName = $"{Config.Id}-out.xml"; if (cppHeadersUpdated.Count != 0) { var resolver = new IncludeDirectoryResolver(Logger); resolver.Configure(Config); var castXml = new CastXml(Logger, resolver, CastXmlExecutablePath) { OutputPath = IntermediateOutputPath, }; group = GenerateExtensionHeaders(filesWithExtensions, cppHeadersUpdated, castXml); group = ParseCpp(castXml, group); if (IsGeneratingDoc) { ApplyDocumentation(DocumentationCache, group); } } else { Logger.Progress(10, "Config files unchanged. Read previous C++ parsing..."); if (File.Exists(Path.Combine(IntermediateOutputPath, groupFileName))) { group = CppModule.Read(Path.Combine(IntermediateOutputPath, groupFileName)); } else { group = new CppModule(); } } // Save back the C++ parsed includes group.Write(Path.Combine(IntermediateOutputPath, groupFileName)); Config.ExpandDynamicVariables(Logger, group); var(docAggregator, solution) = ExecuteMappings(group, consumerConfig); solution.Write(Path.Combine(IntermediateOutputPath, "Solution.xml")); solution = CsSolution.Read(Path.Combine(IntermediateOutputPath, "Solution.xml")); GenerateConfigForConsumers(consumerConfig); GenerateCode(docAggregator, solution, new ExternalDocCommentsReader(ExternalDocumentation)); if (Logger.HasErrors) { Logger.Fatal("Code generation failed"); } // Update Checkfile for assembly File.WriteAllText(_assemblyCheckFile, ""); File.SetLastWriteTime(_assemblyCheckFile, _assemblyDatetime); // Update Checkfile for all config files File.WriteAllText(_allConfigCheck, ""); File.SetLastWriteTime(_allConfigCheck, DateTime.Now); } finally { Logger.Progress(100, "Finished"); } }
private (IDocumentationLinker doc, CsSolution solution) ExecuteMappings(CppModule group, ConfigFile consumerConfig) { var docLinker = new DocumentationLinker(); var typeRegistry = new TypeRegistry(Logger, docLinker); var namingRules = new NamingRulesManager(); var assemblyManager = new AssemblyManager(); // Run the main mapping process var transformer = new TransformManager( GlobalNamespace, namingRules, Logger, typeRegistry, docLinker, new ConstantManager(namingRules, docLinker), assemblyManager) { ForceGenerator = _isAssemblyNew }; var(solution, defines) = transformer.Transform(group, Config, IntermediateOutputPath); consumerConfig.Extension = new List <ExtensionBaseRule>(defines); var(bindings, generatedDefines) = transformer.GenerateTypeBindingsForConsumers(); consumerConfig.Bindings.AddRange(bindings); consumerConfig.Extension.AddRange(generatedDefines); consumerConfig.Mappings.AddRange( docLinker.GetAllDocLinks().Select( link => new MappingRule { DocItem = link.cppName, MappingNameFinal = link.cSharpName })); if (Logger.HasErrors) { Logger.Fatal("Executing mapping rules failed"); } PrintStatistics(assemblyManager); DumpRenames(transformer); return(docLinker, solution); }
public override void Initialize() { Log.Write("Auto AoE optimized for WQs", Color.Green); if (ConfigFile.ReadValue("Hunter", "AspectoftheTurtle Percent") == "") { ConfigFile.WriteValue("Hunter", "AspectoftheTurtle Percent", "15"); } if (ConfigFile.ReadValue("Hunter", "FeignDeath Percent") == "") { ConfigFile.WriteValue("Hunter", "FeignDeath Percent", "5"); } if (ConfigFile.ReadValue("Hunter", "Exhilaration Percent") == "") { ConfigFile.WriteValue("Hunter", "Exhilaration Percent", "45"); } if (ConfigFile.ReadValue("Hunter", "Kick Percent") == "") { ConfigFile.WriteValue("Hunter", "Kick Percent", "65"); } if (ConfigFile.ReadValue("Hunter", "Intimidation Percent") == "") { ConfigFile.WriteValue("Hunter", "Intimidation Percent", "80"); } if (ConfigFile.ReadValue("Hunter", "Potion Percent") == "") { ConfigFile.WriteValue("Hunter", "Potion Percent", "30"); } SettingsForm = new Form { Text = "Beast Mastery Hunter", StartPosition = FormStartPosition.CenterScreen, Width = 400, Height = 500, ShowIcon = false }; nudAspectoftheTurtlePercentValue = new NumericUpDown { Minimum = 0, Maximum = 100, Value = ConfigFile.ReadValue <decimal>("Hunter", "AspectoftheTurtle Percent"), Left = 215, Top = 172, Size = new Size(40, 10) }; SettingsForm.Controls.Add(nudAspectoftheTurtlePercentValue); nudExhilarationPercentValue = new NumericUpDown { Minimum = 0, Maximum = 100, Value = ConfigFile.ReadValue <decimal>("Hunter", "Exhilaration Percent"), Left = 215, Top = 122, Size = new Size(40, 10) }; SettingsForm.Controls.Add(nudExhilarationPercentValue); nudFeignDeathPercentValue = new NumericUpDown { Minimum = 0, Maximum = 100, Value = ConfigFile.ReadValue <decimal>("Hunter", "FeignDeath Percent"), Left = 215, Top = 147, Size = new Size(40, 10) }; SettingsForm.Controls.Add(nudFeignDeathPercentValue); nudKickPercentValue = new NumericUpDown { Minimum = 0, Maximum = 100, Value = ConfigFile.ReadValue <decimal>("Hunter", "Kick Percent"), Left = 215, Top = 100, Size = new Size(40, 10) }; SettingsForm.Controls.Add(nudKickPercentValue); nudIntimidationPercentValue = new NumericUpDown { Minimum = 0, Maximum = 100, Value = ConfigFile.ReadValue <decimal>("Hunter", "Intimidation Percent"), Left = 215, Top = 272, Size = new Size(40, 10) }; SettingsForm.Controls.Add(nudIntimidationPercentValue); nudPotionPercentValue = new NumericUpDown { Minimum = 0, Maximum = 100, Value = ConfigFile.ReadValue <decimal>("Hunter", "Potion Percent"), Left = 215, Top = 347, Size = new Size(40, 10) }; SettingsForm.Controls.Add(nudPotionPercentValue); var lblTitle = new Label { Text = "Sub Rogue by Vectarius", Size = new Size(270, 14), Left = 61, Top = 1 }; lblTitle.ForeColor = Color.Black; Font myFont = new Font(lblTitle.Font, FontStyle.Bold | FontStyle.Underline); lblTitle.Font = myFont; SettingsForm.Controls.Add(lblTitle); var lblTextBox3 = new Label { Text = "Cooldowns", Size = new Size(200, 17), Left = 70, Top = 50 }; lblTextBox3.ForeColor = Color.Black; SettingsForm.Controls.Add(lblTextBox3); var lblT204pcBox = new Label { Text = "T204pc", Size = new Size(270, 15), Left = 100, Top = 75 }; lblT204pcBox.ForeColor = Color.Black; SettingsForm.Controls.Add(lblT204pcBox); var lblKickBox = new Label { Text = "Kick @", Size = new Size(270, 15), Left = 100, Top = 100 }; lblKickBox.ForeColor = Color.Black; SettingsForm.Controls.Add(lblKickBox); var lblExhilarationBox = new Label { Text = "Exhilaration @", Size = new Size(270, 15), Left = 100, Top = 125 }; lblExhilarationBox.ForeColor = Color.Black; SettingsForm.Controls.Add(lblExhilarationBox); var lblAspectoftheTurtleBox = new Label { Text = "Aspect of the Turtle @", Size = new Size(270, 15), Left = 100, Top = 175 }; lblAspectoftheTurtleBox.ForeColor = Color.Black; SettingsForm.Controls.Add(lblAspectoftheTurtleBox); var lblFeignDeathBox = new Label { Text = "Feign Death @", Size = new Size(270, 15), Left = 100, Top = 150 }; lblFeignDeathBox.ForeColor = Color.Black; SettingsForm.Controls.Add(lblFeignDeathBox); var lblTextBox5 = new Label { Text = "Pet Control", Size = new Size(200, 17), Left = 70, Top = 225 }; lblTextBox5.ForeColor = Color.Black; SettingsForm.Controls.Add(lblTextBox5); var lblTextBox6 = new Label { Text = "Items", Size = new Size(200, 17), Left = 70, Top = 300 }; lblTextBox6.ForeColor = Color.Black; SettingsForm.Controls.Add(lblTextBox6); var lblMantleoftheMasterBox = new Label { Text = "MantleoftheMaster", Size = new Size(270, 15), Left = 100, Top = 250 }; lblMantleoftheMasterBox.ForeColor = Color.Black; SettingsForm.Controls.Add(lblMantleoftheMasterBox); var lblIntimidationBox = new Label { Text = "Intimidation @", Size = new Size(270, 15), Left = 100, Top = 275 }; lblIntimidationBox.ForeColor = Color.Black; SettingsForm.Controls.Add(lblIntimidationBox); var lblKilJaedenBox = new Label { Text = "Kil'Jaeden's Burning Wish", Size = new Size(270, 15), Left = 100, Top = 325 }; lblKilJaedenBox.ForeColor = Color.Black; SettingsForm.Controls.Add(lblKilJaedenBox); var lblPotionBox = new Label { Text = "Healthstone/Potion @", Size = new Size(270, 15), Left = 100, Top = 350 }; lblPotionBox.ForeColor = Color.Black; SettingsForm.Controls.Add(lblPotionBox); var lblPotBox = new Label { Text = "Potion of Prolonged Power with Bloodlust", Size = new Size(270, 15), Left = 100, Top = 375 }; lblPotBox.ForeColor = Color.Black; SettingsForm.Controls.Add(lblPotBox); var cmdSave = new Button { Text = "Save", Width = 65, Height = 25, Left = 5, Top = 400, Size = new Size(120, 31) }; var cmdReadme = new Button { Text = "Macros! Use Them", Width = 65, Height = 25, Left = 125, Top = 400, Size = new Size(120, 31) }; //items KilJaedenBox = new CheckBox { Checked = KilJaeden, TabIndex = 8, Size = new Size(14, 14), Left = 70, Top = 325 }; SettingsForm.Controls.Add(KilJaedenBox); PotionBox = new CheckBox { Checked = Potion, TabIndex = 8, Size = new Size(14, 14), Left = 70, Top = 350 }; SettingsForm.Controls.Add(PotionBox); PotBox = new CheckBox { Checked = Pot, TabIndex = 8, Size = new Size(14, 14), Left = 70, Top = 375 }; SettingsForm.Controls.Add(PotBox); //pet control MantleoftheMasterBox = new CheckBox { Checked = MantleoftheMaster, TabIndex = 8, Size = new Size(14, 14), Left = 70, Top = 250 }; IntimidationBox = new CheckBox { Checked = Intimidation, TabIndex = 8, Size = new Size(14, 14), Left = 70, Top = 275 }; SettingsForm.Controls.Add(MantleoftheMasterBox); SettingsForm.Controls.Add(IntimidationBox); // Checkboxes KickBox = new CheckBox { Checked = Kick, TabIndex = 8, Size = new Size(14, 14), Left = 70, Top = 100 }; SettingsForm.Controls.Add(KickBox); ExhilarationBox = new CheckBox { Checked = Exhilaration, TabIndex = 8, Size = new Size(14, 14), Left = 70, Top = 125 }; SettingsForm.Controls.Add(ExhilarationBox); FeignDeathBox = new CheckBox { Checked = FeignDeath, TabIndex = 8, Size = new Size(14, 14), Left = 70, Top = 150 }; SettingsForm.Controls.Add(FeignDeathBox); AspectoftheTurtleBox = new CheckBox { Checked = AspectoftheTurtle, TabIndex = 8, Size = new Size(14, 14), Left = 70, Top = 175 }; SettingsForm.Controls.Add(AspectoftheTurtleBox); //dps cooldowns T204pcBox = new CheckBox { Checked = T204pc, TabIndex = 8, Size = new Size(14, 14), Left = 70, Top = 75 }; SettingsForm.Controls.Add(T204pcBox); KickBox.Checked = Kick; ExhilarationBox.Checked = Exhilaration; FeignDeathBox.Checked = FeignDeath; AspectoftheTurtleBox.Checked = AspectoftheTurtle; T204pcBox.Checked = T204pc; //cmdSave KilJaedenBox.CheckedChanged += KilJaeden_Click; PotionBox.CheckedChanged += Potion_Click; PotBox.CheckedChanged += Pot_Click; MantleoftheMasterBox.CheckedChanged += MantleoftheMaster_Click; IntimidationBox.CheckedChanged += Intimidation_Click; T204pcBox.CheckedChanged += T204pc_Click; ExhilarationBox.CheckedChanged += Exhilaration_Click; KickBox.CheckedChanged += Kick_Click; FeignDeathBox.CheckedChanged += FeignDeath_Click; AspectoftheTurtleBox.CheckedChanged += AspectoftheTurtle_Click; cmdSave.Click += CmdSave_Click; cmdReadme.Click += CmdReadme_Click; SettingsForm.Controls.Add(cmdSave); SettingsForm.Controls.Add(cmdReadme); lblTextBox5.BringToFront(); lblTextBox6.BringToFront(); lblTitle.BringToFront(); nudExhilarationPercentValue.BringToFront(); nudAspectoftheTurtlePercentValue.BringToFront(); nudFeignDeathPercentValue.BringToFront(); KilJaedenBox.BringToFront(); PotionBox.BringToFront(); PotBox.BringToFront(); MantleoftheMasterBox.BringToFront(); IntimidationBox.BringToFront(); T204pcBox.BringToFront(); KickBox.BringToFront(); ExhilarationBox.BringToFront(); FeignDeathBox.BringToFront(); AspectoftheTurtleBox.BringToFront(); }
public static void Awake(ConfigFile Config) { Enabled = Config.Bind(SECTION, "__Enabled", true, DESCRIPTION_ENABLED); Subscription.Subscribe(typeof(ClothState), Enabled, Update); }
// Unity fires off this function void Start() { // Find the common objects we use. These are created by unity. cc = GameObject.FindObjectOfType <CameraController>(); uICanvas = GameObject.Find("UICanvas").GetComponent <Canvas>(); boardCanvas = GameObject.Find("BoardCanvas").GetComponent <Canvas>(); tokenCanvas = GameObject.Find("TokenCanvas").GetComponent <Canvas>(); tokenBoard = GameObject.FindObjectOfType <TokenBoard>(); heroCanvas = GameObject.FindObjectOfType <HeroCanvas>(); monsterCanvas = GameObject.FindObjectOfType <MonsterCanvas>(); // Create some things uiScaler = new UIScaler(uICanvas); config = new ConfigFile(); GameObject go = new GameObject("audio"); audioControl = go.AddComponent <Audio>(); updateList = new List <IUpdateListener>(); if (config.data.Get("UserConfig") == null) { // English is the default current language config.data.Add("UserConfig", "currentLang", "English"); config.Save(); } currentLang = config.data.Get("UserConfig", "currentLang"); // On android extract streaming assets for use if (Application.platform == RuntimePlatform.Android) { System.IO.Directory.CreateDirectory(ContentData.ContentPath()); using (ZipFile jar = ZipFile.Read(Application.dataPath)) { foreach (ZipEntry e in jar) { if (e.FileName.IndexOf("assets") != 0) { continue; } if (e.FileName.IndexOf("assets/bin") == 0) { continue; } e.Extract(ContentData.ContentPath() + "../..", ExtractExistingFileAction.OverwriteSilently); } } } DictionaryI18n valDict = new DictionaryI18n(); foreach (string file in System.IO.Directory.GetFiles(ContentData.ContentPath() + "../text", "Localization*.txt")) { valDict.AddDataFromFile(file); } LocalizationRead.AddDictionary("val", valDict); roundControl = new RoundController(); // Read the version and add it to the log TextAsset versionFile = Resources.Load("version") as TextAsset; version = versionFile.text.Trim(); // The newline at the end stops the stack trace appearing in the log ValkyrieDebug.Log("Valkyrie Version: " + version + System.Environment.NewLine); // Bring up the Game selector gameSelect = new GameSelectionScreen(); }
public HttpServiceInvokationReceiver(string configName) : this(ConfigFile.GetConfig(configName)) { }
private void init3D() { Directory.SetCurrentDirectory(Path.GetDirectoryName(Application.ExecutablePath)); // Create root object mRoot = new Root(); // Define Resources ConfigFile cf = new ConfigFile(); cf.Load("resources.cfg", "\t:=", true); ConfigFile.SectionIterator seci = cf.GetSectionIterator(); String secName, typeName, archName; while (seci.MoveNext()) { secName = seci.CurrentKey; ConfigFile.SettingsMultiMap settings = seci.Current; foreach (KeyValuePair <string, string> pair in settings) { typeName = pair.Key; archName = pair.Value; ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName); } } // Setup RenderSystem RenderSystem rs = mRoot.GetRenderSystemByName("Direct3D9 Rendering Subsystem"); mRoot.RenderSystem = rs; rs.SetConfigOption("Full Screen", "No"); rs.SetConfigOption("Video Mode", "800 x 600 @ 32-bit colour"); // Create Render Window mRoot.Initialise(false, "Main Ogre Window"); NameValuePairList misc = new NameValuePairList(); misc["externalWindowHandle"] = picRender.Handle.ToString(); mWindow = mRoot.CreateRenderWindow("Main RenderWindow", 800, 600, false, misc); // Init resources TextureManager.Singleton.DefaultNumMipmaps = 5; ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); // Create a Simple Scene mgr = mRoot.CreateSceneManager(SceneType.ST_GENERIC, "MainMgr"); Camera cam = mgr.CreateCamera("Camera"); //cam.PolygonMode = PolygonMode.PM_WIREFRAME; cam.AutoAspectRatio = true; mWindow.AddViewport(cam); cam.Position = new Vector3(0, 0, 200); cam.LookAt(new Vector3(0, 0, 0)); cam.ProjectionType = ProjectionType.PT_ORTHOGRAPHIC; //cam.OrthoWindowHeight = 400; cam.OrthoWindowWidth = 650; ManualObject manual = mgr.CreateManualObject("canvas"); manual.Begin("BaseWhiteNoLighting", RenderOperation.OperationTypes.OT_LINE_STRIP); manual.Position(-300.0f, -200.0f, 0.0f); // start position manual.Position(300.0f, -200.0f, 0.0f); // draw first line manual.Position(300.0f, 200.0f, 0.0f); manual.Position(-300.0f, 200.0f, 0.0f); manual.Position(-300.0f, -200.0f, 0.0f); // draw fourth line manual.End(); mgr.RootSceneNode.CreateChildSceneNode().AttachObject(manual); mWindow.GetViewport(0).BackgroundColour = new ColourValue(0.5f, 0.5f, 0.5f); }
public EngineConfig(ConfigFile configFile) { section = configFile.createOrRetrieveConfigSection("Engine"); showStats = section.getValue("ShowStats", false); }
public void TestUserControlRadioButtonHtmlValues() { Console.WriteLine("TestUserControlRadioButtonHtmlValues"); bool usingHtmlInstaller = dotNetInstallerExeUtils.Executable.EndsWith("htmlInstaller.exe"); if (!usingHtmlInstaller) { return; } // a configuration with a checkbox control ConfigFile configFile = new ConfigFile(); SetupConfiguration setupConfiguration = new SetupConfiguration(); setupConfiguration.auto_start = true; setupConfiguration.failed_exec_command_continue = ""; setupConfiguration.auto_close_on_error = true; configFile.Children.Add(setupConfiguration); ControlEdit edit = new ControlEdit(); edit.Text = "3"; edit.Id = "edit1"; setupConfiguration.Children.Add(edit); ComponentCmd cmd = new ComponentCmd(); cmd.command = "cmd.exe /C exit /b [edit1]1"; cmd.required_install = true; setupConfiguration.Children.Add(cmd); // save config file InstallerLinkerArguments args = new InstallerLinkerArguments(); args.config = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml"); Console.WriteLine("Writing '{0}'", args.config); configFile.SaveAs(args.config); // create HTML directory string htmlPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(htmlPath); string htmlIndexFilename = Path.Combine(htmlPath, "index.html"); File.WriteAllText(htmlIndexFilename, @"<html><head><title></title></head><body> <input type=""radio"" id=""edit1"" name=""edit1"" value=""4"" checked=""checked"" /> <input type=""radio"" id=""edit1"" name=""edit1"" value=""2"" /> <input id=""button_install"" type=""button"" value=""Install"" /> </body></html>"); // link the install executable args.htmlFiles = new string[] { htmlPath }; args.embed = true; args.apppath = Path.GetTempPath(); args.embedFiles = new string[] { Path.GetFileName(args.config) }; args.output = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".exe"); args.template = dotNetInstallerExeUtils.Executable; Console.WriteLine("Linking '{0}'", args.output); InstallerLinkerExeUtils.CreateInstaller(args); Assert.IsTrue(File.Exists(args.output)); // execute dotNetInstaller dotNetInstallerExeUtils.RunOptions runOptions = new dotNetInstallerExeUtils.RunOptions(); runOptions.autostart = true; runOptions.quiet = false; Assert.AreEqual(41, dotNetInstallerExeUtils.Run(args.output, runOptions.CommandLineArgs)); File.Delete(args.config); Directory.Delete(args.htmlFiles[0], true); }
private void runExtraction() { steps = (((enddate - startdate).TotalSeconds) / count); if (steps < maxLinhas) { steps = 1; partSeconds = ((enddate - startdate).TotalSeconds); } else { steps = Math.Ceiling((((enddate - startdate).TotalSeconds) / count) / maxLinhas); partSeconds = Math.Ceiling(((enddate - startdate).TotalSeconds) / steps); } count = Math.Ceiling(partSeconds / count); startdate = startdate.AddSeconds(-partSeconds); progressBar_extr.Value = 1; for (double cstep = 1; cstep <= steps; cstep++) { startdate = startdate.AddSeconds(partSeconds); enddate = startdate.AddSeconds(partSeconds); starttime = PItime(startdate); endtime = PItime(enddate); //MessageBox.Show("Step:" + cstep + "/" + steps + " starttime:" + starttime + " endtime:" + endtime + " (partial=" + partSeconds + ")" + " (count=" + count + ")"); System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo.FileName = Support.InstalPath + "resources\\piconfig.exe"; process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; process.StartInfo.RedirectStandardInput = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.Start(); this.BringToFront(); string input = ""; string mode = (ConfigFile.read_attribute(configName, ConfigFile.AttribPIConfig_Inte) == "1") ? "even" : "comp"; input = input + "@logi " + ConfigFile.read_attribute(configName, ConfigFile.AttribPIConfig_Host) + "," + ConfigFile.read_attribute(configName, ConfigFile.AttribPIConfig_User) + "," + ConfigFile.read_attribute(configName, ConfigFile.AttribPIConfig_Pass) + "," + ConfigFile.read_attribute(configName, ConfigFile.AttribPIConfig_Port) + "\r\n"; input = input + "@maxerr 65535" + "\r\n"; input = input + "@table piarc" + "\r\n"; input = input + "@mode list" + "\r\n"; input = input + "@modify count=" + (count + 1) + "\r\n"; input = input + "@modify starttime = " + starttime + "\r\n"; input = input + "@modify endtime = " + endtime + "\r\n"; input = input + "@modify mode = " + mode + "\r\n"; input = input + "@timf 1,F" + "\r\n"; input = input + "@ostr tag,time,value" + "\r\n"; input = input + "@ostr ..." + "\r\n"; //input = input +" @ostructure tag" + "\r\n"; //input = input + "@ostructure time" + "\r\n"; //input = input + "@ostructure value" + "\r\n"; //input = input + "@ostructure *" + "\r\n"; input = input + "@istr tag,starttime,endtime" + "\r\n"; Support.CreateFile(Support.SelectedTagFilePrefix + configName + ".txt"); input = input + "@input " + Support.InstalPath + "\\" + Support.SelectedTagFilePrefix + configName + ".txt" + "\r\n"; input = input + "@endsection" + "\r\n"; input = input + "@bye"; process.StandardInput.Write(input); this.BringToFront(); process.StandardInput.Flush(); this.BringToFront(); process.StandardInput.Close(); this.BringToFront(); string result = (process.StandardOutput.ReadToEnd()); //MessageBox.Show(result); string[] results = result.Split(new string[] { "\r\n" }, StringSplitOptions.None); string finalresult = ""; string datalines = "Timestamp"; //no matrix format if (ConfigFile.read_attribute(configName, ConfigFile.AttribPIConfig_Mtrx) == "0") { for (int i = 0; i < results.Length; i++) { //Selects only usefull info (removes alerts, erros and other messages) if (results[i].Contains(",") == true) { string[] thisline = results[i].Split(','); if (thisline.Length == 3) { DateTime timestamp; if (DateTime.TryParse(thisline[1], out timestamp)) { if (thisline[2] == "Digital State") { thisline[2] = ""; } thisline[1] = timestamp.ToString("yyyyMMdd_HHmmss"); finalresult = finalresult + thisline[0] + ";" + thisline[1] + ";" + thisline[2] + "\r\n"; } } } } } //matrix format else { List <string> tags = new List <string>(); List <string> times = new List <string>(); //for each line from response for (int i = 0; i < results.Length; i++) { //if line is data (non data line wont contain the "," char) if (results[i].Contains(",") == true) { string[] thisline = results[i].Split(','); if (thisline.Length == 3) { //add tag to tag array if (!tags.Contains(thisline[0])) { tags.Add(thisline[0]); } //add times to time array if (!times.Contains(thisline[1])) { times.Add(thisline[1]); } } } } //creates data table (matrix format) string[,] table = new string[tags.Count(), times.Count()]; for (int i = 0; i < results.Length; i++) { if (results[i].Contains(",") == true) { string[] thisline = results[i].Split(','); if (thisline.Length == 3) { if (thisline[2] == "Digital State") { thisline[2] = ""; } //add value to the spot on the table with corresponding tag and time table[tags.IndexOf(thisline[0]), times.IndexOf(thisline[1])] = thisline[2]; } } } foreach (var tag in tags) { datalines += ";" + tag; } datalines += "\r\n"; foreach (var time in times) { DateTime timestamp; if (DateTime.TryParse(time, out timestamp)) { datalines += timestamp.ToString("yyyyMMdd_HHmmss"); foreach (var tag in tags) { string value = (table[tags.IndexOf(tag), times.IndexOf(time)] != null) ? table[tags.IndexOf(tag), times.IndexOf(time)] : ""; datalines += ";" + value.Replace(";", ""); } datalines += "\r\n"; } } finalresult = datalines; } process.WaitForExit(); string Outputpath = Regex.Split(ConfigFile.read_attribute(configName, ConfigFile.AttribPIConfig_OutP), @"(.*[\\|\/])([^\\|\/]*)")[1]; try { string Pref = ConfigFile.read_attribute(configName, ConfigFile.AttribPIConfig_Pref); string filename = (Pref == "") ? configName : Pref; //Support.WriteOneLine(filename + "_Historic_" + startdate.ToString("yyyyMMdd_HHmmss") + "_to_" + enddate.ToString("yyyyMMdd_HHmmss") + ".csv", finalresult, false); File.WriteAllText(Outputpath + filename + "_Historic_" + startdate.ToString("yyyyMMdd_HHmmss") + "_to_" + enddate.ToString("yyyyMMdd_HHmmss") + ".csv", finalresult); } catch (Exception exx) { LogFile.write_LogFile("Error saving output for config " + configName + " with message: " + exx.Message); } progressBar_extr.Value = ((int)Math.Ceiling((cstep / steps) * 100) > 1)? (int)Math.Ceiling((cstep / steps) * 100) :1; this.Update(); } MessageBox.Show(this, "Historical Extraction Complete!", "Success", MessageBoxButtons.OK); this.Close(); }
protected (CsAssembly Assembly, IEnumerable <DefineExtensionRule> Defines) MapModel(CppModule module, ConfigFile config) { var transformer = CreateTransformer(); return(transformer.Transform(module, ConfigFile.Load(config, new string[0], Logger), null)); }
public override void SaveConfigFile() { CurrentProject?.Save(dataManager.DataCollections); ConfigFile.GetConfig().SaveConfig(); }
public Room(ControlSystem cs, string cfgFileName) { _sys = cs; _cfg = new ConfigFile(cfgFileName); }
protected (IEnumerable <BindRule> bindings, IEnumerable <DefineExtensionRule> defines) GetConsumerBindings(CppModule module, ConfigFile config) { var transformer = CreateTransformer(); transformer.Transform(module, ConfigFile.Load(config, new string[0], Logger), null); return(transformer.GenerateTypeBindingsForConsumers()); }
public override AnalyzerConfig ParseConfig(FileInfo file) { return(ConfigFile.Deserialize <MultiRecognizerConfig>(file)); }
protected override void LoadDefaultConfig() { cFile = ConfigFile.DefaultConfig(); }
public void Awake() { ConfigFile cfgFile = new ConfigFile(Paths.ConfigPath + "\\" + ModGuid + ".cfg", true); var cfgCritCap = cfgFile.Bind(new ConfigDefinition("Hypercrit", "CritCap"), 1000000000, new ConfigDescription( "Maximum number of extra crit stacks to allow. Reduce SHARPLY (to ~50) if using StackMode: Exponential; attacks may break at high stacks otherwise.", new AcceptableValueRange <int>(1, int.MaxValue))); critCap = cfgCritCap.Value; var cfgCritBase = cfgFile.Bind(new ConfigDefinition("Hypercrit", "CritBase"), 2f, new ConfigDescription( "Damage multiplier to use for base crit. Replaces vanilla crit multiplier for purposes of dealing damage. Examples used to describe other configs will use default value (2).", new AcceptableValueRange <float>(1f, float.MaxValue))); critBase = cfgCritBase.Value; var cfgCritMult = cfgFile.Bind(new ConfigDefinition("Hypercrit", "CritMult"), 1f, new ConfigDescription( "Damage multiplier to use for all crit stacks except the first.", new AcceptableValueRange <float>(float.Epsilon, float.MaxValue))); critMult = cfgCritMult.Value; var cfgDecayParam = cfgFile.Bind(new ConfigDefinition("Hypercrit", "DecayParam"), 1f, new ConfigDescription( "Used in Asymptotic stack mode. Higher numbers directly multiply the number of stacks required to reach the same crit multiplier (at DecayParam 1, 1 stack : 3x and 2 stacks : 3.5x; at DecayParam 3, 3 stacks : 3x and 6 stacks : 3.5x).", new AcceptableValueRange <float>(float.Epsilon, float.MaxValue))); decayParam = cfgDecayParam.Value; var cfgStackMode = cfgFile.Bind(new ConfigDefinition("Hypercrit", "StackMode"), CritStackingMode.Linear, new ConfigDescription( "How total crit multiplier is calculated based on number of stacked crits. Linear (w/ CritMult 1): x2, x3, x4, x5, x6.... Exponential (w/ CritMult 2): x2, x4, x8, x16, x32.... Asymptotic (w/ CritMult 2): x2, x3, x3.5, x3.75, x3.825....")); stackMode = cfgStackMode.Value; var cfgMultiFlurry = cfgFile.Bind(new ConfigDefinition("Flurry", "Enabled"), true, new ConfigDescription( "If false, no changes will be made to Huntress' alternate primary variant. If true, additional shots will be fired for each additional crit stack.")); multiFlurry = cfgMultiFlurry.Value; var cfgFlurryBase = cfgFile.Bind(new ConfigDefinition("Flurry", "CountBase"), 3, new ConfigDescription( "The number of shots of Flurry to fire with 0 crit stacks.", new AcceptableValueRange <int>(1, int.MaxValue))); flurryBase = cfgFlurryBase.Value; var cfgFlurryAdd = cfgFile.Bind(new ConfigDefinition("Flurry", "CountAdd"), 3, new ConfigDescription( "The number of extra shots of Flurry to fire per crit stack.", new AcceptableValueRange <int>(1, int.MaxValue))); flurryAdd = cfgFlurryAdd.Value; var cfgNerfFlurry = cfgFile.Bind(new ConfigDefinition("Flurry", "CompensateDamage"), true, new ConfigDescription( "If true, only the first crit will count towards extra Flurry damage; every additional stack will adjust total damage to account for increased projectile count.")); nerfFlurry = cfgNerfFlurry.Value; var cfgLoopColors = cfgFile.Bind(new ConfigDefinition("NumberColors", "Enabled"), true, new ConfigDescription( "If true, crit stacks will display with progressively decreasing hue (yellow --> red --> purple...).")); loopColors = cfgLoopColors.Value; var cfgColorLoopRate = cfgFile.Bind(new ConfigDefinition("NumberColors", "ColorLoopRate"), 36, new ConfigDescription( "The number of crit stacks required to loop back around to yellow color.", new AcceptableValueRange <int>(1, int.MaxValue))); colorLoopRate = cfgColorLoopRate.Value; IL.RoR2.HealthComponent.TakeDamage += (il) => { ILCursor c = new ILCursor(il); int damageInfoIndex = -1; bool ILFound = c.TryGotoNext(MoveType.After, x => x.MatchLdarg(out damageInfoIndex), x => x.MatchLdfld(typeof(DamageInfo).GetFieldCached("crit")), x => x.MatchBrfalse(out _), x => x.MatchLdloc(out _), x => x.MatchLdcR4(out _)); if (ILFound) { c.Emit(OpCodes.Ldloc_1); c.Emit(OpCodes.Ldarg, damageInfoIndex); c.EmitDelegate <Func <float, CharacterBody, DamageInfo, float> >((origDmgMult, body, damageInfo) => { if (!body) { return(origDmgMult); } AdditionalCritInfo aci = null; if (!critInfoAttachments.TryGetValue(damageInfo, out aci)) { aci = RollHypercrit(body, true); critInfoAttachments.Add(damageInfo, aci); } damageInfo.crit = aci.numCrits > 0; return(aci.damageMult); }); } else { Debug.LogError("Hypercrit: failed to apply IL patch (HealthComponent.TakeDamage)! Mod will not work."); return; } }; if (loopColors) { IL.RoR2.HealthComponent.SendDamageDealt += (il) => { var c = new ILCursor(il); c.GotoNext(MoveType.After, x => x.MatchNewobj <DamageDealtMessage>()); c.Emit(OpCodes.Dup); c.Emit(OpCodes.Ldarg_0); c.EmitDelegate <Action <DamageDealtMessage, DamageReport> >((msg, report) => { TryPassHypercrit(report.damageInfo, msg); }); }; On.RoR2.DamageDealtMessage.Serialize += (orig, self, writer) => { orig(self, writer); AdditionalCritInfo aci; if (!critInfoAttachments.TryGetValue(self, out aci)) { aci = new AdditionalCritInfo(); } writer.Write(aci.numCrits); writer.Write(aci.totalCritChance); writer.Write(aci.damageMult); }; On.RoR2.DamageDealtMessage.Deserialize += (orig, self, reader) => { orig(self, reader); AdditionalCritInfo aci = new AdditionalCritInfo(); aci.numCrits = reader.ReadInt32(); aci.totalCritChance = reader.ReadSingle(); aci.damageMult = reader.ReadSingle(); critInfoAttachments.Add(self, aci); lastNetworkedCritInfo = aci; }; IL.RoR2.DamageNumberManager.SpawnDamageNumber += (il) => { var c = new ILCursor(il); c.GotoNext(MoveType.After, x => x.MatchCallOrCallvirt("RoR2.DamageColor", "FindColor")); c.EmitDelegate <Func <Color, Color> >((origColor) => { if (lastNetworkedCritInfo == null) { return(origColor); } var aci = lastNetworkedCritInfo; lastNetworkedCritInfo = null; if (aci.numCrits == 0) { return(origColor); } float h = 1f / 6f - (aci.numCrits - 1f) / colorLoopRate; return(Color.HSVToRGB(((h % 1f) + 1f) % 1f, 1f, 1f)); }); }; } if (multiFlurry) { On.EntityStates.Huntress.HuntressWeapon.FireFlurrySeekingArrow.OnEnter += (orig, self) => { orig(self); var newCrit = RollHypercrit(self.characterBody); if (nerfFlurry && newCrit.numCrits > 1) { newCrit.damageMult *= (flurryBase + flurryAdd) / (float)(flurryBase + flurryAdd * newCrit.numCrits); } critInfoAttachments.Add(self, newCrit); self.isCrit = newCrit.numCrits > 0; self.maxArrowCount = flurryBase + newCrit.numCrits * flurryAdd; self.arrowReloadDuration = self.baseArrowReloadDuration * (3f / self.maxArrowCount) / self.attackSpeedStat; }; IL.EntityStates.Huntress.HuntressWeapon.FireSeekingArrow.FireOrbArrow += (il) => { var c = new ILCursor(il); c.GotoNext(x => x.MatchStloc(0)); c.Emit(OpCodes.Dup); c.Emit(OpCodes.Ldarg_0); c.EmitDelegate <Action <GenericDamageOrb, EntityStates.Huntress.HuntressWeapon.FireSeekingArrow> >((orb, self) => { TryPassHypercrit(self, orb); }); }; IL.RoR2.Orbs.GenericDamageOrb.OnArrival += (il) => { var c = new ILCursor(il); c.GotoNext(MoveType.After, x => x.MatchNewobj <DamageInfo>()); c.Emit(OpCodes.Dup); c.Emit(OpCodes.Ldarg_0); c.EmitDelegate <Action <DamageInfo, GenericDamageOrb> >((di, orb) => { TryPassHypercrit(orb, di); }); }; } }
private void refreshProcessList() { cmbWoW.Items.Clear(); var processes = Process.GetProcessesByName("Wow"); foreach (var process in processes) { cmbWoW.Items.Add($"WoW x86 [Live] => {process.Id}"); } processes = Process.GetProcessesByName("Wow-64"); foreach (var process in processes) { cmbWoW.Items.Add($"WoW x64 [Live] => {process.Id}"); } processes = Process.GetProcessesByName("WowB-64"); foreach (var process in processes) { cmbWoW.Items.Add($"WoW x64 [Beta] => {process.Id}"); } processes = Process.GetProcessesByName("WowT-64"); foreach (var process in processes) { cmbWoW.Items.Add($"WoW x64 [PTR] => {process.Id}"); } if (cmbWoW.Items.Count > 0) { cmbWoW.SelectedIndex = 0; cmbWoW.Enabled = true; cmdConnect.Enabled = true; } else { cmbWoW.Items.Add("Please open WoW then click 'Refresh' button."); cmbWoW.SelectedIndex = 0; cmbWoW.Enabled = false; cmdConnect.Enabled = false; } foreach (var fileName in Directory.GetFiles(Application.StartupPath + "\\Rotations", "*.*", SearchOption.AllDirectories)) { cmbRotation.Items.Add(fileName.Replace(Application.StartupPath + "\\Rotations", "").Substring(1)); } if (cmbRotation.Items.Count > 0) { var lastRotation = ConfigFile.ReadValue("PixelMagic", "LastProfile"); if (lastRotation != "") { lastRotation = lastRotation.Replace(Application.StartupPath + "\\Rotations", "").Substring(1); cmbClass.Text = lastRotation.Split('\\')[0]; cmbRotation.Text = lastRotation; } else { if (cmbClass.Text != "") { cmbRotation.SelectedIndex = 0; } } cmbRotation.Enabled = true; } else { cmbRotation.Enabled = false; } }
public static void Bind(ConfigFile config) { //Stamina BaseStamina = config.Bind("Stamina", "BaseStamina", 75f, new ConfigDescription("Base player stamina; vanilla: 75", new AcceptableValueRange <float>(10f, 150f))); StaminaMinimum = config.Bind("Stamina", "StaminaMinimum", -50f, new ConfigDescription("Base stamina minimum, stamina is not usable in negative values but can be reached by using more stamina than you have; vanilla: 0", new AcceptableValueRange <float>(-150f, 0f))); StaminaRegen = config.Bind("Stamina", "StaminaRegen", 12f, new ConfigDescription("Base stamina regen; vanilla: 6", new AcceptableValueRange <float>(0f, 30f))); StaminaDelay = config.Bind("Stamina", "StaminaDelay", 1.75f, new ConfigDescription("Base stamina regen delay; vanilla: 1", new AcceptableValueRange <float>(0f, 20f))); DodgeStamina = config.Bind("Stamina", "DodgeStamina", 12f, new ConfigDescription("Base dodge stamina usage; vanilla: 10", new AcceptableValueRange <float>(0f, 40f))); JumpStamina = config.Bind("Stamina", "JumpStamina", 5f, new ConfigDescription("Base jump stamina usage; vanilla: 10", new AcceptableValueRange <float>(0f, 40f))); BuildUseStamina = config.Bind("Stamina", "BuildUseStamina", false, new ConfigDescription("Enable or disable stamina usage when building, cultivating or uh.. hoeing")); StaminaUseMultiplier = config.Bind("Stamina", "StaminaUseMultiplier", 1.5f, new ConfigDescription("Final stamina usage multiplier for any action; vanilla: 1", new AcceptableValueRange <float>(0f, 10f))); //Player BaseHealth = config.Bind("Player", "BaseHealth", 50f, new ConfigDescription("Base player health; vanilla: 25", new AcceptableValueRange <float>(1f, 150f))); Acceleration = config.Bind("Player", "Acceleration", 0.25f, new ConfigDescription("Base player movement acceleration; vanilla: 1", new AcceptableValueRange <float>(0.01f, 5f))); ParryTime = config.Bind("Player", "ParryTime", 0.13f, new ConfigDescription("Base parry time in seconds; vanilla: 0.25", new AcceptableValueRange <float>(0f, 5f))); ParryRefundEnable = config.Bind("Player", "ParryRefundEnable", true, new ConfigDescription("Enable or disable parry stamina refunds")); ParryRefundMultiplier = config.Bind("Player", "ParryRefundMultiplier", 1f, new ConfigDescription("Final stamina refund multiplier applied for a successful parry", new AcceptableValueRange <float>(0f, 10f))); WeaponWeightStaminaScalingEnable = config.Bind("Player", "WeaponWeightStaminaScalingEnable", true, new ConfigDescription("Enable or disable stamina usage increase based on weapon weight (note that this applies before stamina use multiplier)")); //Food FoodHealthMin = config.Bind("Food", "FoodHealthMin", 10f, new ConfigDescription("Minimum health a food item can give after multipliers", new AcceptableValueRange <float>(0f, 100f))); FoodHealthMultiplier = config.Bind("Food", "FoodHealthMultiplier", 0.8f, new ConfigDescription("Multiplier applied to food health", new AcceptableValueRange <float>(0f, 10f))); FoodStaminaMin = config.Bind("Food", "FoodStaminaMin", 20f, new ConfigDescription("Minimum stamina a food item can give after multipliers", new AcceptableValueRange <float>(0f, 100f))); FoodStaminaMultiplier = config.Bind("Food", "FoodStaminaMultiplier", 0.6f, new ConfigDescription("Multiplier applied to food stamina", new AcceptableValueRange <float>(0f, 10f))); FoodBurnTimeMultiplier = config.Bind("Food", "FoodBurnTimeMultiplier", 1.5f, new ConfigDescription("Multiplier applied to food burn time; vanilla: 1", new AcceptableValueRange <float>(0.01f, 10f))); //Exhaustion ExhaustionEnable = config.Bind("Exhaustion", "ExhaustionEnable", true, new ConfigDescription("Enable or disable exhaustion sprinting system, player will enter 'pushing' state when sprinting at the configured pushing threshold, and 'exhausted' state at the configured exhaustion threshold")); ExhaustionThreshold = config.Bind("Exhaustion", "ExhaustionThreshold", -40f, new ConfigDescription("Stamina threshold to activate exhaustion debuff", new AcceptableValueRange <float>(-150f, 0f))); ExhaustionRecoveryThreshold = config.Bind("Exhaustion", "ExhaustionRecoveryThreshold", 0.8f, new ConfigDescription("Stamina percentage (where 0.0 = 0%, 1.0 = 100%) threshold to deactivate exhaustion debuff", new AcceptableValueRange <float>(0f, 1f))); ExhaustionSpeedMultiplier = config.Bind("Exhaustion", "ExhaustionSpeedModifier", 0.25f, new ConfigDescription("Movement speed multiplier applied when exhausted (note this stacks with the pushing speed modifier)", new AcceptableValueRange <float>(0f, 1f))); PushingThreshold = config.Bind("Exhaustion", "PushingThreshold", 0f, new ConfigDescription("Stamina threshold to apply pushing debuff (speed modifier and sweating effect) at", new AcceptableValueRange <float>(-150f, 100f))); PushingSpeedMultiplier = config.Bind("Exhaustion", "PushingSpeedModifier", 0.85f, new ConfigDescription("Movement speed multiplier applied when pushing", new AcceptableValueRange <float>(0f, 1f))); PushingWarms = config.Bind("Exhaustion", "PushingWarms", true, new ConfigDescription("Enable or disable the pushing debuff 'warming' the player (applies 'warm' debuff; reduces time remaining on 'wet' debuff and temporarily removes 'cold' debuff)")); PushingWarmRate = config.Bind("Exhaustion", "PushingWarmRate", 4f, new ConfigDescription("The rate at which pushing warms the player, reducing time on the 'wet' debuff", new AcceptableValueRange <float>(0f, 20f))); PushingWarmTimeRate = config.Bind("Exhaustion", "PushingWarmTimeRate", 5f, new ConfigDescription("The rate at which more time is generated for the 'warm' debuff", new AcceptableValueRange <float>(0f, 20f))); PushingWarmInitialTime = config.Bind("Exhaustion", "PushingWarmInitialTime", 2f, new ConfigDescription("The initial amount of time the player gains the 'warm' debuff for", new AcceptableValueRange <float>(1f, 30f))); //Encumberance BaseCarryWeight = config.Bind("Encumberance", "BaseCarryWeight", 200f, new ConfigDescription("Base carry weight; vanilla: 300", new AcceptableValueRange <float>(0f, 1000f))); EncumberanceAltEnable = config.Bind("Encumberance", "EncumberanceAltEnable", true, new ConfigDescription("Enable or disable alternative encumberance, scales movement speed on carry weight")); EncumberanceAltMinSpeed = config.Bind("Encumberance", "EncumberanceAltMinSpeed", 0.6f, new ConfigDescription("The minimum speed multiplier applied when reaching the alt encumberance threshold", new AcceptableValueRange <float>(0.6f, 1f))); EncumberanceAltMaxSpeed = config.Bind("Encumberance", "EncumberanceAltMaxSpeed", 1.1f, new ConfigDescription("The maximum speed multiplier applied when unencumbered", new AcceptableValueRange <float>(0.6f, 2f))); EncumberanceAltThreshold = config.Bind("Encumberance", "EncumberanceAltThreshold", 400f, new ConfigDescription("The carry weight threshold at which to apply the encumbered status", new AcceptableValueRange <float>(0f, 1000f))); EncumberedDrain = config.Bind("Encumberance", "EncumberanceDrain", 2f, new ConfigDescription("Base stamina drain when encumbered, applies regardless of alternative encumberance; vanilla: 10", new AcceptableValueRange <float>(0f, 20f))); //NexusID NexusID = config.Bind("Utility", "NexusID", 297, "Nexus Mod ID for updates, do not change"); BaseHealthStaminaEnable = config.Bind("Utility", "BaseHealthStaminaEnable", true, "Enables or disables base health and stamina adjustments (note other mods may disable this functionality by nature). " + "The method of modification used is somewhat fragile and could break with any update to the game, or not play ball with another mod that touches the same values, as such " + "I'm giving you the option to disable the patching process here should anything break."); var sanity = IsConfigSane(); if (!sanity.sane) { UnityEngine.Debug.LogError($"Configuration invalid: {sanity.reason}"); } }
public void CreateConfig(ConfigFile config) { Num3NGBotsSpawned = config.Bind <int>("Item: " + ItemName, "Number of Bots Spawned", 1, "How many 3NG bots should spawn when item is picked up?").Value; }
private static string GenerateIncludeConfigContents(ConfigFile configRoot, ConfigFile configFile, IReadOnlyCollection <ConfigFile> filesWithIncludes, ISet <ConfigFile> filesWithExtensionHeaders, string prolog) { using var outputConfig = new StringWriter(); outputConfig.WriteLine("// SharpGen include config [{0}] - Version {1}", configFile.Id, Version); if (configRoot.Id == configFile.Id) { outputConfig.Write(prolog); } // Write includes foreach (var includeRule in configFile.Includes) { if (!string.IsNullOrEmpty(includeRule.Pre)) { outputConfig.WriteLine(includeRule.Pre); } outputConfig.WriteLine("#include \"{0}\"", includeRule.File); if (!string.IsNullOrEmpty(includeRule.Post)) { outputConfig.WriteLine(includeRule.Post); } } // Write includes to references foreach (var reference in configFile.References) { if (filesWithIncludes.Contains(reference)) { outputConfig.WriteLine("#include \"{0}\"", reference.HeaderFileName); } } // Dump Create from macros if (filesWithExtensionHeaders.Contains(configFile)) { foreach (var typeBaseRule in configFile.Extension) { if (typeBaseRule.GeneratesExtensionHeader()) { outputConfig.WriteLine("// {0}", typeBaseRule); } } // Include extension header if it exists // so we can generate extension headers without needing them to already exist. outputConfig.WriteLine("#if __has_include(\"{0}\")", configFile.ExtensionFileName); outputConfig.WriteLine("#include \"{0}\"", configFile.ExtensionFileName); outputConfig.WriteLine("#endif"); } var outputConfigStr = outputConfig.ToString(); return(outputConfigStr); }