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


C# QueryBuilder.SQLInsertRow类代码示例

本文整理汇总了C#中QueryBuilder.SQLInsertRow的典型用法代码示例。如果您正苦于以下问题:C# QueryBuilder.SQLInsertRow类的具体用法?C# QueryBuilder.SQLInsertRow怎么用?C# QueryBuilder.SQLInsertRow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CreatureEquip

        public static string CreatureEquip(Dictionary<Guid, Unit> units)
        {
            if (units.Count == 0)
                return string.Empty;

            const string tableName = "creature_equip_template";

            var rows = new List<QueryBuilder.SQLInsertRow>();
            foreach (var unit in units)
            {
                var row = new QueryBuilder.SQLInsertRow();
                var creature = unit.Value;
                var equipData = creature.Equipment;

                // check if fields are empty
                if (equipData == null || equipData.All(value => value == 0))
                    continue;

                row.AddValue("entry", unit.Key.GetEntry());
                row.AddValue("itemEntry1", equipData[0]);
                row.AddValue("itemEntry2", equipData[1]);
                row.AddValue("itemEntry3", equipData[2]);
                row.Comment = StoreGetters.GetName(StoreNameType.Unit, (int)unit.Key.GetEntry(), false);
                rows.Add(row);
            }

            return new QueryBuilder.SQLInsert(tableName, rows).Build();
        }
开发者ID:Machiavell1,项目名称:WowPacketParser,代码行数:28,代码来源:UnitMisc.cs

示例2: SniffData

        public static string SniffData()
        {
            if (Storage.SniffData.IsEmpty)
                return String.Empty;

            const string tableName = "SniffData";

            var rows = new List<QueryBuilder.SQLInsertRow>();
            foreach (var data in Storage.SniffData)
            {
                var row = new QueryBuilder.SQLInsertRow();

                row.AddValue("Build", ClientVersion.Build);
                row.AddValue("SniffName", data.FileName);
                row.AddValue("TimeStamp", data.TimeStamp);
                row.AddValue("ObjectType", data.ObjectType.ToString());
                row.AddValue("Id", data.Id);
                row.AddValue("Data", data.Data);
                row.AddValue("Number", data.Number);

                if (data.ObjectType == StoreNameType.Opcode)
                    row.Comment = Opcodes.GetOpcodeName(data.Id);

                rows.Add(row);
            }

            return new QueryBuilder.SQLInsert(tableName, rows, ignore: true, withDelete: false).Build();
        }
开发者ID:Machiavell1,项目名称:WowPacketParser,代码行数:28,代码来源:Miscellaneous.cs

示例3: Creature

        public static string Creature(Dictionary<Guid, Unit> units)
        {
            if (units.Count == 0)
                return string.Empty;

            const string tableName = "creature";

            uint count = 0;
            var rows = new List<QueryBuilder.SQLInsertRow>();
            foreach (var unit in units)
            {
                var row = new QueryBuilder.SQLInsertRow();

                var creature = unit.Value;

                if (Settings.AreaFilters.Length > 0)
                    if (!(creature.Area.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.AreaFilters)))
                        continue;

                var spawnTimeSecs = creature.GetDefaultSpawnTime();
                var movementType = 0; // TODO: Find a way to check if our unit got random movement
                var spawnDist = (movementType == 1) ? 5 : 0;

                row.AddValue("id", unit.Key.GetEntry());
                row.AddValue("map", creature.Map);
                row.AddValue("spawnMask", 1);
                row.AddValue("phaseMask", creature.PhaseMask);
                row.AddValue("modelid", creature.Model);
                row.AddValue("position_x", creature.Movement.Position.X);
                row.AddValue("position_y", creature.Movement.Position.Y);
                row.AddValue("position_z", creature.Movement.Position.Z);
                row.AddValue("orientation", creature.Movement.Orientation);
                row.AddValue("curhealth", creature.MaxHealth);
                row.AddValue("spawntimesecs", spawnTimeSecs);
                row.AddValue("spawndist", spawnDist);
                row.AddValue("MovementType", movementType);
                row.Comment = StoreGetters.GetName(StoreNameType.Unit, (int)unit.Key.GetEntry(), false);
                row.Comment += " (Area: " + StoreGetters.GetName(StoreNameType.Area, creature.Area, false) + ")";

                if (creature.IsTemporarySpawn())
                {
                    row.CommentOut = true;
                    row.Comment += " - !!! might be temporary spawn !!!";
                }
                else
                    ++count;

                rows.Add(row);
            }

            var result = new StringBuilder();
            // delete query for GUIDs
            //var delete = new QueryBuilder.SQLDelete(Tuple.Create("@CGUID+0", "@CGUID+" + --count), "guid", tableName);
            //result.Append(delete.Build());

            var sql = new QueryBuilder.SQLInsert(tableName, rows, withDelete: false);
            result.Append(sql.Build());
            return result.ToString();
        }
