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

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

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

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

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

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

            temp.LoadProfile(@"BasicProfile");
        }