private void SetupTags() { TextTag tag = new TextTag("category"); tag.Weight = Pango.Weight.Bold; tag.Scale = 1.5; tag.Background = "#ddd"; tag.BackgroundFullHeight = true; TagTable.Add(tag); tag = new TextTag("name"); tag.Weight = Pango.Weight.Bold; tag.Scale = 1.3; tag.LeftMargin = 15; tag.PixelsAboveLines = 5; tag.PixelsBelowLines = 5; TagTable.Add(tag); tag = new TextTag("author"); tag.LeftMargin = 15; tag.PixelsBelowLines = 5; TagTable.Add(tag); tag = new TextTag("description"); tag.Style = Pango.Style.Italic; tag.LeftMargin = 15; TagTable.Add(tag); tag = new TextTag("spacer"); tag.Scale = 0.25; TagTable.Add(tag); }
// Remove the specified tag public void RemoveTag(ImageTag tag) { // Root tag can not be removed if (tag.Type == ImageTagTypes.Root) { return; } // Remove tag from parent tag.Parent.Children.Remove(tag); // Check if this makes the parent unused if (tag.Parent.TaggedImages.Count == 0 && tag.Parent.Children.Count == 0) { RemoveTag(tag.Parent); } // Delete tag // TODO: How though? string path = tag.Path; Log.WriteLine($"Deleted tag [{path}]"); // Remove tag entry in tag table TagTable.Remove(path); Log.WriteLine($"Removed database entry for tag [{path}]"); }
protected override void DoWork() { lock (portal) { try { TagTable table = folder.TagTables.Find(function); if (table != null) { XmlDocument table_doc = TIAutils.ExportHMITagTableXML(table); TagParser parser = new TagParser(portal); parser.HandleTag += Parser_HandleTag; parser.Parse(block, log, TagParser.Options.AllowNoComment | TagParser.Options.NoSubelement); TIAutils.ImportHMITagTableXML(table_doc, folder); } else { LogMessage(MessageLog.Severity.Warning, "No tag table named " + function + " for tags from " + block.Name); } } catch (Exception ex) { LogMessage(MessageLog.Severity.Error, "Failed to update tag table from block:\n" + ex.Message); return; } } }
public SourceEditorBuffer() : base(new TextTagTable()) { markup = new TextTag("breakpoint"); markup.Background = "yellow"; TagTable.Add(markup); complete_ahead = new TextTag("complete_ahead"); complete_ahead.Foreground = "grey"; TagTable.Add(complete_ahead); compilation_error = new TextTag("compilation_error"); compilation_error.Underline = Pango.Underline.Error; TagTable.Add(compilation_error); complete_end = CreateMark(null, StartIter, true); highlightLineTag = new TextTag("highlightLine"); highlightLineTag.Background = "lightgrey"; TagTable.Add(highlightLineTag); MaxUndoLevels = 1000; base.InsertText += OnInsertText; base.DeleteRange += onDeleteRangeAfter; base.DeleteRange += onDeleteRangeBefore; }
/// <summary> /// 新しい TagTable オブジェクトを作成します。 /// </summary> /// <param name="tagtableid">tagtableid の初期値。</param> /// <param name="tag">tag の初期値。</param> public static TagTable CreateTagTable(long tagtableid, string tag) { TagTable tagTable = new TagTable(); tagTable.tagtableid = tagtableid; tagTable.tag = tag; return(tagTable); }
public IEnumerable <Resource> LoadResources(IReader reader, TagTable tags, IList <ResourcePointer> pointers) { StructureValueCollection values = LoadTag(reader); byte[] infoBuffer = LoadResourceInfoBuffer(values, reader); StructureValueCollection[] entries = ReadReflexive(values, reader, "number of resources", "resource table address", "resource table entry"); return(entries.Select((e, i) => LoadResource(e, i, tags, pointers, infoBuffer, reader))); }
/// <summary> /// Initializes a new instance of the <see cref="FourthGenResourceManager" /> class. /// </summary> /// <param name="gestalt">The cache file's resource gestalt.</param> /// <param name="layoutTable">The cache file's resource layout table.</param> /// <param name="tags">The cache file's tag table.</param> /// <param name="metaArea">The cache file's meta area.</param> /// <param name="allocator">The cache file's tag data allocator.</param> /// <param name="buildInfo">The cache file's build information.</param> public FourthGenResourceManager(FourthGenResourceGestalt gestalt, FourthGenResourceLayoutTable layoutTable, TagTable tags, FileSegmentGroup metaArea, MetaAllocator allocator, EngineDescription buildInfo) { _gestalt = gestalt; _layoutTable = layoutTable; _tags = tags; _metaArea = metaArea; _allocator = allocator; _buildInfo = buildInfo; }
public FourthGenSimulationDefinitionTable(ITag scenario, TagTable tags, IReader reader, FileSegmentGroup metaArea, MetaAllocator allocator, EngineDescription buildInfo) { _scenario = scenario; _tags = tags; _metaArea = metaArea; _allocator = allocator; _buildInfo = buildInfo; Load(reader); }
private void AddTags() { foreach (Monotalk.SourceView.Style s in config.styles) { Gtk.TextTag tag = new TextTag(s.path); tag.Foreground = s.color; //tag.Weight = Convert.ToInt32 (s.weight); TagTable.Add(tag); } }
/// <summary> /// Initializes a new instance of the <see cref="SoundResourceManager" /> class. /// </summary> /// <param name="gestalt">The cache file's sound resource gestalt.</param> /// <param name="layoutTable">The cache file's resource layout table.</param> /// <param name="tags">The cache file's tag table.</param> /// <param name="metaArea">The cache file's meta area.</param> /// <param name="allocator">The cache file's tag data allocator.</param> /// <param name="buildInfo">The cache file's build information.</param> public SoundResourceManager(SoundResourceGestalt gestalt, TagTable tags, FileSegmentGroup metaArea, MetaAllocator allocator, EngineDescription buildInfo, IPointerExpander expander) { _gestalt = gestalt; _tags = tags; _metaArea = metaArea; _allocator = allocator; _buildInfo = buildInfo; _expander = expander; }
public SecondGenSimulationDefinitionTable(ITag scenario, TagTable tags, IReader reader, FileSegmentGroup metaArea, MetaAllocator allocator, EngineDescription buildInfo) { _scenario = scenario; _tags = tags; _metaArea = metaArea; _allocator = allocator; _buildInfo = buildInfo; Load(reader); }
/// <summary> /// Initializes a new instance of the <see cref="ThirdGenResourceManager" /> class. /// </summary> /// <param name="gestalt">The cache file's resource gestalt.</param> /// <param name="layoutTable">The cache file's resource layout table.</param> /// <param name="tags">The cache file's tag table.</param> /// <param name="metaArea">The cache file's meta area.</param> /// <param name="allocator">The cache file's tag data allocator.</param> /// <param name="buildInfo">The cache file's build information.</param> public ThirdGenResourceManager(ThirdGenResourceGestalt gestalt, ThirdGenResourceLayoutTable layoutTable, TagTable tags, FileSegmentGroup metaArea, MetaAllocator allocator, EngineDescription buildInfo) { _gestalt = gestalt; _layoutTable = layoutTable; _tags = tags; _metaArea = metaArea; _allocator = allocator; _buildInfo = buildInfo; }
protected override void DoWork() { lock (portal) { try { TagTable table = folder.TagTables.Find(tableName); if (table != null) { XmlDocument table_doc = TIAutils.ExportHMITagTableXML(table); HMITagTable editor = new HMITagTable(table_doc); PathComponent enable_selected = new MemberComponent("EnableSelected", new STRUCT(), new MemberComponent(hmiDbName, new STRUCT())); PathComponent preset_selected = new MemberComponent("PresetSelected", new STRUCT(), new MemberComponent(hmiDbName, new STRUCT())); int index = 1; foreach (var tag in tags) { editor.AddIndexedTag("PresetEnable_" + groupName + "_", index, tag.tagPath.PrependPath(enable_selected).ToString()); editor.AddIndexedTag("PresetValue_" + groupName + "_", index, tag.tagPath.PrependPath(preset_selected).ToString(), tag.tagPath.Type); index++; } ARRAY name_array = new ARRAY(); name_array.MemberType = new STRING(); PathComponent preset_names = new MemberComponent("Names", name_array, new MemberComponent(dbName, new STRUCT())); ARRAY color_array = new ARRAY(); color_array.MemberType = INT.Type; PathComponent preset_colors = new MemberComponent("Colors", color_array, new MemberComponent(dbName, new STRUCT())); for (int p = 1; p <= nPresets; p++) { PathComponent name = new IndexComponent(new int[1] { p }, new STRING(), preset_names); editor.AddIndexedTag("PresetName_" + groupName + "_", p, name.ToString()); PathComponent color = new IndexComponent(new int[1] { p }, INT.Type, preset_colors); editor.AddIndexedTag("PresetColor_" + groupName + "_", p, color.ToString()); } TIAutils.ImportHMITagTableXML(table_doc, folder); } else { LogMessage(MessageLog.Severity.Warning, "No tag table named '" + tableName + "' was found, skipping."); } } catch (Exception ex) { LogMessage(MessageLog.Severity.Error, "Failed to update tag table:\n" + ex.Message); return; } } }
public void EmitEndLink() { var link = openLinks.Pop(); var tag = new Gtk.TextTag(null); tag.Underline = Pango.Underline.Single; tag.ForegroundGdk = Toolkit.CurrentEngine.Defaults.FallbackLinkColor.ToGtkValue(); TagTable.Add(tag); ApplyTag(tag, GetIterAtMark(link.StartMark), EndIter); Links[tag] = link; }
public IEnumerable<Resource> LoadResources(IReader reader, TagTable tags, IList<ResourcePointer> pointers) { StructureValueCollection values = LoadTag(reader); byte[] infoBuffer = LoadResourceInfoBuffer(values, reader); var count = (int) values.GetInteger("number of resources"); uint address = values.GetInteger("resource table address"); StructureLayout layout = _buildInfo.Layouts.GetLayout("resource table entry"); StructureValueCollection[] entries = ReflexiveReader.ReadReflexive(reader, count, address, layout, _metaArea); return entries.Select((e, i) => LoadResource(e, i, tags, pointers, infoBuffer, reader)); }
public ThirdGenSimulationDefinitionTable(ITag scenario, TagTable tags, IReader reader, FileSegmentGroup metaArea, MetaAllocator allocator, EngineDescription buildInfo, IPointerExpander expander) { _scenario = scenario; _tags = tags; _metaArea = metaArea; _allocator = allocator; _buildInfo = buildInfo; _expander = expander; Load(reader); }
private void Highlight() { Token [] tokens = highlights.Search(Text); foreach (Token t in tokens) { Gtk.TextIter siter, eiter; GetIterAtOffset(out siter, t.sindex); GetIterAtOffset(out eiter, t.eindex); ApplyTag(TagTable.Lookup(t.style.path), siter, eiter); } }
public IEnumerable <Resource> LoadResources(IReader reader, TagTable tags, IList <ResourcePointer> pointers) { StructureValueCollection values = LoadTag(reader); byte[] infoBuffer = LoadResourceInfoBuffer(values, reader); var count = (int)values.GetInteger("number of resources"); uint address = values.GetInteger("resource table address"); StructureLayout layout = _buildInfo.Layouts.GetLayout("resource table entry"); StructureValueCollection[] entries = ReflexiveReader.ReadReflexive(reader, count, address, layout, _metaArea); return(entries.Select((e, i) => LoadResource(e, i, tags, pointers, infoBuffer, reader))); }
// Add a tag at the specified tag path public ImageTag AddTagAtPath(string path, ImageTagTypes type = ImageTagTypes.Regular) { // If tag already exists, only update type if (ContainsTag(path)) { ChangeTagType(path, type); return(TagTable[path]); } // Start at root tag ImageTag tag = RootTag; // Navigate to parent tag String[] tagNames = path.Split(':'); foreach (String tagName in tagNames.Take(tagNames.Length - 1)) { ImageTag child = tag.Children.Find(t => t.Name == tagName); if (child == null) { // Tag along path not found, display warning message string errorMessage = $"Tag matching path [" + ((tag.Type == ImageTagTypes.Root) ? "" : $"{tag.Path}:") + $"{tagName}] not found"; Log.WriteLine(errorMessage, MessageType.Warning); // Create the missing tag child = new ImageTag(tagName, tag); Log.WriteLine($"Created tag [{child.Path}]"); // Add the tag to the tag table TagTable.Add(child.Path, child); Log.WriteLine($"Created tag table entry for tag [{child.Path}]"); } tag = child; } // Create leaf tag under parent tag ImageTag leaf = new ImageTag(tagNames.Last(), tag, type); Log.WriteLine($"Created leaf tag [{leaf.Path}] with parent [{leaf.Parent.Path}]"); // Add new tag to tag table TagTable.Add(path, leaf); Log.WriteLine($"Created tag table entry for tag [{leaf.Path}]"); // Return newly created tag return(leaf); }
private static DeleteTagResult DeleteTag(string sourceAzid, TagTable tagsTable, TagTransactionEntity tagTx) { var tag = tagsTable.GetPrimaryTag(sourceAzid, tagTx.RowKey); tag.RowKey = "deleted"; return(new DeleteTagResult() { DeleteSourceUris = new TagBlobUris { JsonUri = new Uri(tag.JsonBlobName), XmlUri = new Uri(tag.XmlBlobName) }, Tag = tag }); }
private void HighlightConfigChanged(object sender, GConf.NotifyEventArgs args) { TextTag tag; foreach (Style s in config.styles) { s.Read(); tag = TagTable.Lookup(s.path); if (tag != null) { tag.Foreground = s.color; //tag.Weight = Convert.ToInt32 (s.weight); } } Highlight(); }
private void Load(IReader reader) { _header = LoadHeader(reader, out uint primaryMask); _tags = LoadTagTable(reader, primaryMask); _fileNames = LoadFileNames(reader); _stringIDs = LoadStringIDs(reader); LoadLanguageGlobals(reader); LoadScriptFiles(); LoadSimulationDefinitions(reader); if (string.IsNullOrEmpty(_header.ScenarioName)) { //header didn't contain a scenario path yet, but later engines do so might as well grab it ITag scenario = _tags.GetGlobalTag(CharConstant.FromString("scnr")); _header.ScenarioName = _fileNames.GetTagName(scenario.Index); } }
public void InsertWithTagsByName(ref TextIter iter, string text, params string[] tagnames) { TextIter start; int offset = iter.Offset; Insert(ref iter, text); start = GetIterAtOffset(offset); iter = GetIterAtOffset(offset + text.Length); foreach (string tagname in tagnames) { TextTag tag = TagTable.Lookup(tagname); if (tag != null) { this.ApplyTag(tag, start, iter); } } }
public BaseResponse AddTag(TagTable tagModel) { var response = new BaseResponse(); _context.Tags.Add(tagModel); try { _context.SaveChanges(); response.Success = true; response.Message = "New Tag Saved"; } catch (Exception ex) { response.Success = false; response.Message = ex.Message; } return(response); }
// Assign a tag to an image public void AssignTag(string imageHash, string tagPath, ImageTagTypes tagType = ImageTagTypes.Regular) { // Get or create database entry for image if (!ImageTable.TryGetValue(imageHash, out Image image)) { image = new Image(imageHash); Log.WriteLine($"Created image object for [{imageHash}]"); ImageTable.Add(imageHash, image); Log.WriteLine($"Created database entry for image [{imageHash}]"); } // Get or create database entry for tag if (!TagTable.TryGetValue(tagPath, out ImageTag tag)) { tag = AddTagAtPath(tagPath, tagType); } // Check if tag is already assigned if (image.Tags.Contains(tag) || tag.TaggedImages.Contains(image)) { Log.WriteLine($"Tag [{tagPath}] is already assigned to image [{imageHash}]", MessageType.Warning); return; } // Link image and tag image.Tags.Add(tag); tag.TaggedImages.Add(image); Log.WriteLine($"Tag [{tagPath}] assigned to image [{imageHash}]"); // Assign ancestors as well if (tag.Parent.Type != ImageTagTypes.Root) { AssignTag(imageHash, tag.Parent.Path); } // Assign any implied tags if (ImplicationTable.ContainsKey(tagPath)) { AssignTag(imageHash, ImplicationTable[tagPath]); } }
private Resource LoadResource(StructureValueCollection values, int index, TagTable tags, IList <ResourcePointer> pointers, byte[] infoBuffer, IReader reader) { var result = new Resource(); var parentTag = new DatumIndex(values.GetInteger("parent tag datum index")); result.ParentTag = parentTag.IsValid ? tags[parentTag] : null; var salt = (ushort)values.GetInteger("datum index salt"); result.Index = new DatumIndex(salt, (ushort)index); var typeIndex = (int)values.GetInteger("resource type index"); if (typeIndex >= 0 && typeIndex < _resourceTypes.Length) { result.Type = _resourceTypes[typeIndex].Name; } result.Flags = values.GetInteger("flags"); var infoOffset = (int)values.GetInteger("resource info offset"); var infoSize = (int)values.GetInteger("resource info size"); if (infoSize > 0) { // Copy the section of the info buffer that the resource is pointing to result.Info = new byte[infoSize]; Buffer.BlockCopy(infoBuffer, infoOffset, result.Info, 0, infoSize); } result.Unknown1 = (int)values.GetInteger("unknown 1"); result.Unknown2 = (int)values.GetInteger("unknown 2"); var segmentIndex = (int)values.GetInteger("segment index"); result.Location = (segmentIndex >= 0) ? pointers[segmentIndex] : null; result.Unknown3 = (int)values.GetInteger("unknown 3"); result.ResourceFixups.AddRange(LoadResourceFixups(values, reader)); result.DefinitionFixups.AddRange(LoadDefinitionFixups(values, reader)); return(result); }
static public XmlDocument ExportHMITagTableXML(TagTable tag_table) { FileInfo path = TempFile.File("export_tagtable_", "xml"); try { tag_table.Export(path, ExportOptions.WithDefaults); XmlDocument doc = LoadDoc(path.ToString()); return(doc); } finally { try { path.Delete(); } catch (IOException e) { Console.WriteLine("Failed to delete temporary file: " + e.Message); } } }
/// <summary> /// 新しい TagTable オブジェクトを作成します。 /// </summary> /// <param name="tagtableid">tagtableid の初期値。</param> /// <param name="tag">tag の初期値。</param> public static TagTable CreateTagTable(long tagtableid, string tag) { TagTable tagTable = new TagTable(); tagTable.tagtableid = tagtableid; tagTable.tag = tag; return tagTable; }
/// <summary> /// スキーマの TagTable にはコメントがありません。 /// </summary> public void AddToTagTable(TagTable tagTable) { base.AddObject("TagTable", tagTable); }
public static TagTable dir(this TagTable tag, Dir value) { tag.Dir = value; return(tag); }
public static TagTable xmllang(this TagTable tag, string value) { tag.XmlLang = value; return(tag); }
public IEnumerable <ResourcePredictionD> LoadPredictions(IReader reader, TagTable tags, List <Resource> resources) { StructureValueCollection values = LoadTag(reader); if (!values.HasInteger("number of prediction d2s") || !values.HasInteger("prediction d2 table address")) { return(null); } int subcount = 2; StructureLayout templayout = _buildInfo.Layouts.GetLayout("raw segment table entry"); if (templayout.HasField("tertiary page index")) { subcount = 3; } var result = new List <ResourcePredictionD>(); StructureValueCollection[] d2entries = ReadReflexive(values, reader, "number of prediction d2s", "prediction d2 table address", "prediction d2 entry"); StructureValueCollection[] dentries = ReadReflexive(values, reader, "number of prediction ds", "prediction d table address", "prediction d entry"); StructureValueCollection[] centries = ReadReflexive(values, reader, "number of prediction cs", "prediction c table address", "prediction c entry"); StructureValueCollection[] bentries = ReadReflexive(values, reader, "number of prediction bs", "prediction b table address", "prediction b entry"); StructureValueCollection[] aentries = ReadReflexive(values, reader, "number of prediction as", "prediction a table address", "prediction a entry"); for (int i = 0; i < d2entries.Length; i++) { ResourcePredictionD pd = new ResourcePredictionD(); pd.Index = i; var tag = new DatumIndex(d2entries[i].GetInteger("tag datum")); pd.Tag = tag.IsValid ? tags[tag] : null; pd.Unknown1 = (int)d2entries[i].GetInteger("unknown 1"); pd.Unknown2 = (int)d2entries[i].GetInteger("unknown 2"); var dccount = (int)dentries[i].GetInteger("c count"); var dcindex = (int)dentries[i].GetInteger("c index"); var dacount = (int)dentries[i].GetInteger("a count"); var daindex = (int)dentries[i].GetInteger("a index"); for (int c = dcindex; c < dcindex + dccount; c++) { ResourcePredictionC pc = new ResourcePredictionC(); pc.Index = c; var cbindex = (int)centries[c].GetInteger("b index"); pc.OverallIndex = (short)centries[c].GetInteger("overall index"); ResourcePredictionB pb = new ResourcePredictionB(); pb.Index = cbindex; var bacount = (int)bentries[cbindex].GetInteger("a count"); var baindex = (int)bentries[cbindex].GetInteger("a index"); pb.OverallIndex = (short)bentries[cbindex].GetInteger("overall index"); for (int a = baindex; a < baindex + bacount; a++) { ResourcePredictionA pa = new ResourcePredictionA(); pa.Index = a; pa.Value = new DatumIndex(aentries[a].GetInteger("value")); int resolvedresource = pa.Value.Index / subcount; int subresource = pa.Value.Index - resolvedresource * subcount; if (resolvedresource >= resources.Count) { continue; } var res = resources[resolvedresource]; pa.Resource = res.Index; pa.SubResource = subresource; pb.AEntries.Add(pa); } pc.BEntry = pb; pd.CEntries.Add(pc); } for (int a = daindex; a < daindex + dacount; a++) { ResourcePredictionA pa = new ResourcePredictionA(); pa.Index = a; pa.Value = new DatumIndex(aentries[a].GetInteger("value")); int resolvedresource = pa.Value.Index / subcount; int subresource = pa.Value.Index - resolvedresource * subcount; if (resolvedresource >= resources.Count) { continue; } var res = resources[resolvedresource]; pa.Resource = res.Index; pa.SubResource = subresource; pd.AEntries.Add(pa); } result.Add(pd); } return(result); }
private Resource LoadResource(StructureValueCollection values, int index, TagTable tags, IList<ResourcePointer> pointers, byte[] infoBuffer, IReader reader) { var result = new Resource(); var parentTag = new DatumIndex(values.GetInteger("parent tag datum index")); result.ParentTag = parentTag.IsValid ? tags[parentTag] : null; var salt = (ushort) values.GetInteger("datum index salt"); result.Index = new DatumIndex(salt, (ushort) index); var typeIndex = (int) values.GetInteger("resource type index"); if (typeIndex >= 0 && typeIndex < _resourceTypes.Length) result.Type = _resourceTypes[typeIndex].Name; result.Flags = values.GetInteger("flags"); var infoOffset = (int) values.GetInteger("resource info offset"); var infoSize = (int) values.GetInteger("resource info size"); if (infoSize > 0) { // Copy the section of the info buffer that the resource is pointing to result.Info = new byte[infoSize]; Buffer.BlockCopy(infoBuffer, infoOffset, result.Info, 0, infoSize); } result.Unknown1 = (int) values.GetInteger("unknown 1"); result.Unknown2 = (int) values.GetInteger("unknown 2"); var segmentIndex = (int) values.GetInteger("segment index"); result.Location = (segmentIndex >= 0) ? pointers[segmentIndex] : null; result.Unknown3 = (int) values.GetInteger("unknown 3"); result.ResourceFixups.AddRange(LoadResourceFixups(values, reader)); result.DefinitionFixups.AddRange(LoadDefinitionFixups(values, reader)); return result; }
private Resource LoadResource(StructureValueCollection values, int index, TagTable tags, IList <ResourcePointer> pointers, byte[] infoBuffer, IReader reader) { var result = new Resource(); var parentTag = new DatumIndex(values.GetInteger("parent tag datum index")); result.ParentTag = parentTag.IsValid ? tags[parentTag] : null; var salt = (ushort)values.GetInteger("datum index salt"); result.Index = new DatumIndex(salt, (ushort)index); var typeIndex = (int)values.GetInteger("resource type index"); if (typeIndex >= 0 && typeIndex < _resourceTypes.Length) { result.Type = _resourceTypes[typeIndex].Name; } result.Flags = (uint)values.GetInteger("flags"); var infoSize = (int)values.GetInteger("resource info size"); if (infoSize > 0) { var infoOffset = 0; if (values.HasInteger("number of resource info offsets")) //for h4 { var infocount = (int)values.GetInteger("number of resource info offsets"); uint address = (uint)values.GetInteger("resource info offsets table address"); long expand = _expander.Expand(address); StructureLayout layout = _buildInfo.Layouts.GetLayout("resource info offset entry"); StructureValueCollection[] entries = ReflexiveReader.ReadReflexive(reader, infocount, expand, layout, _metaArea); if (infocount > 0) { infoOffset = (int)entries[0].GetInteger("offset"); } } else { infoOffset = (int)values.GetInteger("resource info offset"); } // Copy the section of the info buffer that the resource is pointing to result.Info = new byte[infoSize]; Buffer.BlockCopy(infoBuffer, infoOffset, result.Info, 0, infoSize); } result.ResourceBits = (ushort)values.GetInteger("resource bits"); var segmentIndex = (int)values.GetInteger("segment index"); result.Location = (segmentIndex >= 0) ? pointers[segmentIndex] : null; result.BaseDefinitionAddress = (int)values.GetInteger("base definition address"); result.ResourceFixups.AddRange(LoadResourceFixups(values, reader)); result.DefinitionFixups.AddRange(LoadDefinitionFixups(values, reader)); return(result); }
private void ShowTagTable(object sender, RoutedEventArgs e) { var s = new TagTable(); s.Show(); }
public void EmitText(FormattedText markup) { var iterEnd = EndIter; var textmark = CreateMark(null, iterEnd, true); Insert(ref iterEnd, markup.Text); foreach (var attr in markup.Attributes) { var iterEndAttr = GetIterAtMark(textmark); iterEndAttr.ForwardChars(attr.StartIndex); var attrStart = CreateMark(null, iterEndAttr, true); iterEndAttr.ForwardChars(attr.Count); var tag = new Gtk.TextTag(null); if (attr is BackgroundTextAttribute) { var xa = (BackgroundTextAttribute)attr; tag.BackgroundGdk = xa.Color.ToGtkValue(); } else if (attr is ColorTextAttribute) { var xa = (ColorTextAttribute)attr; tag.ForegroundGdk = xa.Color.ToGtkValue(); } else if (attr is FontWeightTextAttribute) { var xa = (FontWeightTextAttribute)attr; tag.Weight = (Pango.Weight)(int) xa.Weight; } else if (attr is FontStyleTextAttribute) { var xa = (FontStyleTextAttribute)attr; tag.Style = (Pango.Style)(int) xa.Style; } else if (attr is UnderlineTextAttribute) { var xa = (UnderlineTextAttribute)attr; tag.Underline = xa.Underline ? Pango.Underline.Single : Pango.Underline.None; } else if (attr is StrikethroughTextAttribute) { var xa = (StrikethroughTextAttribute)attr; tag.Strikethrough = xa.Strikethrough; } else if (attr is FontTextAttribute) { var xa = (FontTextAttribute)attr; tag.FontDesc = (Pango.FontDescription)Toolkit.GetBackend(xa.Font); } else if (attr is LinkTextAttribute) { var xa = (LinkTextAttribute)attr; Uri uri = xa.Target; if (uri == null) { Uri.TryCreate(markup.Text.Substring(xa.StartIndex, xa.Count), UriKind.RelativeOrAbsolute, out uri); } var link = new Link { Href = uri }; tag.Underline = Pango.Underline.Single; tag.ForegroundGdk = Toolkit.CurrentEngine.Defaults.FallbackLinkColor.ToGtkValue(); Links [tag] = link; } TagTable.Add(tag); ApplyTag(tag, GetIterAtMark(attrStart), iterEndAttr); DeleteMark(attrStart); } DeleteMark(textmark); }