Esempio n. 1
0
        public bool Load(string FileName)
        {
            try
            {
                FileStream   fileStream = File.OpenRead(FileName);
                BinaryReader br         = new BinaryReader(fileStream, koreanEncoding);

                bh = new BinaryHelper(br);

                try
                {
                    FormatString = koreanEncoding.GetString(br.ReadBytes(4));

                    uint DataOffset = bh.ReadDWord();
                    uint RowCount   = bh.ReadDWord();
                    uint FieldCount = bh.ReadDWord();
                    uint UnknownDW  = bh.ReadDWord();

                    CellData = new string[RowCount, FieldCount];

                    for (int i = 0; i < FieldCount; i++)
                    {
                        ColumnWidth.Add(bh.ReadWord());
                    }

                    for (int i = 0; i < FieldCount; i++)
                    {
                        ColumnHeader.Add(bh.ReadWString());
                    }

                    IDColumnName = bh.ReadWString();

                    for (int i = 0; i < RowCount; i++)
                    {
                        RowData.Add(bh.ReadWString());
                    }

                    for (int rowID = 0; rowID < RowCount; rowID++)
                    {
                        for (int colID = 0; colID < FieldCount; colID++)
                        {
                            string sdata = bh.ReadWString();
                            CellData[rowID, colID] = sdata;
                        }
                    }
                }
                finally
                {
                    br.Close();
                    fileStream.Close();
                }
            }
            catch (Exception)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
        public bool Load(string FileName)
        {
            MaxValue = 0f;
            MinValue = 0f;

            try
            {
                FileStream   fileStream = File.OpenRead(FileName);
                BinaryReader br         = new BinaryReader(fileStream, koreanEncoding);

                bh = new BinaryHelper(br);

                try
                {
                    Height    = bh.ReadDWord();
                    Width     = bh.ReadDWord();
                    GridCount = bh.ReadDWord();
                    GridSize  = br.ReadSingle();
                    for (int i = 0; i < 65; i++)
                    {
                        for (int j = 0; j < 65; j++)
                        {
                            element[i, j] = br.ReadSingle();
                            if (element[i, j] > MaxValue)
                            {
                                MaxValue = element[i, j];
                            }
                            if (element[i, j] < MinValue)
                            {
                                MinValue = element[i, j];
                            }
                        }
                    }
                }
                finally
                {
                    br.Close();
                    fileStream.Close();
                }
            }
            catch (Exception)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 3
0
        public bool Load(string FileName)
        {
            try
            {
                FileStream fileStream = File.OpenRead(FileName);
                br = new BinaryReader(fileStream, koreanEncoding);
                bh = new BinaryHelper(br);

                try
                {
                    MeshCount = bh.ReadWord();
                    for (int meshID = 0; meshID < MeshCount; meshID++)
                    {
                        MeshName.Add(bh.ReadZString());
                    }

                    MaterialCount = bh.ReadWord();
                    for (int materialID = 0; materialID < MaterialCount; materialID++)
                    {
                        ZSCMaterial mat = new ZSCMaterial();
                        mat.Path = bh.ReadZString();
                        br.ReadBytes(2); // Skip 2 bytes!
                        mat.UseAlpha    = (bh.ReadWord() > 0);
                        mat.DoubleSided = (bh.ReadWord() > 0);
                        mat.AlphaTest   = bh.ReadWord();
                        mat.AlphaRef    = (bh.ReadWord() / 256.0f);
                        mat.zTest       = (bh.ReadWord() > 0);
                        mat.zWrite      = (bh.ReadWord() > 0);
                        mat.BlendType   = bh.ReadWord();
                        mat.Specular    = bh.ReadWord();
                        mat.Alpha       = br.ReadSingle();
                        mat.GlowType    = bh.ReadWord();
                        mat.r           = br.ReadSingle();
                        mat.g           = br.ReadSingle();
                        mat.b           = br.ReadSingle();
                        Material.Add(mat);
                    }

                    uint effectsNames_count = bh.ReadWord();
                    for (int effID = 0; effID < effectsNames_count; effID++)
                    {
                        EffectName.Add(bh.ReadZString());
                    }

                    uint models_count = bh.ReadWord();
                    for (int modID = 0; modID < models_count; modID++)
                    {
                        ZSCModel model = new ZSCModel();
                        model.BBRadius = bh.ReadDWord();
                        model.BBX      = bh.ReadDWord();
                        model.BBY      = bh.ReadDWord();

                        uint parts_count = bh.ReadWord();
                        if (parts_count > 0)
                        {
                            // PARTS
                            for (int jparts = 0; jparts < parts_count; jparts++)
                            {
                                ZSCPart part = ReadPart();
                                if (jparts == 0)
                                {
                                    part.ParentID = -1;
                                }
                                model.Part.Add(part);
                            } // parts

                            // EFFECTS
                            uint effects_count = bh.ReadWord();
                            for (int jeffects = 0; jeffects < effects_count; jeffects++)
                            {
                                ZSCEffect effect = ReadEffect();
                                model.Effect.Add(effect);
                            }
                        } // if > 0
                        else
                        {
                            Model.Add(model);
                            continue;
                        }

                        model.BBoxMin = bh.ReadVector3f() * 0.01f;
                        model.BBoxMax = bh.ReadVector3f() * 0.01f;
                        Model.Add(model);
                    }
                }
                finally
                {
                    br.Close();
                    fileStream.Close();
                }
            }
            catch (Exception)
            {
                return(false);
            }
            return(true);
        }