Beispiel #1
0
    bool SaveFile(string file_path, BSIsoData iso)
    {
        if (!Directory.Exists(file_path))
        {
            Directory.CreateDirectory(file_path);
        }

        file_path += iso.m_HeadInfo.Name + BuildingMan.s_IsoExt;

        try
        {
            using (FileStream fileStream = new FileStream(file_path, FileMode.Create, FileAccess.Write))
            {
                BinaryWriter bw    = new BinaryWriter(fileStream);
                byte[]       datas = iso.Export();
                bw.Write(datas);
                bw.Close();
            }

            Debug.Log("Save building ISO successfully");
            return(true);
        }
        catch (System.Exception)
        {
            //			new PeTipMsg ("Failed to create file, please check  the name", PeTipMsg.EMsgLevel.Error, PeTipMsg.EMsgType.Misc);
            return(false);
        }
    }
    void SaveFile(string file_path, BSIsoData iso)
    {
        if (!Directory.Exists(file_path))
        {
            Directory.CreateDirectory(file_path);
        }

        file_path += iso.m_HeadInfo.Name + s_Ext;

        using (FileStream fileStream = new FileStream(file_path, FileMode.Create, FileAccess.Write))
        {
            BinaryWriter bw    = new BinaryWriter(fileStream);
            byte[]       datas = iso.Export();
            bw.Write(datas);
            bw.Close();
        }
    }