开发者ID:hodobaj,项目名称:StrawberryTools,代码行数:59,代码来源:Spawns.cs

示例4: Addon

        public static string Addon(Dictionary<WowGuid, Unit> units)
        {
            if (units.Count == 0)
                return string.Empty;

            if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.creature_template_addon))
                return string.Empty;

            const string tableName = "creature_template_addon";

            var rows = new List<QueryBuilder.SQLInsertRow>();
            foreach (var unit in units)
            {
                var npc = unit.Value;

                if (Settings.AreaFilters.Length > 0)
                    if (!(npc.Area.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.AreaFilters)))
                        continue;

                if (Settings.MapFilters.Length > 0)
                    if (!(npc.Map.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.MapFilters)))
                        continue;

                var row = new QueryBuilder.SQLInsertRow();
                row.AddValue("entry", unit.Key.GetEntry());
                row.AddValue("mount", npc.Mount);
                row.AddValue("bytes1", npc.Bytes1, true);
                row.AddValue("bytes2", npc.Bytes2, true);

                var auras = string.Empty;
                var commentAuras = string.Empty;
                if (npc.Auras != null && npc.Auras.Count() != 0)
                {
                    foreach (var aura in npc.Auras)
                    {
                        if (aura == null)
                            continue;

                        // usually "template auras" do not have caster
                        if (ClientVersion.AddedInVersion(ClientType.MistsOfPandaria) ? !aura.AuraFlags.HasAnyFlag(AuraFlagMoP.NoCaster) : !aura.AuraFlags.HasAnyFlag(AuraFlag.NotCaster))
                            continue;

                        auras += aura.SpellId + " ";
                        commentAuras += StoreGetters.GetName(StoreNameType.Spell, (int) aura.SpellId, false) + ", ";
                    }
                    auras = auras.TrimEnd(' ');
                    commentAuras = commentAuras.TrimEnd(',', ' ');
                }
                row.AddValue("auras", auras);

                row.Comment += StoreGetters.GetName(StoreNameType.Unit, (int)unit.Key.GetEntry(), false);
                if (!String.IsNullOrWhiteSpace(auras))
                    row.Comment += " - " + commentAuras;

                rows.Add(row);
            }

            return new QueryBuilder.SQLInsert(tableName, rows).Build();
        }
开发者ID:DDuarte,项目名称:WowPacketParser,代码行数:59,代码来源:UnitMisc.cs

