private bool SendServerLogXML(TestMessage logMessage, string _BodyLabel, out string ret_errorCode, out string ret_errorDesc)
        {
            //TODO: SendServerLogXML
            bool _value = false;

            ret_errorCode = string.Empty;
            ret_errorDesc = string.Empty;
            string result    = string.Empty;
            string errorCode = string.Empty;
            string errorDesc = string.Empty;

            // TODO: SERVER'A GÖNDERİLEN KISIM
            #region connect server
            RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Dgiworks\KioskAppLog");



            if (key != null)
            {
                if (key.GetValue("KioskServerIP").ToString().Length > 0 &&
                    key.GetValue("KioskServerPort").ToString().Length > 0
                    )
                {
                    localAddr = IPAddress.Parse(key.GetValue("KioskServerIP").ToString());
                    IPEndPoint ipe = new IPEndPoint(localAddr, Convert.ToInt32(key.GetValue("KioskServerPort")));
                    serverSocket = new TcpClient(ipe.Address.ToString(), ipe.Port);
                    NetworkStream ns = serverSocket.GetStream();
                    gonderveri_dizi = new byte[1024];
                    gonderveri_dizi = Encoding.ASCII.GetBytes(logMessage.Serialize());


                    if (gonderveri_dizi.Length < 10)
                    {
                    }
                    if (ns.CanWrite)
                    {
                        ns.Write(gonderveri_dizi, 0, gonderveri_dizi.Length);
                        ns.Flush();
                        _value = true;
                    }
                    else
                    {
                        _value = false;
                    }
                    ns.Close();
                }
            }
            #endregion


            Thread.Sleep(1000);
            return(_value);
        }
Ejemplo n.º 2
0
        public void TestMessageSerializesAndDeserializes()
        {
            var message = new TestMessage()
            {
                Time     = DateTime.Now,
                SomeText = "SomeSpecificTestText"
            };

            var serialized   = message.Serialize();
            var deserialized = Message.Deserialize(serialized);

            Assert.IsType <TestMessage>(deserialized);
        }