예제 #1
0
    public override SavedState SaveState()
    {
        string[] versions = new string[m_versions.Count];
        for (int i = 0; i < m_versions.Count; i++)
        {
            versions[i] = m_versions[i];
        }
        SubtaskState subtask = new SubtaskState(m_path, m_name, m_software, m_currentVersion, versions, m_commentaire, m_todo, m_retakes);

        Debug.Log("save subtask name = " + subtask.Name);
        m_mementoHandler.SetState(subtask); //will move when a new concept is added, to handle undo/redo functionality
        return(m_mementoHandler.GetState());
    }
예제 #2
0
    public override SavedState Serialize()
    {
        string[] imgPaths = new string[m_concepts.Count];
        int      index    = 0;

        foreach (string imgPath in m_concepts.Values)
        {
            imgPaths[index] = imgPath;
            index++;
        }
        Debug.Log("Saving concept");
        MementoHandler m  = new MementoHandler(); //using memento pattern to handle saving/loading and also undo/redo in the
        ConceptState   cs = new ConceptState(imgPaths, m_state);

        m.SetState(cs); //will move when a new concept is added, to handle undo/redo functionality
        return(m.GetState());

/*        IFormatter formatter = new BinaryFormatter();
 *      Stream stream = new FileStream("C:\\Users\\Natspir\\NatspirProd\\Test.assetProd", FileMode.Create, FileAccess.Write);
 *      formatter.Serialize(stream, m.GetState());
 *      stream.Close();*/
    }