コード例 #1
0
        private SubversionPluginProfile Parse(PluginProfile legacyProfile, XmlDocument document)
        {
            var result = new SubversionPluginProfile();
            var root   = document.SelectSingleNode("./Settings");

            result.Uri = GetValueByName(root, "PathToProject");

            var syncIntervalValue = GetValueByName(root, "SyncInterval");

            if (!string.IsNullOrEmpty(syncIntervalValue))
            {
                result.SynchronizationInterval = Int32.Parse(syncIntervalValue);
            }

            result.Login    = GetValueByName(root, "SubversionLogin");
            result.Password = GetValueByName(root, "SubversionPassword");

            result.StartRevision = GetStartRevision(legacyProfile, root);

            var userMapping = GetValueByName(root, "Maps");
            var parser      = new LegacyMappingParser();

            if (!string.IsNullOrEmpty(userMapping))
            {
                parser.Maps = userMapping;
            }
            foreach (string svnUser in parser.Users.Keys)
            {
                var tpUser = GetUserBy(parser.Users[svnUser], x => x.Login);
                if (tpUser != null)
                {
                    result.UserMapping.Add(new MappingElement {
                        Key = svnUser, Value = Create(tpUser)
                    });
                    continue;
                }

                tpUser = GetUserBy(parser.Users[svnUser], x => x.Email);
                if (tpUser != null)
                {
                    result.UserMapping.Add(new MappingElement {
                        Key = svnUser, Value = Create(tpUser)
                    });
                }
            }

            return(result);
        }
		public void UpdateUserMapping(string subversion, string targetprocess)
		{
			var maps = GetLegacyProfileValue("Maps");
			var settings = new LegacyMappingParser();
			if (!string.IsNullOrEmpty(maps))
			{
				settings.Maps = maps.TrimEnd(Environment.NewLine.ToArray());
			}

			settings.Users[subversion] = targetprocess;

			SetLegacyProfileValue("Maps", settings.Maps);
		}