当前位置: 首页>>代码示例>>C#>>正文


C# Properties.Load方法代码示例

本文整理汇总了C#中Properties.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Properties.Load方法的具体用法?C# Properties.Load怎么用?C# Properties.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Properties的用法示例。


在下文中一共展示了Properties.Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Load

        public override void Load()
        {
            Name = "TDSMPlugin Example";
            Description = "Plugin Example for TDSM.";
            Author = "DeathCradle";
            Version = "1";
            TDSMBuild = 32; //You put here the release this plugin was made/build for.

            plugin = this;

            string pluginFolder = Statics.PluginPath + Path.DirectorySeparatorChar + "TDSM";
            //Create folder if it doesn't exist
            CreateDirectory(pluginFolder);

            //setup a new properties file
            properties = new Properties(pluginFolder + Path.DirectorySeparatorChar + "tdsmplugin.properties");
            properties.Load();
            properties.pushData(); //Creates default values if needed. [Out-Dated]
            properties.Save();

            //read properties data
            spawningAllowed = properties.SpawningCancelled;
            tileBreakageAllowed = properties.TileBreakage;
            explosivesAllowed = properties.ExplosivesAllowed;
        }
开发者ID:Dyrian,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:25,代码来源:TDSMPlugin.cs

示例2: Load

        public override void Load()
        {
            Name = "rakAntiGrief";
            Description = "Attempts to stop common griefing attempts";
            Author = "rakiru";
            Version = "0.1.17";
            TDSMBuild = 28; //Current Release - Working

            string pluginFolder = Statics.PluginPath + Path.DirectorySeparatorChar + Name;
            //Create folder if it doesn't exist
            CreateDirectory(pluginFolder);

            //setup a new properties file
            properties = new Properties(pluginFolder + Path.DirectorySeparatorChar + Name + ".properties");
            properties.Load();
            //properties.pushData(); //Creates default values if needed. [Out-Dated]
            properties.Save();

            //read properties data
            configDoorChange = properties.DoorChange;
            configTileChange = properties.TileChange;
            configSignEdit = properties.SignEdit;
            configPlayerProjectile = properties.PlayerProjectile;
            configRange = properties.Range;
        }
开发者ID:UndeadMiner,项目名称:rakAntiGrief,代码行数:25,代码来源:rakAntiGrief.cs

示例3: Load

        public override void Load()
        {
            Name = "TDSMPlugin Example";
            Description = "Plugin Example for TDSM.";
            Author = "DeathCradle";
            Version = "1";
            TDSMBuild = 9;

            string pluginFolder = Statics.getPluginPath + Statics.systemSeperator + "TDSM";
            //Create fodler if it doesn't exist
            if (!Program.createDirectory(pluginFolder, true))
            {
                Program.tConsole.WriteLine("[TSDM Plugin] Failed to create crucial Folder");
                return;
            }

            //setup a new properties file
            properties = new Properties(pluginFolder + Statics.systemSeperator + "tdsmplugin.properties");
            properties.Load();
            properties.pushData(); //Creates default values if needed.
            properties.Save();

            //read properties data
            spawningAllowed = properties.isSpawningCancelled();
            tileBreakageAllowed = properties.getTileBreakage();
            explosivesAllowed = properties.isExplosivesAllowed();

            isEnabled = true;
        }
开发者ID:cwalter5,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:29,代码来源:TDSMPlugin.cs

示例4: Load

        public override void Load()
        {
            Name = "WarpDrive";
            Description = "Warp commands for TDSM";
            Author = "Envoy"; // see credits above, most of this is borrowed
            Version = "1.5.28";
            TDSMBuild = 28;

            Log("version " + base.Version + " Loading...");

            string pluginFolder = Statics.PluginPath + Path.DirectorySeparatorChar + Name;
            CreateDirectory(pluginFolder);

            //setup a new properties file
            properties = new Properties(pluginFolder + Path.DirectorySeparatorChar + "warpdrive.properties");
            properties.Load();
            properties.pushData(); //Creates default values if needed.
            properties.Save();

            //read properties data
            requiresOp = properties.requiresOp();
            globalOwnershipEnforced = properties.globalOwnershipEnforced();
            warpHomeOnDeath = properties.warpHomeOnDeath();

            // spit out useful property info
            Log("Requires Op: " + requiresOp);
            Log("Global Ownership Enforced: " + globalOwnershipEnforced);
            Log("Warp Home on Death: " + warpHomeOnDeath);

            //setup new WarpDriveEngine
            warpDriveEngine = new WarpDriveEngine(this, pluginFolder + Path.DirectorySeparatorChar + "warps.xml");

            isEnabled = true;
        }
