public void CreateMapping(string logicalAddress, string physicalAddress,string guid) { ProfileMapping map = new ProfileMapping(logicalAddress, physicalAddress, guid); if (Contains(map)) { throw new ProfileMappingExistException(map); } _mappingList.Add(map); }
/// <summary> /// Check if a Profilemapping is Contain in this profile. /// throw ProfileMappingConflictException if Profile Mapping has Conflict. /// conflict is identified as there is a similar in 1 or 2 field. /// </summary> /// <param name="mapping">The Mapping to Check</param> /// <returns>true if there is a mapping that is equals to the mapping. Else return false</returns> public bool Contains(ProfileMapping mapping) { foreach (ProfileMapping map in _mappingList) { if (map.Equals(mapping)) { return true; } } return false; }
public Boolean Equals(ProfileMapping mapping) { int equalCount = 0; if (this._guid.Equals(mapping.GUID)) { equalCount++; } if (this._logicalAddress.Equals(mapping.LogicalAddress)) { equalCount++; } if (equalCount == 0) { return false; } if (equalCount == 2) { return true; } throw new ProfileMappingConflictException(this, mapping); }
public static XmlElement CreateElementForMapping(XmlDocument profilexml, ProfileMapping mapping) { XmlElement map = profilexml.CreateElement("drive"); XmlElement logical = profilexml.CreateElement("logical"); XmlElement guid = profilexml.CreateElement("guid"); Debug.Assert(mapping.GUID != null); Debug.Assert(mapping.LogicalAddress != null); logical.InnerText = mapping.LogicalAddress; guid.InnerText = mapping.GUID; map.AppendChild(logical); map.AppendChild(guid); return map; }
public ProfileMappingConflictException(ProfileMapping mapping1, ProfileMapping mapping2):base(""+ErrorMessage.PROFILE_MAPPING_CONFLICT_EXCEPTION) { this.mapping1 = mapping1; this.mapping2 = mapping2; }
public void CreateMapping(ProfileMapping mapping) { this.CreateMapping(mapping.LogicalAddress, mapping.PhyiscalAddress, mapping.GUID); }
public ProfileMappingExistException(ProfileMapping mapping) : base(ErrorMessage.PROFILE_MAPPING_EXIST_EXCEPTION) { }