Example #1
0
            internal PhraseGroup(string name, LanguageManager owner)
            {
                _name  = name;
                _owner = owner;

                _epn = _owner._current.Ps[name];
            }
Example #2
0
        private void SyncLangFile(LanguageFile lFileEng, LanguageFile lFileSync)
        {
            bool changed = false;

            foreach (EasyPropertiesNode nodeEng in lFileEng.Ps.GetChildProperties())
            {
                if (nodeEng.Name.Equals(LanguageFile.LANGUAGE_PROPERTIES_NODE_NAME))
                {
                    continue;
                }

                EasyPropertiesNode            nodeSync = lFileSync.Ps[nodeEng.Name];
                EasyPropertiesNode.Property[] valsEng  = nodeEng.GetValues();

                foreach (EasyPropertiesNode.Property valEng in valsEng)
                {
                    if (nodeSync.ContainsProperty(valEng.Name))
                    {
                        continue;
                    }
                    changed = true;
                    nodeSync.SetValue <string>(valEng.Name, (string)valEng.Value);
                }
            }
            if (!changed)
            {
                return;
            }
            lFileSync.Save();
        }
Example #3
0
        public bool ContainsNode(string name)
        {
            EasyPropertiesNode ps   = null;
            PropertyKey        pkey = new PropertyKey(name);

            _childProperties.TryGetValue(pkey, out ps);
            return(ps != null);
        }
Example #4
0
 public EasyPropertiesNode(string name, EasyPropertiesNode parent)
 {
     //Debug.WriteLine(string.Format("Property={0}, Parent={1}",name, parent));
     _name   = name;
     _parent = parent;
     _root   = this.GetRoot(parent);
     if (_root == null)
     {
         throw (new ArgumentException("EasyProperties root not found.", "parent"));
     }
 }
Example #5
0
 private EasyProperties GetRoot(EasyPropertiesNode parent)
 {
     if (parent == null)
     {
         return(this as EasyProperties);
     }
     if (parent.Parent == null)
     {
         return(parent as EasyProperties);
     }
     return(GetRoot(parent.Parent) as EasyProperties);
 }
Example #6
0
        private void FillTypeCollection(EasyPropertiesNode node, TypeCollection types)
        {
            EasyPropertiesNode.Property[] values = node.GetValues();
            foreach (EasyPropertiesNode.Property value in values)
            {
                types.GetTypeId(value.Value.GetType());
            }

            EasyPropertiesNode[] childProperties = node.GetChildProperties();
            foreach (EasyPropertiesNode childProp in childProperties)
            {
                this.FillTypeCollection(childProp, types);
            }
        }
Example #7
0
 public EasyPropertiesNode this[string name] {
     get {
         EasyPropertiesNode ps   = null;
         PropertyKey        pkey = new PropertyKey(name);
         _childProperties.TryGetValue(pkey, out ps);
         if (ps != null)
         {
             return(ps);
         }
         ps = new EasyPropertiesNode(name, this);
         _childProperties.Add(pkey, ps);
         return(ps);
     }
 }
Example #8
0
        internal void Read(XmlTextReader reader, EasyProperties.TypeCollection types)
        {
            if (reader.IsEmptyElement)
            {
                return;
            }

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.EndElement:
                    if (reader.LocalName == XN_PROPERTY)
                    {
                        return;
                    }
                    break;

                case XmlNodeType.Element:
                    string propertyName = reader.LocalName;
                    if (propertyName == XN_PROPERTY)
                    {
                        string name = reader.GetAttribute(XN_AT_NAME);
                        if (name == EasyProperties.PXmlRootPropertiesName && this is EasyProperties)
                        {
                            continue;
                        }
                        EasyPropertiesNode ps = new EasyPropertiesNode(name, this);
                        _childProperties.Add(new PropertyKey(name), ps);
                        ps.Read(reader, types);
                    }
                    else if (propertyName == XN_VALUES)
                    {
                        this.ReadValues(reader, types);
                    }
                    break;
                }
            }
        }
 public EasyPropertiesChangedEventArgs(EasyPropertiesNode properties, object oldValue, object newValue) : base()
 {
     _oldValue   = oldValue;
     _newValue   = newValue;
     _properties = properties;
 }