开发者ID:FourFourHero,项目名称:TDSM-WarpDrive,代码行数:34,代码来源:WarpDrivePlugin.cs

示例5: ReadAppProps

		public AppProps ReadAppProps()
		{
			if (null == appPropsObj) {
				Properties appProps = new Properties();
				Stream input = null;
				ILogService logger = ServiceFinder.Resolve<ILogService>();
                bool foundLocalDevProps = false;
				try {
                    try
                    {
                        input = Application.Context.Assets.Open(LOCAL_DEV_APP_PROP_FILE);
                        foundLocalDevProps = true;
                    }
                    catch (Exception ex)
                    {
                        input = null;
                        foundLocalDevProps = false;
                        input = Application.Context.Assets.Open(APP_PROP_FILE);
                    }
					appProps.Load(input);
					appPropsObj = new AppProps();
					appPropsObj.projectid = appProps.GetProperty(PROJECT_ID_PROP);
					appPropsObj.appid = appProps.GetProperty(APP_ID_PROP);
					appPropsObj.appkey = appProps.GetProperty(APP_KEY_PROP);
					appPropsObj.host = appProps.GetProperty(HOST_PROP);
					appPropsObj.connectiontag = appProps.GetProperty(CONNECTION_TAG_PROP);
					appPropsObj.mode = appProps.GetProperty(MODE_PROP);
                    if(foundLocalDevProps){
                        appPropsObj.IsLocalDevelopment = true;
                    }
					return appPropsObj;
				} catch (Exception ex) {
					if(null != logger) {
						logger.e(TAG, "Failed to load " + APP_PROP_FILE, ex);
					}
					return null;

				} finally {
					if(null != input){
						try {
							input.Close();
						} catch (Exception exc) {
							if(null != logger){
								logger.w(TAG, "Failed to close stream", exc);
							}
						}
					}
				}
			}
			return appPropsObj;
		}
开发者ID:swizzley,项目名称:fh-dotnet-sdk,代码行数:51,代码来源:DeviceService.cs

示例6: ReadAppProps

 public AppProps ReadAppProps()
 {
     if (null != _appPropsObj) return _appPropsObj;
     var appProps = new Properties();
     Stream input = null;
     var logger = ServiceFinder.Resolve<ILogService>();
     try
     {
         bool foundLocalDevProps;
         try
         {
             input = Application.Context.Assets.Open(LocalDevAppPropFile);
             foundLocalDevProps = true;
         }
         catch (Exception)
         {
             input = null;
             foundLocalDevProps = false;
             input = Application.Context.Assets.Open(AppPropFile);
         }
         appProps.Load(input);
         _appPropsObj = new AppProps
         {
             projectid = appProps.GetProperty(ProjectIdProp),
             appid = appProps.GetProperty(AppIdProp),
             appkey = appProps.GetProperty(AppKeyProp),
             host = appProps.GetProperty(HostProp),
             connectiontag = appProps.GetProperty(ConnectionTagProp),
             mode = appProps.GetProperty(ModeProp)
         };
         if (foundLocalDevProps)
         {
             _appPropsObj.IsLocalDevelopment = true;
         }
         return _appPropsObj;
     }
     catch (Exception ex)
     {
         logger?.e(Tag, "Failed to load " + AppPropFile, ex);
         return null;
     }
     finally
     {
         input?.Dispose();
     }
 }
开发者ID:secondsun,项目名称:fh-dotnet-sdk,代码行数:46,代码来源:DeviceService.cs

示例7: Init

        public void Init()
        {
            try {
                Properties properties = new Properties();
                properties.Load(new FileStream("test-fixtures.properties", FileMode.Open));

                if (properties.ContainsKey("goldSrcServerAddress")) goldSrcServerAddress =           properties["goldSrcServerAddress"];
                if (properties.ContainsKey("goldSrcServerPort"))    goldSrcServerPort    = int.Parse(properties["goldSrcServerPort"]);
                if (properties.ContainsKey("goldSrcServerAuth"))    goldSrcServerAuth    =           properties["goldSrcServerAuth"];
                if (properties.ContainsKey("goldSrcServerTimeout")) goldSrcServerTimeout = int.Parse(properties["goldSrcServerTimeout"]);

                if (properties.ContainsKey("sourceServerAddress")) sourceServerAddress =           properties["sourceServerAddress"];
                if (properties.ContainsKey("sourceServerPort"))    sourceServerPort    = int.Parse(properties["sourceServerPort"]);
                if (properties.ContainsKey("sourceServerAuth"))    sourceServerAuth    =           properties["sourceServerAuth"];
                if (properties.ContainsKey("sourceServerTimeout")) sourceServerTimeout = int.Parse(properties["goldSrcServerTimeout"]);
            } catch { }
        }
