Esempio n. 1
0
    private static void SaveOperators(string path, GenericOperatorContainer operators)
    {
        XmlSerializer serializer = new XmlSerializer(typeof(GenericOperatorContainer));
        FileStream    stream;

        stream = new FileStream(path, FileMode.Create);

        serializer.Serialize(stream, operators);

        stream.Close();
    }
Esempio n. 2
0
 public static void SaveData(string path, GenericOperatorContainer operators)
 {
     Debug.Log("press save");
     if (genericOperatorContainer.operators.Count > 0)
     {
         ClearOperators();
     }
     OnBeforeSave();
     SaveOperators(path, operators);
     ClearOperators();
 }
Esempio n. 3
0
    private static GenericOperatorContainer LoadOperators(string path)
    {
        XmlSerializer serializer = new XmlSerializer(typeof(GenericOperatorContainer));

        FileStream stream = new FileStream(path, FileMode.Open);

        GenericOperatorContainer operators = serializer.Deserialize(stream) as GenericOperatorContainer;

        stream.Close();

        return(operators);
    }
Esempio n. 4
0
 public static void LoadData(string path)
 {
     Debug.Log("press load");
     ClearOperators();
     //destroy any current nodes in observer
     if (observer.GetOperators() != null)
     {
         for (int i = observer.GetOperators().Count - 1; i >= 0; i--)
         {
             observer.GetOperators()[i].Disable();
             observer.DestroyOperator(observer.GetOperators()[i]);
         }
     }
     genericOperatorContainer = LoadOperators(path);
     foreach (OperatorData data in genericOperatorContainer.operators)
     {
         SaveLoadController.CreateGenericOperator(data);
     }
     root = observer.GetOperators()[0];
     instance.StartCoroutine(instance.ReloadData(root));
 }