Exemplo n.º 1
0
        public void CanSerializeRowObjects()
        {
            var sample = new RowList()
            {
                elements = new RowDTO[]
                {
                    new AllRightAnnouncement()
                    {
                        announcement = "alright"
                    }
                }
            };

            var settings = Frontpage.MvcApplication.GetJsonSerializationSettings();

            var serializer = JsonSerializer.Create(settings);

            var sb     = new StringBuilder();
            var reader = new StringWriter(sb);

            serializer.Serialize(reader, sample);

            Console.WriteLine("Serialized: " + sb.ToString());

            var result = serializer.Deserialize <RowList>(new JsonTextReader(new StringReader(sb.ToString())));

            Assert.That(result.elements.Length, Is.EqualTo(1));

            var element = result.elements.Cast <AllRightAnnouncement>().Single();

            Assert.That(element.announcement, Is.EqualTo("alright"));
        }
Exemplo n.º 2
0
        public static string VehicleAccessory()
        {
            if (Storage.VehicleTemplateAccessories.IsEmpty() || !Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.vehicle_template_accessory))
            {
                return(string.Empty);
            }

            var rows = new RowList <VehicleTemplateAccessory>();

            foreach (var accessory in Storage.VehicleTemplateAccessories)
            {
                if (accessory.Item1.SeatId < 0 || accessory.Item1.SeatId > 7)
                {
                    continue;
                }

                // ReSharper disable once UseObjectOrCollectionInitializer
                var row = new Row <VehicleTemplateAccessory>();
                row.Comment  = StoreGetters.GetName(StoreNameType.Unit, (int)accessory.Item1.Entry.GetValueOrDefault(), false) + " - ";
                row.Comment += StoreGetters.GetName(StoreNameType.Unit, (int)accessory.Item1.AccessoryEntry.GetValueOrDefault(), false);
                accessory.Item1.Description = row.Comment;
                row.Data = accessory.Item1;

                rows.Add(row);
            }

            return(new SQLInsert <VehicleTemplateAccessory>(rows, false).Build());
        }
Exemplo n.º 3
0
        public void Execute(Database database)
        {
            Table table = database.GetTable(this.tableName);

            if (this.columnNames.Count == 0)
            {
                this.result = table.GetRows();
                return;
            }

            RowDefinition rowdef = new RowDefinition();
            IList <Row>   rows   = new List <Row>();

            foreach (var name in this.columnNames)
            {
                rowdef.AddColumn(table.GetColumn(name));
            }

            int nc = this.columnNames.Count;

            foreach (var row in table.GetRows())
            {
                object[] values = new object[nc];

                for (int k = 0; k < nc; k++)
                {
                    values[k] = row[this.columnNames[k]];
                }

                rows.Add(new Row(rowdef, values));
            }

            this.result = new RowList(rows);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Sets the Rows List
        /// </summary>
        public override void SetRowLists()
        {
            base.SetRowLists();
            int rowIndex = 0;

            for (int i = 0; i < WebElementRows.Count; i++)
            {
                Report.Write("GridRow by index: " + rowIndex);
                //GridRowType rowType = GetGridRowType(rowIndex);
                GridRowType rowType = GridRowType.Data;
                if (i == 0)
                {
                    rowType = GridRowType.Header;
                }

                bool lastRow = false;
                if (i == WebElementRows.Count - 1)
                {
                    lastRow = true;
                }

                Report.Write("GridRowType: " + rowType);
                var lineItem = new BenchmarkTestsTabOneTestViewRow(gridCssSelector, WebElementRows[i], rowIndex, rowType, lastRow, ColumnList, ControlPrefix);
                RowList.Add(lineItem);
                rowIndex++;
            }
        }
Exemplo n.º 5
0
        public static string HotfixBlob()
        {
            if (Storage.HotfixBlobs.IsEmpty())
            {
                return(string.Empty);
            }

            if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.hotfix_blob))
            {
                return(string.Empty);
            }

            var rows = new RowList <HotfixBlob>();

            foreach (var hotfix in Storage.HotfixBlobs)
            {
                var row = new Row <HotfixBlob>
                {
                    Data    = hotfix.Item1,
                    Comment = hotfix.Item1.TableHash.ToString()
                };

                rows.Add(row);
            }

            return("TRUNCATE `hotfix_blob`;" + Environment.NewLine + new SQLInsert <HotfixBlob>(rows, false).Build());
        }
Exemplo n.º 6
0
        public static string PointsOfInterest()
        {
            if (Storage.GossipPOIs.IsEmpty())
            {
                return(string.Empty);
            }

            if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.points_of_interest))
            {
                return(string.Empty);
            }

            if (Settings.DBEnabled)
            {
                return(SQLUtil.Compare(Storage.GossipPOIs, SQLDatabase.Get(Storage.GossipPOIs), StoreNameType.None));
            }
            else
            {
                uint count = 0;
                var  rows  = new RowList <PointsOfInterest>();

                foreach (var pointOfInterest in Storage.GossipPOIs)
                {
                    Row <PointsOfInterest> row = new Row <PointsOfInterest>();

                    Type t = pointOfInterest.Item1.ID.GetType();
                    if (t.Equals(typeof(int)))
                    {
                        row.Data.ID = pointOfInterest.Item1.ID;
                    }
                    else
                    {
                        row.Data.ID = "@PID+" + count;
                    }

                    row.Data.PositionX     = pointOfInterest.Item1.PositionX;
                    row.Data.PositionY     = pointOfInterest.Item1.PositionY;
                    row.Data.PositionZ     = pointOfInterest.Item1.PositionZ;
                    row.Data.Icon          = pointOfInterest.Item1.Icon;
                    row.Data.Flags         = pointOfInterest.Item1.Flags;
                    row.Data.Importance    = pointOfInterest.Item1.Importance;
                    row.Data.Name          = pointOfInterest.Item1.Name;
                    row.Data.VerifiedBuild = pointOfInterest.Item1.VerifiedBuild;

                    ++count;

                    rows.Add(row);
                }

                StringBuilder result = new StringBuilder();
                // delete query for GUIDs
                var delete = new SQLDelete <PointsOfInterest>(Tuple.Create("@PID+0", "@PID+" + --count));
                result.Append(delete.Build());

                var sql = new SQLInsert <PointsOfInterest>(rows, false);
                result.Append(sql.Build());

                return(result.ToString());
            }
        }
Exemplo n.º 7
0
        public static string HotfixData()
        {
            if (Storage.HotfixDatas.IsEmpty())
            {
                return(string.Empty);
            }

            if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.hotfix_data))
            {
                return(string.Empty);
            }

            var rows = new RowList <HotfixData>();

            foreach (var hotfix in Storage.HotfixDatas)
            {
                var row = new Row <HotfixData>
                {
                    Data    = hotfix.Item1,
                    Comment = hotfix.Item1.TableHash.ToString()
                };

                rows.Add(row);
            }

            return("DELETE FROM `hotfix_data` WHERE `VerifiedBuild`>0;" + Environment.NewLine + new SQLInsert <HotfixData>(rows, false).Build());
        }
