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


C# Properties.Save方法代码示例

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


在下文中一共展示了Properties.Save方法的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 = "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

示例3: 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

示例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: Version

		public void Version_SerializeThenDeserializeRecentPackageInfoInPropertiesObject_ReturnsSameValueAfterDeserialization()
		{
			var version = new Version(1, 0);
			var recentPackageInfo = new RecentPackageInfo("id", version);
			var properties = new Properties();
			properties.Set<RecentPackageInfo>("RecentPackageInfo", recentPackageInfo);
			
			var xml = new StringBuilder();
			var stringWriter = new StringWriter(xml);
			var writer = new XmlTextWriter(stringWriter);
			properties.Save(writer);
			
			var stringReader = new StringReader(xml.ToString());
			var reader = new XmlTextReader(stringReader);
			properties = Properties.Load(reader);
			
			var deserializedRecentPackageInfo = properties.Get<RecentPackageInfo>("RecentPackageInfo", null);
			
			Assert.AreEqual(recentPackageInfo.Version, deserializedRecentPackageInfo.Version);
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:20,代码来源:RecentPackageInfoTests.cs

示例6: 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

示例7: Enabled

        protected override void Enabled()
        {
            pluginFolder = Statics.PluginPath + Path.DirectorySeparatorChar + "House";
            CreateDirectory(pluginFolder);

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

            LoadHouseData();
            startSaveThread();
            Log(base.Name + " enabled.");
        }
开发者ID:elevatorguy,项目名称:House,代码行数:19,代码来源:House.cs

示例8: 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

示例9: Save

		void Save(string fileName)
		{
			Properties p = new Properties();
			p.SetList("CustomizedHighlightingRules", customizationList);
			XElement root = p.Save();
			root.SetAttributeValue("version", Properties.FileVersion.ToString());
			new XDocument(root).Save(fileName);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:8,代码来源:HighlightingOptions.xaml.cs

示例10: 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

示例11: SemanticVersion

        public void Version_SerializeThenDeserializeRecentPackageInfoInPropertiesObject_ReturnsSameValueAfterDeserialization()
        {
            var version = new SemanticVersion(1, 0, 0, 0);
            var recentPackageInfo = new RecentPackageInfo("id", version);
            var properties = new Properties();
            properties.Set<RecentPackageInfo>("RecentPackageInfo", recentPackageInfo);

            XElement savedXml = properties.Save();
            properties = Properties.Load(savedXml);
            var deserializedRecentPackageInfo = properties.Get<RecentPackageInfo>("RecentPackageInfo", (RecentPackageInfo)null);

            Assert.AreEqual(recentPackageInfo.Version, deserializedRecentPackageInfo.Version);
        }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:13,代码来源:RecentPackageInfoTests.cs

示例12: SavePosition

 /// <summary>
 /// Save the CommandBar position in application property settings.
 /// </summary>
 /// <param name="settings"></param>
 internal void SavePosition(Properties.Settings settings)
 {
     settings.BarLeft = _commandBar.Left;
       settings.BarPosition = (int)_commandBar.Position;
       settings.BarPositionSaved = true;
       settings.BarRowIndex = _commandBar.RowIndex;
       settings.BarTop = _commandBar.Top;
       settings.Save();
 }
开发者ID:anonghosteam,项目名称:outlook-privacy-plugin,代码行数:13,代码来源:GnuPGCommandBar.cs

示例13: DownloadJars

        protected void DownloadJars()
        {
            Properties md5s = new Properties();
            if (File.Exists(Path.Combine(Inst.BinDir, "md5s")))
                md5s.Load(Path.Combine(Inst.BinDir, "md5s"));
            State = EnumState.DOWNLOADING;

            int[] fileSizes = new int[this.uriList.Length];
            bool[] skip = new bool[this.uriList.Length];

            // Get the headers and decide what files to skip downloading
            for (int i = 0; i < uriList.Length; i++)
            {
                Console.WriteLine("Getting header " + uriList[i].ToString());

                HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uriList[i]);
                request.Timeout = 1000 * 15; // Set a 15 second timeout
                request.Method = "HEAD";

                string etagOnDisk = null;
                if (md5s.ContainsKey(GetFileName(uriList[i])))
                    etagOnDisk = md5s[GetFileName(uriList[i])];

                if (!forceUpdate && !string.IsNullOrEmpty(etagOnDisk))
                    request.Headers[HttpRequestHeader.IfNoneMatch] = etagOnDisk;

                using (HttpWebResponse response = ((HttpWebResponse)request.GetResponse()))
                {
                    int code = (int)response.StatusCode;
                    if (code == 300)
                        skip[i] = true;

                    fileSizes[i] = (int)response.ContentLength;
                    this.totalDownloadSize += fileSizes[i];
                    Console.WriteLine("Got response: " + code + " and file size of " +
                                      fileSizes[i] + " bytes");
                }
            }

            int initialPercentage = Progress;

            byte[] buffer = new byte[1024 * 10];
            for (int i = 0; i < this.uriList.Length; i++)
            {
                if (skip[i])
                {
                    Progress = (initialPercentage + fileSizes[i] *
                                (100 - initialPercentage) / this.totalDownloadSize);
                }
                else
                {
                    string currentFile = GetFileName(uriList[i]);

                    if (currentFile == "minecraft.jar" && File.Exists("mcbackup.jar"))
                        File.Delete("mcbackup.jar");

                    md5s.Remove(currentFile);
                    md5s.Save(Path.Combine(Inst.BinDir, "md5s"));

                    int failedAttempts = 0;
                    const int MAX_FAILS = 3;
                    bool downloadFile = true;

                    // Download the files
                    while (downloadFile)
                    {
                        downloadFile = false;

                        HttpWebRequest request = (HttpWebRequest) HttpWebRequest.Create(uriList[i]);
                        request.Headers[HttpRequestHeader.CacheControl] = "no-cache";

                        HttpWebResponse response = (HttpWebResponse) request.GetResponse();

                        string etag = "";
                        // If downloading from Mojang, use ETag.
                        if (uriList[i].ToString().StartsWith(Resources.MojangMCDLUri))
                        {
                            etag = response.Headers[HttpResponseHeader.ETag];
                            etag = etag.TrimEnd('"').TrimStart('"');
                        }
                        // If downloading from dropbox, ignore MD5s
                        else
                        {
                            // TODO add a way to verify integrity of files downloaded from dropbox
                        }

                        Stream dlStream = response.GetResponseStream();
                        using (FileStream fos =
                            new FileStream(Path.Combine(Inst.BinDir, currentFile), FileMode.Create))
                        {
                            int fileSize = 0;

                            using (MD5 digest = MD5.Create())
                            {
                                digest.Initialize();
                                int readSize;
                                while ((readSize = dlStream.Read(buffer, 0, buffer.Length)) > 0)
                                {
                                    //							Console.WriteLine("Read " + readSize + " bytes");
                                    fos.Write(buffer, 0, readSize);
//.........这里部分代码省略.........
开发者ID:Orochimarufan,项目名称:MultiMC,代码行数:101,代码来源:GameUpdater.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)
        {
            Languages = new Languages();
            Languages.LoadLanguages(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:emreuyls,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:20,代码来源:TDSM_Plugin.cs


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