Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            ConfigurationProfile profile = DAL.Configuration.GetActiveProfile();

            if (!profile.AllowRegistration || User.Identity.IsAuthenticated)
            {
                return(Redirect("/dashboard"));
            }

            return(View(GetRazorView <AreaRegistration>("SignUp/Index.cshtml")));
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
 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));
     }
 }
Exemplo n.º 6
0
        public GoogleAuthentication()
        {
            ConfigurationProfile profile = DAL.Configuration.GetActiveProfile();

            ClientId = profile.GoogleSigninClientId;
        }
Exemplo n.º 7
0
        public void NotFoundProfileAbsolutePath()
        {
            var temp = new ConfigurationProfile();

            temp.LoadProfile(Path.Combine(Path.GetTempPath(), "derp.ini"));
        }
Exemplo n.º 8
0
        public void NotFoundProfileRelativePath()
        {
            var temp = new ConfigurationProfile();

            temp.LoadProfile(@"Phantom");
        }
Exemplo n.º 9
0
        public void IncorrectSchemaAbsolutePath()
        {
            var temp = new ConfigurationProfile();

            temp.LoadProfile(Path.Combine(Globals.DefaultProfileDirectory, @"CorruptedProfile"));
        }
Exemplo n.º 10
0
        public void IncorrectSchemaRelativePath()
        {
            var temp = new ConfigurationProfile();

            temp.LoadProfile(@"CorruptedProfile");
        }
Exemplo n.º 11
0
        public void CorrectSchemaRelativePath()
        {
            var temp = new ConfigurationProfile();

            temp.LoadProfile(@"BasicProfile");
        }