示例5: QuestPOI

        public static string QuestPOI()
        {
            if (Storage.QuestPOIs.IsEmpty())
                return String.Empty;

            const string tableName1 = "quest_poi";
            const string tableName2 = "quest_poi_points";

            // `quest_poi`
            var rows = new List<QueryBuilder.SQLInsertRow>();
            foreach (var quest in Storage.QuestPOIs)
            {
                var questPOI = quest.Value.Item1;

                var row = new QueryBuilder.SQLInsertRow();

                row.AddValue("questId", quest.Key.Item1);
                row.AddValue("id", quest.Key.Item2);
                row.AddValue("objIndex", questPOI.ObjectiveIndex);
                row.AddValue("mapid", questPOI.Map);
                row.AddValue("WorldMapAreaId", questPOI.WorldMapAreaId);
                row.AddValue("FloorId", questPOI.FloorId);
                row.AddValue("unk3", questPOI.UnkInt1);
                row.AddValue("unk4", questPOI.UnkInt2);
                row.Comment = StoreGetters.GetName(StoreNameType.Quest, (int)quest.Key.Item1, false);

                rows.Add(row);
            }

            var result = new QueryBuilder.SQLInsert(tableName1, rows, 2).Build();

            // `quest_poi_points`
            rows = new List<QueryBuilder.SQLInsertRow>();
            foreach (var quest in Storage.QuestPOIs)
            {
                var questPOI = quest.Value.Item1;

                if (questPOI.Points != null) // Needed?
                    foreach (var point in questPOI.Points)
                    {
                        var row = new QueryBuilder.SQLInsertRow();

                        row.AddValue("questId", quest.Key.Item1);
                        row.AddValue("id", quest.Key.Item2);
                        row.AddValue("idx", point.Index); // Not on sniffs
                        row.AddValue("x", point.X);
                        row.AddValue("y", point.Y);
                        row.Comment = StoreGetters.GetName(StoreNameType.Quest, (int)quest.Key.Item1, false);

                        rows.Add(row);
                    }
            }

            result += new QueryBuilder.SQLInsert(tableName2, rows, 2).Build();

            return result;
        }
开发者ID:skypeak,项目名称:WowPacketParser_SkyFire,代码行数:57,代码来源:QuestMisc.cs

示例6: BroadcastTextLocale

        public static string BroadcastTextLocale()
        {
            if (Storage.BroadcastTextLocales.IsEmpty())
                return String.Empty;

            if (!Settings.HotfixSQLOutputFlag.HasAnyFlagBit(HotfixSQLOutput.broadcast_text_locale))
                return String.Empty;

            const string tableName = "broadcast_text_locale";

            var rowsIns = new List<QueryBuilder.SQLInsertRow>();
            var rowsUpd = new List<QueryBuilder.SQLUpdateRow>();

            foreach (var broadcastTextLocale in Settings.SQLOrderByKey ? Storage.BroadcastTextLocales.OrderBy(blub => blub.Key).ToList() : Storage.BroadcastTextLocales.ToList())
            {
                if (SQLDatabase.BroadcastTextLocaleStores != null && SQLDatabase.BroadcastTextLocaleStores.ContainsKey(Tuple.Create(broadcastTextLocale.Key.Item1, broadcastTextLocale.Key.Item2)))
                {
                    var row = new QueryBuilder.SQLUpdateRow();
                    var broadcastTextLocaleDB = SQLDatabase.BroadcastTextLocaleStores[Tuple.Create(broadcastTextLocale.Key.Item1, broadcastTextLocale.Key.Item2)];

                    if (!Utilities.EqualValues(broadcastTextLocaleDB.MaleText_lang, broadcastTextLocale.Value.Item1.MaleText_lang))
                        row.AddValue("MaleText_lang", broadcastTextLocale.Value.Item1.MaleText_lang);

                    if (!Utilities.EqualValues(broadcastTextLocaleDB.FemaleText_lang, broadcastTextLocale.Value.Item1.FemaleText_lang))
                        row.AddValue("FemaleText_lang", broadcastTextLocale.Value.Item1.FemaleText_lang);

                    if (!Utilities.EqualValues(broadcastTextLocaleDB.VerifiedBuild, broadcastTextLocale.Value.Item1.VerifiedBuild))
                        row.AddValue("VerifiedBuild", broadcastTextLocale.Value.Item1.VerifiedBuild);

                    row.AddWhere("ID", broadcastTextLocale.Key.Item1);
                    row.AddWhere("locale", broadcastTextLocale.Key.Item2);

                    row.Table = tableName;

                    rowsUpd.Add(row);
                }
                else // insert new
                {
                    var row = new QueryBuilder.SQLInsertRow();

                    row.AddValue("ID", broadcastTextLocale.Key.Item1);
                    row.AddValue("locale", broadcastTextLocale.Key.Item2);

                    row.AddValue("MaleText_lang", broadcastTextLocale.Value.Item1.MaleText_lang);
                    row.AddValue("FemaleText_lang", broadcastTextLocale.Value.Item1.FemaleText_lang);

                    row.AddValue("VerifiedBuild", broadcastTextLocale.Value.Item1.VerifiedBuild);

                    rowsIns.Add(row);
                }
            }

            var result = new QueryBuilder.SQLInsert(tableName, rowsIns, deleteDuplicates: false, primaryKeyNumber: 2).Build() +
                         new QueryBuilder.SQLUpdate(rowsUpd).Build();

            return "SET NAMES 'utf8';" + Environment.NewLine + result + Environment.NewLine + "SET NAMES 'latin1';";
        }
