Пример #1
0
        public bool RenderObject(MKDS_Course_Modifier.MKDS.NKM.OBJIEntry Item)
        {
            this.texoffset = 0;
            ushort objectId = Item.ObjectID;

            ObjectDb.Object @object = MKDS_Const.ObjectDatabase.GetObject(objectId);
            if (@object != null)
            {
                List <string> stringList = new List <string>();
                foreach (ObjectDb.Object.File requiredFile in @object.RequiredFiles)
                {
                    if (requiredFile.FileName.EndsWith(".nsbmd"))
                    {
                        stringList.Add(requiredFile.FileName);
                    }
                }
                foreach (string str in stringList)
                {
                    if (!str.StartsWith("sh_") && !str.EndsWith("_shadow.nsbmd"))
                    {
                        NARC.FileEntry fileByPath1 = this.Root1.GetFileByPath("\\MapObj\\" + str);
                        if (fileByPath1 != null)
                        {
                            this.RenderObject(objectId, new MKDS_Course_Modifier.G3D_Binary_File_Format.NSBMD(fileByPath1.Content), (NSBTP)null, 0, stringList.IndexOf(str) == stringList.Count - 1);
                        }
                        else
                        {
                            NARC.FileEntry fileByPath2 = this.Main.GetFileByPath("\\" + str);
                            if (fileByPath2 != null)
                            {
                                this.RenderObject(objectId, new MKDS_Course_Modifier.G3D_Binary_File_Format.NSBMD(fileByPath2.Content), (NSBTP)null, 0, stringList.IndexOf(str) == stringList.Count - 1);
                            }
                            else
                            {
                                NARC.FileEntry fileByPath3 = this.RomRoot.GetFileByPath("\\data\\MissionRun\\" + str);
                                if (fileByPath3 != null)
                                {
                                    this.RenderObject(objectId, new MKDS_Course_Modifier.G3D_Binary_File_Format.NSBMD(fileByPath3.Content), (NSBTP)null, 0, stringList.IndexOf(str) == stringList.Count - 1);
                                }
                                else
                                {
                                    this.CreateCube(Color.Red, Color.SkyBlue, true);
                                    return(false);
                                }
                            }
                        }
                    }
                }
                return(true);
            }
            this.CreateCube(Color.Blue, Color.SkyBlue, true);
            return(false);
        }
Пример #2
0
        public ByteFileInfo(NARC.FileEntry File)
        {
            this.FromFileEntry = true;
            this.NARCFileEntry = File;
            this.Data          = File.Content;
            this.FileID        = File.Id;
            this.FileName      = File.Name;
            this.IsLocal       = false;
            this.Path          = (string)null;
            int num;

            if (this.Data.Length > 4)
            {
                num = !(Convert.ToChar(this.Data[0]).ToString() + (object)Convert.ToChar(this.Data[1]) + (object)Convert.ToChar(this.Data[2]) + (object)Convert.ToChar(this.Data[3]) == "LZ77") ? 1 : 0;
            }
            else
            {
                num = 1;
            }
            if (num == 0)
            {
                this.GotLZ77Header    = true;
                this.IsLZ77Compressed = true;
                this.Data             = Compression.LZ77DecompressHeader(this.Data);
            }
            else if (this.Data.Length > 4 && (this.Data[0] == (byte)16 || this.Data[0] == (byte)0))
            {
                try
                {
                    byte[] numArray = Compression.LZ77Decompress(this.Data);
                    if (numArray.Length != 0)
                    {
                        this.GotLZ77Header    = false;
                        this.IsLZ77Compressed = true;
                        this.Data             = numArray;
                    }
                    else
                    {
                        this.GotLZ77Header    = false;
                        this.IsLZ77Compressed = false;
                    }
                }
                catch
                {
                    this.GotLZ77Header    = false;
                    this.IsLZ77Compressed = false;
                }
            }
            if (this.Data.Length > 4 && this.Data[0] == (byte)17 && !this.IsLZ77Compressed)
            {
                this.GotLZ77Header = false;
                try
                {
                    byte[] numArray = Compression.LZ11Decompress(this.Data);
                    if (numArray.Length != 0)
                    {
                        this.IsLZ11Compressed = true;
                        this.Data             = numArray;
                    }
                    else
                    {
                        this.IsLZ11Compressed = false;
                    }
                }
                catch
                {
                    this.IsLZ11Compressed = false;
                }
            }
            string type = FileHandler.GetType(this);

            if (!(type == "NDS") && !(type == "NARC") && !(type == "SDAT") && !(type == "PAZ"))
            {
                return;
            }
            this.IsArchive = true;
        }