internal Repository[] GetRepositoryOverrides() { Repository[] result = new Repository[0]; try { result = string.IsNullOrEmpty(overridePath) ? UpliftSettings.FromDefaultFile().Repositories : UpliftSettings.FromFile(overridePath).Repositories; } catch (Exception e) { Debug.LogError("Could not load repositories overrides from .Uplift file\n" + e); } return(result); }
public static UpliftSettings FromFile(string source) { UpliftSettings result = new UpliftSettings { Repositories = new Repository[0], AuthenticationMethods = new RepositoryToken[0] }; if (!File.Exists(source)) { Debug.Log("No local settings file detected at " + source); return(result); } StrictXmlDeserializer <UpliftSettings> deserializer = new StrictXmlDeserializer <UpliftSettings>(); using (FileStream fs = new FileStream(source, FileMode.Open)) { try { result = deserializer.Deserialize(fs); } catch (InvalidOperationException) { Debug.LogError(string.Format("Global Override file at {0} is not well formed", source)); return(result); } foreach (Repository repo in result.Repositories) { if (repo is FileRepository) { (repo as FileRepository).Path = FileSystemUtil.MakePathOSFriendly((repo as FileRepository).Path); } } return(result); } }
private string GetToken() { UpliftSettings dotUplift = UpliftSettings.FromDefaultFile(); if (dotUplift.AuthenticationMethods != null) { foreach (RepositoryAuthentication auth in dotUplift.AuthenticationMethods) { if (!(auth is RepositoryToken)) { continue; } if (!(auth.Repository == urlField)) { continue; } return((auth as RepositoryToken).Token); } } Debug.LogWarning("Could not find authentication method for repository at " + urlField); return(null); }