Пример #1
0
        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);
     }
 }
Пример #3
0
 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);
 }
Пример #4
0
        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;
        }
Пример #5
0
 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);
 }
Пример #6
0
 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);
 }
Пример #7
0
 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()));
 }
Пример #10
0
 public T GetValue <T> (ResXNode node)
 {
     return((T)GetValue(node));
 }