public static void LoadFromSystemDB(MieSystemDB systemDB, MieConversationNodeInfo convNodeInfo) { SQLiteCommand command = systemDB.Connection.CreateCommand(); command.CommandText = @"SELECT FileCode,FromNodeID,ToNodeID FROM ConversationNodeLinks ORDER BY FileCode;"; using (SQLiteDataReader reader = command.ExecuteReader()) { while (reader.Read() == true) { var fileCode = (long)reader["FileCode"]; var fromNodeID = (int)(long)reader["FromNodeID"]; var toNodeID = (int)(long)reader["ToNodeID"]; var nodeFile = convNodeInfo.GetNodeFile(fileCode); MieConversationLink nodeLink = new MieConversationLink(fromNodeID, toNodeID); nodeFile.AddLinkEntry(nodeLink); } } }
public static void LoadFromSystemDB(MieSystemDB systemDB, MieConversationNodeInfo convNodeInfo) { SQLiteCommand command = systemDB.Connection.CreateCommand(); command.CommandText = @"SELECT * FROM ConversationNodeEntries ORDER BY FileCode;"; using (SQLiteDataReader reader = command.ExecuteReader()) { while (reader.Read() == true) { var fileCode = (long)reader["FileCode"]; var nodeID = (int)(long)reader["NodeID"]; var xNodeType = (long)reader["NodeType"]; var xSpeakerGuid = (byte[])reader["SpeakerGuid"]; var xListenerGuid = (byte[])reader["ListenerGuid"]; var xIsRootNode = (long)reader["IsRootNode"]; var xIsQuestionNode = (long)reader["IsQuestionNode"]; MieConversationNodeEntry.NNodeType nodeType = (MieConversationNodeEntry.NNodeType)Enum.ToObject(typeof(MieConversationNodeEntry.NNodeType), xNodeType); Guid speakerGuid = new Guid(xSpeakerGuid); Guid listenerGuid = new Guid(xListenerGuid); bool isRootNode = xIsRootNode == 0 ? false : true; bool isQuestionNode = xIsQuestionNode == 0 ? false : true; MieConversationNodeEntry nodeEntry = new MieConversationNodeEntry( nodeType, nodeID, speakerGuid, listenerGuid, isRootNode, isQuestionNode); var nodeFile = convNodeInfo.GetNodeFile(fileCode); var rc = nodeFile.AddFlatNodeEntry(nodeEntry); } } foreach (var nodeFile in convNodeInfo.Files.Values) { nodeFile.BuildLink(); nodeFile.UpdateDepth(); } }