コード例 #1
0
        public bool SaveToBinary(string tablePath)
        {
            int buffSize = 8 * 1024 * 1024;

            byte[] buff = new byte[buffSize];
            ggc.Foundation.CStream stream = new ggc.Foundation.CStream(buff, 0);

            // 1. Get Version to stream
            stream.WriteT(CFxsTableInfo.TableInfoVer);

            // 2. Write entries to stream
            stream.WriteT(m_mapFxsTableInfos.Count);
            foreach (var keyValuePair in m_mapFxsTableInfos)
            {
                var entry = keyValuePair.Value;
                if (!entry.SerializeTo(stream))
                {
                    ggc.Foundation.Log.LogErrorMsg("Fail to Serialize " + TableName);
                    return(false);
                }
            }
            // 3. write to file
            System.IO.FileStream   fs     = new System.IO.FileStream(tablePath + TableName, System.IO.FileMode.Create, System.IO.FileAccess.Write);
            System.IO.BinaryWriter writer = new System.IO.BinaryWriter(fs);
            writer.Write(stream.ByteData, 0, (int)stream.TotalSizeWritten());
            writer.Close();
            fs.Close();

            return(true);
        }
コード例 #2
0
        public bool LoadFromBinary(byte[] content)
        {
            m_mapFxsTableInfos.Clear();
            ggc.Foundation.CStream stream = new ggc.Foundation.CStream(content, 0, 0, (uint)content.Length);

            // 1. Get Version
            int iVersion = 0;

            stream.ReadT(out iVersion);
            if (iVersion != CFxsTableInfo.TableInfoVer)
            {
                ggc.Foundation.Log.LogErrorMsg(string.Format("[Table] {0} binary file version doesnt match", TableName));
                return(false);
            }

            // 2. load entry
            int iCount = 0;

            stream.ReadT(out iCount);
            for (int i = 0; i < iCount; i++)
            {
                CFxsTableInfo tableInfo = new CFxsTableInfo();
                if (!tableInfo.UnserializeFrom(stream))
                {
                    ggc.Foundation.Log.LogErrorMsg("Fail to Unserialize From: " + TableName);
                    return(false);
                }
                m_mapFxsTableInfos.Add(tableInfo.UniqueID, tableInfo);
            }
            return(true);
        }
コード例 #3
0
ファイル: CTableUtility.cs プロジェクト: jasonyyl/Tools
 public virtual bool UnserializeFrom(ggc.Foundation.CStream stream)
 {
     stream.ReadT(out StartTime);
     stream.ReadT(out EndTime);
     stream.ReadT(out Movement);
     stream.ReadT(out BlendTime);
     return(true);
 }
コード例 #4
0
ファイル: CTableUtility.cs プロジェクト: jasonyyl/Tools
        public float BlendTime;         // blend time

        #region ISerializable
        public virtual bool SerializeTo(ggc.Foundation.CStream stream)
        {
            stream.WriteT(StartTime);
            stream.WriteT(EndTime);
            stream.WriteT(Movement);
            stream.WriteT(BlendTime);
            return(true);
        }
コード例 #5
0
ファイル: CTableUtility.cs プロジェクト: jasonyyl/Tools
 public virtual bool UnserializeFrom(ggc.Foundation.CStream stream)
 {
     stream.ReadT(out m_streamVersion);
     if (m_streamVersion != Version)
     {
         return(false);
     }
     return(true);
 }
コード例 #6
0
 public override bool SerializeTo(ggc.Foundation.CStream stream)
 {
     base.SerializeTo(stream);
     stream.WriteT(m_ID);
     stream.WriteT(m_Fx);
     stream.WriteT(m_LoopType);
     stream.WriteT(m_IsAttach);
     stream.WriteT(m_CameraType);
     stream.WriteT(m_Duration);
     stream.WriteT(m_Scale);
     stream.WriteT(m_IsStop);
     stream.WriteT(m_Bone);
     stream.WriteT(m_Offset);
     stream.WriteT(m_Rotate);
     return(true);
 }
コード例 #7
0
 public override bool UnserializeFrom(ggc.Foundation.CStream stream)
 {
     if (!base.UnserializeFrom(stream))
     {
         ggc.Foundation.Log.LogErrorMsg(string.Format("CFxsTableInfo Version is wrong: stream version {0}, local version {1}", StreamVersion, Version));
         return(false);
     }
     stream.ReadT(out m_ID);
     stream.ReadT(out m_Fx);
     stream.ReadT(out m_LoopType);
     stream.ReadT(out m_IsAttach);
     stream.ReadT(out m_CameraType);
     stream.ReadT(out m_Duration);
     stream.ReadT(out m_Scale);
     stream.ReadT(out m_IsStop);
     stream.ReadT(out m_Bone);
     stream.ReadT(out m_Offset);
     stream.ReadT(out m_Rotate);
     return(true);
 }
コード例 #8
0
ファイル: CTableUtility.cs プロジェクト: jasonyyl/Tools
 public virtual bool SerializeTo(ggc.Foundation.CStream stream)
 {
     stream.WriteT(Version);
     return(true);
 }