private T ReadToConfigTree <T>(Stream inputStream, ConfigurationProfile configurationProfile) where T : ConfigTreeNode, new() { T local = Activator.CreateInstance <T>(); ConfigsMerger merger = new ConfigsMerger(); string str = null; try { IReader reader = ReaderFactory.Open(inputStream, Options.KeepStreamsOpen); while (reader.MoveToNextEntry()) { str = NormalizePath(reader.Entry.FilePath); if (!string.IsNullOrEmpty(str)) { if (reader.Entry.IsDirectory) { local.FindOrCreateNode(str); continue; } if (configurationProfile.Match(Path.GetFileName(str))) { merger.Put(local.FindOrCreateNode(this.GetDirectoryName(str)), Path.GetFileNameWithoutExtension(str), this.LoadYaml(reader)); } } } } catch (Exception exception) { LoggerProvider.GetLogger(this).Fatal("Error read configs " + str, exception); throw; } merger.Merge(); return(local); }
public ActionResult Index() { ConfigurationProfile profile = DAL.Configuration.GetActiveProfile(); if (!profile.AllowRegistration || User.Identity.IsAuthenticated) { return(Redirect("/dashboard")); } return(View(GetRazorView <AreaRegistration>("SignUp/Index.cshtml"))); }
public T Import <T>(string path, ConfigurationProfile configurationProfile) where T : ConfigTreeNode, new() { this.configurationProfile = configurationProfile; this.root = Activator.CreateInstance <T>(); DirectoryInfo directoryInfo = new DirectoryInfo(path); this.rootPath = directoryInfo.FullName; this.CreateConfigTree(directoryInfo, this.configsMerger); this.configsMerger.Merge(); return((T)this.root); }
public ActionResult Index() { if (User.Identity.IsAuthenticated) { return(Redirect("/dashboard")); } ConfigurationProfile profile = DAL.Configuration.GetActiveProfile(); Mapper.CreateMap <ConfigurationProfile, SignIn>(); SignIn model = Mapper.Map <SignIn>(profile); return(View(GetRazorView <AreaRegistration>("SignIn/Index.cshtml"), model)); }
public T Import <T>(Stream inputStream, ConfigurationProfile configurationProfile) where T : ConfigTreeNode, new() { if (inputStream == null) { throw new ArgumentNullException("inputStream"); } if (configurationProfile == null) { throw new ArgumentNullException("configurationProfile"); } using (MemoryStream stream = new MemoryStream()) { this.TransferTo(inputStream, stream); stream.Seek(0L, SeekOrigin.Begin); return(this.ReadToConfigTree <T>(stream, configurationProfile)); } }
public GoogleAuthentication() { ConfigurationProfile profile = DAL.Configuration.GetActiveProfile(); ClientId = profile.GoogleSigninClientId; }
public void NotFoundProfileAbsolutePath() { var temp = new ConfigurationProfile(); temp.LoadProfile(Path.Combine(Path.GetTempPath(), "derp.ini")); }
public void NotFoundProfileRelativePath() { var temp = new ConfigurationProfile(); temp.LoadProfile(@"Phantom"); }
public void IncorrectSchemaAbsolutePath() { var temp = new ConfigurationProfile(); temp.LoadProfile(Path.Combine(Globals.DefaultProfileDirectory, @"CorruptedProfile")); }
public void IncorrectSchemaRelativePath() { var temp = new ConfigurationProfile(); temp.LoadProfile(@"CorruptedProfile"); }
public void CorrectSchemaRelativePath() { var temp = new ConfigurationProfile(); temp.LoadProfile(@"BasicProfile"); }