开发者ID:killradio,项目名称:WowPacketParser,代码行数:57,代码来源:Locales.cs

示例7: QuestPOI

        public static string QuestPOI()
        {
            if (Storage.QuestPOIs.IsEmpty())
                return String.Empty;

            var sql = string.Empty;

            if (Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.quest_poi))
            {
                var entries = Storage.QuestPOIs.Keys();
                var poiDb = SQLDatabase.GetDict<uint, uint, QuestPOI>(entries, "questid", "id");

                sql = SQLUtil.CompareDicts(Storage.QuestPOIs, poiDb, StoreNameType.Quest, "questid", "id");
            }

            //var points = new StoreMulti<Tuple<uint, uint>, QuestPOIPoint>();
            //
            //foreach (KeyValuePair<Tuple<uint, uint>, Tuple<QuestPOI, TimeSpan?>> pair in Storage.QuestPOIs)
            //    foreach (var point in pair.Value.Item1.Points)
            //        points.Add(pair.Key, point, pair.Value.Item2);
            //
            //var entries2 = points.Keys();
            //var poiPointsDb = SQLDatabase.GetDictMulti<uint, uint, QuestPOIPoint>(entries2, "questid", "id");

            const string tableName2 = "quest_poi_points";

            if (Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.quest_poi_points))
            {
                var rows = new List<QueryBuilder.SQLInsertRow>();
                foreach (var quest in Storage.QuestPOIs)
                {
                    var questPOI = quest.Value.Item1;

                    if (questPOI.Points != null) // Needed?
                        foreach (var point in questPOI.Points)
                        {
                            var row = new QueryBuilder.SQLInsertRow();

                            row.AddValue("questId", quest.Key.Item1);
                            row.AddValue("id", quest.Key.Item2);
                            row.AddValue("idx", point.Index); // Not on sniffs
                            row.AddValue("x", point.X);
                            row.AddValue("y", point.Y);
                            row.Comment = StoreGetters.GetName(StoreNameType.Quest, (int) quest.Key.Item1, false);

                            rows.Add(row);
                        }
                }

                sql += new QueryBuilder.SQLInsert(tableName2, rows, 2).Build();

            }

            return sql;
        }
开发者ID:Huri,项目名称:WowPacketParser,代码行数:55,代码来源:QuestMisc.cs

示例8: DefenseMessage

        public static string DefenseMessage()
        {
            if (Storage.DefenseMessages.IsEmpty())
                return String.Empty;

            if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.defense_message))
                return string.Empty;

            const string tableName = "defense_message";

            var rows = new List<QueryBuilder.SQLInsertRow>();
            foreach (var message in Storage.DefenseMessages)
            {
                foreach (var messageValue in message.Value)
                {
                    var row = new QueryBuilder.SQLInsertRow();

                    var query = new StringBuilder(string.Format("SELECT Id FROM {1}.broadcast_text WHERE MaleText='{0}' OR FemaleText='{0}';", MySqlHelper.DoubleQuoteString(messageValue.Item1.text), Settings.TDBDatabase));

                    string broadcastTextId = "";

                    if (Settings.DevMode)
                    {
                        using (var reader = SQLConnector.ExecuteQuery(query.ToString()))
                        {
                            if (reader != null)
                                while (reader.Read())
                                {
                                    var values = new object[1];
                                    var count = reader.GetValues(values);
                                    if (count != 1)
                                        break; // error in query

                                    if (!String.IsNullOrWhiteSpace(broadcastTextId))
                                        broadcastTextId += " - " + Convert.ToInt32(values[0]);
                                    else
                                        broadcastTextId += Convert.ToInt32(values[0]);
                                }
                        }

                    }

                    row.AddValue("ZoneId", message.Key);
                    row.AddValue("Id", "x", false, true);
                    row.AddValue("Text", messageValue.Item1.text);
                    if (Settings.DevMode)
                        row.AddValue("BroadcastTextId", broadcastTextId);

                    rows.Add(row);
                }
            }

            return new QueryBuilder.SQLInsert(tableName, rows, 1, false).Build();
        }
