Exemplo n.º 1
0
 public static void V_VNA(NetwRunnable nr, ExecHm rc, Bys m, out string name, out IDictionary<string, Object> args)
 {
     var res = new Dict(m.V<Dictionary<string, object>>());
     name = res.Val("name", "");
     var obj = res["args"];
     args = res["args"] as IDictionary<string,object>;
 }
Exemplo n.º 2
0
 public virtual void onCmd(NetwRunnable nr, Bys m)
 {
     foreach (CmdListener ml in this.qs)
     {
         ml.onCmd(nr, m);
     }
 }
Exemplo n.º 3
0
Arquivo: ExecH.cs Projeto: Centny/cswf
 public void onCmd(NetwRunnable nr, Bys m)
 {
     if (m.length < 3)
     {
         L.W("RC_S receive the command data less 3:" + m.toBs());
         return;
     }
     var pref = m.slice(0, 3);
     m.forward(3);
     this.H.onCmd(nr, m.newM(new PrefC(m, pref), m.bys, m.offset, m.length));
 }
Exemplo n.º 4
0
 public void onCmd(NetwRunnable nr, Bys m)
 {
     try {
         string name;
         IDictionary<string, Object> args;
         this.vna(nr, this, m, out name, out args);
         var rc = new RCM_Cmd(m, name, args);
         bool next = false;
         foreach (var filter in this.filters)
         {
             if (!filter.Key.IsMatch(name))
             {
                 continue;
             }
             var res = filter.Value(rc, out next);
             if (next)
             {
                 continue;
             }
             else
             {
                 m.writev(res);
                 return;
             }
         }
         foreach (var handler in this.handler)
         {
             if (handler.Key.IsMatch(name))
             {
                 m.writev(handler.Value(rc));
                 return;
             }
         }
         m.writev(Util.dict("err", "function not found by name:" + name));
     }catch(Exception e)
     {
         L.E(e, "ExecHm exec error:{0}", e.Message);
         m.writev(Util.dict("err", "exec fail with " + e.Message));
     }
 }
Exemplo n.º 5
0
Arquivo: TaskH.cs Projeto: Centny/cswf
 public virtual void onCmd(NetwRunnable nr, Bys m)
 {
     new Task(i => h.onCmd(nr, m), 0).Start();
 }
Exemplo n.º 6
0
 public void onCmd(NetwRunnable nr, Bys m)
 {
     Console.WriteLine(val++);
     Thread.Sleep(300);
 }
Exemplo n.º 7
0
 public void onCmd(NetwRunnable nr, Bys m)
 {
 }
Exemplo n.º 8
0
 public RCM_Cmd(Bys cmd, string name, IDictionary<string, object> data)
     : base(data)
 {
 }
Exemplo n.º 9
0
 public void onCmd(NetwRunnable nr, Bys m)
 {
     Assert.AreEqual(this.val, m.get(0));
 }
Exemplo n.º 10
0
Arquivo: PrefC.cs Projeto: Centny/cswf
 /// <summary>
 /// default constructor by base stream and byte.
 /// </summary>
 /// <param name="nb">base stream</param>
 /// <param name="m">byte mode</param>
 public PrefC(r.NetwBase nb, Bys pref)
 {
     this.nb = nb;
     this.pref = pref;
 }
Exemplo n.º 11
0
 public void onCmd(NetwRunnable nr, Bys m)
 {
     Assert.AreEqual(this.val, this.t.val);
     this.t.val++;
 }