コード例 #1
0
        public static void SetAttribute(this StageElement parent, string name, object value)
        {
            bool           flag = value == null;
            StageAttribute str  = parent.Attribute(name);

            if (str != null)
            {
                if (flag)
                {
                    str.Remove();
                    return;
                }
                if (str.isText && !(value is string))
                {
                    throw new InvalidOperationException("Use SetTextAttribute to set text attributes.");
                }
                str.@value = SerializationMaster.ToString(value);
            }
            else if (!flag)
            {
                parent.Add(SerializationMaster.ToStageAttribute(name, value));
                return;
            }
        }