示例#1
0
        static void Main(string[] args)
        {
            CASC.InitCasc(null, "C:\\World of Warcraft", "wow");

            var creatureData = new DBFilesClient.NET.Storage <CreatureEntry>(CASC.cascHandler.OpenFile(@"DBFilesClient/Creature.db2"));
            var cdiData      = new DBFilesClient.NET.Storage <CreatureDisplayInfoEntry>(CASC.cascHandler.OpenFile(@"DBFilesClient/CreatureDisplayInfo.db2"));

            using (DatWebClient client = new DatWebClient())
            {
                foreach (var entry in creatureData)
                {
                    if (File.Exists("Creature/" + entry.Key + ".png"))
                    {
                        continue;
                    }
                    if (entry.Value.DisplayID[0] == 0)
                    {
                        continue;
                    }
                    try
                    {
                        client.DownloadFile(new Uri("http://localhost:12345/wow/creature/" + entry.Key), "Creature/" + entry.Key + ".png");
                    }
                    catch
                    {
                    }
                }

                foreach (var entry in cdiData)
                {
                    if (File.Exists("CDI/" + entry.Key + ".png"))
                    {
                        continue;
                    }
                    if (entry.Value.ModelID == 0)
                    {
                        continue;
                    }
                    try
                    {
                        client.DownloadFile(new Uri("http://localhost:12345/wow/creatureDisplayInfo/" + entry.Key), "CDI/" + entry.Key + ".png");
                    }
                    catch
                    {
                    }
                }
            }
        }
示例#2
0
        private void MapsTab_GotFocus(object sender, RoutedEventArgs e)
        {
            if (!mapsLoaded)
            {
                try
                {
                    mapListBox.DisplayMemberPath = "Value";
                    var mapsData = new DBFilesClient.NET.Storage <MapEntry>(CASC.OpenFile(@"DBFilesClient/Map.db2"));
                    foreach (var mapEntry in mapsData)
                    {
                        mapListBox.Items.Add(new KeyValuePair <string, string>(mapEntry.Value.directory, mapEntry.Value.mapname_lang));
                    }

                    mapsLoaded = true;
                }
                catch (Exception ex)
                {
                    Console.WriteLine("An error occured: " + ex.Message);
                }
            }
        }
示例#3
0
        private void UpdateMapListView()
        {
            if (!File.Exists("mapnames.csv"))
            {
                UpdateMapList();
            }

            if (File.Exists("mapnames.csv") && mapNames.Count == 0)
            {
                using (TextFieldParser parser = new TextFieldParser("mapnames.csv"))
                {
                    parser.TextFieldType = FieldType.Delimited;
                    parser.SetDelimiters(",");
                    while (!parser.EndOfData)
                    {
                        string[] fields = parser.ReadFields();
                        if (fields[0] != "ID")
                        {
                            mapNames.Add(int.Parse(fields[0]), new NiceMapEntry {
                                ID = fields[0], Name = fields[4], Internal = fields[2], Type = fields[3], Expansion = fields[5]
                            });
                        }
                    }
                }
            }

            mapListBox.DisplayMemberPath = "Value";
            mapListBox.Items.Clear();

            // try
            //{
            CASC.cascHandler.OpenFile(@"DBFilesClient/Map.db2").ExtractToFile("DBFilesClient", "Map.db2");
            var mapsData = new DBFilesClient.NET.Storage <MapEntry72>(@"DBFilesClient/Map.db2");

            foreach (var mapEntry in mapsData)
            {
                if (CASC.cascHandler.FileExists("World/Maps/" + mapEntry.Value.directory + "/" + mapEntry.Value.directory + ".wdt"))
                {
                    var mapItem = new MapListItem {
                        Internal = mapEntry.Value.directory
                    };

                    if (mapNames.ContainsKey(mapEntry.Key))
                    {
                        mapItem.Name = mapNames[mapEntry.Key].Name;
                        mapItem.Type = mapNames[mapEntry.Key].Type;
                        var expansionID = ExpansionNameToID(mapNames[mapEntry.Key].Expansion);
                        mapItem.Image = "pack://application:,,,/Resources/wow" + expansionID + ".png";

                        if (!mapFilters.Contains("wow" + expansionID) || !mapFilters.Contains(mapItem.Type))
                        {
                            continue;
                        }
                    }
                    else
                    {
                        mapItem.Name  = mapEntry.Value.mapname_lang;
                        mapItem.Type  = "UNKNOWN";
                        mapItem.Image = "pack://application:,,,/Resources/wow7.png";
                    }

                    if (string.IsNullOrEmpty(filterTextBox.Text) || (mapEntry.Value.directory.IndexOf(filterTextBox.Text, 0, StringComparison.CurrentCultureIgnoreCase) != -1 || mapEntry.Value.mapname_lang.IndexOf(filterTextBox.Text, 0, StringComparison.CurrentCultureIgnoreCase) != -1))
                    {
                        mapListBox.Items.Add(mapItem);
                    }
                }
            }

            /*}
             * catch (Exception ex)
             * {
             *  Console.WriteLine("An error occured during DBC reading.. falling back to CSV!" + ex.Message);
             *  foreach (var map in mapNames)
             *  {
             *      if (CASC.FileExists("World/Maps/" + map.Value.Internal + "/" + map.Value.Internal + ".wdt"))
             *      {
             *          mapListBox.Items.Add(new MapListItem { Name = map.Value.Name, Internal = map.Value.Internal, Type = map.Value.Type });
             *      }
             *  }
             * }*/

            mapsLoaded = true;
        }