void m_initialize(String computerName) { OcspAdmin = new OCSPAdmin(); try { OcspAdmin.Ping(computerName); } catch (Exception e) { throw Error.ComExceptionHandler(e); } OcspAdmin.GetConfiguration(computerName, true); ComputerName = computerName; Object[,] obj = (Object[, ])OcspAdmin.OCSPServiceProperties.GetAllProperties(); for (Int32 index = 0; index < OcspAdmin.OCSPServiceProperties.Count; index++) { switch ((String)obj[index, 0]) { case "ArrayController": ArrayController = (String)obj[index, 1]; break; case "ArrayMembers": Int32 length = ((Object[])obj[index, 1]).Length; ArrayMembers = new String[length]; Array.Copy((Object[])obj[index, 1], ArrayMembers, length); break; case "AuditFilter": audit = (OcspAuditFilterEnum)obj[index, 1]; break; case "MaxNumOfCacheEntries": maxNumOfCacheEntries = (Int32)obj[index, 1]; break; case "NumOfThreads": numOfThreads = (Int32)obj[index, 1]; break; } } get_configurations(OcspAdmin); }
/// <summary> /// Releases unmanaged resources held by the object. /// </summary> public void Dispose() { ComputerName = null; ServiceStatus = ServiceControllerStatus.Stopped; //ProvConfig = null; ActiveConfigurations = null; ArrayController = null; ArrayMembers = null; maxNumOfCacheEntries = numOfThreads = 0; AuditFilter = 0; if (OcspAdmin != null) { CryptographyUtils.ReleaseCom(OcspAdmin); OcspAdmin = null; IsDisposed = true; } }
/// <summary> /// Attempts to check Online Responder's management interfaces availability. /// </summary> /// <param name="computerName"></param> /// <returns> /// <strong>True</strong> if management interfaces are available and accessible, otherwise <strong>False</strong>. /// </returns> /// <exception cref="ArgumentNullException"><strong>computerName</strong> parameter is null or empty string.</exception> public static Boolean Ping(String computerName) { if (String.IsNullOrEmpty(computerName)) { throw new ArgumentNullException(nameof(computerName)); } OCSPAdmin ocspAdmin = null; try { ocspAdmin = new OCSPAdmin(); ocspAdmin.Ping(computerName); return(true); } catch { return(false); } finally { if (ocspAdmin != null) { CryptographyUtils.ReleaseCom(ocspAdmin); } } }