开发者ID:samaelsacred,项目名称:WowPacketParser,代码行数:54,代码来源:Miscellaneous.cs

示例9: Npc

        public static string Npc()
        {
            if (Storage.UnitTemplates.IsEmpty)
                return String.Empty;

            // Not TDB structure
            const string tableName = "creature_template";

            var rows = new List<QueryBuilder.SQLInsertRow>();
            foreach (var unitTemplate in Storage.UnitTemplates)
            {
                var row = new QueryBuilder.SQLInsertRow();
                var template = unitTemplate.Value;

                row.AddValue("Id", unitTemplate.Key);
                row.AddValue("Name", template.Name);
                row.AddValue("SubName", template.SubName);
                row.AddValue("IconName", template.IconName);
                row.AddValue("TypeFlags", template.TypeFlags);
                row.AddValue("TypeFlags2", template.TypeFlags2);
                row.AddValue("Type", template.Type);
                row.AddValue("Family", template.Family);
                row.AddValue("Rank", template.Rank);
                row.AddValue("KillCredit1", template.KillCredit1);
                row.AddValue("KillCredit2", template.KillCredit2);
                row.AddValue("UnkInt", template.UnkInt);
                row.AddValue("PetSpellData", template.PetSpellData);

                for (var i = 0; i < template.DisplayIds.Length; i++)
                    row.AddValue("DisplayId" + (i + 1), template.DisplayIds[i]);

                row.AddValue("Modifier1", template.Modifier1);
                row.AddValue("Modifier2", template.Modifier2);
                row.AddValue("RacialLeader", template.RacialLeader);

                for (var i = 0; i < template.QuestItems.Length; i++)
                    row.AddValue("QuestItem" + (i + 1), template.QuestItems[i]);

                row.AddValue("MovementId", template.MovementId);
                row.AddValue("Expansion", template.Expansion);

                rows.Add(row);
            }

            return new QueryBuilder.SQLInsert(tableName, rows).Build();
        }
开发者ID:Machiavell1,项目名称:WowPacketParser,代码行数:46,代码来源:WDBTemplates.cs

示例10: Addon

        public static string Addon(Dictionary<Guid, Unit> units)
        {
            if (units.Count == 0)
                return string.Empty;

            const string tableName = "creature_template_addon";

            var rows = new List<QueryBuilder.SQLInsertRow>();
            foreach (var unit in units)
            {
                var npc = unit.Value;
                npc.LoadValuesFromUpdateFields();

                var row = new QueryBuilder.SQLInsertRow();
                row.AddValue("entry", unit.Key.GetEntry());
                row.AddValue("mount", npc.Mount);
                row.AddValue("bytes1", npc.Bytes1, true);
                row.AddValue("bytes2", npc.Bytes2, true);

                var auras = string.Empty;
                var commentAuras = string.Empty;
                if (npc.Auras != null && npc.Auras.Count() != 0)
                {
                    foreach (var aura in npc.Auras)
                    {
                        if (aura.CasterGuid.Full == 0) // usually "template auras" do not have caster
                        {
                            auras += aura.SpellId + " ";
                            commentAuras += StoreGetters.GetName(StoreNameType.Spell, (int) aura.SpellId, false) + ", ";
                        }
                    }
                    auras = auras.TrimEnd(' ');
                    commentAuras = commentAuras.TrimEnd(',', ' ');
                }
                row.AddValue("auras", auras);

                row.Comment += StoreGetters.GetName(StoreNameType.Unit, (int)unit.Key.GetEntry(), false);
                if (!String.IsNullOrWhiteSpace(auras))
                    row.Comment += " - " + commentAuras;

                rows.Add(row);
            }

            return new QueryBuilder.SQLInsert(tableName, rows).Build();
        }
