bool UpdateNodeModel(ResXNode node, Xwt.TextCellView etc, string newText) { if (etc.TextField == nameField) { // If we already have a key with that name, revert to the old text, otherwise remove it from the set. if (names.Contains(newText) || newText == string.Empty) { return(true); } names.Remove(etc.Text); names.Add(newText); node.Name = newText; } else if (etc.TextField == valueField) { try { // Check FileRef support. node.ObjectValue = Convert.ChangeType(newText, Data.GetValue(node).GetType()); } catch { return(true); } } else if (etc.TextField == commentField) { node.Comment = newText; } return(false); }
void AddPlaceholder() { placeholder = GetPlaceholder(); if (placeholder != null) { store.InsertWithValues(-1, placeholder); } }
protected virtual void OnAddValues(Xwt.ListStore store, int row, ResXNode node) { store.SetValues(row, nameField, node.Name, valueField, Data.GetValue(node).ToString(), commentField, node.Comment ?? string.Empty, typeField, node.TypeName ?? string.Empty, nodeField, node); }
public void SetValue(ResXNode node, object value) { if (node.ObjectValue.GetType() != value.GetType()) { throw new ArgumentException(string.Format("Type should be {0}, but was {1}", node.ObjectValue.GetType(), value.GetType()), nameof(value)); } node.ObjectValue = value; }
public object GetValue(ResXNode node) { if (node.ObjectValue is ResXFileRef fileRef) { var absolutePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Path), fileRef.FileName); var absoluteRef = new ResXFileRef(absolutePath, fileRef.TypeName, fileRef.TextFileEncoding); var newNode = new ResXDataNode(node.Name, absoluteRef).GetValue(Constants.DefaultResolutionService); return(newNode); } return(node.ObjectValue); }
public System.Drawing.Image GetDrawingImage(ResXNode node) { if (node.TypeName == typeof(System.Drawing.Bitmap).AssemblyQualifiedName) { return((System.Drawing.Image)GetValue(node)); } if (node.TypeName == typeof(System.Drawing.Icon).AssemblyQualifiedName) { return(((System.Drawing.Icon)GetValue(node)).ToBitmap()); } return(null); }
protected abstract bool SkipNode(ResXNode node);
protected override bool SkipNode(ResXNode node) { return(!(node.Value is string)); }
protected override bool SkipNode(ResXNode node) { return(ResXEditorKnownEditors.IsKnownType(node.Value.GetType())); }
public T GetValue <T> (ResXNode node) { return((T)GetValue(node)); }