public static void IndexNamedData(string dataPath) { try { EntryDataIndex fullGuide = new EntryDataIndex(); foreach (string dir in PathMod.GetModFiles(dataPath, "*" + DataManager.DATA_EXT)) { string file = Path.GetFileNameWithoutExtension(dir); int num = Convert.ToInt32(file); IEntryData data = (IEntryData)DataManager.LoadData(dir); while (fullGuide.Entries.Count <= num) { fullGuide.Entries.Add(new EntrySummary()); } fullGuide.Entries[num] = data.GenerateEntrySummary(); } using (Stream stream = new FileStream(PathMod.ModPath(dataPath + "index.idx"), FileMode.Create, FileAccess.Write, FileShare.None)) { using (BinaryWriter writer = new BinaryWriter(stream)) { IFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, fullGuide); } } } catch (Exception ex) { DiagManager.Instance.LogError(new Exception("Error importing index at " + dataPath + "\n", ex)); } }
public MusicMenu(MusicChoice choice) { this.choice = choice; files = PathMod.GetModFiles(GraphicsManager.MUSIC_PATH); List <MenuChoice> flatChoices = new List <MenuChoice>(); flatChoices.Add(new MenuTextChoice("---", () => { choose(""); })); foreach (string song in files) { if (!DataManager.IsNonTrivialFile(song)) { continue; } flatChoices.Add(new MenuTextChoice(Path.GetFileNameWithoutExtension(song), () => { choose(Path.GetFileName(song)); })); } List <MenuChoice[]> choices = SortIntoPages(flatChoices, SLOTS_PER_PAGE); summaryMenu = new SongSummary(Rect.FromPoints(new Loc(8, GraphicsManager.ScreenHeight - 8 - 5 * VERT_SPACE - GraphicsManager.MenuBG.TileHeight * 2), new Loc(GraphicsManager.ScreenWidth - 8, GraphicsManager.ScreenHeight - 8))); Initialize(new Loc(8, 16), 304, Text.FormatKey("MENU_MUSIC_TITLE"), choices.ToArray(), 0, 0, SLOTS_PER_PAGE); }
public override void LoadWindowControls(StackPanel control, string parent, string name, Type type, object[] attributes, String member) { LoadLabelControl(control, name); AnimAttribute animAtt = ReflectionExt.FindAttribute <AnimAttribute>(attributes); ComboBox cbValue = new ComboBox(); cbValue.VirtualizationMode = ItemVirtualizationMode.Simple; string choice = member; List <string> items = new List <string>(); items.Add("---"); int chosenIndex = 0; string[] dirs = PathMod.GetModFiles(GraphicsManager.CONTENT_PATH + animAtt.FolderPath); for (int ii = 0; ii < dirs.Length; ii++) { string filename = Path.GetFileNameWithoutExtension(dirs[ii]); if (filename == choice) { chosenIndex = items.Count; } items.Add(filename); } var subject = new Subject <List <string> >(); cbValue.Bind(ComboBox.ItemsProperty, subject); subject.OnNext(items); cbValue.SelectedIndex = chosenIndex; control.Children.Add(cbValue); }
public static void BuildTileIndex(string cachePattern) { TileGuide fullGuide = new TileGuide(); string search = Path.GetDirectoryName(String.Format(cachePattern, '*')); string pattern = Path.GetFileName(String.Format(cachePattern, '*')); try { foreach (string dir in PathMod.GetModFiles(search, pattern)) { string file = Path.GetFileNameWithoutExtension(dir); using (FileStream stream = File.OpenRead(dir)) { using (BinaryReader reader = new BinaryReader(stream)) { TileIndexNode guide = TileIndexNode.Load(reader); fullGuide.Nodes[file] = guide; } } } using (FileStream stream = new FileStream(PathMod.HardMod(search + "/index.idx"), FileMode.Create, FileAccess.Write)) { using (BinaryWriter writer = new BinaryWriter(stream)) fullGuide.Save(writer); } } catch (Exception ex) { DiagManager.Instance.LogError(new Exception("Error importing index at " + search + "\n", ex)); } }
public static void ReserializeData(string dataPath, string ext) { foreach (string dir in PathMod.GetModFiles(dataPath, "*" + ext)) { IEntryData data = (IEntryData)DataManager.LoadData(dir, DiagManager.Instance.UpgradeBinder); DataManager.SaveData(dir, data); } }
public static void DemoData(string dataPath, string ext) { foreach (string dir in PathMod.GetModFiles(dataPath, "*" + ext)) { IEntryData data = (IEntryData)DataManager.LoadData(dir); if (!data.Released) { data = (IEntryData)ReflectionExt.CreateMinimalInstance(data.GetType()); } DataManager.SaveData(dir, data); } }
public override void ReIndex() { FeatureData.Clear(); string dataPath = DataManager.DATA_PATH + DataManager.DataType.Monster.ToString() + "/"; foreach (string dir in PathMod.GetModFiles(dataPath, "*" + DataManager.DATA_EXT)) { string file = Path.GetFileNameWithoutExtension(dir); int num = Convert.ToInt32(file); MonsterData data = DataManager.LoadData <MonsterData>(dir); Dictionary <int, FormFeatureSummary> formSummaries = computeSummary(dataPath, num, data); FeatureData[num] = formSummaries; } }
public override void ReIndex() { RarityMap.Clear(); string dataPath = DataManager.DATA_PATH + DataManager.DataType.Item.ToString() + "/"; foreach (string dir in PathMod.GetModFiles(dataPath, "*" + DataManager.DATA_EXT)) { string file = Path.GetFileNameWithoutExtension(dir); int num = Convert.ToInt32(file); ItemData data = DataManager.LoadData <ItemData>(dir); if (data.Released) { computeSummary(num, data); } } }
public static void ReserializeBase() { { string dir = PathMod.ModPath(DataManager.DATA_PATH + "Universal.bin"); object data = DataManager.LoadData(dir, DiagManager.Instance.UpgradeBinder); DataManager.SaveData(dir, data); } string editPath = Path.Combine(PathMod.RESOURCE_PATH, "Extensions"); foreach (string dir in Directory.GetFiles(editPath, "*.op")) { object data = DataManager.LoadData(dir, DiagManager.Instance.UpgradeBinder); DataManager.SaveData(dir, data); } foreach (string dir in PathMod.GetModFiles(DataManager.FX_PATH, "*.fx")) { object data = DataManager.LoadData(dir, DiagManager.Instance.UpgradeBinder); DataManager.SaveData(dir, data); } }
public GroundTabDecorationsViewModel() { Layers = new AnimLayerBoxViewModel(DiagManager.Instance.DevEditor.GroundEditor.Edits); Layers.SelectedLayerChanged += Layers_SelectedLayerChanged; SelectedEntity = new GroundAnim(); Directions = new ObservableCollection <string>(); foreach (Dir8 dir in DirExt.VALID_DIR8) { Directions.Add(dir.ToLocal()); } ObjectAnims = new ObservableCollection <string>(); string[] dirs = PathMod.GetModFiles(GraphicsManager.CONTENT_PATH + "Object/"); for (int ii = 0; ii < dirs.Length; ii++) { string filename = Path.GetFileNameWithoutExtension(dirs[ii]); ObjectAnims.Add(filename); } ChosenObjectAnim = 0; FrameLength = 1; }
private void reloadMusic() { if (Design.IsDesignMode) { return; } lock (GameBase.lockObj) { Music.Clear(); string[] files = PathMod.GetModFiles(GraphicsManager.MUSIC_PATH, "*.ogg"); Music.Add("None"); for (int ii = 0; ii < files.Length; ii++) { string song = Path.GetFileName(files[ii]); Music.Add(song); if (song == ZoneManager.Instance.CurrentGround.Music) { ChosenMusic = ii + 1; } } } }