Exemplo n.º 8
0
        public void SetUp()
        {
            _conditionsOnePk = new RowList<TestDataOnePK>
            {
                new TestDataOnePK {ID = 1, TestInt1 = 2, TestString1 = "string1"},
                new TestDataOnePK {ID = 2, TestInt1 = 3}
            };

            _valuesOnePk = new RowList<TestDataOnePK>
            {
                new TestDataOnePK {ID = 4, TestInt1 = 5, TestString1 = "string2"},
                new TestDataOnePK {ID = 6, TestInt1 = 7}
            };

            _conditionsTwoPk = new RowList<TestDataTwoPK>
            {
                new TestDataTwoPK {ID = 10, TestInt1 = 20, TestString1 = "string10"},
                new TestDataTwoPK {ID = 20, TestInt1 = 30}
            };

            _valuesTwoPk = new RowList<TestDataTwoPK>
            {
                new TestDataTwoPK {ID = 40, TestInt1 = 50, TestString1 = "string20"},
                new TestDataTwoPK {ID = 60, TestInt1 = 70}
            };
        }
Exemplo n.º 9
0
        public static string WeatherUpdates()
        {
            if (Storage.WeatherUpdates.IsEmpty())
            {
                return(string.Empty);
            }

            if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.weather_updates))
            {
                return(string.Empty);
            }

            var rows = new RowList <WeatherUpdate>();

            foreach (var row in Storage.WeatherUpdates.Select(weatherUpdate => new Row <WeatherUpdate>
            {
                Data = weatherUpdate.Item1,
                Comment = StoreGetters.GetName(StoreNameType.Map, (int)weatherUpdate.Item1.MapId.GetValueOrDefault(), false) +
                          " - " + weatherUpdate.Item1.State + " - " + weatherUpdate.Item1.Grade
            }))
            {
                rows.Add(row);
            }

            return(new SQLInsert <WeatherUpdate>(rows, ignore: true, withDelete: false).Build());
        }
Exemplo n.º 10
0
        public static string HotfixBlob()
        {
            if (Storage.HotfixBlobs.IsEmpty())
            {
                return(string.Empty);
            }

            if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.hotfix_blob))
            {
                return(string.Empty);
            }

            var rows = new RowList <HotfixBlob>();

            foreach (var hotfix in Storage.HotfixBlobs)
            {
                var row = new Row <HotfixBlob>
                {
                    Data    = hotfix.Item1,
                    Comment = hotfix.Item1.TableHash.ToString()
                };

                rows.Add(row);
            }

            return($"DELETE FROM `hotfix_blob` WHERE `locale` = '{ClientLocale.PacketLocale}' AND `VerifiedBuild`>0;" + Environment.NewLine + new SQLInsert <HotfixBlob>(rows, false).Build());
        }
Exemplo n.º 11
0
        public static string HotfixOptionalData()
        {
            if (Storage.HotfixOptionalDatas.IsEmpty())
            {
                return(string.Empty);
            }

            var rows = new RowList <HotfixOptionalData>();

            foreach (var hotfixOptionalData in Storage.HotfixOptionalDatas)
            {
                if (HotfixSettings.Instance.ShouldLog(hotfixOptionalData.Item1.TableHash))
                {
                    var row = new Row <HotfixOptionalData>
                    {
                        Data    = hotfixOptionalData.Item1,
                        Comment = hotfixOptionalData.Item1.TableHash.ToString()
                    };

                    rows.Add(row);
                }
            }
            if (rows.Count != 0)
            {
                return($"DELETE FROM `hotfix_optional_data` WHERE `locale` = '{ClientLocale.PacketLocale}' AND `VerifiedBuild`>0;" + Environment.NewLine + new SQLInsert <HotfixOptionalData>(rows, false).Build());
            }
            else
            {
                return(string.Empty);
            }
        }
Exemplo n.º 12
0
        public void Execute(Database database)
        {
            Table table = database.GetTable(this.tableName);

            if (this.columnNames.Count == 0)
            {
                this.result = table.GetRows();
                return;
            }

            RowDefinition rowdef = new RowDefinition();
            IList<Row> rows = new List<Row>();

            foreach (var name in this.columnNames)
                rowdef.AddColumn(table.GetColumn(name));

            int nc = this.columnNames.Count;

            foreach (var row in table.GetRows())
            {
                object[] values = new object[nc];

                for (int k = 0; k < nc; k++)
                    values[k] = row[this.columnNames[k]];

                rows.Add(new Row(rowdef, values));
            }

            this.result = new RowList(rows);
        }
Exemplo n.º 13
0
        private void UpdateDimensionList(ReactiveList <LocalDimension> list)
        {
            list.ChangeTrackingEnabled = false;
            foreach (var dim in list)
            {
                dim.IsDuplicate = false;
                dim.RaisePropertyChanged(nameof(dim.Name));
            }

            var duplicatgroups = list
                                 .GroupBy(dim => dim.Name)
                                 .Where(g => g.Count() > 1)
                                 .ToList();


            foreach (var group in duplicatgroups)
            {
                foreach (var dim in group)
                {
                    dim.IsDuplicate = true;
                    dim.RaisePropertyChanged(nameof(dim.Name));
                }
            }

            list.ChangeTrackingEnabled = true;

            CanCreate = !AllErrors.Any() &&
                        ColumnList.Count(col => col.HasErrors) == 0 &&
                        RowList.Count(row => row.HasErrors) == 0;
        }
Exemplo n.º 14
0
 public void Initialize()
 {
     _condList = new RowList<TestDataModel>
     {
         new TestDataModel {ID = 1, TestInt1 = 2},
         new TestDataModel {ID = 3, TestInt1 = 4}
     };
 }
Exemplo n.º 15
0
        private void dataGridViewX1_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.ColumnIndex == colYear.Index)
            {
                RowList.Sort(SortRowList);

                dataGridViewX1.Refresh();
            }
        }
Exemplo n.º 16
0
        public void GetRowsWithNullFirstName()
        {
            IRowFilter filter = new IsNullFilter(this.table.GetColumnPosition("FirstName"));

            RowList rows = this.table.ApplyFilter(filter);

            Assert.IsNotNull(rows);
            Assert.AreEqual(0, rows.Count);
        }
