public PropSheet(string fileName) { try { this.rows = new Dictionary <uint, Prop>(); uint index = 0; Dictionary <string, string> stringRows = SerializerService.DeserializeFile <Dictionary <string, string> >(fileName); foreach ((string key, string value) in stringRows) { string[] parts = value.Split(';', StringSplitOptions.RemoveEmptyEntries); (ushort modelSet, ushort modelBase, ushort modelVariant) = IItemConverter.SplitString(key); Prop prop = new Prop(); prop.Name = parts[0].Trim(); if (parts.Length == 2) { prop.Description = parts[1].Trim(); } prop.ModelBase = modelBase; prop.ModelVariant = modelVariant; prop.ModelSet = modelSet; this.rows.Add(index, prop); index++; } } catch (Exception ex) { throw new Exception($"Failed to load json data: {fileName}", ex); } }
private SkeletonFile Load(string path) { SkeletonFile template = SerializerService.DeserializeFile <SkeletonFile>(path); BoneNameFiles.Add(template); if (template.BasedOn != null) { SkeletonFile baseTemplate = this.Load("Data/Skeletons/" + template.BasedOn); template.CopyBaseValues(baseTemplate); } // Validate that all bone names are unique if (template.BoneNames != null) { HashSet <string> boneNames = new HashSet <string>(); foreach ((string orignal, string name) in template.BoneNames) { if (boneNames.Contains(name)) { throw new Exception($"Duplicate bone name: {name} in skeleton file: {path}"); } boneNames.Add(name); } } return(template); }
private async Task Run() { if (this.isRunning) { return; } this.isRunning = true; Random rnd = new Random(); while (this.IsVisible) { List <Entry> entries = SerializerService.DeserializeFile <List <Entry> >("Data/Images.json"); while (this.IsVisible && entries.Count > 0) { int index = rnd.Next(entries.Count); await this.Show(entries[index], rnd); entries.RemoveAt(index); await Task.Delay(5000); } } this.isRunning = false; }
private void Load(SkeletonFile template) { BoneNameFiles.Add(template); if (template.BasedOn != null) { SkeletonFile baseTemplate = SerializerService.DeserializeFile <SkeletonFile>("Data/Skeletons/" + template.BasedOn); this.Load(baseTemplate); template.CopyBaseValues(baseTemplate); } }
private async Task Run() { if (this.isRunning) { return; } while (!this.IsVisible) { await Task.Delay(500); } if (!SettingsService.Current.ShowGallery) { return; } this.isRunning = true; Random rnd = new Random(); this.skip = true; while (this.IsVisible) { List <Entry> entries = SerializerService.DeserializeFile <List <Entry> >("Data/Images.json"); while (this.IsVisible && entries.Count > 0) { if (!SettingsService.Current.ShowGallery) { this.isRunning = false; return; } int delay = 0; while (!this.skip && delay < ImageDelay) { delay += 100; await Task.Delay(100); } int index = rnd.Next(entries.Count); await this.Show(entries[index], rnd); entries.RemoveAt(index); this.skip = false; } } this.isRunning = false; }
public override Task Start() { try { this.tips = SerializerService.DeserializeFile <List <TipEntry> >("Data/Tips.json"); } catch (Exception ex) { Log.Warning(ex, "Failed to load tips."); } Task.Run(this.TipCycle); return(base.Start()); }
public override Task Start() { try { this.tips = SerializerService.DeserializeFile <List <TipEntry> >("Tips.json"); } catch (Exception ex) { Log.Write(SimpleLog.Severity.Warning, new Exception("Failed to load tips.", ex)); } Task.Run(this.TipCycle); return(base.Start()); }
public JsonDictionarySheet(string fileName) { try { Dictionary <string, T> stringRows = SerializerService.DeserializeFile <Dictionary <string, T> >(fileName); this.rows = new Dictionary <int, T>(); foreach ((string key, T value) in stringRows) { int intKey = int.Parse(key); value.Key = intKey; this.rows.Add(intKey, value); } } catch (Exception ex) { throw new Exception($"Failed to load json data: {fileName}", ex); } }
public override async Task Initialize() { await base.Initialize(); try { string filePath = MemoryService.GamePath + "\\game\\XivMods.json"; if (!File.Exists(filePath)) { return; } modList = SerializerService.DeserializeFile <ModList>(filePath); } catch (Exception ex) { Log.Error(ex, "Failed to read modlist"); } }
public JsonListSheet(string fileName) { try { List <T> rows = SerializerService.DeserializeFile <List <T> >(fileName); this.rows = new Dictionary <uint, T>(); uint index = 0; foreach (T value in rows) { value.Key = index; this.rows.Add(index, value); index++; } } catch (Exception ex) { throw new Exception($"Failed to load json data: {fileName}", ex); } }
public override Task Initialize() { this.lumina = new LuminaData(MemoryService.GamePath + "\\game\\sqpack\\"); Races = new Sheet <IRace, Race, RaceViewModel>(this.lumina); Tribes = new Sheet <ITribe, Tribe, TribeViewModel>(this.lumina); Items = new Sheet <IItem, Lumina.Excel.GeneratedSheets.Item, GameData.ViewModels.ItemViewModel>(this.lumina); Dyes = new Sheet <IDye, Stain, DyeViewModel>(this.lumina); BaseNPCs = new Sheet <INpcBase, ENpcBase, NpcBaseViewModel>(this.lumina); Territories = new Sheet <ITerritoryType, TerritoryType, TerritoryTypeViewModel>(this.lumina); Weathers = new Sheet <IWeather, Weather, WeatherViewModel>(this.lumina); CharacterMakeCustomize = new CustomizeSheet(this.lumina); CharacterMakeTypes = new Sheet <ICharaMakeType, GameData.Sheets.CharaMakeType, CharaMakeTypeViewModel>(this.lumina); ResidentNPCs = new Sheet <INpcResident, ENpcResident, NpcResidentViewModel>(this.lumina); // no view models for these WeatherRates = this.lumina.GetExcelSheet <WeatherRate>(); // props from the props.json file try { List <Prop> propList = SerializerService.DeserializeFile <List <Prop> >("Props.json"); propList.Sort((a, b) => { return(a.Name.CompareTo(b.Name)); }); Props = propList.AsReadOnly(); } catch (Exception ex) { Log.Write(new Exception("Failed to load props list", ex)); } return(base.Initialize()); }
public override async Task Start() { await base.Start(); try { List <ModelTypes> modelTypes = SerializerService.DeserializeFile <List <ModelTypes> >("ModelTypes.json"); ModelTypes = modelTypes.AsReadOnly(); foreach (ModelTypes modelType in ModelTypes) { if (!isCustomizableLookup.ContainsKey(modelType.Id)) { isCustomizableLookup.Add(modelType.Id, modelType.CanCustomize); } isCustomizableLookup[modelType.Id] |= modelType.CanCustomize; } } catch (Exception ex) { Log.Write(Severity.Error, new Exception("Failed to load model type list", ex)); } }
public override async Task Initialize() { await base.Initialize(); this.freezePosition = new NopHookViewModel(AddressService.SkeletonFreezePosition, 5); this.freezePosition2 = new NopHookViewModel(AddressService.SkeletonFreezePosition2, 5); this.freezeRot1 = new NopHookViewModel(AddressService.SkeletonFreezeRotation, 6); this.freezeRot2 = new NopHookViewModel(AddressService.SkeletonFreezeRotation2, 6); this.freezeRot3 = new NopHookViewModel(AddressService.SkeletonFreezeRotation3, 4); this.freezeScale1 = new NopHookViewModel(AddressService.SkeletonFreezeScale, 6); this.freeseScale2 = new NopHookViewModel(AddressService.SkeletonFreezeScale2, 6); this.freezePhysics1 = new NopHookViewModel(AddressService.SkeletonFreezePhysics, 4); this.freezePhysics2 = new NopHookViewModel(AddressService.SkeletonFreezePhysics2, 3); this.freezePhysics3 = new NopHookViewModel(AddressService.SkeletonFreezePhysics3, 4); GposeService.GposeStateChanging += this.OnGposeStateChanging; string[] templates = Directory.GetFiles("Data/Skeletons/", "*.json"); foreach (string templatePath in templates) { SkeletonFile template = SerializerService.DeserializeFile <SkeletonFile>(templatePath); this.Load(template); } }