Esempio n. 1
0
        private void OnGet(Beetle.IChannel channel, string appname, IProperties properties)
        {
            IAppTrackerHandler appHandler = GetAppHandler(appname);

            if (appHandler == null)
            {
                HttpHeader result = new HttpHeader();
                result.Action = "500 " + string.Format("{0} Tracker Handler Notfound", appname);
                channel.Send(result);
            }
            else
            {
                AppHost apphost = appHandler.GetHost(properties);
                if (apphost == null)
                {
                    HttpHeader result = new HttpHeader();
                    result.Action = "500 App Host Notfound!";
                    channel.Send(result);
                }
                else
                {
                    HttpHeader result = new HttpHeader();
                    result.Action  = "200";
                    result["Host"] = apphost.Host;
                    result["Port"] = apphost.Port.ToString();
                    channel.Send(result);
                }
            }
        }
Esempio n. 2
0
        private void OnGetInfo(Beetle.IChannel channel, string appname, IProperties properties)
        {
            HttpHeader  result;
            TrackerInfo info;

            byte[]             data;
            BytesReader        reader;
            HttpBody           body;
            IAppTrackerHandler appHandler = GetAppHandler(appname);

            if (appHandler == null)
            {
                result        = new HttpHeader();
                result.Action = "500 " + string.Format("{0} Tracker Handler Notfound", appname);
                channel.Send(result);
            }
            else
            {
                info          = appHandler.GetInfo(properties);
                data          = Encoding.UTF8.GetBytes(info.Data);
                result        = new HttpHeader();
                result.Action = "200";
                result.Length = data.Length;
                result[Protocol.HEADER_INFOTYPE] = info.TypeName;
                channel.Send(result);
                reader = new BytesReader(data, 0, data.Length);
                while (reader.Read())
                {
                    body = HttpPacket.InstanceBodyData();
                    reader.ReadTo(body);
                    channel.Send(body);
                }
            }
        }
Esempio n. 3
0
 public void OnRegister(Beetle.IChannel channel, Register e)
 {
     Console.WriteLine(e.UserName);
     Console.WriteLine(e.EMail);
     e.RegTime = DateTime.Now;
     channel.Send(e);
 }
Esempio n. 4
0
        private void cmdRegister_Click(object sender, EventArgs e)
        {
            Register reg = new Register();

            reg.Name  = txtName.Text;
            reg.EMail = txtEMail.Text;
            channel.Send(reg);
        }
Esempio n. 5
0
        private void cmdRegister_Click(object sender, EventArgs e)
        {
            FileContent content = new FileContent();

            content.Data = richTextBox1.Text;

            channel.Send(content);
        }
Esempio n. 6
0
        private void OnRegister(Beetle.IChannel channel, string appName, IProperties properties)
        {
            IAppTrackerHandler appHandler;
            HttpHeader         result;
            IProperties        ips;

            appHandler = GetAppHandler(appName);
            if (appHandler == null)
            {
                result        = new HttpHeader();
                result.Action = RESULT_STATE_500 + string.Format(ERROR_MSG_TRACKER_NOTFOUND, appName);
                channel.Send(result);
            }
            else
            {
                ips           = appHandler.Register(properties);
                result        = this.GetResponse(ips);
                result.Action = RESULT_STATE_200;
                channel.Send(result);
            }
        }
Esempio n. 7
0
 private void cmdSend_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(richTextBox1.Text))
         {
             Beetle.StringMessage msg = new Beetle.StringMessage();
             msg.Value = richTextBox1.Text;
             channel.Send(msg);
             richTextBox1.Text = "";
             richTextBox1.Focus();
         }
     }
     catch (Exception e_)
     {
         MessageBox.Show(e_.Message);
     }
 }