public void ParseLocalData()
        {                                           // extract data from local FFXIV installation
            int itemCount = 0;
            var realm = new SaintCoinach.ARealmReversed(gameDir, SaintCoinach.Ex.Language.English);
            if (!realm.IsCurrentVersion)
            {
                const bool IncludeDataChanges = true;
                var updateReport = realm.Update(IncludeDataChanges);
                Console.WriteLine(updateReport.Changes.Count + " files updated.");
                if (File.Exists(dataBuilt))
                {
                    File.Delete(dataBuilt);
                }
            }

            //// DELETE THIS BEFORE PRODUCTION
            if (File.Exists(dataBuilt))          
            {
                File.Delete(dataBuilt);
            }   //// DELETE THIS BEFORE PRODUCTION

            if (!File.Exists(dataBuilt))
            {
                CreateOrEmptyDirectories();
                List<string> itemData = new List<string>();
                itemCount = realm.GameData.GetSheet<SaintCoinach.Xiv.Item>().Count;
                var itemList = realm.GameData.GetSheet<SaintCoinach.Xiv.Item>();

                //for (int ix = 1; ix <= 10; ix++)
                foreach (var item in itemList)
                {
                    string itemName = item.Name;
                    itemName = RemovePathUnfriendlyCharacters(itemName);
                    string path = itemPath + itemName + itemExt;
                    //string path = itemPath + item.Name + itemExt;
                    if (!File.Exists(path))
                    {
                        CreateEntry(File.CreateText(path), item);
                    }
                }
                File.Create(dataBuilt);
            }
        }
        public MainWindow()
        {
            InitializeComponent();

            realm = new ARealmReversed(FFXIVHSPaths.GetGameDirectory(), SaintCoinach.Ex.Language.English);

            if (!realm.IsCurrentVersion)
            {
                MessageBox.Show("Game ver: " + realm.GameVersion + Environment.NewLine +
                                "Def ver: " + realm.DefinitionVersion + Environment.NewLine +
                                "Updating...");
                realm.Update(true);
            }

            TerritoryType[]      territoryTypes      = realm.GameData.GetSheet <TerritoryType>().ToArray();
            List <TerritoryType> relevantTerritories = new List <TerritoryType>();

            foreach (TerritoryType t in territoryTypes)
            {
                if (!String.IsNullOrEmpty(t.PlaceName.ToString()))
                {
                    byte intendedUse = (byte)t.GetRaw("TerritoryIntendedUse");

                    //Housing intended use column value is 13
                    if (intendedUse == 13)// || intendedUse == 16 || intendedUse == 17)
                    {
                        relevantTerritories.Add(t);
                    }
                    else if (intendedUse == 14)
                    {
                        if (t.PlaceName.ToString().Contains("Private") || t.PlaceName.ToString().Contains("Apartment"))
                        {
                            relevantTerritories.Add(t);
                        }
                    }
                }
            }
            amountLabel.Content = (String)amountLabel.Content + relevantTerritories.Count;

            placeBox.ItemsSource       = relevantTerritories;
            placeBox.DisplayMemberPath = "PlaceName";
            placeBox.SelectedValuePath = ".";
        }