FromFile_Header() private method

private FromFile_Header ( Kn5Reader reader ) : void
reader Kn5Reader
return void
コード例 #1
0
        public static Kn5 FromFile(string filename, IKn5TextureLoader textureLoader = null, IKn5MaterialLoader materialLoader = null,
                                   IKn5NodeLoader nodeLoader = null)
        {
            if (!File.Exists(filename))
            {
                throw new FileNotFoundException(filename);
            }

            var kn5 = new Kn5(filename);

            (textureLoader = textureLoader ?? DefaultKn5TextureLoader.Instance).OnNewKn5(filename);
            (materialLoader = materialLoader ?? DefaultKn5MaterialLoader.Instance).OnNewKn5(filename);
            (nodeLoader = nodeLoader ?? DefaultKn5NodeLoader.Instance).OnNewKn5(filename);

            using (var reader = new Kn5Reader(filename)) {
                kn5.FromFile_Header(reader);
                kn5.FromFile_Textures(reader, textureLoader);
                if (nodeLoader != SkippingNodeLoader.Instance || materialLoader != SkippingMaterialLoader.Instance)
                {
                    kn5.FromFile_Materials(reader, materialLoader);
                    kn5.FromFile_Nodes(reader, nodeLoader);
                }
            }

            return(kn5);
        }
コード例 #2
0
ファイル: Kn5.FromFile.cs プロジェクト: WildGenie/actools
        public static Kn5 FromFile(string filename, bool skipTextures, bool readNodesAsBytes = true)
        {
            if (!File.Exists(filename))
            {
                throw new FileNotFoundException(filename);
            }

            var kn5 = new Kn5(filename);

            using (var reader = new Kn5Reader(filename)) {
                kn5.FromFile_Header(reader);

                if (skipTextures)
                {
                    kn5.FromFile_Textures(reader, BlankKn5TextureLoader.Instance);
                }
                else
                {
                    kn5.FromFile_Textures(reader, DefaultKn5TextureLoader.Instance);
                }

                kn5.FromFile_Materials(reader);
                kn5.FromFile_Nodes(reader, readNodesAsBytes);
            }

            return(kn5);
        }
コード例 #3
0
ファイル: Kn5.FromFile.cs プロジェクト: WildGenie/actools
        public static Kn5 FromStream(Stream entry, IKn5TextureLoader textureLoader = null)
        {
            var kn5 = new Kn5(string.Empty);

            using (var reader = new Kn5Reader(entry)) {
                kn5.FromFile_Header(reader);
                kn5.FromFile_Textures(reader, textureLoader ?? DefaultKn5TextureLoader.Instance);
                kn5.FromFile_Materials(reader);
                kn5.FromFile_Nodes(reader, false);
            }

            return(kn5);
        }
コード例 #4
0
ファイル: Kn5.FromFile.cs プロジェクト: Abishai2007/actools
        public static Kn5 FromStream(Stream entry, IKn5TextureLoader textureLoader = null, IKn5MaterialLoader materialLoader = null,
                                     IKn5NodeLoader nodeLoader = null)
        {
            var kn5 = new Kn5(string.Empty);

            using (var reader = new Kn5Reader(entry)) {
                kn5.FromFile_Header(reader);
                kn5.FromFile_Textures(reader, textureLoader ?? DefaultKn5TextureLoader.Instance);
                if (nodeLoader != SkippingNodeLoader.Instance || materialLoader != SkippingMaterialLoader.Instance)
                {
                    kn5.FromFile_Materials(reader, materialLoader ?? DefaultKn5MaterialLoader.Instance);
                    kn5.FromFile_Nodes(reader, nodeLoader ?? DefaultKn5NodeLoader.Instance);
                }
            }

            return(kn5);
        }
コード例 #5
0
ファイル: Kn5.FromFile.cs プロジェクト: WildGenie/actools
        public static Kn5 FromFile(string filename, IKn5TextureLoader textureLoader = null)
        {
            if (!File.Exists(filename))
            {
                throw new FileNotFoundException(filename);
            }

            var kn5 = new Kn5(filename);

            using (var reader = new Kn5Reader(filename)) {
                kn5.FromFile_Header(reader);
                kn5.FromFile_Textures(reader, textureLoader ?? DefaultKn5TextureLoader.Instance);
                kn5.FromFile_Materials(reader);
                kn5.FromFile_Nodes(reader, false);
            }

            return(kn5);
        }
コード例 #6
0
ファイル: Kn5_FromFile.cs プロジェクト: gro-ove/actools
        public static Kn5 FromStream(Stream entry, bool skipTextures = false) {
            var kn5 = new Kn5(string.Empty);

            using (var reader = new Kn5Reader(entry)) {
                kn5.FromFile_Header(reader);

                if (skipTextures) {
                    kn5.FromFile_SkipTextures(reader);
                } else {
                    kn5.FromFile_Textures(reader);
                }

                kn5.FromFile_Materials(reader);
                kn5.FromFile_Nodes(reader);
            }

            return kn5;
        }
コード例 #7
0
ファイル: Kn5_FromFile.cs プロジェクト: gro-ove/actools
        public static Kn5 FromFile(string filename, bool skipTextures = false) {
            if (!File.Exists(filename)) {
                throw new FileNotFoundException(filename);
            }

            var kn5 = new Kn5(filename);

            using (var reader = new Kn5Reader(filename)) {
                kn5.FromFile_Header(reader);

                if (skipTextures) {
                    kn5.FromFile_SkipTextures(reader);
                } else {
                    kn5.FromFile_Textures(reader);
                }

                kn5.FromFile_Materials(reader);
                kn5.FromFile_Nodes(reader);
            }

            return kn5;
        }