/// <summary> /// Set the raw frequency/indexFrequency/dataFrequency values. Only exposed as their use is so badly documented by microsoft, and there may be hidden unexpected uses. /// </summary> /// <param name="index">the stream index to set</param> /// <param name="frequency">Unknown use. Use with caution</param> /// <param name="indexFrequency">Only valid for the first stream (stream zero), sets the number of times indices are repeated</param> /// <param name="instanceDataFrequency">Not valid for the first stream (stream zero), repeat count for the actual data. Best kept at 1.</param> public void SetData(int index, int frequency, int indexFrequency, int instanceDataFrequency) { layout = DataLayout.Custom; this.frequency[index] = frequency; this.indexFrequency[index] = indexFrequency; this.dataFrequency[index] = instanceDataFrequency; }
private void ImportSettingsExecuted() { var dialog = new OpenFileDialog(); dialog.Title = "Import settings"; dialog.Filter = "Config files (*.json)|*.json"; dialog.ShowDialog(); if (dialog.FileName != string.Empty) { var ser = new DataContractJsonSerializer(typeof(Configuration)); var stream = new FileStream(dialog.FileName, FileMode.Open); var configuration = ser.ReadObject(stream) as Configuration; stream.Close(); var properties = typeof(Configuration).GetProperties(); foreach (var property in properties) { if (property.PropertyType == typeof(IList <ConfigurationItem>)) { var dataItems = property.GetValue(configuration) as IList <ConfigurationItem>; DataLayout.Clear(); if (dataItems != null) { foreach (var plusDataItem in dataItems) { DataLayout.Add(plusDataItem); } } } else if (property.PropertyType == typeof(IList <DirectHopItem>)) { var directHops = property.GetValue(configuration) as IList <DirectHopItem>; DirectHops.Clear(); if (directHops != null) { foreach (var directHopItem in directHops) { DirectHops.Add(directHopItem); } } } else { var propertyInfo = GetType().GetProperty(property.Name); if (propertyInfo != null) { propertyInfo.SetValue(this, property.GetValue(configuration)); } else { throw new Exception("Property not found."); } } } } }
public void NavigateToDataItemPropertyDetail() { var nParams = new NavigationParameters(); nParams.Add(ParameterNames.SelectedItem, SelectedPropertyItem); nParams.Add(ParameterNames.DataLayout, DataLayout.Where(s => s.IsDetailComboBoxItem).Select(t => t.Name).ToList()); _navigationService.Navigate(RegionNames.DetailRegion, ViewNames.DataItemPropertyDetailView, nParams); }
private void SortItemUpCommandExecuted() { int order = SelectedItem.Order; ConfigurationItem item = DataLayout.First(t => t.Order == order - 1); item.Order = order; SelectedItem.Order--; ItemCollection.Refresh(); RaiseCanExecuteChanged(); }
private void DeleteItemCommandExecuted() { DataLayout.Remove(SelectedItem); int count = 0; foreach (ConfigurationItem item in DataLayout) { item.Order = count++; } RaiseCanExecuteChanged(); }
public RemoteData(string m, bool l, int lV, bool L, bool o, int oV, string cL, System.Windows.Forms.ComboBox.ObjectCollection lL, List <MusicButtonInfo> b) { if (m == "full" || m == "audio") { audio = new DataAudio(l, lV, L, o, oV); } if (m == "full" || m == "layout") { layout = new DataLayout(cL, lL, b); } }
public static bool SaveLayout(DataLayout dl) { dl.layoutDate = DateTime.Now; dl.layoutId = GetLayoutId(); dl.basePath = CombinePath(dl.layoutName); FileStream fileStream = new FileStream(dl.basePath, FileMode.Create); XmlSerializer xmlSerializer = new XmlSerializer(dl.GetType()); xmlSerializer.Serialize(fileStream, dl); fileStream.Close(); return(true); }
private void AddItemCommandExecuted() { var item = new ConfigurationItem { Properties = new ObservableCollection <ConfigurationProperty>(), Order = DataLayout.Count }; DataLayout.Add(item); SelectedItem = item; RaiseCanExecuteChanged(); }
private static void CreateDoCopyFunctionBody(BitcodeModule module , DataLayout layout , Function doCopyFunc , IStructType foo , GlobalVariable bar , GlobalVariable baz , Function copyFunc ) { var bytePtrType = module.Context.Int8Type.CreatePointerType( ); // create block for the function body, only need one for this simple sample var blk = doCopyFunc.AppendBasicBlock("entry"); // create instruction builder to build the body var instBuilder = new InstructionBuilder(blk); bool param0ByVal = copyFunc.Attributes[FunctionAttributeIndex.Parameter0].Contains(AttributeKind.ByVal); if (!param0ByVal) { // create a temp local copy of the global structure var dstAddr = instBuilder.Alloca(foo) .RegisterName("agg.tmp") .Alignment(layout.CallFrameAlignmentOf(foo)); var bitCastDst = instBuilder.BitCast(dstAddr, bytePtrType) .SetDebugLocation(25, 11, doCopyFunc.DISubProgram); var bitCastSrc = instBuilder.BitCast(bar, bytePtrType) .SetDebugLocation(25, 11, doCopyFunc.DISubProgram); instBuilder.MemCpy(module , bitCastDst , bitCastSrc , module.Context.CreateConstant(layout.ByteSizeOf(foo)) , ( int )layout.CallFrameAlignmentOf(foo) , false ).SetDebugLocation(25, 11, doCopyFunc.DISubProgram); instBuilder.Call(copyFunc, dstAddr, baz) .SetDebugLocation(25, 5, doCopyFunc.DISubProgram); } else { instBuilder.Call(copyFunc, bar, baz) .SetDebugLocation(25, 5, doCopyFunc.DISubProgram) .AddAttributes(FunctionAttributeIndex.Parameter0, copyFunc.Parameters[0].Attributes); } instBuilder.Return( ) .SetDebugLocation(26, 1, doCopyFunc.DISubProgram); }
public MediaFormat(MediaType mediaType, Common.Binary.ByteOrder byteOrder, DataLayout dataLayout, int components, int[] componentSizes, byte[] componentIds) { //Assign the media type MediaType = mediaType; if (byteOrder == Common.Binary.ByteOrder.Unknown) { throw new System.ArgumentException("byteOrder", "Cannot be Unknown"); } ByteOrder = byteOrder; //Validate the datalayout if (dataLayout == Media.Codec.DataLayout.Unknown) { throw new System.ArgumentException("dataLayout", "Cannot be Unknown"); } DataLayout = dataLayout; //Validate the amount of components if (components < 1) { throw new System.ArgumentException("components", "Must be greater than 0."); } //Create the array Components = new MediaComponent[components]; long length; //Validate the sizes array if (Common.Extensions.Array.ArrayExtensions.IsNullOrEmpty(componentSizes, out length) || length < components) { throw new System.ArgumentException("componentSizes", "Must have the amount of elements indicated by 'components'"); } //Validate the length of the id array if (Common.Extensions.Array.ArrayExtensions.IsNullOrEmpty(componentIds, out length) || length < components) { throw new System.ArgumentException("componentIds", "Must have the amount of elements indicated by 'components'"); } //Creates each component for (int i = 0; i < components; ++i) { length = componentSizes[i]; int ilen = (int)length; Components[i] = new MediaComponent(componentIds[i], ilen); Size += ilen; } }
public static bool UpdateLayout(string fileName, DataLayout newLayout) { if (File.Exists(CombinePath(fileName))) { DeleteLayout(fileName); FileStream fileStream = new FileStream(CombinePath(newLayout.layoutName), FileMode.Create); XmlSerializer xmlSerializer = new XmlSerializer(newLayout.GetType()); xmlSerializer.Serialize(fileStream, newLayout); fileStream.Close(); return(true); } return(false); }
public static DataLayout GetLayout(string fileName) { string path = Path.Combine(basePath); DataLayout dl = null; string[] file = Directory.GetFiles(path); string fn = file.Where(x => x.Contains($"{fileName}.xml")).FirstOrDefault(); FileStream fileStream = new FileStream(fn, FileMode.Open); XmlSerializer xmlSerializer = new XmlSerializer(typeof(DataLayout)); dl = (DataLayout)xmlSerializer.Deserialize(fileStream); fileStream.Close(); return(dl); }
private void AddVersionCommandExecuted() { var item = new ConfigurationItem { Name = SelectedItem.Name + "Version", Translation = SelectedItem.Translation + "Version", CanClone = true, CanDelete = true, CanEdit = true, Order = DataLayout.Count, Parent = SelectedItem.Name, Properties = new ObservableCollection <ConfigurationProperty> { new ConfigurationProperty { Order = 0, IsKey = true, IsRequired = true, Type = "int", Name = "Version", TranslationDe = "Version", TranslationEn = "Version", Length = "2" }, new ConfigurationProperty { Order = 1, Type = "bool", Name = "IsActive", TranslationDe = "Aktiv", TranslationEn = "Active", Length = "2" }, new ConfigurationProperty { Order = 2, Type = "string", Name = "Description", TranslationDe = "Beschreibung", TranslationEn = "Description", Length = "60" } } }; DataLayout.Add(item); SelectedItem = item; RaiseCanExecuteChanged(); }
/// <summary> /// Automatic setup of frequency data from a vertices group (eg, geometry and instance data in two buffers) /// </summary> /// <param name="vertices"></param> /// <param name="layout"></param> public StreamFrequency(VerticesGroup vertices, DataLayout layout) { this.layout = layout; this.frequency = new int[vertices.ChildCount]; this.indexFrequency = new int[vertices.ChildCount]; this.dataFrequency = new int[vertices.ChildCount]; if (layout == DataLayout.Stream0Geometry_Stream1InstanceData) { if (vertices.Count < 2) { throw new ArgumentException("vertices.Count"); } RepeatCount = vertices.GetChild(1).Count; } }
/// <summary> /// Setup the frequency data and source vertex buffer /// </summary> /// <param name="vertices"></param> /// <param name="repeatCount">Number of times the vertex data should be repeated</param> public StreamFrequency(IVertices vertices, int repeatCount) { layout = DataLayout.Stream0Geometry_Stream1InstanceData; if (vertices is VerticesGroup) { this.frequency = new int[(vertices as VerticesGroup).ChildCount]; this.indexFrequency = new int[(vertices as VerticesGroup).ChildCount]; this.dataFrequency = new int[(vertices as VerticesGroup).ChildCount]; this.RepeatCount = repeatCount; } else { this.frequency = new int[1]; this.indexFrequency = new int[1]; this.dataFrequency = new int[1]; this.indexFrequency[0] = repeatCount; } }
/// <summary>Resolves a temporary metadata node for the array if full size information wasn't available at creation time</summary> /// <param name="layout">Type layout information</param> /// <param name="diBuilder">Debug information builder for creating the new debug information</param> public void ResolveTemporary(DataLayout layout, DebugInfoBuilder diBuilder) { if (layout == null) { throw new ArgumentNullException(nameof(layout)); } if (diBuilder == null) { throw new ArgumentNullException(nameof(diBuilder)); } if (DIType.IsTemporary && !DIType.IsResolved) { DIType = diBuilder.CreateArrayType(layout.BitSizeOf(NativeType) , layout.AbiBitAlignmentOf(NativeType) , DebugElementType.DIType , diBuilder.CreateSubRange(LowerBound, NativeType.Length) ); } }
public MediaFormat(MediaType mediaType, Common.Binary.ByteOrder byteOrder, DataLayout dataLayout, System.Collections.Generic.IEnumerable <MediaComponent> components) { //Assign the media type MediaType = mediaType; if (byteOrder == Common.Binary.ByteOrder.Unknown) { throw new System.ArgumentException("byteOrder", "Cannot be Unknown"); } ByteOrder = byteOrder; //Validate the dataLayout if (dataLayout == Media.Codec.DataLayout.Unknown) { throw new System.ArgumentException("dataLayout", "Cannot be Unknown"); } DataLayout = dataLayout; if (components == null) { throw new System.ArgumentNullException("components"); } //Assign the components Components = System.Linq.Enumerable.ToArray <MediaComponent>(components); //Validate the amount of components if (Components.Length < 1) { throw new System.ArgumentException("components", "Must be greater than 0."); } //Calulcate the size foreach (MediaComponent mc in Components) { Size += mc.Size; } }
private bool SortItemUpCommandCanExecute() { return(SelectedItem != null && SelectedItem.Order > DataLayout.Min(t => t.Order)); }
public void ReRead() { DataLayout.Fill <Sector>(BPB.RawReadSector(Number), this); }
private static void CreateCopyFunctionBody(BitcodeModule module , DataLayout layout , Function copyFunc , DIFile diFile , ITypeRef foo , DebugPointerType fooPtr , DIType constFooType ) { var diBuilder = module.DIBuilder; copyFunc.Parameters[0].Name = "src"; copyFunc.Parameters[1].Name = "pDst"; // create block for the function body, only need one for this simple sample var blk = copyFunc.AppendBasicBlock("entry"); // create instruction builder to build the body var instBuilder = new InstructionBuilder(blk); // create debug info locals for the arguments // NOTE: Debug parameter indices are 1 based! var paramSrc = diBuilder.CreateArgument(copyFunc.DISubProgram, "src", diFile, 11, constFooType, false, 0, 1); var paramDst = diBuilder.CreateArgument(copyFunc.DISubProgram, "pDst", diFile, 12, fooPtr.DIType, false, 0, 2); uint ptrAlign = layout.CallFrameAlignmentOf(fooPtr); // create Locals // NOTE: There's no debug location attached to these instructions. // The debug info will come from the declare intrinsic below. var dstAddr = instBuilder.Alloca(fooPtr) .RegisterName("pDst.addr") .Alignment(ptrAlign); bool param0ByVal = copyFunc.Attributes[FunctionAttributeIndex.Parameter0].Contains(AttributeKind.ByVal); if (param0ByVal) { diBuilder.InsertDeclare(copyFunc.Parameters[0] , paramSrc , new DILocation(module.Context, 11, 43, copyFunc.DISubProgram) , blk ); } instBuilder.Store(copyFunc.Parameters[1], dstAddr) .Alignment(ptrAlign); // insert declare pseudo instruction to attach debug info to the local declarations diBuilder.InsertDeclare(dstAddr, paramDst, new DILocation(module.Context, 12, 38, copyFunc.DISubProgram), blk); if (!param0ByVal) { // since the function's LLVM signature uses a pointer, which is copied locally // inform the debugger to treat it as the value by dereferencing the pointer diBuilder.InsertDeclare(copyFunc.Parameters[0] , paramSrc , diBuilder.CreateExpression(ExpressionOp.deref) , new DILocation(module.Context, 11, 43, copyFunc.DISubProgram) , blk ); } var loadedDst = instBuilder.Load(dstAddr) .Alignment(ptrAlign) .SetDebugLocation(15, 6, copyFunc.DISubProgram); var dstPtr = instBuilder.BitCast(loadedDst, module.Context.Int8Type.CreatePointerType( )) .SetDebugLocation(15, 13, copyFunc.DISubProgram); var srcPtr = instBuilder.BitCast(copyFunc.Parameters[0], module.Context.Int8Type.CreatePointerType( )) .SetDebugLocation(15, 13, copyFunc.DISubProgram); uint pointerSize = layout.IntPtrType(module.Context).IntegerBitWidth; instBuilder.MemCpy(module , dstPtr , srcPtr , module.Context.CreateConstant(pointerSize, layout.ByteSizeOf(foo), false) , ( int )layout.AbiAlignmentOf(foo) , false ).SetDebugLocation(15, 13, copyFunc.DISubProgram); instBuilder.Return( ) .SetDebugLocation(16, 1, copyFunc.DISubProgram); }
private bool AddVersionCommandCanExecute() { return(SelectedItem != null && DataLayout.Count < 2 && DataLayout.All(t => t.Name != null && !t.Name.EndsWith("Version"))); }
private bool SortItemDownCommandCanExecute() { return(SelectedItem != null && SelectedItem.Order < DataLayout.Max(t => t.Order)); }
public TableBlockBuilder(DataLayout <TPointer> layout) { Layout = layout; }
public MediaFormat(MediaFormat other, Common.Binary.ByteOrder byteOrder, DataLayout dataLayout, params MediaComponent[] additionalComponents) : this(other.MediaType, byteOrder, dataLayout, System.Linq.Enumerable.Concat(other.Components, additionalComponents ?? System.Linq.Enumerable.Empty <MediaComponent>())) { }