private static TemplatesSourceConfig GetConfigFromCdn(EnvEnum env) { Fs.SafeDeleteFile(Path.Combine(Path.GetTempPath(), "config.json")); string configFile = RemoteSource.DownloadCdnElement(Environments.CdnUrls[env], "config.json", Path.GetTempPath()); TemplatesSourceConfig config = TemplatesSourceConfig.LoadFromFile(configFile); return(config); }
private static EnvEnum ParseEnv(string name) { EnvEnum parsedEnv = EnvEnum.Unknown; string pattern = @"^pro|pre|dev|test"; Regex regex = new Regex(pattern, RegexOptions.Compiled & RegexOptions.IgnoreCase & RegexOptions.CultureInvariant); var match = regex.Match(name); if (match.Success) { Enum.TryParse(match.Value, true, out parsedEnv); } return(parsedEnv); }
public XShoppyClient(EnvEnum envEnum = EnvEnum.Prod) { _envEnum = envEnum; }
public static RemoteTemplatesSourceConfig GetRemoteTemplatesSourceConfig(string storageAccount, EnvEnum environment) { string env = environment.ToString().ToLowerInvariant(); CloudBlobContainer container = RemoteSource.GetContainerAnonymous(storageAccount, env); var remoteElements = RemoteSource.GetAllElements(container); var remotePackages = remoteElements.Where(e => e != null && e.Name.StartsWith(env, StringComparison.OrdinalIgnoreCase) && e.Name.EndsWith(".mstx", StringComparison.OrdinalIgnoreCase)) .Select((e) => new RemoteTemplatesPackage() { Name = e.Name, StorageUri = e.Uri, Bytes = e.Properties.Length, Date = e.Properties.LastModified.Value.DateTime, Version = ParseVersion(e.Name), }) .OrderByDescending(e => e.Date) .OrderByDescending(e => e.Version) .GroupBy(e => e.MainVersion) .Select(e => e.FirstOrDefault()); RemoteTemplatesSourceConfig config = new RemoteTemplatesSourceConfig() { VersionCount = remotePackages.Count(), Latest = remotePackages.FirstOrDefault(), Versions = remotePackages.ToList() }; return(config); }
public AllegroClient(HttpClient client, string clientId, string clientSecret, EnvEnum envEnum = EnvEnum.Dev) { _client = client; _clientId = clientId; _clientSecret = clientSecret; }
public static TemplatesSourceConfig GetTemplatesSourceConfig(string storageAccount, EnvEnum environment) { string env = environment.ToString().ToLowerInvariant(); CloudBlobContainer container = GetContainerAnonymous(storageAccount, env); var remoteElements = RemoteSource.GetAllElements(container); var remotePackages = remoteElements.Where(e => e != null && e.Name.StartsWith(env, StringComparison.OrdinalIgnoreCase) && e.Name.EndsWith(".mstx", StringComparison.OrdinalIgnoreCase)) .Select((e) => new TemplatesPackageInfo() { Name = e.Name, Bytes = e.Properties.Length, Date = e.Properties.LastModified.Value.DateTime, Platform = e.Metadata.ContainsKey("platform") ? e.Metadata["platform"] : string.Empty, Language = e.Metadata.ContainsKey("language") ? e.Metadata["language"] : string.Empty, WizardVersions = e.Metadata.ContainsKey("wizardversion") ? e.Metadata["wizardversion"].Split(';').Select(v => new Version(v)).ToList() : new List <Version>(), }) .OrderByDescending(e => e.Date) .OrderByDescending(e => e.Version) .GroupBy(e => new { e.MainVersion, e.Language, e.Platform }) .Select(e => e.FirstOrDefault()); TemplatesSourceConfig config = new TemplatesSourceConfig() { Latest = remotePackages.FirstOrDefault(), Versions = remotePackages.ToList(), RootUri = container.Uri, }; return(config); }