コード例 #1
0
 public void Init()
 {
     bf       = new BinaryFormatter();
     filePath = Application.persistentDataPath + "/" + fileName;
     Debug.Log(filePath);
     if (System.IO.File.Exists(filePath))
     {
         anchorToRecordingMap = new SerializableAnchorMap();
         LoadAll();
     }
     else
     {
         anchorToRecordingMap = new SerializableAnchorMap();
     }
 }
コード例 #2
0
    public void LoadAll()
    {
        FileStream fs = File.Open(filePath, FileMode.Open);

        try
        {
            anchorToRecordingMap = (SerializableAnchorMap)bf.Deserialize(fs);
        }
        catch (SerializationException e)
        {
            Console.WriteLine("Failed to deserialize. Reason: " + e.Message);
            throw;
        }
        finally
        {
            fs.Close();
        }
    }