开发者ID:nefarius,项目名称:steam-condenser-csharp,代码行数:17,代码来源:RCONTests.cs

示例8: TestSerializer

        public void TestSerializer() {

            using (var stream = new MemoryStream()) {
                
                prop.Save(new UnclosableStream(stream));

                stream.Seek(0, SeekOrigin.Begin);

                var other = new Properties();
                other.Load(stream);

                Assert.AreEqual(prop.Count, other.Count);
                Assert.AreEqual(prop, other);
            }
            
           


        }
开发者ID:lovethisgame,项目名称:SharpNL,代码行数:19,代码来源:PropertiesSeriealizerTest.cs

示例9: LoadInto

        public void LoadInto(IConfiguration config, Stream inputStream)
        {
            if (inputStream == null)
                throw new ArgumentNullException("inputStream");

            try {
                var properties = new Properties();
                properties.Load(inputStream);

                foreach (var entry in properties) {
                    var propKey = (string) entry.Key;
                    SetValue(config, propKey, (string) entry.Value);
                }
            } catch (DatabaseConfigurationException) {
                throw;
            } catch (Exception ex) {
                throw new DatabaseConfigurationException("Could not load properties from the given stream.", ex);
            }
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:19,代码来源:PropertiesConfigFormatter.cs

示例10: Load

        public override void Load()
        {
            Name = "amarrinerPlugin";
            Description = "Learning how to create a TDSM plugin";
            Author = "amarriner";
            Version = "1";
            TDSMBuild = 30; //Current Release - Working

            plugin = this;

            string pluginFolder = Statics.PluginPath + Path.DirectorySeparatorChar + "amarrinerPlugin";
            //Create folder if it doesn't exist
            CreateDirectory(pluginFolder);

            //setup a new properties file
            properties = new Properties(pluginFolder + Path.DirectorySeparatorChar + "amarrinerplugin.properties");
            properties.Load();
            properties.Save();

            //read properties data
            //spawningAllowed = properties.SpawningCancelled;
        }
开发者ID:amarriner,项目名称:amarriner-Plugin,代码行数:22,代码来源:amarrinerPlugin.cs

示例11: Initialized

        protected override void Initialized(object state)
        {
            string pluginFolder = Statics.PluginPath + Path.DirectorySeparatorChar + Name;
            //Create folder if it doesn't exist
            CreateDirectory(pluginFolder);

            //setup a new properties file
            properties = new Properties(pluginFolder + Path.DirectorySeparatorChar + Name + ".properties");
            properties.Load();

            //read properties data
            configExtendedReachDoor = properties.ExtendedReachDoor;
            configExtendedReach = properties.ExtendedReach;
            configExtendedReachSign = properties.ExtendedReachSign;
            configBlockExplosives = properties.BlockExplosives;
            configExtendedReachRange = properties.ExtendedReachRange;
            configBlockLavaFlow = properties.BlockLavaFlow;
            configBlockWaterFlow = properties.BlockWaterFlow;
            configBlockChatSpam = properties.BlockChatSpam;
            configBlockMovementNoclip = properties.BlockMovementNoclip;
            configBlockMovementTeleport = properties.BlockMovementTeleport;
            configBlockMovementTeleportDistance = properties.BlockMovementTeleportDistance;
            configSpawnProtection = properties.SpawnProtection;
            configSpawnProtectionType = properties.SpawnProtectionType;
            configSpawnProtectionRange = properties.SpawnProtectionRange;
            properties.Save();

            states = new HashSet<PlayerState>();
            timer = new System.Threading.Timer(RepeatingTask);
            timer.Change(1000, 1000);
            timer2 = new System.Threading.Timer(RepeatingTask2);
            timer2.Change(10000, 10000);
        }
开发者ID:elevatorguy,项目名称:rakAntiGrief,代码行数:33,代码来源:rakAntiGrief.cs

示例12: Initialized

        protected override void Initialized(object state)
        {
            Name = "Essentials";
            Description = "Essential commands for TDSM.";
            Author = "Luke";
            Version = "0.6";
            TDSMBuild = 29;

            string pluginFolder = Statics.PluginPath + Path.DirectorySeparatorChar + "Essentials";
            string kitsFile = pluginFolder + Path.DirectorySeparatorChar + "kits.xml";
            string propertiesFile = pluginFolder + Path.DirectorySeparatorChar + "essentials.properties";

            lastEventByPlayer = new Dictionary<String, String>();
            essentialsPlayerList = new Dictionary<int, bool>();

            if (!Directory.Exists(pluginFolder))
                CreateDirectory(pluginFolder); //Touch Directory, We need this.

            //We do not want to delete records!
            if (!File.Exists(kitsFile))
                File.Create(kitsFile).Close();

            if (!File.Exists(propertiesFile))
                File.Create(propertiesFile).Close();

            properties = new Properties(pluginFolder + Path.DirectorySeparatorChar + "essentials.properties");
            properties.Load();
            properties.pushData();
            properties.Save();

            Log("Loading Kits...");
            kitManager = new KitManager(kitsFile);

            LOADKITS:
            try
            {
                    kitManager.LoadKits();
            }
            catch (Exception)
            {
                Console.Write("Create a parsable file? [Y/n]: ");
                if (Console.ReadLine().ToLower() == "y")
                {
                    kitManager.CreateTemplate();
                    goto LOADKITS; //Go back to reload data ;)...I'm lazy I KNOW
                }
            }
            Log("Complete, Loaded " + kitManager.KitList.Count + " Kit(s)");
        }
开发者ID:Stickiler,项目名称:Essentials-TDSM,代码行数:49,代码来源:Essentials.cs

示例13: Initialized

        protected override void Initialized(object state)
        {
            if (!Directory.Exists(RegionsFolder))
                Directory.CreateDirectory(RegionsFolder);

            rProperties = new Properties(RegionsFolder + Path.DirectorySeparatorChar + "regions.properties");
            rProperties.Load();

            rProperties.AddHeaderLine("Use 'rectify=false' to ignore world alterations from");
            rProperties.AddHeaderLine("players who are blocked; Possibly saving bandwidth.");

            rProperties.pushData();
            rProperties.Save();

            if (rProperties.RectifyChanges)
                WorldAlter = HookResult.RECTIFY;

            SelectorItem = rProperties.SelectionToolID;

            regionManager = new RegionManager(DataFolder);

            selection = new Selection();

            commands = new Commands();
            commands.regionManager = regionManager;
            commands.RegionsPlugin = this;
            commands.selection = selection;

            AddCommand("region")
                .WithAccessLevel(AccessLevel.OP)
                .WithHelpText("Usage:    region [select, create, user, list, npcres, opres]")
                .WithDescription("Region Management.")
                .WithPermissionNode("regions")
                .Calls(commands.Region);

            AddCommand("regions")
                .WithAccessLevel(AccessLevel.OP)
                .WithHelpText("Usage:    regions [select, create, user, list, npcres, opres]")
                .WithDescription("Region Management.")
                .WithPermissionNode("regions") //Need another method to split the commands up.
                .Calls(commands.Region);

            Hook(HookPoints.PlayerWorldAlteration,  OnPlayerWorldAlteration);
            Hook(HookPoints.LiquidFlowReceived,     OnLiquidFlowReceived);
            Hook(HookPoints.ProjectileReceived,     OnProjectileReceived);
            Hook(HookPoints.PlayerEnteredGame,      OnPlayerEnteredGame);
            Hook(HookPoints.ServerStateChange,      OnServerStateChange);
            Hook(HookPoints.DoorStateChanged,       OnDoorStateChange);
            Hook(HookPoints.ChestBreakReceived,     OnChestBreak);
            Hook(HookPoints.SignTextSet,            OnSignEdit);

            UsingPermissions = isRunningPermissions();
            if (UsingPermissions)
                Log("Using Permissions.");
            else
                Log("No Permissions Found\nUsing Internal User System");
        }
开发者ID:Skiles,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:57,代码来源:Regions.cs

示例14: Enable

        public override void Enable()
        {
            lastTime = Server.time;

            pluginFolder = Statics.PluginPath + Path.DirectorySeparatorChar + "House";
            CreateDirectory(pluginFolder);

            properties = new Properties(pluginFolder + Path.DirectorySeparatorChar + "house.properties");
            properties.Load();
            properties.Save();
            maxArea = properties.MaxArea;
            minHeight = properties.MinHeight;
            maxHeight = properties.MaxHeight;
            maxHouses = properties.MaxHouses;
            playersCanTeleport = properties.PlayersCanTeleport;
            playersCanMakeHouses = properties.PlayersCanMakeHouses;

            LoadHouseData();

            Program.tConsole.WriteLine(base.Name + " enabled.");
        }
开发者ID:Ricealso,项目名称:House,代码行数:21,代码来源:House.cs

示例15: Initialized

        protected override void Initialized(object state)
        {
            if (!Directory.Exists(RegionsFolder))
                Directory.CreateDirectory(RegionsFolder);

            rProperties = new Properties(RegionsFolder + Path.DirectorySeparatorChar + "regions.properties");
            rProperties.Load();

            rProperties.AddHeaderLine("Use 'rectify=false' to ignore world alterations from");
            rProperties.AddHeaderLine("players who are blocked; Possibly saving bandwidth.");

            rProperties.pushData();
            rProperties.Save(false);

            if (rProperties.RectifyChanges)
                WorldAlter = HookResult.RECTIFY;

            SelectorItem = rProperties.SelectionToolID;
            #region set up mysql properties

            string pluginFolder = Statics.PluginPath + Path.DirectorySeparatorChar + "mysql";
            if (!Directory.Exists(pluginFolder))
            {
                Directory.CreateDirectory(pluginFolder);
            }

            mysql = new PropertiesFile(pluginFolder + Path.DirectorySeparatorChar + "mysql.properties");
            mysql.Load();
            var dummy1 = mysqlenabled;
            var dummy2 = mysqlserver;
            var dummy3 = mysqldatabase;
            var dummy4 = mysqluser;
            var dummy5 = mysqlpassword;
            var dummy6 = imported;
            mysql.Save(false);

            #endregion

            #region check if mysql table exists
            if (mysqlenabled)
            {
                try
                {
                    checkTable(connectionString, "terraria_regions");
                }
                catch (MySqlException e)
                {
                    if (e.Number == 1042)
                    {
                        ProgramLog.Error.Log("[Regions] Could not connect to mysql server. Falling back to using regions files");
                        mysql.setValue("mysql-enabled", "False");
                        mysql.Save();
                    }
                    else
                    {
                        ProgramLog.Error.Log("[Regions] MYSQL ERROR CODE: " + e.Number);
                        ProgramLog.Error.Log(e.StackTrace);
                    }
                }
            }
            #endregion

            regionManager = new RegionManager(DataFolder);
            selection = new Selection();

            commands = new Commands();
            commands.regionManager = regionManager;
            commands.RegionsPlugin = this;
            commands.selection = selection;

            commands.Node_Create        = Node.FromPath("region.create");
            commands.Node_Here          = Node.FromPath("region.here");
            commands.Node_List          = Node.FromPath("region.list");
            commands.Node_Npcres        = Node.FromPath("region.npcres");
            commands.Node_Opres         = Node.FromPath("region.opres");
            commands.Node_Projectile    = Node.FromPath("region.projectile");
            commands.Node_ProtectAll    = Node.FromPath("region.protectall");
            commands.Node_Select        = Node.FromPath("region.select");
            commands.Node_User          = Node.FromPath("region.user");

            AddCommand("region")
                .WithAccessLevel(AccessLevel.OP)
                .WithHelpText("Usage:    region [select, create, user, list, npcres, opres]")
                .WithDescription("Region Management.")
                .WithPermissionNode("regions")
                .Calls(commands.Region);

            AddCommand("regions")
                .WithAccessLevel(AccessLevel.OP)
                .WithHelpText("Usage:    regions [select, create, user, list, npcres, opres]")
                .WithDescription("Region Management.")
                .WithPermissionNode("regions") //Need another method to split the commands up.
                .Calls(commands.Region);

            ChestBreak      = AddAndCreateNode("region.chestbreak");
            ChestOpen       = AddAndCreateNode("region.chestopen");
            DoorChange      = AddAndCreateNode("region.doorchange");
            LiquidFlow      = AddAndCreateNode("region.liquidflow");
            ProjectileUse   = AddAndCreateNode("region.projectileuse");
            SignEdit        = AddAndCreateNode("region.signedit");
//.........这里部分代码省略.........
开发者ID:zealic,项目名称:TDSM,代码行数:101,代码来源:Regions.cs


注:本文中的Properties.Load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。