Beispiel #1
0
    public void SaveFile()
    {
        //Class Data Save
        userDB.SaveData();
        levelDB.SaveData();

#if !EditorDebug
        tropyDB.SaveData();
                #else
        Debug.Log("Editor Debug");
#endif

        dataCls.PlayerBinData = userDB.getBinData();
        dataCls.LevelBinData  = levelDB.getBinData();

        /* Prev (
         * dataCls.InstallBinData = installData.getBinData();
         * )
         */

        for (ObjectClassEnumType type = ObjectClassEnumType.None + 1; type < ObjectClassEnumType.End; type++)
        {
            ObjectDatas[(int)type].SaveData();
            dataCls.SetBinInstallData(ObjectDatas[(int)type].getBinData(), type);
        }

        if (File.Exists(file_path))
        {
            try
            {
                fileStream = new FileStream(file_path, FileMode.Truncate);
                binform.Serialize(fileStream, dataCls);
            }
            catch (ArgumentException AE)
            {
                Debug.Log(AE.StackTrace);
            }
            finally
            {
                fileStream.Close();
            }
        }
        else
        {
            using (fileStream = File.Create(file_path))
            {
                try
                {
                    binform.Serialize(fileStream, dataCls);
                }
                catch (Exception e)
                {
                    Debug.Log(e.Source + "/" + e.StackTrace);
                }
                finally
                {
                    fileStream.Close();
                }
            }
        }
    }