//Type Parsers private AsyncObservableCollection <TKeyframeType> ParseKeyframes <TKeyframeType>(int keyframeCount, int keyframeListOffset) where TKeyframeType : IKeyframe, new() { int floatOffset = 0; //Calculate float list offset float fCount = keyframeCount; if (Math.Floor(fCount / 2) != fCount / 2) { fCount += 1f; } fCount = fCount * 2; floatOffset = (int)fCount + keyframeListOffset; AsyncObservableCollection <TKeyframeType> keyframes = AsyncObservableCollection <TKeyframeType> .Create(); for (int i = 0; i < keyframeCount; i++) { keyframes.Add(new TKeyframeType() { Index = BitConverter.ToInt16(rawBytes, keyframeListOffset), Float = BitConverter.ToSingle(rawBytes, floatOffset) }); keyframeListOffset += 2; floatOffset += 4; } return(keyframes); }
private Struct3 ParseStruct3(int StructOffset, int mainEntryOffset) { Struct3 _struct3 = new Struct3() { I_00 = BitConverter.ToUInt16(rawBytes, StructOffset + 0), I_02 = BitConverter.ToUInt16(rawBytes, StructOffset + 2), I_04 = BitConverter.ToUInt16(rawBytes, StructOffset + 4), I_08 = BitConverter.ToUInt16(rawBytes, StructOffset + 8), I_10 = BitConverter.ToUInt16(rawBytes, StructOffset + 10), FloatList = AsyncObservableCollection <Struct3_Entries> .Create() }; int count = BitConverter.ToInt16(rawBytes, StructOffset + 6) + 1; int listOffset = BitConverter.ToInt32(rawBytes, StructOffset + 12) + mainEntryOffset; for (int i = 0; i < count; i++) { _struct3.FloatList.Add(new Struct3_Entries() { F_00 = BitConverter.ToSingle(rawBytes, listOffset + 0), F_04 = BitConverter.ToSingle(rawBytes, listOffset + 4), F_08 = BitConverter.ToSingle(rawBytes, listOffset + 8), F_12 = BitConverter.ToSingle(rawBytes, listOffset + 12) }); listOffset += 16; } return(_struct3); }
private AsyncObservableCollection <ParticleEffect> SortEffect(int entryOffset, int nextParticleEffectOffset_Abs) { AsyncObservableCollection <ParticleEffect> effectEntries = AsyncObservableCollection <ParticleEffect> .Create(); int i = 0; while (true) { int SubEntry_Offset = BitConverter.ToInt32(rawBytes, entryOffset + 156); int NextEntry_Offset = BitConverter.ToInt32(rawBytes, entryOffset + 152); //Get entryEndOffset (relative) int nextEntry = (SubEntry_Offset != 0) ? SubEntry_Offset : NextEntry_Offset; currentEntryEnd = (nextEntry != 0) ? nextEntry + entryOffset : nextParticleEffectOffset_Abs; int nextEntryOffset = (NextEntry_Offset != 0) ? NextEntry_Offset + entryOffset : nextParticleEffectOffset_Abs; effectEntries.Add(ParseEffect(entryOffset)); if (SubEntry_Offset > 0) { effectEntries[i].ChildParticleEffects = SortEffect(SubEntry_Offset + entryOffset, nextEntryOffset); } entryOffset += NextEntry_Offset; i++; if (NextEntry_Offset == 0) { break; } } return(effectEntries); }
/// <inheritdoc /> protected override async Task OnInitialization() { await base.OnInitialization(); Dialogs = AsyncObservableCollection <DialogContainerViewModel> .Create(_dialogService.GetMinimizedDialogs().Cast <DialogContainerViewModel>()); DialogsCount = Dialogs.Count; Dialogs.CollectionChanged += delegate { DialogsCount = Dialogs.Count; }; _dialogService.DialogStateChanged += DialogServiceDialogStateChanged; _dialogService.DialogClosed += DialogClosed; var shell = (Window)Resolve <IShell>(); SetPopupOffset(shell); ExecuteOnUIContext(() => { shell.SizeChanged += delegate { SetPopupOffset(shell); }; shell.StateChanged += delegate { SetPopupOffset(shell); }; shell.LocationChanged += delegate { SetPopupOffset(shell); }; }); }
private void Parse() { int AnimationCount = BitConverter.ToInt16(rawBytes, 18); int SkeletonOffset = BitConverter.ToInt32(rawBytes, 20); int AnimationOffset = BitConverter.ToInt32(rawBytes, 24); int AnimationNamesOffset = BitConverter.ToInt32(rawBytes, 28); //Header eanFile.I_08 = BitConverter.ToInt32(rawBytes, 8); eanFile.IsCamera = (rawBytes[16] == 0) ? false : true; eanFile.I_17 = rawBytes[17]; //Skeleton eanFile.Skeleton = ESK_Skeleton.Read(rawBytes, SkeletonOffset, false); //Animations eanFile.Animations = AsyncObservableCollection <EAN_Animation> .Create(); if (AnimationCount > 0) { for (int i = 0; i < AnimationCount; i++) { if (BitConverter.ToInt32(rawBytes, AnimationOffset) != 0) { eanFile.Animations.Add(ParseAnimation(BitConverter.ToInt32(rawBytes, AnimationOffset), BitConverter.ToInt32(rawBytes, AnimationNamesOffset), i)); } AnimationOffset += 4; AnimationNamesOffset += 4; } } eanFile.LinkEskData(); }
public ToastService() { if (IsDesignMode()) { ToastList = AsyncObservableCollection <Toast> .Create(new [] { new Toast { Message = "Like harold ye sorrow in monastic come not pleasure her did way been condole come pollution him the true superstition", Type = ToastType.Error }, new Toast { Message = "Message2", Type = ToastType.Information }, new Toast { Message = "Message3", Type = ToastType.Success }, new Toast { Message = "Message4", Type = ToastType.Warning } }); } }
/// <inheritdoc /> public void Initialize(Region dialogRegion) { dialogRegion.View(this); ActiveDialogs = AsyncObservableCollection <IDialog> .Create(); MinimizedDialogs = AsyncObservableCollection <IDialog> .Create(); }
/// <summary> /// Loads the specified emm file. It can be in either binary or xml format. /// /// If a file can not be found at the specified location, then a empty one will be returned. /// </summary> public static EMM_File LoadEmm(string path, bool returnEmptyIfNotValid = true) { if (Path.GetExtension(path) == ".emm") { return(new Xv2CoreLib.EMM.Parser(path, false).GetEmmFile()); } else if (Path.GetExtension(path) == ".xml" && Path.GetExtension(Path.GetFileNameWithoutExtension(path)) == ".emm") { YAXSerializer serializer = new YAXSerializer(typeof(Xv2CoreLib.EMM.EMM_File), YAXSerializationOptions.DontSerializeNullObjects); return((Xv2CoreLib.EMM.EMM_File)serializer.DeserializeFromFile(path)); } else { if (returnEmptyIfNotValid) { return(new EMM_File() { I_08 = 0, Materials = AsyncObservableCollection <Material> .Create() }); } else { throw new FileNotFoundException("An .emm could not be found at the specified location."); } } }
/// <summary> /// Initilize the toast service /// </summary> /// <param name="toastRegion">The region that the toast service the be contained</param> /// <param name="duration">The default duration for the toasts</param> public void Initialize(Region toastRegion, TimeSpan duration) { _toastRegion = toastRegion; _duration = duration; ToastList = AsyncObservableCollection <Toast> .Create(); _toastRegion.View(this); }
protected override async Task OnInitialization() { await base.OnInitialization(); Resolutions = AsyncObservableCollection <Resolution> .Create(Resolution.CommonResolutions); Resolutions.SelectedItem = Resolutions.First(); }
protected override async Task OnInitialization() { await base.OnInitialization(); Branches = AsyncObservableCollection <Branch> .Create(); _employeesViewModel = CreateViewModel <EmployeesViewModel>(); }
public static EMA_Command GetNewLight() { return(new EMA_Command() { Keyframes = AsyncObservableCollection <EMA_Keyframe> .Create(), emaType = EmaType.light, I_02 = 2, //Color }); }
protected override async Task OnInitialization() { await base.OnInitialization(); LocalizationResourceFiles = AsyncObservableCollection <LocalizationResourceFile> .Create(); _filesWatchers = new List <FileSystemWatcher>(); _keys = new HashSet <string>(); }
public static EMM_File DefaultEmmFile() { return(new EMM_File() { I_08 = 16, Materials = AsyncObservableCollection <Material> .Create(), Unknown_Data = new UnknownData() }); }
public static EMA_Animation Read(byte[] rawBytes, List <byte> bytes, int offset, int index, EMA_File emaFile) { EMA_Animation animation = new EMA_Animation(); animation.Index = index; animation.I_00 = BitConverter.ToUInt16(rawBytes, offset + 0); animation.I_08 = (EmaType)BitConverter.ToUInt16(rawBytes, offset + 8); animation.I_10 = (ValueType)BitConverter.ToUInt16(rawBytes, offset + 10); animation.Commands = AsyncObservableCollection <EMA_Command> .Create(); int commandCount = BitConverter.ToUInt16(rawBytes, offset + 2); int valueCount = BitConverter.ToInt32(rawBytes, offset + 4); int valueOffset = BitConverter.ToInt32(rawBytes, offset + 16) + offset; int nameOffset = (BitConverter.ToInt32(rawBytes, offset + 12) != 0) ? BitConverter.ToInt32(rawBytes, offset + 12) + offset : 0; //Name if (nameOffset > 0) { animation.Name = Utils.GetString(bytes, nameOffset + 11); } //Values float[] values = new float[valueCount]; for (int i = 0; i < valueCount; i++) { if (animation.I_10 == ValueType.Float16) { values[i] = Half.ToHalf(rawBytes, valueOffset + (i * 2)); } else if (animation.I_10 == ValueType.Float32 || animation.I_10 == ValueType.Float32_2) { values[i] = BitConverter.ToSingle(rawBytes, valueOffset + (i * 4)); } else { throw new InvalidDataException(String.Format("EMA_Animation: Unknown float type ({0}).", animation.I_10)); } //Console.WriteLine(string.Format("{1}: {0}", values[i], i)); } //Console.ReadLine(); //Commands for (int i = 0; i < commandCount; i++) { int commandOffset = BitConverter.ToInt32(rawBytes, offset + 20 + (i * 4)); if (commandOffset != 0) { animation.Commands.Add(EMA_Command.Read(rawBytes, commandOffset + offset, values, emaFile, animation.I_08)); } } return(animation); }
/// <summary> /// Creates an <see cref="AsyncObservableCollection{T}"/> and binds the repository changes to the collection /// </summary> public static async Task <AsyncObservableCollection <T> > ToAsyncObservableCollection <T, TKey>(this ICRUDRepository <T, TKey> repo) where T : IUniqueObject <TKey> { var items = await repo.GetItems(); var collection = AsyncObservableCollection <T> .Create(items); collection.BindToRepositoryChanges(repo); return(collection); }
protected override async Task OnInitialization() { await base.OnInitialization(); ImportArgumentes = AsyncObservableCollection <TableImportArgumentsViewModel> .Create(); _modelGenerator = new ModelCodeGenerator(); _repositoryInterfaceGenerator = new RepositoryInterfaceCodeGenerator(); _linqRepositoryGenerator = new LinqRepositoryCodeGenerator(); _restRepositoryGenerator = new RestRepositoryCodeGenerator(); }
/// <inheritdoc /> protected override async Task OnInitialization() { await base.OnInitialization(); NavigationStack = AsyncObservableCollection <ViewModelNavigationItem> .Create(); ViewModels = AsyncObservableCollection <ViewModelNavigationItem> .Create(); await _mainpulator.Initialize(); ViewModelManipulatorContent = (UIElement)_mainpulator.GetView(); }
public static Material NewMaterial() { var param = AsyncObservableCollection <Parameter> .Create(); param.Add(Parameter.NewParameter()); return(new Material() { Str_00 = "NewMaterial", Str_32 = "ParticleDecal", Parameters = param }); }
private void ParseEmm() { int headerSize = BitConverter.ToInt16(rawBytes, 12); int offset = BitConverter.ToInt32(rawBytes, 12) + 4; int count = BitConverter.ToInt32(rawBytes, BitConverter.ToInt32(rawBytes, 12)); emmFile.I_08 = BitConverter.ToUInt32(rawBytes, 8); int unkOffset = (headerSize == 32) ? BitConverter.ToInt32(rawBytes, 16) : 0; int unkCount = bytes.Count() - unkOffset; emmFile.Materials = AsyncObservableCollection <Material> .Create(); if (count > 0) { for (int i = 0; i < count; i++) { emmFile.Materials.Add(ParseMaterial(BitConverter.ToInt32(rawBytes, offset), i, headerSize)); offset += 4; } } if (unkCount == 68) { emmFile.Unknown_Data = new UnknownData() { I_00 = BitConverter.ToInt32(rawBytes, unkOffset + 0), I_04 = BitConverter.ToInt32(rawBytes, unkOffset + 4), I_08 = BitConverter.ToInt32(rawBytes, unkOffset + 8), I_12 = BitConverter.ToInt32(rawBytes, unkOffset + 12), I_16 = BitConverter.ToInt32(rawBytes, unkOffset + 16), I_20 = BitConverter.ToInt32(rawBytes, unkOffset + 20), I_24 = BitConverter.ToInt32(rawBytes, unkOffset + 24), I_28 = BitConverter.ToInt32(rawBytes, unkOffset + 28), I_32 = BitConverter.ToInt32(rawBytes, unkOffset + 32), I_36 = BitConverter.ToInt32(rawBytes, unkOffset + 36), I_40 = BitConverter.ToInt32(rawBytes, unkOffset + 40), I_44 = BitConverter.ToInt32(rawBytes, unkOffset + 44), I_48 = BitConverter.ToInt32(rawBytes, unkOffset + 48), I_52 = BitConverter.ToInt32(rawBytes, unkOffset + 52), I_56 = BitConverter.ToInt32(rawBytes, unkOffset + 56), I_60 = BitConverter.ToInt32(rawBytes, unkOffset + 60), I_64 = BitConverter.ToInt32(rawBytes, unkOffset + 64) }; } else if (unkCount != 0 && unkCount != bytes.Count()) { Console.WriteLine(String.Format("Unknown extended data size: {0}\nSkipping...", unkCount)); Console.ReadLine(); } }
public List <RgbColor> GetUsedColors() { if (Entry == null) { Entry = AsyncObservableCollection <EmbEntry> .Create(); } List <RgbColor> colors = new List <RgbColor>(); foreach (var entry in Entry) { colors.Add(entry.GetDdsColor()); } return(colors); }
protected override async Task OnInitialization() { await base.OnInitialization(); Tables = AsyncObservableCollection <SqlTableViewModel> .Create(); _pluralizationServices = PluralizationService.CreateService(CultureInfo.GetCultureInfo("en-us")); _importWizardViewModel = await InitializeViewModel <ImportWizardViewModel>(); _dbmlCompare = new DbmlCompare(); _eventDispatcher.GetEvent <SqlLinqConfigurationUpdatedEvents>().Subscribe(e => { GetDbTitle(); }); }
public TableImportArgumentsViewModel(SqlTableViewModel table) { _table = table; TableName = table.TableName; SingularName = table.SingularName; BaseRepositoryTypes = new List <Type> { typeof(ICRUDRepository <,>), typeof(IReadOnlyRepository <,>), typeof(IIndexedRepository <,>), typeof(IRepository), }; SelectedBaseRepositoryType = BaseRepositoryTypes[0]; Columns = AsyncObservableCollection <ColumnImportArgumentsViewModel> .Create(_table.Columns.Select(CreateColumn)); }
public List <RgbColor> GetUsedColors() { List <RgbColor> colors = new List <RgbColor>(); if (Animations == null) { Animations = AsyncObservableCollection <EMA_Animation> .Create(); } foreach (var anim in Animations) { colors.AddRange(anim.GetUsedColors()); } return(colors); }
public EMA_Command GetCommand(string parameter, string component) { if (Commands == null) { Commands = AsyncObservableCollection <EMA_Command> .Create(); } foreach (var command in Commands) { if (command.Parameter.ToLower() == parameter.ToLower() && command.Component.ToLower() == component.ToLower()) { return(command); } } return(null); }
public Parameter GetParameter(string parameterName) { if (Parameters == null) { Parameters = AsyncObservableCollection <Parameter> .Create(); } foreach (var parameter in Parameters) { if (parameter.Str_00 == parameterName) { return(parameter); } } return(null); }
public Material Clone() { Material newMaterial = new Material(); newMaterial.Str_00 = Str_00; newMaterial.Str_32 = Str_32; newMaterial.LocalCopy = true; newMaterial.I_66 = I_66; newMaterial.Parameters = AsyncObservableCollection <Parameter> .Create(); foreach (var param in Parameters) { newMaterial.Parameters.Add(param.Clone()); } return(newMaterial); }
public BAC.BAC_File ConvertToXv2(int skillID) { List <BAC.BAC_Entry> xv2BacEntries = new List <BAC.BAC_Entry>(); for (int i = 0; i < BacEntries.Count; i++) { xv2BacEntries.Add(BacEntries[i].ConvertToXv2(skillID)); } return(new BAC.BAC_File() { I_20 = I_20, I_80 = I_80, F_32 = F_32, BacEntries = AsyncObservableCollection <BAC.BAC_Entry> .Create(xv2BacEntries) }); }
private AsyncObservableCollection <Type0_Keyframe> ParseKeyframes(int keyframeCount, int keyframeListOffset, int floatOffset) { AsyncObservableCollection <Type0_Keyframe> keyframes = AsyncObservableCollection <Type0_Keyframe> .Create(); for (int i = 0; i < keyframeCount; i++) { keyframes.Add(new Type0_Keyframe() { Index = BitConverter.ToUInt16(rawBytes, keyframeListOffset), Float = BitConverter.ToSingle(rawBytes, floatOffset) }); keyframeListOffset += 2; floatOffset += 4; } return(keyframes); }
/// <summary> /// Show the GUI to select a new database /// </summary> public string GetDatabaseConnectionString(string message = null) { if (!string.IsNullOrEmpty(message)) { Message = message; } IsBusy = true; Databases = AsyncObservableCollection <string> .Create(); ServersList = AsyncObservableCollection <SQLServer> .Create(); GetView(); GetServers(); CreateView(); View.ShowDialog(); return(_connection); }