예제 #1
0
 public override bool CanRead(string file, IOSystem ioHandler, bool checkSig)
 {
     string extension = GetExtension(file);
     if (extension == "fbx")
     {
         return true;
     }
     else if ((extension.Length == 0 || checkSig) && ioHandler != null)
     {
         var tokens = new string[] {"FBX"};
         return SearchFileHeaderForToken(ioHandler, file, tokens);
     }
     return false;
 }
예제 #2
0
        /// <summary>
        /// A utility for CanRead().
        /// </summary>
        /// <remarks>
        /// The function searches the header of a file for a specific token
        /// and returns true if this token is found. This works for text
        /// files only. There is a rudimentary handling of UNICODE files.
        /// The comparison is case independent.
        /// </remarks>
        /// <param name="iosystem">IO System to work with</param>
        /// <param name="file">File name of the file</param>
        /// <param name="tokens">List of tokens to search for</param>
        /// <param name="searchBytes">Size of the token array</param>
        /// <param name="tokensSol">Number of bytes to be searched for the tokens.</param>
        public static bool SearchFileHeaderForToken(IOSystem iosystem, string file, string[] tokens, int searchBytes = 200, bool tokensSol = false)
        {
            Debug.Assert(tokens != null && tokens.Length > 0 && searchBytes != 0);
            if (iosystem == null)
            {
                return false;
            }

            var stream = iosystem.Open(file);
            if (stream != null)
            {
                var buffer = new byte[searchBytes];
                var read = stream.Read(buffer, 0, searchBytes);
                if (read == 0)
                {
                    return false;
                }

                throw (new NotImplementedException());

            }
            return true;
        }
예제 #3
0
 protected static bool CheckMagicToken(IOSystem ioHandler, string file, string[] magic, int num, int offset = 0, int size = 4)
 {
     throw (new NotImplementedException());
 }
예제 #4
0
 public abstract bool CanRead(string file, IOSystem ioHandler, bool checkSig);