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


C# IDatabase.Load方法代码示例

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


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

示例1: Init

        public static void Init()
        {
            Version = new CVar("smod_version", "0.1");

            // load plugins

            Server.Print(License);
            Server.RegisterCommand("smod", smod);

            Verifier = new Verifier(Directory.GetCurrentDirectory(), Server.GameDirectory);

            try {
                var doc = new System.Xml.XmlDocument();
                doc.Load(Path.Combine(Server.ModDirectory, Path.Combine("cfg", "databases.xml")));
                try {
                    Database = DefaultDatabase.Load(Path.Combine(Server.ModDirectory, "SharpMod.Database.MySql.dll"));
                    Database.Load(doc);
                } catch (Exception e) {
                    Server.LogError("Database Interface failed to load, using default: {0}", e.Message);
                    Database = new DefaultDatabase();
                    Database.Load(doc);
                }
            } catch (Exception e) {
                Server.LogError("Failed to load cfg/databases.xml: {0}", e.Message);
            }

            Message.Init();
            MapCycle.Init();
        }
开发者ID:txdv,项目名称:sharpmod,代码行数:29,代码来源:SharpMod.cs

示例2: Load

 private static void Load(IDatabase database, string xml)
 {
     var stringReader = new StringReader(xml);
     var reader = new XmlTextReader(stringReader);
     database.Load(reader);
     reader.Close();
 }
开发者ID:whesius,项目名称:allors,代码行数:7,代码来源:SerializationTest.cs

示例3: LoadDb

		/// <summary>
		/// Loads db, first from system, then from user.
		/// Logs problems as warnings.
		/// </summary>
		private void LoadDb(IDatabase db, string path, bool reload, bool log = true)
		{
			var systemPath = Path.Combine("system", path).Replace('\\', '/');
			var userPath = Path.Combine("user", path).Replace('\\', '/');

			var cachePath = Path.Combine("cache", path).Replace('\\', '/');
			cachePath = Path.ChangeExtension(cachePath, "mpk");
			var cacheDir = Path.GetDirectoryName(cachePath);
			if (!Directory.Exists(cacheDir))
				Directory.CreateDirectory(cacheDir);

			if (!File.Exists(systemPath))
				throw new FileNotFoundException("Data file '" + systemPath + "' couldn't be found.", systemPath);

			db.Load(new string[] { systemPath, userPath }, cachePath, reload);

			foreach (var ex in db.Warnings)
				Log.Warning("{0}", ex.ToString());

			if (log)
				Log.Info("  done loading {0} entries from {1}", db.Count, Path.GetFileName(path));
		}
开发者ID:ripxfrostbite,项目名称:aura,代码行数:26,代码来源:ServerMain.cs

示例4: LoadDb

        private static void LoadDb(IDatabase db, string path, bool reload, bool log = true)
        {
            db.Load(path, reload);
            PrintDataWarnings(db.Warnings);

            if (log)
                Logger.Info("Done loading {0} entries from {1}.", db.Count, Path.GetFileName(path));
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:8,代码来源:ServerUtil.cs

示例5: LoadDb

        /// <summary>
        /// Loads db, first from system, then from user.
        /// Logs problems as warnings.
        /// </summary>
        private void LoadDb(IDatabase db, string path, bool reload, bool log = true)
        {
            var systemPath = Path.Combine("system", path);
            var userPath = Path.Combine("user", path);

            // System
            {
                db.Load(systemPath, reload);

                foreach (var ex in db.Warnings)
                    Log.Warning(ex.ToString());
            }

            // User
            {
                // It's okay if user dbs don't exist.
                if (File.Exists(userPath))
                {
                    db.Load(userPath, false);

                    foreach (var ex in db.Warnings)
                        Log.Warning(ex.ToString());
                }
            }

            if (log)
                Log.Info("  done loading {0} entries from {1}", db.Count, Path.GetFileName(path));
        }
开发者ID:pie3467,项目名称:aura,代码行数:32,代码来源:ServerMain.cs


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