Exemplo n.º 1
0
        public override void InitializePageControl()
        {
            base.InitializePageControl();

            if (string.IsNullOrEmpty(registry.ReadString("DellCatalogURI")))
            {
                registry.Write("DellCatalogURI", "http://downloads.dell.com/catalog/DriverPackCatalog.cab");
            }

            if (string.IsNullOrEmpty(registry.ReadString("HPCatalogURI")))
            {
                registry.Write("HPCatalogURI", "https://ftp.hp.com/pub/caps-softpaq/cmit/HPClientDriverPackCatalog.cab");
            }

            if (string.IsNullOrEmpty(registry.ReadString("TempDownloadPath")))
            {
                registry.Write("TempDownloadPath", Path.GetTempPath());
            }

            if (string.IsNullOrEmpty(registry.ReadString("DellFolderPrefix")))
            {
                registry.Write("DellFolderPrefix", "Dell");
            }

            if (string.IsNullOrEmpty(registry.ReadString("HPFolderPrefix")))
            {
                registry.Write("HPFolderPrefix", "HP");
            }

            checkBoxWipeSource.Checked = registry.ReadString("WipeSource") == "" ? true : registry.ReadBool("WipeSource");

            textBoxDellCatalogUri.Text = registry.ReadString("DellCatalogURI");
            textBoxDellPrefix.Text     = registry.ReadString("DellFolderPrefix");

            textBoxHPCatalogUri.Text = registry.ReadString("HPCatalogURI");
            textBoxHPPrefix.Text     = registry.ReadString("HPFolderPrefix");

            browseFolderControlDownload.Controls.OfType <SmsOsdTextBox>().First().Text = registry.ReadString("TempDownloadPath");

            ControlsInspector = new ControlsInspector();
            controlsValidator = new ControlsValidator(ControlsInspector);

            browseFolderControlDownload.SetErrorMessageFolderPath("Specify a valid path");
            browseFolderControlDownload.SetCustomValidateFilePath(new ControlDataStateEvaluator(ValidateDownloadDirectory));
            browseFolderControlDownload.SetValidator(controlsValidator);

            ControlsInspector.InspectAll();

            Dirty = false;

            Initialized = true;
        }
Exemplo n.º 2
0
        public override void OnActivated()
        {
            base.OnActivated();

            os = string.Format("Win{0}-{1}", UserData["OS"].ToString().Split(' ')[1].Replace(".", ""), UserData["Architecture"].ToString());

            structure        = registry.ReadString("LegacyFolderStructure");
            sourceFolderPath = registry.ReadString("DriverSourceFolder");
            tempFolderPath   = registry.ReadString("TempDownloadPath");

            ProcessCatalog();

            Utility.UpdateDataGridViewColumnsSize(dataGridViewDriverPackages, columnPack);
        }
        public override void OnActivated()
        {
            base.OnActivated();

            Regex regex = new Regex(@"Windows\s(\d\.\d|\d{2}|\d).*(\d{2})-bit");
            Match match = regex.Match(UserData["OS"].ToString());

            os               = match.Success ? string.Format("Win{0}-{1}", match.Groups[1].Value, match.Groups[2].Value) : "unknown";
            structure        = registry.ReadString("LegacyFolderStructure");
            sourceFolderPath = registry.ReadString("DriverSourceFolder");
            tempFolderPath   = registry.ReadString("TempDownloadPath");

            ProcessCatalog();

            Utility.UpdateDataGridViewColumnsSize(dataGridViewDriverPackages, columnPack);
        }
