Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Egomotion.EgoXproject.Internal.PBXBaseObject"/> class.
        /// </summary>
        /// <param name="isa">Isa.</param> The type of object it is
        /// <param name="uid">Uid.</param> The UID in the project objects dictionary for this object
        /// <param name="dict">Dict.</param> The dictionary entry in the project objects dictionary for this object
        protected PBXBaseObject(PBXTypes isa, string uid, PBXProjDictionary dict)
        {
            if (string.IsNullOrEmpty(uid))
            {
                throw new System.ArgumentNullException((uid).ToString(), "Dictionary cannot be null");
            }

            if (dict == null)
            {
                throw new System.ArgumentNullException((dict).ToString(), "Dictionary cannot be null");
            }

            var isaValue = dict.Element <PBXProjString>(isaKey);

            if (isaValue == null)
            {
                throw new System.ArgumentException("Dictionary must contain an isa key with a string value", (dict).ToString());
            }

            if (isa.ToString() != isaValue.Value)
            {
                throw new System.ArgumentException("Dictionary must be a " + isa + " dictionary and not a " + isaValue.Value + " dictionary", (dict).ToString());
            }

            Dict = dict;
            UID  = uid;
            Isa  = isa;
        }
Example #2
0
        protected static PBXProjDictionary CommonCreate(string uid, PBXTypes type)
        {
            if (string.IsNullOrEmpty(uid))
            {
                throw new System.ArgumentNullException(nameof(uid), "uid cannot be null or empty");
            }

            PBXProjDictionary emptyDic = new PBXProjDictionary();

            //isa
            emptyDic.Add(isaKey, type.ToString());
            emptyDic.Add(CHILDREN_KEY, new PBXProjArray());
            emptyDic.Add(SOURCE_TREE_KEY, SourceTreeLocation.GROUP);
            return(emptyDic);
        }