Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        ITestLogic lo  = InvokeService.Proxy <ITestLogic>();
        string     res = lo.test();

        print(res);
        //bool isAss = typeof(IHttpSync).IsAssignableFrom(typeof(ITesst));
        //print(typeof(ITesst));
        //print(typeof(IHttpSync));
        //print(isAss);
        //ITesst socket = InvokeService.Proxy<ITesst>();
        //socket.xxx(1, "a");、
        // HttpWebRequest wbRequest = (HttpWebRequest)WebRequest.Create("");
        //wbRequest.Method = "POST";
        //wbRequest.ContentType = "application/octet-stream";
        //using (Stream requestStream = wbRequest.GetRequestStream())
        //{
        //    using (StreamWriter sw = new StreamWriter(requestStream))
        //    {
        //        //sw.Write(null);
        //    }
        //}
        //HttpWebResponse wbResponse = (HttpWebResponse)wbRequest.GetResponse();
        //using (Stream responseStream = wbResponse.GetResponseStream())
        //{
        //    using (StreamReader sread = new StreamReader(responseStream))
        //    {
        //        result = sread.ReadToEnd();
        //    }
        //}
    }
        public GuildAccountService(CreateGuildAccountFilesService guildFiles, CooldownService cooldown,
                                   InvokeService invoke)
        {
            if (!File.Exists(filePath))
            {
                CreateFile();
            }
            string json = File.ReadAllText(filePath);

            guildIDs = JsonConvert.DeserializeObject <List <ulong> >(json);

            _guildFiles = guildFiles;
            _cooldown   = cooldown;
            _invoke     = invoke;
        }
Beispiel #3
0
        private void InitService(ServerNode node, bool forceRefresh)
        {
            if (!forceRefresh && defaultNode != null)
            {
                if (node.Key == defaultNode.Key && listAssembly.Items.Count > 0)
                    return;
            }

            listAssembly.Items.Clear();
            listService.Items.Clear();
            listMethod.Items.Clear();
            richTextBox3.Clear();

            listAssembly.SelectedIndex = -1;
            listService.SelectedIndex = -1;
            listMethod.SelectedIndex = -1;

            listAssembly.Invalidate();
            listService.Invalidate();
            listMethod.Invalidate();

            tabPage0.Text = "服务信息";

            try
            {
                services = CastleFactory.Create().GetChannel<IStatusService>(node)
                    .GetServiceList().OrderBy(p => p.Name).ToList();

                methods.Clear();
                foreach (var s in services)
                {
                    foreach (var m in s.Methods)
                    {
                        var methodName = m.FullName;
                        var indexOf = m.FullName.IndexOf(' ');
                        if (indexOf >= 0)
                        {
                            methodName = m.FullName.Substring(indexOf + 1);
                        }

                        string key = string.Format("【{0}】{1}", s.FullName, methodName);
                        methods[key] = new InvokeService
                        {
                            ServiceName = s.FullName,
                            MethodName = m.FullName,
                            Parameters = m.Parameters
                        };
                    }
                }

                //处理自动完成列表
                autoCompleteTextbox1.AutoCompleteList = methods.Select(p => p.Key).ToList();

                this.Text = string.Format("分布式服务监控 v1.0 【当前服务器节点({0}:{1}) 服务数:{2} 接口数:{3}】",
                    node.IP, node.Port, services.Count, services.Sum(p => p.Methods.Count));
            }
            catch (Exception ex)
            {
                SimpleLog.Instance.WriteLogForDir("Client", ex);
                MessageBox.Show(ex.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            var assemblies = services.GroupBy(prop => prop.Assembly)
                .Select(p => new { Name = p.Key.Split(',')[0], FullName = p.Key, Services = p.ToList() })
                .OrderBy(p => p.Name).ToList();
            tabPage0.Text = "服务信息(" + assemblies.Count + ")";
            listAssembly.Items.Clear();
            foreach (var assembly in assemblies)
            {
                listAssembly.Items.Add(
                    new ParseMessageEventArgs
                    {
                        MessageType = ParseMessageType.Info,
                        LineHeader = string.Format("{0} => ({1}) services", assembly.Name, assembly.Services.Count),
                        MessageText = string.Format("{0}", assembly.FullName),
                        Source = assembly.Services
                    });
            }

            listAssembly.Invalidate();

            defaultNode = node;
        }
 public string GetLibroData(string id)
 {
     return(InvokeService.Get(_configuration["APILibro"], id).Message);
 }
 public void CreatePedido(Pedido pedido)
 {
     InvokeService.Post(_configuration["APIRoutePedido"], pedido, "");
 }
 public void Create(Cliente client)
 {
     InvokeService.Post(_configuration["APIRouteCliente"], client, "");
 }