protected override List <IOptionEntry> generateEntries(CameraOptionsUI options, string libraryVersion) { List <IOptionEntry> entries = new List <IOptionEntry>(); OptionsCategory ExposureCategory = new OptionsCategory("Exposure"); entries.Add(ExposureCategory); EnumEntry <ExposureAutoEnums> ExposureAutoEntry = new EnumEntry <ExposureAutoEnums>("Auto Exposure", ExposureAutoEnums.Continuous, ExposureAutoEnums.NUM_EXPOSUREAUTO, new Property <FlirProperties, EnumNode <ExposureAutoEnums> >(nameof(options.FakeProperties.ExposureAuto)), options.Stream); ExposureAutoEntry.Parent = ExposureCategory; FloatEntry UpperExposureEntry = new FloatEntry(" - Upper Limit", new Property <FlirProperties, FloatNode>(nameof(options.FakeProperties.ExposureAutoUpperLimit)), options.Stream); UpperExposureEntry.Parent = ExposureCategory; FloatEntry LowerExposureEntry = new FloatEntry(" - Lower Limit", new Property <FlirProperties, FloatNode>(nameof(options.FakeProperties.ExposureAutoLowerLimit)), options.Stream); LowerExposureEntry.Parent = ExposureCategory; FloatEntry ExposureTimeEntry = new FloatEntry("Exposure Time", new Property <FlirProperties, FloatNode>(nameof(options.FakeProperties.ExposureTime)), options.Stream); ExposureTimeEntry.Parent = ExposureCategory; FloatEntry ExposureTimeAbsEntry = new FloatEntry("Absolute Exposure Time", new Property <FlirProperties, FloatNode>(nameof(options.FakeProperties.ExposureTimeAbs)), options.Stream); ExposureTimeAbsEntry.Parent = ExposureCategory; return(entries); /* * ExposureMode = new EnumNode<ExposureModeEnums>(camera, "ExposureMode"); */ }
protected override List <IOptionEntry> generateEntries(CameraOptionsUI options, string libraryVersion) { List <IOptionEntry> entries = new List <IOptionEntry>(); OptionsCategory GainCategory = new OptionsCategory("Gain"); entries.Add(GainCategory); FloatEntry GainEntry = new FloatEntry("Gain", new Property <FlirProperties, FloatNode>(nameof(options.FakeProperties.Gain)), options.Stream); GainEntry.Parent = GainCategory; EnumEntry <GainAutoEnums> AutoGainEntry = new EnumEntry <GainAutoEnums>("Auto Gain", GainAutoEnums.Off, GainAutoEnums.NUM_GAINAUTO, new Property <FlirProperties, EnumNode <GainAutoEnums> >(nameof(options.FakeProperties.GainAuto)), options.Stream); AutoGainEntry.Parent = GainCategory; FloatEntry UpperGainEntry = new FloatEntry(" - Upper Limit", new Property <FlirProperties, FloatNode>(nameof(options.FakeProperties.AutoGainUpperLimit)), options.Stream); UpperGainEntry.Parent = GainCategory; FloatEntry LowerGainEntry = new FloatEntry(" - Lower Limit", new Property <FlirProperties, FloatNode>(nameof(options.FakeProperties.AutoGainLowerLimit)), options.Stream); LowerGainEntry.Parent = GainCategory; return(entries); }
private static CodeMemberField ToCodeMemberField(EnumEntry enumEntry) { CodeMemberField field = new CodeMemberField(); field.Name = enumEntry.Name; if (enumEntry.Value.HasValue) { field.InitExpression = new CodePrimitiveExpression(enumEntry.Value); } string[] lines = GetSummaryCommentLines(enumEntry); // Add summary comments CodeCommentStatement[] summaryCommentStatements = CodeCommentStatementHelper.GetSummaryCodeCommentStatements(lines); field.Comments.AddRange(summaryCommentStatements); if (enumEntry.IsNameTransformed) { // Add remarks comments CodeCommentStatement[] remarksCommentStatements = CodeCommentStatementHelper.GetRemarksCodeCommentStatements(enumEntry.XmlDefinition.Name); field.Comments.AddRange(remarksCommentStatements); } // Add description attribute CodeAttributeDeclaration descriptionAttributeDeclaration = CreateDescriptionAttributeDeclaration(enumEntry); field.CustomAttributes.Add(descriptionAttributeDeclaration); return(field); }
public ReadTexture(int width, int height, uint handle, EnumEntry formatEnum, EnumEntry usageEnum) { Format format; if (formatEnum.Name == "INTZ") format = D3DX.MakeFourCC((byte)'I', (byte)'N', (byte)'T', (byte)'Z'); else if (formatEnum.Name == "RAWZ") format = D3DX.MakeFourCC((byte)'R', (byte)'A', (byte)'W', (byte)'Z'); else if (formatEnum.Name == "RESZ") format = D3DX.MakeFourCC((byte)'R', (byte)'E', (byte)'S', (byte)'Z'); else if (formatEnum.Name == "No Specific") throw (new Exception("Texture mode not supported")); else format = (Format)Enum.Parse(typeof(Format), formatEnum, true); var usage = Usage.Dynamic; if (usageEnum.Index == (int)(TextureType.RenderTarget)) usage = Usage.RenderTarget; else if (usageEnum.Index == (int)(TextureType.DepthStencil)) usage = Usage.DepthStencil; this.FWidth = width; this.FHeight = height; this.FHandle = (IntPtr)unchecked((int)handle); this.FFormat = format; this.FUsage = usage; Initialise(); }
static EX9.Format EnumEntryToEx9Format(EnumEntry entry) { var enumName = entry.Name .Replace("_", string.Empty) .Replace("No Specific", "Unknown"); return((EX9.Format)Enum.Parse(typeof(EX9.Format), enumName, true)); }
public FunctionScope Add(EnumEntry enumEntry) { var localSymbleTable = this.LocalScopes.Peek().Add(enumEntry); return(new FunctionScope( this.FunctionType, this.FunctionParams, this.LocalScopes.Pop().Push(localSymbleTable) )); }
public static void RegisterEnumAsText <T>(Func <T, string> enumToNameFunc, Func <string, T> nameToEnumFunc) { var entry = new EnumEntry(); entry.Type = typeof(T); entry.EnumName = null; entry.EnumToNameFunc = o => enumToNameFunc((T)o); entry.NameToEnumFunc = name => nameToEnumFunc(name); entry.ValueType = new KDPgValueTypeEnum(entry); Entries.Add(entry); }
InterimTextureInfo() { var count = EnumManager.GetEnumEntryCount("TextureFormat"); for (int i = 0; i < count; i++) { var entry = EnumManager.GetEnumEntry("TextureFormat", i); if (entry.Name == "A8R8G8B8") { FEnumEntry = entry; break; } } }
public static void RegisterEnum <T>(string enumName, Func <T, string> enumToNameFunc, Func <string, T> nameToEnumFunc, string schema = null) { var entry = new EnumEntry(); entry.Type = typeof(T); entry.EnumName = enumName; entry.EnumToNameFunc = o => enumToNameFunc((T)o); entry.NameToEnumFunc = name => nameToEnumFunc(name); entry.Schema = schema; entry.ValueType = new KDPgValueTypeEnum(entry); Entries.Add(entry); }
public void Update(IPluginIO pin, DX11RenderContext context) { Device device = context.Device; if (this.updateddevices.Contains(context)) { return; } int samplecount = Convert.ToInt32(FInAASamplesPerPixel[0].Name); SampleDescription sd = new SampleDescription(samplecount, 0); if (this.FResized || this.FInvalidateSwapChain || this.FOutBackBuffer[0][context] == null) { EnumEntry bbf = this.FCfgBackBufferFormat[0]; this.FOutBackBuffer[0].Dispose(context); //NOTE ENUM BROKEN Format fmt = (Format)Enum.Parse(typeof(Format), this.FCfgBackBufferFormat[0].Name); this.FOutBackBuffer[0][context] = new DX11SwapChain(context, this.Handle, fmt, sd); #if DEBUG this.FOutBackBuffer[0][context].Resource.DebugName = "BackBuffer"; #endif this.depthmanager.NeedReset = true; } DX11SwapChain sc = this.FOutBackBuffer[0][context]; if (this.FResized) { //if (!sc.IsFullScreen) //{ // sc.Resize(); // } //this.FInvalidateSwapChain = true; } if (!this.renderers.ContainsKey(context)) { this.renderers.Add(context, new DX11GraphicsRenderer(this.FHost, context)); } this.depthmanager.Update(context, sc.Width, sc.Height, sd); this.updateddevices.Add(context); }
private static string[] GetSummaryCommentLines(EnumEntry enumEntry) { IList <String> lines = new List <String>() { enumEntry.Description }; foreach (EnumEntryParameter entryParameter in enumEntry.Parameters) { lines.Add($"Mission Param #{entryParameter.Index} : {entryParameter.Description}"); } return(lines.ToArray()); }
public static EnumEntry[] GetEnumEntries(Type enumType) { EnumEntry[] entries; var fields = enumType.GetFields(BindingFlags.Public | BindingFlags.Static); entries = new EnumEntry[fields.Length]; for (int i = 0; i < fields.Length; i++) { var description = fields[i].GetCustomAttributes(typeof(DescriptionAttribute), false).OfType <DescriptionAttribute>().FirstOrDefault(); entries[i] = new EnumEntry(fields[i].Name, Convert.ChangeType(fields[i].GetValue(null), Enum.GetUnderlyingType(enumType)), description.Description); } return(entries); }
protected override void OnUpdate(DX11RenderContext context) { var maxSamples = SlimDX.Direct3D11.Device.MultisampleCountMaximum; SampleDescription sd = new SampleDescription((int)Math.Min(FInAASamplesPerPixel[0], maxSamples), FInAAQuality[0]); if (this.resized || this.invalidatesc || this.FOutBackBuffer[0][context] == null) { EnumEntry bbf = this.FCfgBackBufferFormat[0]; this.FOutBackBuffer[0].Dispose(context); //NOTE ENUM BROKEN Format fmt = (Format)Enum.Parse(typeof(Format), this.FCfgBackBufferFormat[0].Name); this.FOutBackBuffer[0][context] = new DX11SwapChain(context, this.Handle, fmt, sd); this.depthmanager.NeedReset = true; } }
public ReadTexture(int width, int height, uint handle, EnumEntry formatEnum, EnumEntry usageEnum) { Format format; if (formatEnum.Name == "INTZ") { format = D3DX.MakeFourCC((byte)'I', (byte)'N', (byte)'T', (byte)'Z'); } else if (formatEnum.Name == "RAWZ") { format = D3DX.MakeFourCC((byte)'R', (byte)'A', (byte)'W', (byte)'Z'); } else if (formatEnum.Name == "RESZ") { format = D3DX.MakeFourCC((byte)'R', (byte)'E', (byte)'S', (byte)'Z'); } else if (formatEnum.Name == "No Specific") { throw (new Exception("Texture mode not supported")); } else { format = (Format)Enum.Parse(typeof(Format), formatEnum, true); } var usage = Usage.Dynamic; if (usageEnum.Index == (int)(TextureType.RenderTarget)) { usage = Usage.RenderTarget; } else if (usageEnum.Index == (int)(TextureType.DepthStencil)) { usage = Usage.DepthStencil; } this.FWidth = width; this.FHeight = height; this.FHandle = (IntPtr) unchecked ((int)handle); this.FFormat = format; this.FUsage = usage; Initialise(); }
public Env2 Add(EnumEntry entry) { if (this._functionScope.IsNone) { // global return(new Env2( this._globalSymbolTable.Add(entry), this._functionScope )); } else { // local return(new Env2( this._globalSymbolTable, Option.Some(this._functionScope.Value.Add(entry)) )); } }
public Instance(int deviceID, string modeString, uint textureHandle, EnumEntry format, EnumEntry usage, SyncLoop syncLoop) { IDeckLink device = null; WorkerThread.Singleton.PerformBlocking(() => { device = DeviceRegister.Singleton.GetDeviceHandle(deviceID); }); try { ModeRegister.Mode mode = null; WorkerThread.Singleton.PerformBlocking(() => { mode = ModeRegister.Singleton.Modes[modeString]; }); bool useCallback = syncLoop != SyncLoop.DeckLink; this.Source = new Source(device, mode, useCallback); this.ReadTexture = new ReadTexture(mode.CompressedWidth, mode.Height, textureHandle, format, usage); this.FBuffer = new byte[this.ReadTexture.BufferLength]; if (useCallback) { this.Source.NewFrame += Source_NewFrame; } } catch { if (this.Source != null) { this.Source.Dispose(); } if (this.ReadTexture != null) { this.ReadTexture.Dispose(); } if (this.FBuffer != null) { this.FBuffer = null; } throw; } }
public Instance(int deviceID, string modeString, uint textureHandle, EnumEntry format, EnumEntry usage, SyncLoop syncLoop) { IDeckLink device = null; WorkerThread.Singleton.PerformBlocking(() => { device = DeviceRegister.Singleton.GetDeviceHandle(deviceID); }); try { ModeRegister.Mode mode = null; WorkerThread.Singleton.PerformBlocking(() => { mode = ModeRegister.Singleton.Modes[modeString]; }); bool useCallback = syncLoop != SyncLoop.DeckLink; this.Source = new Source(device, mode, useCallback); this.ReadTexture = new ReadTexture(mode.CompressedWidth, mode.Height, textureHandle, format, usage); this.FBuffer = new byte[this.ReadTexture.BufferLength]; if (useCallback) { this.Source.NewFrame += Source_NewFrame; } } catch { if (this.Source != null) this.Source.Dispose(); if (this.ReadTexture != null) this.ReadTexture.Dispose(); if (this.FBuffer != null) this.FBuffer = null; throw; } }
public LocalSymbolTable Add(EnumEntry enumEntry) => new LocalSymbolTable(this.TypeDefs, this.Enums.Add(enumEntry), this.FrameObjects);
private static CodeAttributeDeclaration CreateDescriptionAttributeDeclaration(EnumEntry enumEntry) { CodeAttributeDeclaration codeAttributeDeclaration = new CodeAttributeDeclaration("Description", new CodeAttributeArgument(new CodePrimitiveExpression(enumEntry.Description))); return(codeAttributeDeclaration); }
public Env2 Add(EnumEntry entry) { if (this._functionScope.IsNone) { // global return new Env2( this._globalSymbolTable.Add(entry), this._functionScope ); } else { // local return new Env2( this._globalSymbolTable, Option.Some(this._functionScope.Value.Add(entry)) ); } }
public FunctionScope Add(EnumEntry enumEntry) { var localSymbleTable = this.LocalScopes.Peek().Add(enumEntry); return new FunctionScope( this.FunctionType, this.FunctionParams, this.LocalScopes.Pop().Push(localSymbleTable) ); }
Format enumToFormat(EnumEntry formatEnum) { Format format; if (formatEnum.Name == "INTZ") format = D3DX.MakeFourCC((byte)'I', (byte)'N', (byte)'T', (byte)'Z'); else if (formatEnum.Name == "RAWZ") format = D3DX.MakeFourCC((byte)'R', (byte)'A', (byte)'W', (byte)'Z'); else if (formatEnum.Name == "RESZ") format = D3DX.MakeFourCC((byte)'R', (byte)'E', (byte)'S', (byte)'Z'); else if (formatEnum.Name == "No Specific") throw (new Exception("Texture mode not supported")); else format = (Format)Enum.Parse(typeof(Format), formatEnum, true); return format; }
Usage enumToUsage(EnumEntry usageEnum) { var usage = Usage.Dynamic; if (usageEnum.Index == (int)(TextureType.RenderTarget)) usage = Usage.RenderTarget; else if (usageEnum.Index == (int)(TextureType.DepthStencil)) usage = Usage.DepthStencil; return usage; }
public GlobalSymbolTable Add(EnumEntry enumEntry) => new GlobalSymbolTable(this.TypeDefs, this.Enums.Add(enumEntry), this.GlobalObjects);
internal void ParseEnumSheet() { IXLWorksheet dataTypeSheet = Workbook.Worksheets.Worksheet("Enums"); IXLRows rows = dataTypeSheet.RowsUsed(); bool firstRow = true; foreach (IXLRow row in rows) { if (firstRow) { firstRow = false; continue; } IXLCell dataTypeCell = row.Cell("A"); IXLCell qualifiedNameCell = row.Cell("B"); //IXLCell enumDescriptionDataTypeCell = row.Cell("C"); IXLCell valueCell = row.Cell("C"); IXLCell displayNameCell = row.Cell("D"); IXLCell descriptionCell = row.Cell("E"); IXLCell valueNameCell = row.Cell("F"); EnumEntry entry = new EnumEntry(); if (!TryGetNodeID(dataTypeCell.GetString(), out NodeID tempID, CommonConfig)) { continue; } entry.DataType = tempID; entry.QualifiedName = qualifiedNameCell.GetString(); int intValue; try { intValue = valueCell.GetValue <int>(); } catch (FormatException exception) { Logger.Error($"Unable to parse integer value for enum '{valueCell.GetString()}' in row {row.RowNumber()}", exception); continue; } entry.Value = intValue; entry.DisplayName = displayNameCell.GetString(); entry.Description = descriptionCell.GetString(); entry.ValueName = valueNameCell.GetString(); EnumDescription enumDescription; if (CommonConfig.EnumDescriptions.ContainsKey(entry.DataType)) { enumDescription = CommonConfig.EnumDescriptions[entry.DataType]; } else { enumDescription = new EnumDescription { Name = new QualifiedName(entry.QualifiedName), DataTypeID = entry.DataType, Fields = new List <EnumField>() }; CommonConfig.EnumDescriptions.Add(entry.DataType, enumDescription); } EnumField enumField = new EnumField { Value = entry.Value, Name = new String(entry.ValueName), Description = new LocalizedText(), DisplayName = new LocalizedText() }; if (!string.IsNullOrEmpty(entry.DisplayName)) { enumField.DisplayName.Locale = new String("en-US"); enumField.DisplayName.Text = new String(entry.DisplayName); } if (!string.IsNullOrEmpty(entry.Description)) { enumField.Description.Locale = new String("en-US"); enumField.Description.Text = new String(entry.Description); } // TODO: Add check for duplicates enumDescription.Fields.Add(enumField); } }
private static IReadOnlyList <EnumEntry> ParseEnum(string def) { var pos = EnumPos.Unknown; var i = def.IndexOf('{'); var sb = new StringBuilder(); var entries = new List <EnumEntry>(); var currentEntry = new EnumEntry(); for (; i < def.Length; ++i) { var chr = def[i]; var ended = false; var rest = def.Substring(i); // for debugging. switch (chr) { case '{' when pos == EnumPos.Unknown: pos = EnumPos.Name; SkipWhitespace(def, ref i); break; case '/' when pos == EnumPos.Name: currentEntry.Comment = GetComment(def, ref i); break; case ',' when pos == EnumPos.Name: currentEntry.Name = sb.ToString(); sb.Clear(); SkipWhitespace(def, ref i); ended = true; break; case '=' when pos == EnumPos.Name: case ' ' when pos == EnumPos.Name: case '/' when pos == EnumPos.Name: currentEntry.Name = sb.ToString(); sb.Clear(); SkipWhitespace(def, ref i); pos = EnumPos.Equals; break; case ',' when pos == EnumPos.Equals: SkipWhitespace(def, ref i); pos = EnumPos.Comment; break; case '=' when pos == EnumPos.Equals: SkipWhitespace(def, ref i); pos = EnumPos.Value; break; case ',' when pos == EnumPos.Value || pos == EnumPos.Equals: case '/' when pos == EnumPos.Value || pos == EnumPos.Equals: case '}' when pos == EnumPos.Value || pos == EnumPos.Equals: case ' ' when pos == EnumPos.Value: currentEntry.Value = sb.ToString().Trim(); sb.Clear(); SkipWhitespace(def, ref i); pos = EnumPos.Comment; ended = true; break; default: switch (pos) { case EnumPos.Comment: case EnumPos.Name: case EnumPos.Value: sb.Append(chr); break; } break; } if (ended) { if (currentEntry.Comment == null) { for (; i < def.Length; ++i) { var chr2 = def[i]; if (char.IsWhiteSpace(chr2)) { continue; } if (chr2 == '/' && def[i + 1] == '*') { currentEntry.Comment = GetComment(def, ref i); break; } --i; break; } } entries.Add(currentEntry); currentEntry = new EnumEntry(); pos = EnumPos.Name; sb.Clear(); SkipWhitespace(def, ref i); } } return(entries); }
public void SetProperties(int width, int height, uint handle, EnumEntry formatEnum, EnumEntry usageEnum) { this.FHandle = (IntPtr)unchecked((int)handle); if (handle == 0) { throw (new Exception("No shared texture handle set")); } var format = enumToFormat(formatEnum); var usage = enumToUsage(usageEnum); if (width != this.FWidth || height != this.FHeight || format != this.FFormat || usage != this.FUsage) { Allocate(width, height, format, usage); } this.FTextureShared = new Texture(this.FDevice, width, height, 1, usage, format, Pool.Default, ref this.FHandle); }