Exemplo n.º 17
0
        public static string CreatureTextLocale()
        {
            if (Storage.CreatureTexts.IsEmpty() || !Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.creature_text_locale))
            {
                return(string.Empty);
            }



            /* can't use compare DB without knowing values of groupid or id
             * var entries = Storage.CreatureTexts.Keys.ToList();
             * var creatureTextDb = SQLDatabase.GetDict<uint, CreatureText>(entries);
             */

            var rows       = new RowList <CreatureText>();
            var rowLocales = new RowList <CreatureTextLocale>();
            Dictionary <uint, uint> entryCount = new Dictionary <uint, uint>();

            foreach (var text in Storage.CreatureTexts.OrderBy(t => t.Key))
            {
                foreach (var textValue in text.Value)
                {
                    var count = entryCount.ContainsKey(text.Key) ? entryCount[text.Key] : 0;

                    if (rows.Where(text2 => text2.Data.Text == textValue.Item1.Text).Count() != 0)
                    {
                        continue;
                    }

                    var row = new Row <CreatureTextLocale>
                    {
                        Data = new CreatureTextLocale
                        {
                            Entry   = text.Key,
                            GroupId = "" + count, ///@GROUP_ID+
                            ID      = "0",        ///@ID+
                            Text    = textValue.Item1.Text
                        },
                    };

                    if (!entryCount.ContainsKey(text.Key))
                    {
                        entryCount.Add(text.Key, count + 1);
                    }
                    else
                    {
                        entryCount[text.Key] = count + 1;
                    }

                    rowLocales.Add(row);
                }
            }

            return(new SQLInsert <CreatureTextLocale>(rowLocales, true).Build());
        }
        public void SetUp()
        {
            _conditionsOnePk = new RowList <TestDataOnePK>
            {
                new TestDataOnePK {
                    ID = 1, TestInt1 = 2, TestString1 = "string1"
                },
                new TestDataOnePK {
                    ID = 2, TestInt1 = 3
                }
            };

            _valuesOnePk = new RowList <TestDataOnePK>
            {
                new TestDataOnePK {
                    ID = 4, TestInt1 = 5, TestString1 = "string2", noQuotes = "@CGUID"
                },
                new TestDataOnePK {
                    ID = 6, TestInt1 = 7, noQuotes = "@CGUID+1"
                }
            };

            _conditionsTwoPk = new RowList <TestDataTwoPK>
            {
                new TestDataTwoPK {
                    ID = 10, TestInt1 = 20, TestString1 = "string10"
                },
                new TestDataTwoPK {
                    ID = 20, TestInt1 = 30
                },
                new TestDataTwoPK {
                    ID = 30, TestInt1 = 40
                },
                new TestDataTwoPK {
                    ID = 30, TestInt1 = 50
                }
            };

            _valuesTwoPk = new RowList <TestDataTwoPK>
            {
                new TestDataTwoPK {
                    ID = 60, TestInt1 = 70, TestString1 = "string20"
                },
                new TestDataTwoPK {
                    ID = 80, TestInt1 = 90
                },
                new TestDataTwoPK {
                    ID = 100, TestInt1 = 110
                },
                new TestDataTwoPK {
                    ID = 100, TestInt1 = 120
                }
            };
        }
Exemplo n.º 19
0
 public void Initialize()
 {
     _condList = new RowList <TestDataModel>
     {
         new TestDataModel {
             ID = 1, TestInt1 = 2
         },
         new TestDataModel {
             ID = 3, TestInt1 = 4
         }
     };
 }
        /// <summary>
        /// Sets the Rows List
        /// </summary>
        public override void SetRowLists()
        {
            base.SetRowLists();
            int rowIndex = 0;

            foreach (var webElement in WebElementRows)
            {
                GridRowType rowType  = GetGridRowType(rowIndex);
                var         lineItem = new TestCentralHomeRow(gridCssSelector, webElement, rowIndex, rowType, ColumnList, ControlPrefix);
                RowList.Add(lineItem);
                rowIndex++;
            }
        }
Exemplo n.º 21
0
        public PyDataType GetMultiInvTypesEx(PyList <PyInteger> ids)
        {
            MySqlConnection connection = null;
            MySqlDataReader reader     = Database.PrepareQuery(ref connection,
                                                               $"SELECT typeID, groupID, typeName, description, graphicID, radius, mass, volume, capacity, portionSize, raceID, basePrice, published, marketGroupID, chanceOfDuplicating, dataID FROM invTypes WHERE typeID IN ({PyString.Join(',', ids)})"
                                                               ).ExecuteReader();

            using (connection)
                using (reader)
                {
                    return(RowList.FromMySqlDataReader(Database, reader));
                }
        }
Exemplo n.º 22
0
        public void GetRowsWithNullAddress()
        {
            IRowFilter filter = new IsNullFilter(this.table.GetColumnPosition("Address"));

            RowList rows = this.table.ApplyFilter(filter);

            Assert.IsNotNull(rows);
            Assert.AreEqual(this.table.RowCount / 2, rows.Count);

            foreach (Row row in rows)
            {
                Assert.IsNull(row["Address"]);
            }
        }
Exemplo n.º 23
0
 public override void SetRowLists()
 {
     base.SetRowLists();
     int rowIndex = 0;
     foreach (var webElement in WebElementRows)
     {
         Report.Write("GridRow by index: " + rowIndex);
         GridRowType rowType = GetGridRowType(rowIndex);
         Report.Write("GridRowType: " + rowType);
         var lineItem = new ProfileHomeTabRow(gridCssSelector, webElement, rowIndex, rowType, ColumnList, ControlPrefix);
         RowList.Add(lineItem);
         rowIndex++;
     }
 }
Exemplo n.º 24
0
        public static string NpcSpellClick()
        {
            if (Storage.NpcSpellClicks.IsEmpty())
            {
                return(string.Empty);
            }

            if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.npc_spellclick_spells))
            {
                return(string.Empty);
            }

            var rows = new RowList <NpcSpellClick>();

            foreach (var npcSpellClick in Storage.NpcSpellClicks)
            {
                foreach (var spellClick in Storage.SpellClicks)
                {
                    var row = new Row <NpcSpellClick>();

                    if (spellClick.Item1.CasterGUID.GetObjectType() == ObjectType.Unit && spellClick.Item1.TargetGUID.GetObjectType() == ObjectType.Unit)
                    {
                        spellClick.Item1.CastFlags = 0x0;
                    }
                    if (spellClick.Item1.CasterGUID.GetObjectType() == ObjectType.Player && spellClick.Item1.TargetGUID.GetObjectType() == ObjectType.Unit)
                    {
                        spellClick.Item1.CastFlags = 0x1;
                    }
                    if (spellClick.Item1.CasterGUID.GetObjectType() == ObjectType.Unit && spellClick.Item1.TargetGUID.GetObjectType() == ObjectType.Player)
                    {
                        spellClick.Item1.CastFlags = 0x2;
                    }
                    if (spellClick.Item1.CasterGUID.GetObjectType() == ObjectType.Player && spellClick.Item1.TargetGUID.GetObjectType() == ObjectType.Player)
                    {
                        spellClick.Item1.CastFlags = 0x3;
                    }

                    spellClick.Item1.Entry = npcSpellClick.Item1.GetEntry();
                    row.Data = spellClick.Item1;

                    var timeSpan = spellClick.Item2 - npcSpellClick.Item2;
                    if (timeSpan != null && timeSpan.Value.Duration() <= TimeSpan.FromSeconds(1))
                    {
                        rows.Add(row);
                    }
                }
            }

            return(new SQLInsert <NpcSpellClick>(rows, false).Build());
        }
Exemplo n.º 25
0
        public void TestGet()
        {
            SQLConnector.Enabled = true;
            SQLConnector.Connect();

            var cond = new RowList<TestDataModel>
            {
                new TestDataModel {ID = 1, TestInt1 = 10, TestString1 = "a"},
                new TestDataModel {ID = 1, TestInt1 = 20, TestInt2 = 6},
                new TestDataModel {ID = 2, TestInt1 = 11, TestInt2 = 4},
                new TestDataModel {ID = 2, TestInt1 = 21, TestString1 = "b"}
            };
            var data = SQLDatabase.Get(cond, "wpp_test");
            Assert.NotNull(data);
        }
        public void AddRow(Color ValCol)
        {
            DataGridViewRow Row = null;

            Row = AddRow();

            UpdateRow(Row, RowHeight, false, false);
            UpdateCells(Row, false, ValCol, ValueFont, DataGridViewContentAlignment.MiddleRight);

            if (!Expanded)
            {
                Rows.RemoveAt(1);
                RowList.Add(Row);
            }
        }
