2013-03-13 2 views
4

Oracle 32 비트 버전을 사용해야하는 응용 프로그램이 있습니다. 필자는 이것을 전제 조건으로 추가 할 수 있으며 대상 컴퓨터에 아직 설치되지 않은 경우 해당 컴퓨터가 다운로드되어 설치됩니다. VS 2010 설치 프로젝트 전에 대상 시스템 요구 사항 테스트 방법 C#

사실은 내 요구 사항은 "나는 램 크기, 프로세서 속도, 마우스 가용성, 키보드 가용성, 프린터 가용성, 시스템 최대 화면 해상도의 support..etc 같은 시스템 성능 테스트를 할 필요가있다."입니다

설치 전에 모든 정보를 테스트 할 가능성이 있습니까?

프로젝트를 배포하는 데있어 새로운 걸 시작해야 할 곳을 알려주시겠습니까?

답변

2

나는 당신이 이러한 개별 기능을 사용하는 방법을 잘 모르겠지만, 여기에 다른 일을 확인하는 기능은 다음과 같습니다

 //Get system RAM 
     private double GetSystemRam() 
     { 
      var searcher = new ManagementObjectSearcher("Select * From Win32_ComputerSystem"); 
      double total_Ram_Bytes = 0; 
      foreach (ManagementObject Mobject in searcher.Get()) 
      { 
       total_Ram_Bytes = (Convert.ToDouble(Mobject["TotalPhysicalMemory"])); 
       Console.WriteLine("RAM Size in Giga Bytes: {0}", total_Ram_Bytes/1073741824); 

      } 
      return total_Ram_Bytes; 
     } 


     //Get system processor speed 
     private int GetprocessorSpeed() 
     { 
      var searcher = new ManagementObjectSearcher("select MaxClockSpeed from Win32_Processor"); 
      int processorSpeed = 0; 
      foreach (var item in searcher.Get()) 
      { 
       processorSpeed = Convert.ToInt32(item["MaxClockSpeed"]); 
       Console.WriteLine("Processor Speed is(GHz):" + processorSpeed); 
      } 
      return processorSpeed; 
     } 


     //Get system maximum resolution 
     private void GetMaxResolution() 
     { 
      using (var searcher = new System.Management.ManagementObjectSearcher("SELECT * FROM CIM_VideoControllerResolution")) 
      { 
       var results = searcher.Get(); 
       UInt32 maxHResolution = 0; 
       UInt32 maxVResolution = 0; 

       foreach (var item in results) 
       { 
        if ((UInt32)item["HorizontalResolution"] > maxHResolution) 
         maxHResolution = (UInt32)item["HorizontalResolution"]; 

        if ((UInt32)item["VerticalResolution"] > maxVResolution) 
         maxVResolution = (UInt32)item["VerticalResolution"]; 
       } 

       Console.WriteLine("Max Supported Resolution " + maxHResolution + "x" + maxVResolution); 
      } 
     } 


     //Check for availability of keyboard 
     private bool IsKeyboardAvailable() 
     { 
      bool isKeyboardAvailable = false; 
      var searcher = new ManagementObjectSearcher("select * from Win32_Keyboard"); 

      List<string> keyBoardName = new List<string>(); 
      foreach (var item in searcher.Get()) 
      { 
       keyBoardName.Add(Convert.ToString(item["Name"])); 
       Console.WriteLine("KeyBoard name is :" + item["Name"]); 
       isKeyboardAvailable = true; 
      } 
      return isKeyboardAvailable; 
     } 


     //Check for availability of printer 
     private bool IsPrinterAvailable() 
     { 
      bool isPrinterAvailable = false; 
      var searcher = new ManagementObjectSearcher("Select * from Win32_Printer"); 
      List<string> printerName = new List<string>(); 
      foreach (var item in searcher.Get()) 
      { 
       printerName.Add(item["Name"].ToString().ToLower()); 
       Console.WriteLine("Printer name is :" + item["Name"]); 
       isPrinterAvailable = true; 
      } 
      return isPrinterAvailable; 
     } 


     //Check for availability of mouse 
     private bool IsMouseAvailable() 
     { 
      bool isMouseAvailable = false; 
      var searcher = new ManagementObjectSearcher("Select * from Win32_PointingDevice"); 
      List<string> mouseType = new List<string>(); 
      foreach (var item in searcher.Get()) 
      { 
       mouseType.Add(item["Name"].ToString().ToLower()); 
       Console.WriteLine("Mouse type is :" + item["Name"]); 
       isMouseAvailable = true; 
      } 
      return isMouseAvailable; 
     } 

참고 : 값을 볼 수 있도록 난 그냥 Console.WriteLine을 사용하고 또한 LIST를 사용하면 원하는 경우 해당 항목을 더 사용할 수 있습니다.

How To Get Hardware Information (CPU ID, MainBoard Info, Hard Disk Serial, System Information , ...)

+0

답장을 보내 주셔서 감사합니다. 내가 필요로하는 가장 중요한 것은 설치 전에 그것을 확인하는 방법입니다. – Civa

+0

나중에 그게 임프 물건입니다, 나는 당신이 당신의 프로젝트에서 무엇을하는지 알지 못해서, 나는 단지 분리 된 기능을 만들었습니다. 당신을 돕기를 바랍니다. – Popeye

+2

아마도 [custom prerequisite package] (http://msdn.microsoft.com/en-us/library/ms165429(v=80) .aspx)를 설치 프로그램에 추가 한 다음 를 < InstallChecks> 요소를 사용하여 성능 테스트 용 사용자 지정 프로그램을 실행하십시오. (ClickOnce 부트 스트 래퍼 참조 (http://msdn.microsoft.com/en-us/library/ms229432(v=80) .aspx) – Alexander