示例#1
0
    int typeIndex         = 2; //第三行:是类型

    public void Gen()
    {
        string currDir = Environment.CurrentDirectory;

        this.m_inPath = Path.Combine(currDir, m_inPath);
        Assist.CreateDir(this.m_inPath);

        this.m_outPath = Path.Combine(currDir, m_outPath);
        Assist.CreateDir(this.m_outPath);

        ForGen(m_inPath, m_outPath);
    }
示例#2
0
    public void Gen()
    {
        string currDir = Environment.CurrentDirectory;

        this.m_inPath = Path.Combine(currDir, m_inPath);
        Assist.CreateDir(this.m_inPath);

        this.m_outPath = Path.Combine(currDir, m_outPath);
        Assist.CreateDir(this.m_outPath);

        ForGen(m_inPath, m_outPath);

        string savePath = Path.Combine(m_outPath, "PBData.bytes");

        using (var file = File.Create(savePath))
        {
            try
            {
                ProtoBuf.Serializer.Serialize(file, obj);
            }
            catch (Exception e)
            {
                Assist.Log(e.ToString());
            }
        }

        Assist.Log("Gen OK");

        //FileStream fs = new FileStream(savePath, FileMode.Open, FileAccess.Read);
        //int len = (int)fs.Length;
        //byte[] array = new byte[len];
        //fs.Read(array, 0, len);

        //MemoryStream ms = new MemoryStream(array);
        //PBData pbData = null;
        //try
        //{
        //    pbData  = ProtoBuf.Serializer.Deserialize<PBData>(ms);
        //}
        //catch (Exception e)
        //{
        //    Assist.Log(e.ToString());
        //}

        //int c = pbData.HeroInfoDic.Count;

        //// string s = pbData.HeroInfoDic[]

        //foreach (var item in pbData.HeroInfoDic)
        //{
        //    string s = item.Key;

        //    Assist.Log(s);

        //    string sda = item.Value.Name;

        //    Assist.Log(sda);
        //}

        //foreach (var item in pbData.SkillInfoDic)
        //{
        //    string s = item.Key;

        //    Assist.Log(s);

        //    string sda = item.Value.SkillName;

        //    Assist.Log(sda);
        //}
    }