Exemplo n.º 27
0
 public static void SaveToXml(string path, RowList rows)
 {
     try
     {
         using (System.IO.TextWriter writer = new System.IO.StreamWriter(path))
         {
             XmlSerializer serializer = new XmlSerializer(typeof(RowList));
             serializer.Serialize(writer, rows);
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.Print(ex.Message);
     }
 }
Exemplo n.º 28
0
        public static string NpcSpellClickMop(Dictionary <WowGuid, Unit> units)
        {
            if (units.Count == 0)
            {
                return(string.Empty);
            }

            if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.npc_spellclick_spells))
            {
                return(string.Empty);
            }

            var rows = new RowList <NpcSpellClick>();

            foreach (var unit in units)
            {
                var row = new Row <NpcSpellClick>();

                Unit npc = unit.Value;
                if (npc.InteractSpellID == null)
                {
                    continue;
                }

                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;
                    }
                }

                row.Data.Entry   = unit.Key.GetEntry();
                row.Data.SpellID = npc.InteractSpellID.GetValueOrDefault();

                rows.Add(row);
            }

            return(new SQLInsert <NpcSpellClick>(rows, false).Build());
        }
Exemplo n.º 29
0
        /// <summary>
        /// Sets the Rows List
        /// </summary>
        public override void SetRowLists()
        {
            base.SetRowLists();
            int rowIndex = 0;

            //last row is not part of the grid. so use count - 1 to disclude it.
            for (int i = 0; i < WebElementRows.Count - 1; i++)
            {
                Report.Write("GridRow by index: " + rowIndex);
                GridRowType rowType = GetGridRowType(rowIndex);
                Report.Write("GridRowType: " + rowType);
                var lineItem = new BenchmarkELARow(gridCssSelector, WebElementRows[i], _gridIndex, rowIndex, rowType, ColumnList, ControlPrefix);
                RowList.Add(lineItem);
                rowIndex++;
            }
        }
Exemplo n.º 30
0
        public void GetRowWithAddress()
        {
            IRowFilter filter = new AreEqualsFilter(this.table.GetColumnPosition("Address"), "Address 11");

            RowList rows = this.table.ApplyFilter(filter);

            Assert.IsNotNull(rows);
            Assert.AreEqual(1, rows.Count);

            Row row = rows[0];

            Assert.AreEqual("John 11", row["FirstName"]);
            Assert.AreEqual("Doe 11", row["LastName"]);
            Assert.AreEqual("Address 11", row["Address"]);
            Assert.AreEqual(2, row["DepartmentID"]);
        }
 public AutomaticSubtotalContext(AspNetCore.ReportingServices.ReportIntermediateFormat.Report report, List <ICreateSubtotals> createSubtotals, List <AspNetCore.ReportingServices.ReportIntermediateFormat.Grouping> domainScopeGroups, NameValidator reportItemNameValidator, NameValidator scopeNameValidator, NameValidator variableNameValidator, Dictionary <string, AspNetCore.ReportingServices.ReportIntermediateFormat.ISortFilterScope> reportScopes, List <AspNetCore.ReportingServices.ReportIntermediateFormat.ReportItemCollection> reportItemCollections, List <AspNetCore.ReportingServices.ReportIntermediateFormat.IAggregateHolder> aggregateHolders, List <AspNetCore.ReportingServices.ReportIntermediateFormat.IRunningValueHolder> runningValueHolders, Holder <int> variableSequenceIdCounter, Holder <int> textboxSequenceIdCounter, ScopeTree scopeTree)
 {
     this.m_createSubtotals         = createSubtotals;
     this.m_domainScopeGroups       = domainScopeGroups;
     this.m_reportItemNameValidator = reportItemNameValidator;
     this.m_scopeNameValidator      = scopeNameValidator;
     this.m_variableNameValidator   = variableNameValidator;
     this.m_report = report;
     this.m_variableSequenceIdCounter        = variableSequenceIdCounter;
     this.m_textboxSequenceIdCounter         = textboxSequenceIdCounter;
     this.m_dynamicWithStaticPeerEncountered = false;
     this.m_location          = LocationFlags.None;
     this.m_objectName        = null;
     this.m_objectType        = ObjectType.Tablix;
     this.m_currentDataRegion = null;
     this.m_cellLists         = null;
     this.m_tablixColumns     = null;
     this.m_rows                                = null;
     this.m_scopeNameMap                        = new Dictionary <string, string>(StringComparer.Ordinal);
     this.m_reportItemNameMap                   = new Dictionary <string, string>(StringComparer.Ordinal);
     this.m_aggregateMap                        = new Dictionary <string, string>(StringComparer.Ordinal);
     this.m_lookupMap                           = new Dictionary <string, string>(StringComparer.Ordinal);
     this.m_variableNameMap                     = new Dictionary <string, string>(StringComparer.Ordinal);
     this.m_currentScope                        = null;
     this.m_currentScopeBeingCloned             = null;
     this.m_startIndex                          = new Holder <int>();
     this.m_currentIndex                        = new Holder <int>();
     this.m_headerLevel                         = 0;
     this.m_originalColumnCount                 = 0;
     this.m_originalRowCount                    = 0;
     this.m_reportScopes                        = reportScopes;
     this.m_reportItemCollections               = reportItemCollections;
     this.m_aggregateHolders                    = aggregateHolders;
     this.m_runningValueHolders                 = runningValueHolders;
     this.m_expressionsWithReportItemReferences = new List <AspNetCore.ReportingServices.ReportIntermediateFormat.ExpressionInfo>();
     this.m_visibilitiesWithToggleToUpdate      = new List <AspNetCore.ReportingServices.ReportIntermediateFormat.Visibility>();
     this.m_reportItemsWithRepeatWithToUpdate   = new List <AspNetCore.ReportingServices.ReportIntermediateFormat.ReportItem>();
     this.m_endUserSortWithTarget               = new List <AspNetCore.ReportingServices.ReportIntermediateFormat.EndUserSort>();
     this.m_scopeNamesToClone                   = new Dictionary <string, IRIFDataScope>(StringComparer.Ordinal);
     this.m_headerLevelHasStaticArray           = null;
     this.m_currentDataRegionClone              = null;
     this.m_currentMapClone                     = null;
     this.m_outerAggregate                      = null;
     this.m_scopeTree                           = scopeTree;
     this.m_currentDataScope                    = null;
     this.m_currentMapVectorLayerClone          = null;
 }
