Esempio n. 1
0
      private void _listPlatformsOnSelectedIndexChanged(object sender, EventArgs e) {
         if (listPlatforms.SelectedItems.Count == 0) {
            return;
         }

         var platformItem = (PlatformListItem)listPlatforms.SelectedItems[0];
         _selectedPlatform = platformItem.Platform;
      }
Esempio n. 2
0
         public PlatformListItem(PlatformInfo platformInfo)
            : base(string.Format("{0}", platformInfo.PlatformId.LocalId.ToString())) {
            _platformInfo = platformInfo;

            var v = SwlVersion.FromInt32(_platformInfo.PlatformVersion);
            SubItems.Add(string.Format("{0:000}.{1:000}.{2:00000}", v.Major, v.Minor, v.Release));

            SubItems.Add(_platformInfo.PlatformName);
         }
Esempio n. 3
0
         public PlatformListItem(PlatformInfo platform) : base(string.Format("{0}", platform.PlatformId.LocalId.ToString())) {
            _platform = platform;

            SubItems.Add(_platform.Lock.ToString());
            SubItems.Add((_platform.LockDate.IsUndefined) ? "" : _platform.LockDate.ToString());
            SubItems.Add((_platform.LockerId.IsEmpty) ? "" : _platform.LockerId.LocalId.ToString());

            var v = SwlVersion.FromInt32(_platform.PlatformVersion);
            SubItems.Add(string.Format("{0:000}.{1:000}.{2:00000}", v.Major, v.Minor, v.Release));

            SubItems.Add(_platform.PlatformName);
         }
Esempio n. 4
0
      internal static SwlResult InstallAddNewImage(DbConnector dbConn, BplIdentity requestPlatformId, string requestCodeName, string sourcePath) {
         sourcePath = Path.Combine(LogisticsHelpers.PathTemp, sourcePath);

         var tempImageFile = Path.Combine(sourcePath, InstallImageFileName);
         var tempMasterPackageFile = Path.Combine(sourcePath, InstallMasterPackageFileName);

         var imageHdr = Interop.GetImageHeader(tempImageFile);
         if (imageHdr == null) {
            Log.Error("Bad image file {0}", tempImageFile);
            return SwlResult.INVALID_DATA;
         }

         var platformId = BplIdentity.Get(string.Format("{0:X08}", imageHdr.Value.PlatformId));
         if (platformId != requestPlatformId) {
            Log.Error("Platform id ({0}) in request is not equal image file platform id ({1})", requestPlatformId, platformId);
            return SwlResult.INVALID_PLATFORM;
         }

         var pi = dbConn.ExecuteBpl(new PlatformGetById(platformId));
         if (pi == null) {
            pi = new PlatformInfo();
            pi.PlatformId = platformId;
            pi.PlatformUId = (int)imageHdr.Value.PlatformId;
            pi.PlatformName = imageHdr.Value.PlatformName;
            pi.PlatformVersion = imageHdr.Value.PlatformVersion.ToInt32();

            dbConn.ExecuteBpl(new PlatformAdd(pi));

            dbConn.ExecuteBpl(new PlatformSetLock(platformId, PlatformLockType.ByClient, BplIdentity.Empty));
         }

         var ii = dbConn.ExecuteBpl(new InstallGetByPlatformIdTypeVersionNumber(pi.PlatformId, Mpcr.Services.Oscar.Logistics.SoftwareUpdateType.Image, imageHdr.Value.Version.ToInt32()));
         if (ii != null) {
            return SwlResult.ALREADY_EXISTS;
         }

         ii = new InstallInfo();

         ii.InstallId = BplIdentity.Get(string.Format("PLID{0:X08}-IID{1:000}{2:000}{3:00000}",
            imageHdr.Value.PlatformId,
            imageHdr.Value.Version.Major, imageHdr.Value.Version.Minor, imageHdr.Value.Version.Release));
         ii.Type = Mpcr.Services.Oscar.Logistics.SoftwareUpdateType.Image;
         ii.PlatformId = platformId;
         ii.VersionNumber = imageHdr.Value.Version.ToInt32(); ;
         ii.Description = imageHdr.Value.Desc;
         ii.Date = imageHdr.Value.Date.ToDateTime();
         ii.Status = InstallStatus.Ready;
         ii.CodeName = requestCodeName;

         var installStoragePath = LogisticsHelpers.InstallGetStoragePath(ii);

         Directory.CreateDirectory(installStoragePath);
         File.Move(tempImageFile, Path.Combine(installStoragePath, LogisticsHelpers.InstallImageFileName));
         File.Move(tempMasterPackageFile, Path.Combine(installStoragePath, LogisticsHelpers.InstallMasterPackageFileName));
         Directory.Delete(sourcePath, true);

         dbConn.ExecuteBpl(new InstallAdd(ii));

         var swlr = LogisticsHelpers.InstallCreatePackages(dbConn, ii.InstallId);
         if (swlr != SwlResult.OK) {
            return swlr;
         }

         return SwlResult.OK;
      }
Esempio n. 5
0
      private void _listPlatformsRefresh(IEnumerable<PlatformInfo> platforms) {
         textSelectedPlatform.Text = "";
         _selectedPlatform = null;
         listPlatforms.Items.Clear();

         foreach (var pl in platforms) {
            var li = new PlatformListItem(pl);
            listPlatforms.Items.Add(li);
         }

         if (listPlatforms.Items.Count > 0) {
            listPlatforms.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
         }
      }
Esempio n. 6
0
      private void _listPlatformsOnSelectedIndexChanged(object sender, EventArgs e) {
         if (listPlatforms.SelectedItems.Count == 0) {
            return;
         }

         var platformItem = (PlatformListItem)listPlatforms.SelectedItems[0];
         _selectedPlatform = platformItem.Platform;

         textSelectedPlatform.Text = string.Format("{0}", _selectedPlatform.PlatformId.LocalId.ToString());

         _listInstallsRefreshReq();
      }