Esempio 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);
        }
Esempio 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")));
        }
Esempio 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);
        }
Esempio 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));
        }
Esempio 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));
     }
 }
Esempio n. 6
0
        public GoogleAuthentication()
        {
            ConfigurationProfile profile = DAL.Configuration.GetActiveProfile();

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

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

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

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

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

            temp.LoadProfile(@"BasicProfile");
        }