Exemplo n.º 32
0
        public override MvcHtmlString GetTable(int id)
        {
            if (id == 1)
            {
                HeaderList = new List <string>();
                RowList    = Context.Companies.Take(20).ToList();
                FillPropNames(RowList.First());
                TagBuilder tableBuilder = new TagBuilder("table");
                tableBuilder.AddCssClass("table");
                tableBuilder.AddCssClass("table-hover");
                tableBuilder.GenerateId("myTable");
                #region thbuilder

                tableBuilder.InnerHtml += "<thead>";
                tableBuilder.InnerHtml += "<tr>";
                foreach (string th in HeaderList)
                {
                    tableBuilder.InnerHtml += "<th scope='col'>" + th + "</th>";
                }
                tableBuilder.InnerHtml += "<th scope='col'>Düzenle</th>";
                tableBuilder.InnerHtml += "<th scope='col'>Sil</th>";
                tableBuilder.InnerHtml += "</tr>";
                tableBuilder.InnerHtml += "</thead>";
                #endregion

                #region trbuilder

                tableBuilder.InnerHtml += "<tbody>";
                foreach (Company item in RowList)
                {
                    tableBuilder.InnerHtml += "<tr>";
                    foreach (string prop in HeaderList)
                    {
                        tableBuilder.InnerHtml += "<td name='" + prop + "'>" + item.GetType().GetProperty(prop)?.GetValue(item) + "</td>";
                    }
                    tableBuilder.InnerHtml += "<td id='c-" + item.GetType().GetProperty("id")?.GetValue(item) + "'><i onclick='Update(this)'; class='fa fa-edit' style='cursor:pointer'></i> </td>";
                    tableBuilder.InnerHtml += "<td id='c-" + item.GetType().GetProperty("id")?.GetValue(item) + "'><i onclick='Remove(this)'; class='fa fa-remove' style='color:red;cursor:pointer'></i> </td>";
                    tableBuilder.InnerHtml += "</tr>";
                }
                tableBuilder.InnerHtml += "</tbody>";

                #endregion

                return(MvcHtmlString.Create("<div class='row'><input type='text' class='form-control col-lg-8' id='TbSearch' placeholder='Arama için Yazınız'><input type='text' class='form-control col-lg-2' id='TbFilter' placeholder='Kriter Yazınız'><button id='BtnSearch' data-id='c' class='btn btn-info col-lg-2'>Ara</button></div>" + tableBuilder.ToString(TagRenderMode.Normal) + "<br><br><div class='text-center'><button id='BtnNext' data-id='c' class='btn btn-lg btn-success'> Devamını Gör</button></div><br><br><br>"));
            }
            return(NextTable.GetTable(id));
        }
Exemplo n.º 33
0
        public LoadRowsResult LoadRows(string relex, bool totalcount)
        {
            var res         = new LoadRowsResult();
            var relexParser = new RelExParser();
            var q           = relexParser.Parse(relex);

            var fldMapping = new FieldMapping(q.Fields);

            q.Fields = fldMapping.GetCompactFields();

            if (totalcount)
            {
                res.TotalCount = StorageDalc.RecordsCount(q);
            }

            var data = new RowList();

            StorageDalc.ExecuteReader(q, (reader) => {
                for (int i = 0; i < q.StartRecord; i++)
                {
                    reader.Read();                     // skip first N records
                }
                var cols = new List <string>();
                for (int i = 0; i < reader.FieldCount; i++)
                {
                    var fName = reader.GetName(i);
                    cols.Add(fldMapping.GetOriginalFieldName(fName));
                }

                while (reader.Read() && data.Count < q.RecordCount)
                {
                    var values = new object[reader.FieldCount];
                    reader.GetValues(values);
                    var row = new Dictionary <string, object>(values.Length);
                    for (int i = 0; i < reader.FieldCount; i++)
                    {
                        row[cols[i]] = DBNull.Value.Equals(values[i]) ? null : values[i];
                    }
                    data.Add(new DictionaryItem(row));
                }
            });

            res.Data = data;
            return(res);
        }
Exemplo n.º 34
0
    public override IEnumerable <Row> Combine(RowSet left, RowSet right, Row outputRow, string[] args)
    {
        var _rowList = new RowList();

        _rowList.Load(right); // Load the right RowSet into memory
        foreach (Row leftRow in left.Rows)
        {
            leftRow.CopyTo(outputRow); // Copy the data from the leftRow to the output
                                       // Copy the data from the rightRow to the output
            foreach (Row rightRow in _rowList.Rows)
            {
                for (int i = 0; i < rightRow.Count; ++i)
                {
                    rightRow[i].CopyTo(outputRow[i + leftRow.Count]);
                }
                yield return(outputRow);
            }
        }
    }
Exemplo n.º 35
0
        public static string Creature(Dictionary<WowGuid, Unit> units)
        {
            if (units.Count == 0)
                return string.Empty;

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

            uint count = 0;
            var rows = new RowList<Creature>();
            var addonRows = new RowList<CreatureAddon>();
            foreach (var unit in units)
            {
                Row<Creature> row = new Row<Creature>();
                bool badTransport = false;

                Unit creature = unit.Value;

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

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

                UpdateField uf;
                if (!creature.UpdateFields.TryGetValue(UpdateFields.GetUpdateField(ObjectField.OBJECT_FIELD_ENTRY), out uf))
                    continue;   // broken entry, nothing to spawn

                uint entry = uf.UInt32Value;

                uint movementType = 0;
                int spawnDist = 0;

                if (creature.Movement.HasWpsOrRandMov)
                {
                    movementType = 1;
                    spawnDist = 10;
                }

                row.Data.GUID = "@CGUID+" + count;

                row.Data.ID = entry;
                if (!creature.IsOnTransport())
                    row.Data.Map = creature.Map;
                else
                {
                    int mapId;
                    badTransport = !GetTransportMap(creature, out mapId);
                    if (mapId != -1)
                        row.Data.Map = (uint)mapId;
                }

                row.Data.SpawnMask = (uint)creature.GetDefaultSpawnMask();
                row.Data.PhaseMask = creature.PhaseMask;

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_3_4_15595) && creature.Phases != null)
                {
                    string data = string.Join(" - ", creature.Phases);
                    if (string.IsNullOrEmpty(data))
                        data = "0";

                    row.Data.PhaseID = data;
                }

                if (!creature.IsOnTransport())
                {
                    row.Data.PositionX = creature.Movement.Position.X;
                    row.Data.PositionY = creature.Movement.Position.Y;
                    row.Data.PositionZ = creature.Movement.Position.Z;
                    row.Data.Orientation = creature.Movement.Orientation;
                }
                else
                {
                    row.Data.PositionX = creature.Movement.TransportOffset.X;
                    row.Data.PositionY = creature.Movement.TransportOffset.Y;
                    row.Data.PositionZ = creature.Movement.TransportOffset.Z;
                    row.Data.Orientation = creature.Movement.TransportOffset.O;
                }

                row.Data.SpawnTimeSecs = creature.GetDefaultSpawnTime();
                row.Data.SpawnDist = spawnDist;
                row.Data.MovementType = movementType;

                // set some defaults
                row.Data.ZoneID = 0;
                row.Data.AreaID = 0;
                row.Data.PhaseGroup = 0;
                row.Data.ModelID = 0;
                row.Data.CurrentWaypoint = 0;
                row.Data.CurHealth = 0;
                row.Data.CurMana = 0;
                row.Data.NpcFlag = 0;
                row.Data.UnitFlag = 0;
                row.Data.DynamicFlag = 0;

                row.Comment = StoreGetters.GetName(StoreNameType.Unit, (int)unit.Key.GetEntry(), false);
                row.Comment += " (Area: " + StoreGetters.GetName(StoreNameType.Area, creature.Area, false) + ")";

                string auras = string.Empty;
                string commentAuras = string.Empty;
                if (creature.Auras != null && creature.Auras.Count != 0)
                {
                    foreach (Aura aura in creature.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 += aura.SpellId + " - " + StoreGetters.GetName(StoreNameType.Spell, (int)aura.SpellId, false) + ", ";
                    }

                    auras = auras.TrimEnd(' ');
                    commentAuras = commentAuras.TrimEnd(',', ' ');

                    row.Comment += " (Auras: " + commentAuras + ")";
                }

                var addonRow = new Row<CreatureAddon>();
                if (Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.creature_addon))
                {
                    addonRow.Data.GUID = "@CGUID+" + count;
                    addonRow.Data.PathID = 0;
                    addonRow.Data.Mount = creature.Mount.GetValueOrDefault(0);
                    addonRow.Data.Bytes1 = creature.Bytes1.GetValueOrDefault(0);
                    addonRow.Data.Bytes2 = creature.Bytes2.GetValueOrDefault(0);
                    addonRow.Data.Emote = 0;
                    addonRow.Data.Auras = auras;
                    addonRow.Data.AIAnimKit = creature.AIAnimKit.GetValueOrDefault(0);
                    addonRow.Data.MovementAnimKit = creature.MovementAnimKit.GetValueOrDefault(0);
                    addonRow.Data.MeleeAnimKit = creature.MeleeAnimKit.GetValueOrDefault(0);
                    addonRow.Comment += StoreGetters.GetName(StoreNameType.Unit, (int)unit.Key.GetEntry(), false);
                    if (!string.IsNullOrWhiteSpace(auras))
                        addonRow.Comment += " - " + commentAuras;
                    addonRows.Add(addonRow);
                }

                if (creature.IsTemporarySpawn())
                {
                    row.CommentOut = true;
                    row.Comment += " - !!! might be temporary spawn !!!";
                }
                else if (creature.IsOnTransport() && badTransport)
                {
                    row.CommentOut = true;
                    row.Comment += " - !!! on transport - transport template not found !!!";
                }
                else
                    ++count;

                if (creature.Movement.HasWpsOrRandMov)
                    row.Comment += " (possible waypoints or random movement)";

                rows.Add(row);
            }

            if (count == 0)
                return string.Empty;

            StringBuilder result = new StringBuilder();
            // delete query for GUIDs
            var delete = new SQLDelete<Creature>(Tuple.Create("@CGUID+0", "@CGUID+" + --count));
            result.Append(delete.Build());
            var sql = new SQLInsert<Creature>(rows, false);
            result.Append(sql.Build());

            if (Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.creature_addon))
            {
                var addonDelete = new SQLDelete<CreatureAddon>(Tuple.Create("@CGUID+0", "@CGUID+" + count));
                result.Append(addonDelete.Build());
                var addonSql = new SQLInsert<CreatureAddon>(addonRows, false);
                result.Append(addonSql.Build());
            }

            return result.ToString();
        }