开发者ID:Machiavell1,项目名称:WowPacketParser,代码行数:45,代码来源:UnitMisc.cs

示例11: NpcText

        public static string NpcText()
        {
            if (Storage.NpcTexts.IsEmpty())
                return String.Empty;

            // Not TDB structure
            const string tableName = "npc_text";

            var rows = new List<QueryBuilder.SQLInsertRow>();
            foreach (var npcTextPair in Storage.NpcTexts)
            {
                var row = new QueryBuilder.SQLInsertRow();
                var npcText = npcTextPair.Value.Item1;

                row.AddValue("Id", npcTextPair.Key);

                for (var i = 0; i < npcText.Probabilities.Length; i++)
                    row.AddValue("Probability" + (i + 1), npcText.Probabilities[i]);

                for (var i = 0; i < npcText.Texts1.Length; i++)
                    row.AddValue("Text1_" + (i + 1), npcText.Texts1[i]);

                for (var i = 0; i < npcText.Texts2.Length; i++)
                    row.AddValue("Text2_" + (i + 1), npcText.Texts2[i]);

                for (var i = 0; i < npcText.Languages.Length; i++)
                    row.AddValue("Language" + (i + 1), npcText.Languages[i]);

                for (var i = 0; i < npcText.EmoteDelays[0].Length; i++)
                    for (var j = 0; j < npcText.EmoteDelays[1].Length; j++)
                        row.AddValue("EmoteDelay" + (i + 1) + "_" + (j + 1), npcText.EmoteDelays[i][j]);

                for (var i = 0; i < npcText.EmoteIds[0].Length; i++)
                    for (var j = 0; j < npcText.EmoteIds[1].Length; j++)
                        row.AddValue("EmoteId" + (i + 1) + "_" + (j + 1), npcText.EmoteDelays[i][j]);

                rows.Add(row);
            }

            return new QueryBuilder.SQLInsert(tableName, rows).Build();
        }
开发者ID:skypeak,项目名称:WowPacketParser_SkyFire,代码行数:41,代码来源:WDBTemplates.cs

示例12: ObjectNames

        public static string ObjectNames()
        {
            if (Storage.ObjectNames.IsEmpty)
                return String.Empty;

            const string tableName = "ObjectNames";

            var rows = new List<QueryBuilder.SQLInsertRow>();
            foreach (var data in Storage.ObjectNames)
            {
                var row = new QueryBuilder.SQLInsertRow();

                row.AddValue("ObjectType", data.Value.ObjectType.ToString());
                row.AddValue("Id", data.Key);
                row.AddValue("Name", data.Value.Name);

                rows.Add(row);
            }

            return new QueryBuilder.SQLInsert(tableName, rows, 2, ignore: true, withDelete: false).Build();
        }
开发者ID:Machiavell1,项目名称:WowPacketParser,代码行数:21,代码来源:Miscellaneous.cs

示例13: SniffData

        public static string SniffData()
        {
            if (Storage.SniffData.IsEmpty())
                return String.Empty;

            const string tableName = "SniffData";

            var rows = new List<QueryBuilder.SQLInsertRow>();
            foreach (var data in Storage.SniffData)
            {
                var row = new QueryBuilder.SQLInsertRow();

                row.AddValue("Build", ClientVersion.Build);
                row.AddValue("SniffName", data.Item1.FileName);
                row.AddValue("ObjectType", data.Item1.ObjectType.ToString());
                row.AddValue("Id", data.Item1.Id);
                row.AddValue("Data", data.Item1.Data);

                rows.Add(row);
            }

            return new QueryBuilder.SQLInsert(tableName, rows, ignore: true, withDelete: false, deleteDuplicates: true).Build();
        }
开发者ID:kandera,项目名称:WowPacketParser,代码行数:23,代码来源:Miscellaneous.cs

