Пример #1
0
        private void ExtractMapBtn_Click(object sender, RoutedEventArgs e)
        {
            TerritoryType t    = (TerritoryType)placeBox.SelectedValue;
            Territory     teri = null;

            if (!string.IsNullOrEmpty(packBox.Text))
            {
                //if (packBox.Text.Contains("bg"))
                {
                    var split    = packBox.Text.Split('/');
                    var teriName = split[4];

                    var datPath = packBox.Text.Replace(".lgb", "").Replace("bg/", "");

                    teri = new SaintCoinach.Graphics.Territory(realm.Packs, teriName, datPath);
                }
            }

            DataWriter.WriteMap(realm, t, teri);
        }
Пример #2
0
        //Does not support recursive sgb
        private void getFilesBtn_Click(object sender, RoutedEventArgs e)
        {
            maplist.Clear();

            StringBuilder sb = new StringBuilder(mapPath);

            sb.Append(territoryName + @"\");

            territory = new SaintCoinach.Graphics.Territory((TerritoryType)placeBox.SelectedItem);

            String territoryFolder = sb.ToString();

            if (!Directory.Exists(territoryFolder))
            {
                Directory.CreateDirectory(territoryFolder);
            }

            if (territory.Terrain != null)
            {
                foreach (var part in territory.Terrain.Parts)
                {
                    addToMapList("territory", part);
                    addToFileList(part.Model.File.Path);
                }
            }

            // Get the files we need
            foreach (var lgbFile in territory.LgbFiles)
            {
                foreach (var group in lgbFile.Groups)
                {
                    if (!eventCheck(group.Name))
                    {
                        addHeaderToMapList("LGBGroup: " + group.Name);
                        foreach (var part in group.Entries)
                        {
                            var asMdl = part as SaintCoinach.Graphics.Lgb.LgbModelEntry;
                            var asGim = part as SaintCoinach.Graphics.Lgb.LgbGimmickEntry;

                            string path = "";
                            if (asMdl?.Model?.Model != null)
                            {
                                path = asMdl.Model.Model.File.Path;
                                addToMapList(group.Name, asMdl.Model);
                                addToFileList(path);
                            }

                            if (asGim?.Gimmick != null)
                            {
                                List <String> gimmickFileList = getGimmickPaths(asGim);

                                addGimmickInfoToMapList(asGim);
                                addGimmicksToMapList(group.Name, asGim);
                                addHeaderToMapList("GimmickEnd");

                                foreach (String gPath in gimmickFileList)
                                {
                                    addToFileList(gPath);
                                }
                            }

                            addToFileList(path);
                        }
                    }
                }
            }
        }
Пример #3
0
        private void OnOpen()
        {
            if (SelectedTerritory == null)
                return;

            try {
                var t = new Territory(SelectedTerritory.TerritoryType);

                if (t == null)
                    System.Windows.MessageBox.Show(string.Format("Could not find territory data for {0}.", SelectedTerritory.Name), "Territory not found", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
                else
                    Parent.EngineHelper.OpenInNew(SelectedTerritory.Name, (e) => new SaintCoinach.Graphics.Viewer.Content.ContentTerritory(e, t));
            } catch (Exception e) {
                System.Windows.MessageBox.Show(string.Format("Error reading territory for {0}:{1}{2}", SelectedTerritory.Name, Environment.NewLine, e), "Failure to read territory", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
            }
        }