Exemplo n.º 36
0
        public static string VehicleAccessory()
        {
            if (Storage.VehicleTemplateAccessories.IsEmpty() || !Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.vehicle_template_accessory))
                return string.Empty;

            var rows = new RowList<VehicleTemplateAccessory>();
            foreach (var accessory in Storage.VehicleTemplateAccessories)
            {
                if (accessory.Item1.SeatId < 0 || accessory.Item1.SeatId > 7)
                    continue;

                // ReSharper disable once UseObjectOrCollectionInitializer
                var row = new Row<VehicleTemplateAccessory>();
                row.Comment = StoreGetters.GetName(StoreNameType.Unit, (int)accessory.Item1.Entry.GetValueOrDefault(), false) + " - ";
                row.Comment += StoreGetters.GetName(StoreNameType.Unit, (int)accessory.Item1.AccessoryEntry.GetValueOrDefault(), false);
                accessory.Item1.Description = row.Comment;
                row.Data = accessory.Item1;

                rows.Add(row);
            }

            return new SQLInsert<VehicleTemplateAccessory>(rows, false).Build();
        }
Exemplo n.º 37
0
        public static string NpcSpellClickMop(Dictionary<WowGuid, Unit> units)
        {
            if (units.Count == 0 || !Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.npc_spellclick_spells))
                return string.Empty;

            var rows = new RowList<NpcSpellClick>();

            foreach (var unit in units)
            {
                var row = new Row<NpcSpellClick>();

                var npc = unit.Value;
                if (npc.InteractSpellID == null)
                    continue;

                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;

                row.Data.Entry = unit.Key.GetEntry();
                row.Data.SpellID = npc.InteractSpellID.GetValueOrDefault();

                rows.Add(row);
            }

            return new SQLInsert<NpcSpellClick>(rows, false).Build();
        }
Exemplo n.º 38
0
        public static string NpcSpellClick()
        {
            if (Storage.NpcSpellClicks.IsEmpty() || !Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.npc_spellclick_spells))
                return string.Empty;

            var rows = new RowList<NpcSpellClick>();

            foreach (var npcSpellClick in Storage.NpcSpellClicks)
            {
                foreach (var spellClick in Storage.SpellClicks)
                {
                    var row = new Row<NpcSpellClick>();

                    if (spellClick.Item1.CasterGUID.GetObjectType() == ObjectType.Unit && spellClick.Item1.TargetGUID.GetObjectType() == ObjectType.Unit)
                        spellClick.Item1.CastFlags = 0x0;
                    if (spellClick.Item1.CasterGUID.GetObjectType() == ObjectType.Player && spellClick.Item1.TargetGUID.GetObjectType() == ObjectType.Unit)
                        spellClick.Item1.CastFlags = 0x1;
                    if (spellClick.Item1.CasterGUID.GetObjectType() == ObjectType.Unit && spellClick.Item1.TargetGUID.GetObjectType() == ObjectType.Player)
                        spellClick.Item1.CastFlags = 0x2;
                    if (spellClick.Item1.CasterGUID.GetObjectType() == ObjectType.Player && spellClick.Item1.TargetGUID.GetObjectType() == ObjectType.Player)
                        spellClick.Item1.CastFlags = 0x3;

                    spellClick.Item1.Entry = npcSpellClick.Item1.GetEntry();
                    row.Data = spellClick.Item1;

                    var timeSpan = spellClick.Item2 - npcSpellClick.Item2;
                    if (timeSpan != null && timeSpan.Value.Duration() <= TimeSpan.FromSeconds(1))
                        rows.Add(row);
                }
            }

            return new SQLInsert<NpcSpellClick>(rows, false).Build();
        }