Exemplo n.º 4
0
        private bool CreateDriverPackge()
        {
            string query = string.Format("SELECT * FROM SMS_DriverPackage WHERE NAME = '{0}'", Name);

            packageObject = Utility.GetFirstWMIInstance(connectionManager, query);

            if (packageObject == null)
            {
                IResultObject instance = connectionManager.CreateInstance("SMS_DriverPackage");
                instance["Name"].StringValue           = Name;
                instance["Description"].StringValue    = "";
                instance["PkgSourceFlag"].IntegerValue = 2;
                instance["PkgSourcePath"].StringValue  = Target;
                instance["PkgFlags"].IntegerValue     |= 16777216;
                // this is only supported on 1810 and above
                if (instance.PropertyList.ContainsKey("DriverManufacturer"))
                {
                    instance["DriverManufacturer"].StringValue = Vendor;
                }
                instance["Version"].StringValue = FileVersion;
                try
                {
                    instance.Put();
                    instance.Get();
                }
                catch (SmsQueryException ex)
                {
                    string str;
                    switch (ex.ExtendStatusErrorCode)
                    {
                    case 4:
                        str = "The driver package storage path is not empty.";
                        break;

                    case 1078462229:
                        str = "The system does not have read or write permissions to the driver package's source path.";
                        break;

                    default:
                        str = "An error occurred while importing the selected driver package.";
                        break;
                    }
                    Exception.Add(new SystemException(str));

                    return(false);
                }

                string folder = registry.ReadString("DriverPackageConsoleFolder");
                if (folder == "%MANUFACTURER%")
                {
                    folder = Vendor;
                }

                Utility.AddObjectToFolder(connectionManager, folder, instance["PackageID"].StringValue, 23);

                packageObject = instance;
            }

            return(true);
        }
        public override void InitializePageControl()
        {
            base.InitializePageControl();

            browseFolderControlSource.Controls.OfType <SmsOsdTextBox>().First().Text  = registry.ReadString("DriverSourceFolder");
            browseFolderControlPackage.Controls.OfType <SmsOsdTextBox>().First().Text = registry.ReadString("DriverPackageFolder");

            //checkBoxQuickMerge.Checked = registry.ReadBool("DriverPackageQuickMerge");
            textBoxConsoleFolder.Text = registry.ReadString("DriverPackageConsoleFolder");

            checkBoxLegacyFolder.Checked = registry.ReadBool("LegacyFolderStructure");

            ControlsInspector = new ControlsInspector();
            controlsValidator = new ControlsValidator(ControlsInspector);

            browseFolderControlSource.SetErrorMessageFolderPath("Specify a valid UNC path");
            browseFolderControlSource.SetCustomValidateFilePath(new ControlDataStateEvaluator(ValidateSourceDirectory));
            browseFolderControlSource.SetValidator(controlsValidator);

            browseFolderControlPackage.SetErrorMessageFolderPath("Specify a valid UNC path");
            browseFolderControlPackage.SetCustomValidateFilePath(new ControlDataStateEvaluator(ValidatePackageDirectory));
            browseFolderControlPackage.SetValidator(controlsValidator);

            ControlsInspector.InspectAll();

            Dirty = false;

            Initialized = true;
        }
Exemplo n.º 6
0
        public override void InitializePageControl()
        {
            base.InitializePageControl();

            browseFolderControlLegacyPackage.Controls.OfType <SmsOsdTextBox>().First().Text = registry.ReadString("LegacyPackageFolder");
            checkBoxZipContent.Checked = registry.ReadBool("LegacyPackageZipContent");
            textBoxConsoleFolder.Text  = registry.ReadString("LegacyConsoleFolder");
        }
        public override void OnActivated()
        {
            base.OnActivated();

            ((SmsWizardPage)Parent).WizardForm.EnableButton(ButtonType.Next, true);

            if (string.IsNullOrEmpty(registry.ReadString("DriverSourceFolder")))
            {
                ((SmsWizardPage)Parent).WizardForm.EnableButton(ButtonType.Next, false);
                labelOptions.Text = "No driver source structure specified!";
            }
        }
Exemplo n.º 8
0
        public override void InitializePageControl()
        {
            base.InitializePageControl();

            labelDestination.Text = registry.ReadString("DriverSourceFolder");

            ControlsInspector.AddControl(dataGridViewDrivers, new ControlDataStateEvaluator(ValidateSelectedDrivers), "Select drivers to capture");
            dataGridViewDrivers.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

            Initialized = false;

            InitializeDataGridView();
        }
        public override void InitializePageControl()
        {
            base.InitializePageControl();

            if (string.IsNullOrEmpty(registry.ReadString("DellApiKey")) || string.IsNullOrEmpty(registry.ReadString("DellAPIURI")))
            {
                labelHttpResponse.Text  = "No Dell TechDirect API key set in options";
                buttonSURefresh.Enabled = false;
            }
            else
            {
                buttonSURefresh.Enabled = true;
            }

            if (!PropertyManager["IsClient"].BooleanValue)
            {
                labelHttpResponse.Text  = "No ConfigMgr client installed";
                buttonSURefresh.Enabled = false;
            }

            Initialized = true;
        }
Exemplo n.º 10
0
        public override void InitializePageControl()
        {
            base.InitializePageControl();

            if (string.IsNullOrEmpty(registry.ReadString("DellAPIURI")))
            {
                registry.Write("DellAPIURI", "https://api.dell.com/support/assetinfo/v4/");
            }

            textBoxAPIUri.Text = registry.ReadString("DellAPIURI");
            textBoxAPIKey.Text = registry.ReadString("DellAPIKey");

            Dirty = false;

            if (PropertyManager != null)
            {
                UpdateUserData();

                PropertyManager.UserDataObject = UserData;
            }

            Initialized = true;
        }
Exemplo n.º 11
0
        public override void InitializePageControl()
        {
            base.InitializePageControl();

            labelInformation.Text = string.Format("Welcome to the Driver Legacy Package Import tool.\r\n\r\nThis tool gives you a quick way to work with your drivers as no ConfigMgr skill are required. Just create your driver structure and manage all drivers on a storage level.\r\n\r\nThe tool will import your drivers and create packages from {0}.", registry.ReadString("DriverSourceFolder"));

            Initialized = true;

            buttonOptions.Image = new Icon(Properties.Resources.options, new Size(16, 16)).ToBitmap();
        }
