namespace Website.DataAccess { public class StaticRedirectRepository : IRedirectRepository { private static readonly string DOWNLOAD_SERVER_PATH = Parse.AppSetting("Downloads.BasePath") ?? "http://downloads.jesschadwick.com"; private static readonly string DEMO_SERVER_PATH = Parse.AppSetting("Demos.BasePath") ?? "http://demos.jesschadwick.com"; public string GetRedirectUrlByPath(string path) { if(string.IsNullOrEmpty(path)) return null; if(path.StartsWith("downloads/")) { var chopLength = "downloads/".Length; return string.Format("{0}/{1}", DOWNLOAD_SERVER_PATH, path.Substring(chopLength, path.Length - chopLength)); } if(path.StartsWith("demos/")) { var chopLength = "demos/".Length; return string.Format("{0}/{1}", DEMO_SERVER_PATH, path.Substring(chopLength, path.Length - chopLength)); } return null; } public string GetRedirectUrlByCode(string code) { return null; } } }