示例#1
0
 /// <summary>
 /// Check if the given profile drive is the same as the current profile drive
 /// </summary>
 /// <param name="drive">The profile drive that is to be compared</param>
 /// <returns>True if the given profile drive is the same as the current profile drive, else false</returns>
 public bool Equals(ProfileDrive drive)
 {
     int matchCount = 0;
     if (LogicalId.Equals(drive.LogicalId))
     {
         matchCount++;
     }
     if (matchCount == 1)
     {
         return true;
     }
     return false;
 }
示例#2
0
        /// <summary>
        /// Create a profile drive from the attribtues of the given profile drive xml element
        /// </summary>
        /// <param name="driveElement">The xml element for which the profile drive is to be created from</param>
        /// <returns>The profile drive created from the given profile drive xml element</returns>
        private static ProfileDrive CreateProfileDrive(XmlElement driveElement)
        {
            try
            {
                string guid = driveElement.GetAttribute(ATTR_PROFILE_DRIVE_GUID);
                string lastUpdatedString = driveElement.GetAttribute(ATTR_PROFILE_LAST_UPDATED);

                long lastUpdated = long.Parse(lastUpdatedString);

                string driveName = driveElement.GetAttribute(ATTR_PROFILE_DRIVE_NAME);

                ProfileDrive drive = new ProfileDrive(guid, driveName);
                drive.LastUpdated = lastUpdated;

                return drive;
            }
            catch (Exception)
            {
                ServiceLocator.GetLogger(ServiceLocator.USER_LOG).Write(new LogData(LogEventType.UNKNOWN,"Error Loading Profile"));
                return null;
            }
        }
示例#3
0
 /// <summary>
 /// Add the given profile drive the the list of existing profile drives
 /// </summary>
 /// <param name="drive">The new profile drive to be added</param>
 /// <returns>True if the drive is added</returns>
 internal bool AddProfileDrive(ProfileDrive drive)
 {
     lock (_fullList)
     {
         _fullList.Add(drive);
     }
     return true;
 }
示例#4
0
 /// <summary>
 /// Create a ProfileDrive using the GUID given and add to the list of existing profile drives
 /// </summary>
 /// <param name="guid">The GUID for which the profile drive is to be created</param>
 /// <returns>The ProfileDrive that is created</returns>
 public ProfileDrive CreateProfileDrive(string guid)
 {
     ProfileDrive drive = new ProfileDrive(guid, DefaultDriveName);
     lock (_fullList)
     {
         _fullList.Add(drive);
     }
     return drive;
 }