public ICommand GetCommand(byte[] request) { intCommand = null; var buf = new ByteBuffer(request); var message = Message.GetRootAsMessage(buf); command = message.Comtype; switch (command) { case ComType.GetChildrenConts: { intCommand = new CommandGetchildrenContainers(message.DbID); break; } case ComType.SavePara: { var senttlist = SentenceMap.BuildFromMessage(message); var docID = -1; // TODO docID надо передавать в первом элементе таблицы documents сообщения intCommand = new CommandSaveParagraph(message.DbID, docID, senttlist); break; } case ComType.ReadPara: { var ParagraphID = message.DbID; intCommand = new CommandReadParagraph(message.DbID); break; } case ComType.GetWord: { Param?par = message.Params(0); var strParam = ""; if (par.HasValue) { strParam = par.Value.Value; } intCommand = new CommandGetWord(strParam); break; } case ComType.SaveLex: { Param?par = message.Params(0); var strParam = ""; if (par.HasValue) { strParam = par.Value.Value; } intCommand = new CommandSaveLex(strParam); break; } default: break; } return(intCommand); }
public ICommand GetCommand(byte[] request) { intCommand = null; var buf = new ByteBuffer(request); var message = Message.GetRootAsMessage(buf); command = message.Comtype; switch (command) { case ComType.Synt: { Param?par = message.Params(0); var strParam = ""; if (par.HasValue) { strParam = par.Value.Value; } intCommand = new CommandSyntAn(strParam); break; } case ComType.Separ: { Param?par = message.Params(0); var strParam = ""; if (par.HasValue) { strParam = par.Value.Value; } intCommand = new CommandSepar(strParam); break; } case ComType.Repar: { SentenceMap sentence = null; var sentlist = SentenceMap.BuildFromMessage(message); if (sentlist.Count > 0) { sentence = sentlist[0]; } intCommand = new CommandRepar(sentence); break; } case ComType.Morph: break; default: break; } return(intCommand); }
/// <summary> /// Получение списка структур предложений из сообщения. /// </summary> public List <SentenceMap> GetSentenceStructList() { List <SentenceMap> sentlist = new List <SentenceMap>(); if (replay != null) { replay.Position = 0; var bufrep = replay.Read(); var buf = new ByteBuffer(bufrep); var message = Message.GetRootAsMessage(buf); sentlist = SentenceMap.BuildFromMessage(message); } return(sentlist); }