示例14: GameObject

        public static string GameObject()
        {
            if (Storage.GameObjectTemplates.IsEmpty)
                return String.Empty;

            // Not TDB structure
            const string tableName = "gameobject_template";

            var rows = new List<QueryBuilder.SQLInsertRow>();
            foreach (var goTemplate in Storage.GameObjectTemplates)
            {
                var row = new QueryBuilder.SQLInsertRow();

                row.AddValue("Id", goTemplate.Key);
                row.AddValue("Type", goTemplate.Value.Type);
                row.AddValue("DisplayId", goTemplate.Value.DisplayId);
                row.AddValue("Name", goTemplate.Value.Name);
                row.AddValue("IconName", goTemplate.Value.IconName);
                row.AddValue("CastCaption", goTemplate.Value.CastCaption);
                row.AddValue("UnkString", goTemplate.Value.UnkString);

                for (var i = 0; i < goTemplate.Value.Data.Length; i++)
                    row.AddValue("Data" + (i + 1), goTemplate.Value.Data[i]);

                row.AddValue("Size", goTemplate.Value.Size);

                for (var i = 0; i < goTemplate.Value.QuestItems.Length; i++)
                    row.AddValue("QuestItem" + (i + 1), goTemplate.Value.QuestItems[i]);

                row.AddValue("UnknownUInt", goTemplate.Value.UnknownUInt);

                rows.Add(row);
            }

            return new QueryBuilder.SQLInsert(tableName, rows).Build();
        }
开发者ID:Machiavell1,项目名称:WowPacketParser,代码行数:36,代码来源:WDBTemplates.cs

示例15: PointsOfInterest

        public static string PointsOfInterest()
        {
            if (Storage.GossipPOIs.IsEmpty())
                return string.Empty;

            var result = string.Empty;

            if (!Storage.GossipSelects.IsEmpty() && Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.gossip_menu_option))
            {
                var gossipPOIsTable = new Dictionary<Tuple<uint, uint>, uint>();

                foreach (var poi in Storage.GossipPOIs)
                {
                    foreach (var gossipSelect in Storage.GossipSelects)
                    {
                        var tuple = Tuple.Create(gossipSelect.Key.Item1, gossipSelect.Key.Item2);

                        if (gossipPOIsTable.ContainsKey(tuple))
                            continue;

                        var timeSpan = poi.Value.Item2 - gossipSelect.Value.Item2;
                        if (timeSpan != null && timeSpan.Value.Duration() <= TimeSpan.FromSeconds(1))
                            gossipPOIsTable.Add(tuple, poi.Key);
                    }
                }

                var rowsUpd = new List<QueryBuilder.SQLUpdateRow>();

                foreach (var u in gossipPOIsTable)
                {
                    var row = new QueryBuilder.SQLUpdateRow();

                    row.AddValue("action_poi_id", u.Value);

                    row.AddWhere("menu_id", u.Key.Item1);
                    row.AddWhere("id", u.Key.Item2);

                    row.Table = "gossip_menu_option";

                    rowsUpd.Add(row);
                }

                result += new QueryBuilder.SQLUpdate(rowsUpd).Build();
            }

            if (Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.points_of_interest))
            {
                const string tableName = "points_of_interest";
                var rowsIns = new List<QueryBuilder.SQLInsertRow>();

                uint count = 0;

                foreach (var poi in Storage.GossipPOIs)
                {
                    var row = new QueryBuilder.SQLInsertRow();

                    row.AddValue("ID", "@ID+" + count, noQuotes: true);
                    row.AddValue("PositionX", poi.Value.Item1.PositionX);
                    row.AddValue("PositionY", poi.Value.Item1.PositionY);
                    row.AddValue("Icon", poi.Value.Item1.Icon);
                    row.AddValue("Flags", poi.Value.Item1.Flags);
                    row.AddValue("Importance", poi.Value.Item1.Importance);
                    row.AddValue("Name", poi.Value.Item1.Name);

                    rowsIns.Add(row);
                    count++;
                }

                result += new QueryBuilder.SQLDelete(Tuple.Create("@ID+0", "@ID+" + (count - 1)), "entry", tableName).Build();
                result += new QueryBuilder.SQLInsert(tableName, rowsIns, withDelete: false).Build();
            }

            return result;
        }
开发者ID:rob3ns,项目名称:PacketSniffer,代码行数:74,代码来源:UnitMisc.cs


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