Example #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(FbxNodeList document)
        {
            var timestamp = document.GetRelative($"{timePath1}/{timePath2}");

            if (timestamp == null)
            {
                throw new FbxException(-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(-1, "Invalid timestamp");
            }
        }
Example #2
0
        private FbxNode[] GetFbxNodes(string name, FbxNodeList fbxNodeList)
        {
            var nodeList = new List <FbxNode>();

            foreach (var node in fbxNodeList.Nodes)
            {
                if (node == null)
                {
                    continue;
                }
                if (node.Name == name)
                {
                    nodeList.Add(node);
                }
                nodeList.AddRange(GetFbxNodes(name, node));
            }
            return(nodeList.ToArray());
        }
Example #3
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('/');
            FbxNodeList n      = this;

            foreach (var t in tokens)
            {
                if (t == "")
                {
                    continue;
                }

                n = n[t].FirstOrDefault();
                if (n == null)
                {
                    break;
                }
            }
            return(n as FbxNode);
        }