Пример #1
0
      private void _btnAddOnClick(object sender, EventArgs e) {
         var req = new SetInstallRuntimeDescriptor();

         req.PlatformId = BplIdentity.Get(string.Format("{0:X08}", _platformID));
         req.VersionNumber = _version.ToInt32();
         req.Descriptor = File.ReadAllBytes(_descriptorFile);

         SendRequest(req);
      }
      internal void Handle(SetInstallRuntimeDescriptor request) {
         var resp = new SwlResponse();
         resp.swlr = SwlResult.GENERAL_FAIL;

         using (var dbConn = DatabaseManager.DbConn()) {
            var ii = dbConn.ExecuteBpl(new InstallGetByPlatformIdTypeVersionNumber(request.PlatformId, SoftwareUpdateType.Image, request.VersionNumber));
            if (ii == null) {
               Log.Error("Install with Id {0} not found in the database", request.PlatformId);
               resp.swlr = SwlResult.NOT_FOUND;
               Reply(resp);
               return;
            }

            var descriptor = Encoding.ASCII.GetString(request.Descriptor);
            dbConn.ExecuteBpl(new InstallSetRuntimeDescriptor(ii.InstallId, descriptor));
         }

         resp.swlr = SwlResult.OK;
         Reply(resp);
      }