예제 #1
0
 protected override void doExecute() {
   try {
     base.doExecute();
   } catch (EBioOk bex) {
     var rsp = new BioResponse() {
       Success = true,
       GCfg = new GlobalCfgPack {
         Debug = this.BioSession.Cfg.Debug
       },
       Ex = bex
     };
     this.Context.Response.Write(rsp.Encode());
   }
 }
예제 #2
0
    public void DoExecute(RmtClientRequestCmd cmd, Params bioParams) {
      if (bioParams != null)
        this.BioParams = bioParams;
      if (this.BioParams == null)
        this.BioParams = new Params();
      try {
        switch (cmd) {
          case RmtClientRequestCmd.Run: {
              // запусить
              this._run();
              this.Context.Response.Write(new BioResponse { 
                Success = true, 
                BioParams = this.BioParams,
                RmtStatePacket = this.getCurrentStatePack()
              }.Encode());
            } break;
          case RmtClientRequestCmd.GetState: {
              // проверить состояния
              var rspns = new BioResponse {
                Success = true,
                BioParams = this.BioParams,
                RmtStatePacket = this.getCurrentStatePack()
              };
              this.Context.Response.Write(rspns.Encode());
            } break;
          case RmtClientRequestCmd.Break: {
              // остановить
              var vRptInst = this.Instance;
              if (vRptInst != null) {
                vRptInst.Abort(null);
              }
              this.Context.Response.Write(new BioResponse { Success = true, BioParams = this.BioParams }.Encode());
            } break;
          case RmtClientRequestCmd.GetResult: {
              // отдать результат
              this._sendFileToClient();
            } break;
          case RmtClientRequestCmd.Kill: {
              var vRptInst = this.Instance;
              if (vRptInst != null) {
                this.removeInstance();
              }
            } break;
        }

      } catch(Exception ex) {
        var ebioex = EBioException.CreateIfNotEBio(ex);
        this.Context.Response.Write(new BioResponse { Success = false, BioParams = this.BioParams, Ex = ebioex }.Encode());
      }
    }