Exemplo n.º 12
0
        private bool CreatePackge()
        {
            string query = string.Format("SELECT * FROM SMS_Package WHERE NAME = '{0}'", Name);

            packageObject = Utility.GetFirstWMIInstance(connectionManager, query);

            if (packageObject == null)
            {
                IResultObject instance = connectionManager.CreateInstance("SMS_Package");
                instance["Name"].StringValue           = Name;
                instance["Description"].StringValue    = "";
                instance["PkgSourceFlag"].IntegerValue = 2;
                instance["PkgSourcePath"].StringValue  = Target;
                instance["PkgFlags"].IntegerValue     |= 16777216;
                instance["Manufacturer"].StringValue   = Vendor;
                instance["Version"].StringValue        = FileVersion;
                try
                {
                    instance.Put();
                    instance.Get();
                }
                catch (SmsQueryException ex)
                {
                    Exception.Add(ex);

                    return(false);
                }

                Utility.AddObjectToFolder(connectionManager, registry.ReadString("LegacyConsoleFolder"), instance["PackageID"].StringValue, 2);

                packageObject = instance;
            }

            if (!Directory.Exists(Target))
            {
                Directory.CreateDirectory(Target);
            }

            return(true);
        }
        public override bool OnNavigating(NavigationType navigationType)
        {
            if (navigationType != NavigationType.Forward || valiadated)
            {
                return(base.OnNavigating(navigationType));
            }

            string cabFile = Path.Combine(Path.GetTempPath(), "DriverPackCatalog.cab");

            if (File.Exists(cabFile))
            {
                long fileSize = new FileInfo(cabFile).Length;
                long webSize  = Utility.GetFileSize(registry.ReadString("DellCatalogURI"));

                if (fileSize == webSize)
                {
                    downloadedCatalog = true;
                }
            }

            if (downloadedCatalog == false)
            {
                progressInformationDialog = new ProgressInformationDialog
                {
                    Title = "Downloading Catalog",
                };

                progressWorker                       = new BackgroundWorker();
                progressWorker.DoWork               += new DoWorkEventHandler(ProgressWorker_DoWork);
                progressWorker.ProgressChanged      += new ProgressChangedEventHandler(ProgressWorker_ProgressChanged);
                progressWorker.RunWorkerCompleted   += new RunWorkerCompletedEventHandler(ProgressWorker_RunWorkerCompleted);
                progressWorker.WorkerReportsProgress = true;
                UseWaitCursor = true;
                progressWorker.RunWorkerAsync();

                progressInformationDialog.ShowDialog(this);
                if (!progressInformationDialog.Result)
                {
                    return(false);
                }
            }

            return(base.OnNavigating(navigationType));
        }
        public override void OnActivated()
        {
            base.OnActivated();

            bool          flag;
            StringBuilder sb = new StringBuilder();

            if (string.IsNullOrEmpty(registry.ReadString("HPCatalogURI")))
            {
                flag = false;
                comboBoxOS.Enabled = false;
                sb.AppendLine("No HP Catalog URL specified!");
            }
            // check if we already process the catalog xml, then enabled the wizard
            else if (processedCatalog)
            {
                flag = true;
                comboBoxOS.Enabled = true;
            }
            // check if we already have the file and its not older than 1 hour
            else if (!string.IsNullOrEmpty(registry.ReadString("HPCatalogDownloadTime")))
            {
                flag = false;
                comboBoxOS.Enabled = true;

                string cabFile = Path.Combine(Path.GetTempPath(), "HPClientDriverPackCatalog.cab");

                DateTime date1  = DateTime.Now;
                DateTime date2  = DateTime.Parse(registry.ReadString("HPCatalogDownloadTime")).AddHours(1);
                int      result = DateTime.Compare(date1, date2);

                if (File.Exists(cabFile) && result < 0)
                {
                    downloadedCatalog = true;
                    if (processedCatalog = ProcessCatalog())
                    {
                        flag = true;
                    }
                }
                else if (File.Exists(cabFile))
                {
                    long fileSize = new FileInfo(cabFile).Length;
                    long webSize  = Utility.GetFileSize(registry.ReadString("HPCatalogURI"));

                    if (fileSize == webSize)
                    {
                        downloadedCatalog = true;
                        registry.Write("HPCatalogDownloadTime", DateTime.Now.ToString());

                        if (processedCatalog = ProcessCatalog())
                        {
                            flag = true;
                        }
                    }
                }
            }
            else
            {
                flag = false;
                comboBoxOS.Enabled = true;
            }

            if (string.IsNullOrEmpty(registry.ReadString("DriverSourceFolder")))
            {
                flag = false;
                sb.AppendLine("No driver source structure specified!");
            }
            else if (!Utility.CheckFolderPermissions(registry.ReadString("DriverSourceFolder"), FileSystemRights.Modify))
            {
                flag = false;
                sb.AppendLine("Access denied to source folder");
            }

            if (string.IsNullOrEmpty(registry.ReadString("TempDownloadPath")))
            {
                flag = false;
                sb.AppendLine("No temporary download folder specified!");
            }

            // enabled disable wizard next button
            ((SmsWizardPage)Parent).WizardForm.EnableButton(ButtonType.Next, flag);
            labelOptions.Text = sb.ToString();
        }