Assets.IPC.SendMessage C# (CSharp) Method

SendMessage() public method

public SendMessage ( string recipient, string messageHead, string messageBody ) : void
recipient string
messageHead string
messageBody string
return void
        public void SendMessage(string recipient, string messageHead, string messageBody)
        {
            List<string> fileNameVec = FileSystem.ListFilesInDirectory(Globals.IpcPath);

            bool found = true;
            int fileCount = 0;

            while (found)
            {
                found = false;
                foreach (string fileNameCurrent in fileNameVec)
                    if (fileNameCurrent == recipient + fileCount.ToString())
                    {
                        found = true;
                        ++fileCount;
                        break;
                    }
            }

            string pathOld = Globals.IpcPath + "\\s" + selfName + IPC.SentCount.ToString();
            string pathNew = Globals.IpcPath + "\\" + recipient + fileCount.ToString();

            FileSystem.WriteStringToFile(pathOld, messageHead + "!" + messageBody);
            FileSystem.RenameFile(pathOld, pathNew);

            ++IPC.SentCount;

            Globals.WriteLine("message sent: " + recipient + " " + messageHead + " " + messageBody);
        }