Exemplo n.º 39
0
        public static string CreatureText()
        {
            if (Storage.CreatureTexts.IsEmpty() || !Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.creature_text))
                return string.Empty;

            // For each sound and emote, if the time they were send is in the +1/-1 seconds range of
            // our texts, add that sound and emote to our Storage.CreatureTexts

            foreach (var text in Storage.CreatureTexts)
            {
                // For each text
                foreach (var textValue in text.Value)
                {
                    // For each emote
                    var text1 = text;
                    var value1 = textValue;
                    foreach (var emoteValue in from emote in Storage.Emotes where emote.Key.GetEntry() == text1.Key from emoteValue in emote.Value let timeSpan = value1.Item2 - emoteValue.Item2 where timeSpan != null && timeSpan.Value.Duration() <= TimeSpan.FromSeconds(1) select emoteValue)
                        textValue.Item1.Emote = emoteValue.Item1;

                    // For each sound
                    var value = textValue;
                    foreach (var sound in from sound in Storage.Sounds let timeSpan = value.Item2 - sound.Item2 where timeSpan != null && timeSpan.Value.Duration() <= TimeSpan.FromSeconds(1) select sound)
                        textValue.Item1.Sound = sound.Item1;

                    List<int> textList;
                    if (SQLDatabase.BroadcastMaleTexts.TryGetValue(textValue.Item1.Text, out textList) ||
                        SQLDatabase.BroadcastFemaleTexts.TryGetValue(textValue.Item1.Text, out textList))
                        textValue.Item1.BroadcastTextID = string.Join(" - ", textList);

                    // Set comment
                    string from = null, to = null;
                    if (!textValue.Item1.SenderGUID.IsEmpty())
                    {
                        if (textValue.Item1.SenderGUID.GetObjectType() == ObjectType.Player)
                            from = "Player";
                        else
                            from = !string.IsNullOrEmpty(textValue.Item1.SenderName) ? textValue.Item1.SenderName : StoreGetters.GetName(StoreNameType.Unit, (int)textValue.Item1.SenderGUID.GetEntry(), false);
                    }

                    if (!textValue.Item1.ReceiverGUID.IsEmpty())
                    {
                        if (textValue.Item1.ReceiverGUID.GetObjectType() == ObjectType.Player)
                            to = "Player";
                        else
                            to = !string.IsNullOrEmpty(textValue.Item1.ReceiverName) ? textValue.Item1.ReceiverName : StoreGetters.GetName(StoreNameType.Unit, (int)textValue.Item1.ReceiverGUID.GetEntry(), false);
                    }

                    Trace.Assert(text.Key == textValue.Item1.SenderGUID.GetEntry() ||
                        text.Key == textValue.Item1.ReceiverGUID.GetEntry());

                    if (from != null && to != null)
                        textValue.Item1.Comment = from + " to " + to;
                    else if (from != null)
                        textValue.Item1.Comment = from;
                    else
                        Trace.Assert(false);
                }
            }

            /* can't use compare DB without knowing values of groupid or id
            var entries = Storage.CreatureTexts.Keys.ToList();
            var creatureTextDb = SQLDatabase.GetDict<uint, CreatureText>(entries);
            */

            var rows = new RowList<CreatureText>();
            foreach (var text in Storage.CreatureTexts)
            {
                foreach (var textValue in text.Value)
                {
                    var row = new Row<CreatureText>
                    {
                        Data = new CreatureText
                        {
                            Entry = text.Key,
                            GroupId = null,
                            ID = null,
                            Text = textValue.Item1.Text,
                            Type = textValue.Item1.Type,
                            Language = textValue.Item1.Language,
                            Probability = 100.0f,
                            Emote = textValue.Item1.Emote,
                            Duration = 0,
                            Sound = textValue.Item1.Sound,
                            BroadcastTextID = textValue.Item1.BroadcastTextID,
                            Comment = textValue.Item1.Comment
                        }
                    };

                    rows.Add(row);
                }
            }

            return new SQLInsert<CreatureText>(rows, false).Build();
        }
Exemplo n.º 40
0
        //Override the OnPrintPage to provide the printing logic for the document
        protected override void OnPrintPage(PrintPageEventArgs ev)
        {
            int count = 0;
            float leftMargin = ev.MarginBounds.Left;
            float rightMargin = ev.MarginBounds.Right;
            float topMargin = ev.MarginBounds.Top;
            //ev.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;

            if (rc == null)
            {
                Document.ParseAll();
                Document.ParseAll(true);


                rc = new RowList();
                foreach (Row r in Document)
                {
                    bool hasbreak = false;
                    float x = leftMargin;
                    var newRow = new Row();
                    rc.Add(newRow);
                    foreach (Word w in r)
                    {
                        Font f = fontNormal;
                        if (w.Style != null)
                        {
                            FontStyle fs = 0;

                            if (w.Style.Bold)
                                fs |= FontStyle.Bold;

                            if (w.Style.Italic)
                                fs |= FontStyle.Italic;

                            if (w.Style.Underline)
                                fs |= FontStyle.Underline;

                            f = new Font("Courier new", 8, fs);
                        }
                        SizeF sf = ev.Graphics.MeasureString(w.Text, f);
                        if (x + sf.Width > rightMargin)
                        {
                            var chr = (char) 0xbf;
                            var br = new Word {Text = (chr + ""), InfoTip = "break char"};
                            newRow.Add(br);
                            hasbreak = true;


                            newRow = new Row();
                            rc.Add(newRow);
                            x = leftMargin;
                        }
                        x += sf.Width;
                        newRow.Add(w);
                    }
                    if (hasbreak)
                    {
                        rc.Add(new Row());
                    }
                }
            }
            //------------------------------------------------------

            base.OnPrintPage(ev);


            float lpp = ev.MarginBounds.Height/fontNormal.GetHeight(ev.Graphics);


            while (count < lpp && (RowIndex < rc.Count))
            {
                float x = leftMargin;
                float yPos = topMargin + (count*fontNormal.GetHeight(ev.Graphics));

                Row r = rc[RowIndex];

                foreach (Word w in r)
                {
                    if (w.InfoTip != null && w.InfoTip == "break char")
                    {
                        ev.Graphics.DrawString(w.Text, fontBreak, Brushes.Black, x, yPos,
                                               new StringFormat());
                    }
                    else
                    {
                        SizeF sf = ev.Graphics.MeasureString(w.Text, fontNormal);

                        if (w.Text != null && (".,:;".IndexOf(w.Text) >= 0))
                        {
                            sf.Width = 6;
                            x -= 4;
                        }
                        if (w.Text == "\t")
                        {
                            sf.Width = ev.Graphics.MeasureString("...", fontNormal).Width;
                        }


                        Color c = Color.Black;
                        Font f = fontNormal;
                        if (w.Style != null)
                        {
                            c = w.Style.ForeColor;
                            FontStyle fs = 0;

                            if (w.Style.Bold)
                                fs |= FontStyle.Bold;

                            if (w.Style.Italic)
                                fs |= FontStyle.Italic;

                            if (w.Style.Underline)
                                fs |= FontStyle.Underline;

                            f = new Font("Courier new", 8, fs);

                            if (!w.Style.Transparent)
                            {
                                Color bg = w.Style.BackColor;
                                ev.Graphics.FillRectangle(new SolidBrush(bg), x, yPos, sf.Width,
                                                          fontNormal.GetHeight(ev.Graphics));
                            }
                        }

                        c = Color.FromArgb(c.R, c.G, c.B);


                        ev.Graphics.DrawString(w.Text, f, new SolidBrush(c), x, yPos, new
                                                                                          StringFormat());
                        x += sf.Width;
                    }
                }

                count++;
                RowIndex++;
            }

            //If we have more lines then print another page
            ev.HasMorePages = RowIndex < rc.Count;
        }
Exemplo n.º 41
0
 public Table(string[] columns, RowList rows)
 {
     Columns = columns;
       Rows = rows;
 }
