Beispiel #1
0
        /// <summary>
        /// Generates the unique footer code based on the document's timestamp
        /// </summary>
        /// <param name="document"></param>
        /// <returns>A 16-byte code</returns>
        protected static byte[] GenerateFooterCode(FbxNodeCollection document)
        {
            var timestamp = document.GetRelative(timePath1 + "/" + timePath2);

            if (timestamp == null)
            {
                throw new FbxException(timePath, -1, "No creation timestamp");
            }
            try
            {
                return(GenerateFooterCode(
                           GetTimestampVar(timestamp, "Year"),
                           GetTimestampVar(timestamp, "Month"),
                           GetTimestampVar(timestamp, "Day"),
                           GetTimestampVar(timestamp, "Hour"),
                           GetTimestampVar(timestamp, "Minute"),
                           GetTimestampVar(timestamp, "Second"),
                           GetTimestampVar(timestamp, "Millisecond")
                           ));
            }
            catch (ArgumentOutOfRangeException)
            {
                throw new FbxException(timePath, -1, "Invalid timestamp");
            }
        }
Beispiel #2
0
        /// <summary>
        /// Gets a child node, using a '/' separated path
        /// </summary>
        /// <param name="path"></param>
        /// <returns>The child node, or null</returns>
        public FbxNode GetRelative(string path)
        {
            var tokens          = path.Split('/');
            FbxNodeCollection n = this;

            foreach (var t in tokens)
            {
                if (t == "")
                {
                    continue;
                }
                n = n[t];
                if (n == null)
                {
                    break;
                }
            }
            return(n as FbxNode);
        }