Esempio n. 1
0
        public TagsetBase[][] Receive(object anything)
        {
            if (anything == null)
            {
                throw new ArgumentNullException(nameof(anything));
            }
            if (!IsMyProcessRunning(ProcessId))
            {
                throw new RahRowRagee($"The process by id [{ProcessId}] has exited");
            }

            if (!NfNet.IsValidPortNumber(SocketPort))
            {
                throw new ItsDeadJim("The assigned socket port is not valids " + SocketPort);
            }

            var bufferOut = NfNet.SendToLocalhostSocket(Encoding.UTF8.GetBytes(anything.ToString()), SocketPort);

            var taggedText = Encoding.UTF8.GetString(bufferOut);

            TagsetBase[][] tagsOut;
            if (!PtTagset.TryParse(taggedText, out tagsOut))
            {
                throw new RahRowRagee("was unable to parse the tagged string sent back from the" +
                                      $"remote process [{ProcessId}] on port [{SocketPort}]");
            }

            return(tagsOut);
        }
Esempio n. 2
0
 public TagsetBase[][] LoadFromDisk(string filePath)
 {
     return(PtTagset.ParseFile(filePath));
 }