public override bool Equals(object obj) { bool flag = base.Equals(obj); DrivePort d = obj as DrivePort; if (flag) { flag = this.IsSame(d); } return(flag); }
public static DrivePort FromString(string s) { DrivePort drivePort = new DrivePort(); string[] array = s.Split(new char[] { '.' }); for (int i = 0; i < array.Length; i++) { drivePort.ports.Add(int.Parse(array[i])); } return(drivePort); }
protected DrivePort GetDrivePort(MvApi.MvApi.HD_Info hdInfo) { DrivePort drivePort = new DrivePort(); if (hdInfo.Link.Parent.DevType == 255) { drivePort.ports.Add((int)hdInfo.Link.Parent.PhyID[0]); } else if (hdInfo.Link.Parent.DevType == 2) { MvApi.MvApi.PM_Info_Request pm_Info_Request = default(MvApi.MvApi.PM_Info_Request); pm_Info_Request.header.Init(); pm_Info_Request.header.requestType = 2; pm_Info_Request.header.startingIndexOrId = hdInfo.Link.Parent.DevID; pm_Info_Request.header.numRequested = 1; byte b; lock (MarvellUtil.mvApiLock) { try { b = MvApi.MvApi.MV_PD_GetPMInfo(this.AdapterId, ref pm_Info_Request); } catch (Exception ex) { Logger.Warn("MV_PD_GetPMInfo exception: {0}", new object[] { ex }); return(drivePort); } } if (b != 0) { Storage.Debug("Failed MV_PD_GetPMInfo: mvstatus={0}", new object[] { b }); return(drivePort); } if (pm_Info_Request.header.numReturned == 1) { MvApi.MvApi.PM_Info pm_Info = pm_Info_Request.pmInfo[0]; drivePort.ports.Add((int)pm_Info.Link.Parent.PhyID[0]); drivePort.ports.Add((int)hdInfo.Link.Parent.PhyID[0]); return(drivePort); } return(drivePort); } return(drivePort); }
public bool IsSame(DrivePort d) { if (d.ports.Count != this.ports.Count) { return(false); } for (int i = 0; i < this.ports.Count; i++) { if (this.ports[i] != d.ports[i]) { return(false); } } return(true); }