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


C# IDataStore.connect方法代码示例

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


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

示例1: getCardFromDB

        /// <summary>
        /// Gets a input from the database
        /// </summary>
        /// <param name="BOGUS_ID">The ID of the input object to retreive</param>
        /// <param name="mongo">the database object to use to get the results</param>
        /// <returns>a Card object</returns>
        public Card getCardFromDB(int BOGUS_ID, IDataStore database)
        {
            #region oldCode
            /*
            Document query = new Document(

            Cursor cq = new Cursor();
            c

            query["BOGUS_ID"] = "$in" + BOGUS_ID;
            Document results = mongo["pokemon"]["cards"].Find(

            //TODO: Convert the strings to their proper type internally
            string Name = results["Name"].ToString();
            string Stage = results["Stage"].ToString();
            string Type = results["Type"].ToString();

            //Evolution code (Just noticed that the two keys in the database are in different case
            //now (after an ugly exception) whoever did that should get punched in the head :/
            string[] evolInto = results["EvolvesFrom"].ToString().Split(',');
            string[] evolFrom = results["evolvesInto"].ToString().Split(',');

            Enums.Element type = parseType(Type);
            Enums.Stage stage = parseStage(Stage);
            int HP = 0;
            string Weakness = "";
            string Resistance = "";
            int pNum = 0;
            Attack[] atk = new Attack[2];

            if (type != Enums.Element.Trainer && type != Enums.Element.Energy)
            {
                HP = int.Parse((results["HP"] ?? 0).ToString());
                Weakness = results["Weakness"].ToString();
                Resistance = results["Resistance"].ToString();

                //Give me the pokemon number or -1
                int tryP = -1;

                if (!(int.TryParse(results["pokemonNumberInt"].ToString(), out tryP)))
                {
                    Console.Write("?");
                }

                if (!(results["Attack1"].ToString() == string.Empty)) //If there is an attack 1
                {
                    atk[0] = new Attack(results["Attack1"].ToString());
                    atk[0].damage = results["TypicalDamage1"].ToString();
                }

                if (!(results["Attack2"].ToString() == string.Empty))
                {
                    atk[1] = new Attack(results["Attack2"].ToString());
                    atk[1].damage = (results["TypicalDamage2"].ToString());
                }
            }
            //Make sure to fix input to correct this issue.
            return new Card(BOGUS_ID, Name, HP, Stage, Weakness, Resistance, Type, atk, evolInto, evolFrom, pNum);

             * */
            #endregion
            database.connect();
            return database.getCardbyID(BOGUS_ID);
        }
开发者ID:edude03,项目名称:PokemonTCG,代码行数:70,代码来源:Game.cs


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