コード例 #1
0
        public static bool LoadResources()
        {
            mDriverResourceList = new DriverResourceList();

            DirectoryInfo diApp     = new DirectoryInfo(Path.GetDirectoryName(Application.ExecutablePath));
            DirectoryInfo diCurrent = new DirectoryInfo(Environment.CurrentDirectory);

            System.Collections.Generic.List <String> tempResPathList = new System.Collections.Generic.List <string>();

            tempResPathList.Add(diApp.FullName);
            tempResPathList.Add(diApp.FullName + Path.DirectorySeparatorChar + "DriverResources");
            if (diApp.FullName != diCurrent.FullName)
            {
                tempResPathList.Add(diCurrent.FullName);
                tempResPathList.Add(diCurrent.FullName + Path.DirectorySeparatorChar + "DriverResources");
            }

            foreach (string resPath in tempResPathList)
            {
                loadResourcesFromPath(resPath);
            }

            loadResourcesFromAssembly(Assembly.GetExecutingAssembly());


            if (mDriverResourceList.Count == 0)
            {
                InfWizardStatus.Log(CategoryType.DriverResource, StatusType.Warning, "no resources found");
                InfWizardStatus.Log(CategoryType.DriverResource, StatusType.Warning, resInfWizard.DRIVERRESOURCE_NOTFOUND);
                return(false);
            }

            return(true);
        }
コード例 #2
0
 public void DownloadDataAsync(ProgressBar progressBar, string uri, object userObject)
 {
     try
     {
         lock (mDownloadLock)
         {
             mDownloadCompleteEvent.Reset();
             if (!ReferenceEquals(progressBar, null))
             {
                 progressBar.Style   = ProgressBarStyle.Continuous;
                 progressBar.Minimum = 0;
                 progressBar.Maximum = 100;
                 progressBar.Value   = 0;
             }
             mProgressBar = progressBar;
             mWebClient.DownloadDataAsync(new Uri(uri), userObject);
         }
     }
     catch (WebException ex)
     {
         InfWizardStatus.Log(CategoryType.DriverDownloader, StatusType.Error, "failed getting driver resource list: {0}", ex.Message);
     }
     catch (Exception ex)
     {
         if (ex.InnerException != null)
         {
             if (ex.InnerException is WebException)
             {
                 InfWizardStatus.Log(CategoryType.DriverDownloader, StatusType.Error, "failed getting driver resource list: {0}", ex.InnerException.Message);
                 return;
             }
         }
         InfWizardStatus.Log(CategoryType.DriverDownloader, StatusType.Error, "failed getting driver resource list: {0}", ex);
     }
 }
コード例 #3
0
        private void WebClient_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
        {
            if (IsCancelled)
            {
                mResult = null;
                return;
            }

            try
            {
                mResult = e.Result;
            }
            catch (WebException ex)
            {
                InfWizardStatus.Log(CategoryType.DriverDownloader, StatusType.Error, "failed getting driver resource list: {0}", ex.Message);
                return;
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                {
                    if (ex.InnerException is WebException)
                    {
                        InfWizardStatus.Log(CategoryType.DriverDownloader, StatusType.Error, "download failed: {0}", ex.InnerException.Message);
                        return;
                    }
                }
                InfWizardStatus.Log(CategoryType.DriverDownloader, StatusType.Error, "download failed: {0}", ex);
            }
            finally
            {
                mDownloadCompleteEvent.Set();
            }
        }
コード例 #4
0
ファイル: InfWizardForm.cs プロジェクト: tmcqueen2/GSharp
        private void InstallSetupPackageFn(object state)
        {
            Thread.Sleep(0);
            rtfFinishedSatus.LoggingEnabled = true;

            InfWizardStatus.Log(CategoryType.InstallSetupPackage, StatusType.Info, "installing driver, please wait..");

            bool success = Wdi.InstallSetupPackage(mCurrentDeviceItem.BuildInfHardwareID(), mCurrentInfWriter.GetDriverPathFilename("inf"));

            if (success)
            {
                InfWizardStatus.Log(CategoryType.InstallSetupPackage, StatusType.Success, "driver installed successfully");
            }
            else
            {
                InfWizardStatus.Log(CategoryType.InstallSetupPackage, StatusType.Error, "driver install failed");
            }

            rtfFinishedSatus.LoggingEnabled = false;
            Invoke(new GenericStateDelegate(InstallSetupPackageCompleteFn), new object[] { success });
        }
コード例 #5
0
        private void Remove()
        {
            DEIFlags flags = DEIFlags.DICFG_AllClasses | DEIFlags.IncludeWindowsServices;

            Cursor = Cursors.WaitCursor;

            rtfRemoveDeviceStatus.StatusFilter = RemoveStatusFilter;
            removeDeviceOptionGrid.Enabled     = false;
            removeCommand.Enabled = false;

            if (DefaultRemoveOptions.OnlyConnectedDevices)
            {
                flags = flags | DEIFlags.DICFG_Present;
            }

            try
            {
                mRemoveDialogResult = DialogResult.OK;
                rtfRemoveDeviceStatus.LoggingEnabled = true;
                InfWizardStatus.Log(CategoryType.RemoveDevice, StatusType.Info, "enumerating devices..");
                DeviceSelectionHelper.RemoveDevice(DefaultRemoveOptions, Handle, flags);

                if (DefaultRemoveOptions.DeepClean)
                {
                    DeepClean();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.ToString(), "Device Removal", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                rtfRemoveDeviceStatus.LoggingEnabled = false;
                Cursor = Cursors.Default;
                removeDeviceOptionGrid.Enabled = true;
            }
        }