Exemplo n.º 42
0
        public static string WeatherUpdates()
        {
            if (Storage.WeatherUpdates.IsEmpty())
                return string.Empty;

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

            var rows = new RowList<WeatherUpdate>();
            foreach (var row in Storage.WeatherUpdates.Select(weatherUpdate => new Row<WeatherUpdate>
            {
                Data = weatherUpdate.Item1,
                Comment = StoreGetters.GetName(StoreNameType.Map, (int)weatherUpdate.Item1.MapId.GetValueOrDefault(), false) +
                          " - " + weatherUpdate.Item1.State + " - " + weatherUpdate.Item1.Grade
            }))
            {
                rows.Add(row);
            }

            return new SQLInsert<WeatherUpdate>(rows, ignore: true, withDelete: false).Build();
        }
Exemplo n.º 43
0
        private void InternalResetVisibleRows()
        {
//			if (System.DateTime.Now > new DateTime (2002,12,31))
//			{
//				
//				this.rows = new RowList ();
//				this.Add ("BETA VERSION EXPIRED");
//				VisibleRows = this.rows;
//				return;
//			}

            if (!folding)
            {
                VisibleRows = rows;
                NeedResetRows = false;
            }
            else
            {
                NeedResetRows = false;
                VisibleRows = new RowList(); //.Clear ();			
                int RealRow = 0;
                for (int i = 0; i < Count; i++)
                {
                    Row r = this[RealRow];
                    VisibleRows.Add(r);
                    bool collapsed = false;
                    if (r.CanFold)
                        if (r.expansion_StartSpan.Expanded == false)
                        {
                            if (r.expansion_StartSpan.EndWord == null) {}
                            else
                            {
                                r = r.Expansion_EndRow; // .expansion_StartSpan.EndRow;
                                collapsed = true;
                            }
                        }

                    if (!collapsed)
                        RealRow++;
                    else
                        RealRow = IndexOf(r) + 1;

                    if (RealRow >= Count)
                        break;
                }
            }
        }
Exemplo n.º 44
0
        public static string GameObject(Dictionary<WowGuid, GameObject> gameObjects)
        {
            if (gameObjects.Count == 0)
                return string.Empty;

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

            uint count = 0;
            var rows = new RowList<GameObjectModel>();
            var addonRows = new RowList<GameObjectAddon>();
            foreach (var gameobject in gameObjects)
            {
                Row<GameObjectModel> row = new Row<GameObjectModel>();

                GameObject go = gameobject.Value;

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

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

                uint animprogress = 0;
                uint state = 0;
                UpdateField uf;
                if (!go.UpdateFields.TryGetValue(UpdateFields.GetUpdateField(ObjectField.OBJECT_FIELD_ENTRY), out uf))
                    continue;   // broken entry, nothing to spawn

                uint entry = uf.UInt32Value;
                bool badTransport = false;

                if (go.UpdateFields.TryGetValue(UpdateFields.GetUpdateField(GameObjectField.GAMEOBJECT_BYTES_1), out uf))
                {
                    uint bytes = uf.UInt32Value;
                    state = (bytes & 0x000000FF);
                    animprogress = Convert.ToUInt32((bytes & 0xFF000000) >> 24);
                }

                row.Data.GUID = "@OGUID+" + count;

                row.Data.ID = entry;
                if (!go.IsOnTransport())
                    row.Data.Map = go.Map;
                else
                {
                    int mapId;
                    badTransport = !GetTransportMap(go, out mapId);
                    if (mapId != -1)
                        row.Data.Map = (uint)mapId;
                }

                row.Data.SpawnMask = (uint)go.GetDefaultSpawnMask();
                row.Data.PhaseMask = go.PhaseMask;

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_3_4_15595) && go.Phases != null)
                    row.Data.PhaseID = string.Join(" - ", go.Phases);

                if (!go.IsOnTransport())
                {
                    row.Data.PositionX = go.Movement.Position.X;
                    row.Data.PositionY = go.Movement.Position.Y;
                    row.Data.PositionZ = go.Movement.Position.Z;
                    row.Data.Orientation = go.Movement.Orientation;
                }
                else
                {
                    row.Data.PositionX = go.Movement.TransportOffset.X;
                    row.Data.PositionY = go.Movement.TransportOffset.Y;
                    row.Data.PositionZ = go.Movement.TransportOffset.Z;
                    row.Data.Orientation = go.Movement.TransportOffset.O;
                }

                var rotation = go.GetStaticRotation();
                row.Data.Rotation = new float?[] { rotation.X, rotation.Y, rotation.Z, rotation.W };

                bool add = true;
                var addonRow = new Row<GameObjectAddon>();
                if (Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.gameobject_addon))
                {
                    addonRow.Data.GUID = "@OGUID+" + count;

                    var parentRotation = go.GetParentRotation();

                    if (parentRotation != null)
                    {
                        addonRow.Data.parentRot0 = parentRotation[0].GetValueOrDefault(0.0f);
                        addonRow.Data.parentRot1 = parentRotation[1].GetValueOrDefault(0.0f);
                        addonRow.Data.parentRot2 = parentRotation[2].GetValueOrDefault(0.0f);
                        addonRow.Data.parentRot3 = parentRotation[3].GetValueOrDefault(1.0f);

                        if (addonRow.Data.parentRot0 == 0.0f &&
                            addonRow.Data.parentRot1 == 0.0f &&
                            addonRow.Data.parentRot2 == 0.0f &&
                            addonRow.Data.parentRot3 == 1.0f)
                            add = false;
                    }
                    else
                        add = false;

                    addonRow.Comment += StoreGetters.GetName(StoreNameType.GameObject, (int)gameobject.Key.GetEntry(), false);

                    if (add)
                        addonRows.Add(addonRow);
                }

                row.Data.SpawnTimeSecs = (int)go.GetDefaultSpawnTime();
                row.Data.AnimProgress = animprogress;
                row.Data.State = state;

                // set some defaults
                row.Data.ZoneID = 0;
                row.Data.AreaID = 0;
                row.Data.PhaseGroup = 0;

                row.Comment = StoreGetters.GetName(StoreNameType.GameObject, (int)gameobject.Key.GetEntry(), false);
                row.Comment += " (Area: " + StoreGetters.GetName(StoreNameType.Area, go.Area, false) + ")";

                if (go.IsTemporarySpawn())
                {
                    row.CommentOut = true;
                    row.Comment += " - !!! might be temporary spawn !!!";
                }
                else if (go.IsTransport())
                {
                    row.CommentOut = true;
                    row.Comment += " - !!! transport !!!";
                }
                else if (go.IsOnTransport() && badTransport)
                {
                    row.CommentOut = true;
                    row.Comment += " - !!! on transport - transport template not found !!!";
                }
                else
                    ++count;

                rows.Add(row);
            }

            if (count == 0)
                return String.Empty;

            StringBuilder result = new StringBuilder();
            // delete query for GUIDs
            var delete = new SQLDelete<GameObjectModel>(Tuple.Create("@OGUID+0", "@OGUID+" + --count));
            result.Append(delete.Build());

            var sql = new SQLInsert<GameObjectModel>(rows, false);
            result.Append(sql.Build());

            if (Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.gameobject_addon))
            {
                var addonDelete = new SQLDelete<GameObjectAddon>(Tuple.Create("@OGUID+0", "@OGUID+" + count));
                result.Append(addonDelete.Build());
                var addonSql = new SQLInsert<GameObjectAddon>(addonRows, false);
                result.Append(addonSql.Build());
            }

            return result.ToString();
        }