protected virtual void Load()
    {
        string savePath = OpenFileDialogue();

        if (savePath == "")
        {
            return;
        }
        Graph <NodeType, ConnectionType> graphDeserialized = XMLSerializerHelper.Deserialize <Graph <NodeType, ConnectionType> >(savePath);

        m_Graph.m_Nodes       = new List <NodeType>();
        m_Graph.m_Connections = new List <ConnectionType>();

        foreach (var nodeDeserialized in graphDeserialized.m_Nodes)
        {
            m_Graph.m_Nodes.Add(GetAsFinalType().DeserializeNode(nodeDeserialized));
        }

        foreach (var connectionDeserialized in graphDeserialized.m_Connections)
        {
            var        inPoint        = m_Graph.m_Nodes.First(n => n.m_InPoint.m_Id == connectionDeserialized.m_InPoint.m_Id).m_InPoint;
            var        outPoint       = m_Graph.m_Nodes.First(n => n.m_OutPoint.m_Id == connectionDeserialized.m_OutPoint.m_Id).m_OutPoint;
            Connection connectionBase = new Connection(inPoint, outPoint, OnClickRemoveConnection);
            m_Graph.m_Connections.Add(GetAsFinalType().CreateConnection(connectionBase));
        }
    }
Exemplo n.º 2
0
        public void TriggerDialogue(string tag)
        {
            Assert.IsFalse(m_IsInDialogue, "Already in dialogue, cannot start another one");
            string   filename = Application.streamingAssetsPath + ms_DialogueDirectory + tag + ".xml";
            Dialogue dialogue = XMLSerializerHelper.Deserialize <Dialogue>(filename);

            m_Dialogue = dialogue;
            StartDialogue();
        }
Exemplo n.º 3
0
 public Customers GetCustomers()
 {
     using (var reader = new StreamReader(@"F:\DefaultCollection\Connector Design\BasicConnectorSolution\WebserviceY\App_Data\Customers.xml"))
     {
         var xml = reader.ReadToEnd();
         var ser = new XMLSerializerHelper<Customers>();
         return ser.Deserialize(xml);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Gets the data and returns a customer object.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 public Customer GetData(string value)
 {
     using (var reader = new StreamReader(@"F:\DefaultCollection\Connector Design\BasicConnectorSolution\WebserviceX\App_Data\Customers.xml"))
     {
         var xml = reader.ReadToEnd();
         var ser = new XMLSerializerHelper<Customers>();
         return ser.Deserialize(xml).Find(c => c.CustomerId == value);
     }
 }
Exemplo n.º 5
0
    protected virtual void Load()
    {
        string savePath = OpenFileDialogue();

        if (savePath == "")
        {
            return;
        }
        Graph <NodeType, ConnectionType> graphDeserialized = XMLSerializerHelper.Deserialize <Graph <NodeType, ConnectionType> >(savePath);

        m_Graph.m_Nodes       = new List <NodeType>();
        m_Graph.m_Connections = new List <ConnectionType>();

        foreach (var nodeDeserialized in graphDeserialized.m_Nodes)
        {
            m_Graph.m_Nodes.Add(GetAsFinalType().DeserializeNode(nodeDeserialized));
        }

        foreach (var connectionDeserialized in graphDeserialized.m_Connections)
        {
            ConnectionPoint outPoint = null;
            foreach (Node n in m_Graph.m_Nodes)
            {
                outPoint = n.GetConnectionPoint(connectionDeserialized.m_OutPoint.m_Id);
                if (outPoint != null)
                {
                    break;
                }
            }
            ConnectionPoint inPoint = null;
            foreach (Node n in m_Graph.m_Nodes)
            {
                inPoint = n.GetConnectionPoint(connectionDeserialized.m_InPoint.m_Id);
                if (inPoint != null)
                {
                    break;
                }
            }
            Connection     connectionBase = new Connection(inPoint, outPoint, OnClickRemoveConnection);
            ConnectionType connection     = GetAsFinalType().CreateConnection(connectionBase);
            m_Graph.m_Connections.Add(connection);
            inPoint.OnConnectionMade(connection);
            outPoint.OnConnectionMade(connection);
            outPoint.GetNode().OnConnectionMade(connection);
            inPoint.GetNode().OnConnectionMade(connection);
        }
    }
Exemplo n.º 6
0
    public AnyObject GetSavedObject(System.Type type, string filename)
    {
        string path = Application.streamingAssetsPath + m_SaveDirectory + filename;

        return(XMLSerializerHelper.Deserialize(path, type));
    }