Example #1
0
        public bool Parse(Section section)
        {
            Info = section.GetSection(SectionHeaders.MeshInfo).Decode <MeshInfo>();

            var meshData = section.GetSection(SectionHeaders.MeshData);

            Description = meshData.GetSection(SectionHeaders.MeshDescription).Decode <MeshDescription>();
            Vertices    = meshData.GetSection(SectionHeaders.MeshVertices).Decode <MeshVertices>();
            Indices     = meshData.GetSection(SectionHeaders.MeshIndices).Decode <MeshIndices>();

            return(true);
        }
Example #2
0
            public FloatEntry(Section section)
            {
                Verify.Argument.IsNotNull(section, nameof(section));

                _bounds = section.GetValue <Rectangle>("Bounds");
                _root   = ToLayout(section.GetSection("Root"));
            }
Example #3
0
        /// <summary>
        /// Build Configure Starup
        /// </summary>
        public void BuildConfigureStartup()
        {
            IConfigurationSection startupSection = Section.GetSection("startups");
            object obj = null;
            IConfigurationStartup cs = null;

            foreach (var section in startupSection.GetChildren())
            {
                var assemlySection = section.GetSection("assemly");
                var typeSection    = section.GetSection("type");
                var pathSection    = section.GetSection("path");
                if (assemlySection == null && assemlySection.Value == null && pathSection == null)
                {
                    continue;
                }
                else if ((assemlySection == null || assemlySection.Value == null) && pathSection != null && pathSection.Value != null)
                {
                    cs = new ConfigurationStartup(pathSection.Value);
                }
                else
                {
                    var ass  = System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromAssemblyPath(assemlySection.Value);
                    var type = ass.GetType(typeSection.Value);
                    obj = System.Activator.CreateInstance(type);
                }
                if (obj is IConfigurationStartup)
                {
                    cs = obj as IConfigurationStartup;
                }
                else if (obj is IConfigurationSectionStartup)
                {
                    cs         = obj as IConfigurationSectionStartup;
                    cs.Parent  = this;
                    cs.Section = Section.GetSection(section.GetSection("section").Value);
                }
                var prioritySection = section.GetSection("priority");
                if (prioritySection == null)
                {
                    cs.Priority = 1000;
                }
                else
                {
                    cs.Priority = Convert.ToInt32(prioritySection.Value);
                }
                cs.Original = this;
                //cs.BuildConfigureStartup();
                //if (Manager.Startups.ContainsKey(cs.UnionCode))
                //{
                //    Manager.Startups[cs.UnionCode] = cs;
                //}
                //else
                //{
                //    Manager.Startups.Add(cs.UnionCode, cs);
                //}
            }
        }
Example #4
0
            public SplitEntry(Section section)
                : this()
            {
                Verify.Argument.IsNotNull(section, nameof(section));

                _orientation = section.GetValue <Orientation>("Orientation");
                var splitters = section.GetSection("Splitters");

                foreach (var s in splitters.Parameters)
                {
                    _splitters.Add((double)s.Value);
                }
                var cells = section.GetSection("Cells");

                foreach (var c in cells.Sections)
                {
                    _cells.Add(ToLayout(c));
                }
            }
Example #5
0
        public bool Parse(Section section)
        {
            var header = section.GetSection(SectionHeaders.ArchiveHeader);

            Details     = header.GetSection(SectionHeaders.ArchiveDetails).Decode <ArchiveDetails>();
            List        = header.GetSection(SectionHeaders.FileList).Decode <FileList>();
            LookupTable = header.GetSection(SectionHeaders.FileDictionary).Decode <FileDictionary>();

            _data = section.Data;

            return(true);
        }
Example #6
0
            public HostEntry(Section section)
                : this()
            {
                Verify.Argument.IsNotNull(section, nameof(section));

                _isRoot         = section.GetValue <bool>("IsRoot");
                _isDocumentWell = section.GetValue <bool>("IsDocumentHost");
                var tools = section.GetSection("Views");

                foreach (var t in tools.Sections)
                {
                    _views.Add(new ViewEntry(t));
                }
            }
Example #7
0
        /// <summary>
        /// 初始化Appsetting配置
        /// </summary>
        public void BuildAppsetting()
        {
            var aps = Section.GetSection("appsettings");

            foreach (ConfigurationSection cs in aps.GetChildren())
            {
                if ("viewrootpath".Equals(cs.Key, StringComparison.OrdinalIgnoreCase))
                {
                    AppSetting.AppSettings[cs.Key] = cs.Value.Replace("~", AppSetting.AppSettings.Get <string>("hostdir"));
                }
                else
                {
                    AppSetting.AppSettings[cs.Key] = cs.Value;
                }
            }
        }
Example #8
0
        public void BuildMiddleware()
        {
            var  middles = Section.GetSection("Middlewares");
            Type type    = null;

            foreach (ConfigurationSection cs in middles.GetChildren())
            {
                var    values     = cs.Value.Split(';');
                string assemlyDll = values[0].Replace("~", AppSetting.AppSettings["hostdir"].ToString());

                var assemly = AssemblyLoadContext.Default.LoadFromAssemblyPath(assemlyDll);
                if (assemly != null)
                {
                    type = assemly.GetType(values[1]);
                    Phyah.Web.BehaviorFactory.Factory.Cache(type);
                }
            }
        }
Example #9
0
        public ConfigurationStartup(string configpath)
        {
            m_ConfigurePath = configpath;
            var cb = new ConfigurationBuilder();

            Section   = cb.AddJsonFile(ConfigurePath, true, true).Build();
            UnionCode = Section.GetSection("unioncode").Value;
            Manager.Startups.Add(this.UnionCode, this);
            if (Manager.Startups.ContainsKey(this.UnionCode))
            {
                Manager.Startups[this.UnionCode] = this;
            }
            else
            {
                Manager.Startups.Add(this.UnionCode, this);
            }
            BuildConfigureStartup();
        }
Example #10
0
        public ConfigurationStartup()
        {
            var cb = new ConfigurationBuilder();

            Section   = cb.AddJsonFile(ConfigurePath, true, true).Build();
            UnionCode = Section.GetSection("unioncode").Value;
            if (!string.IsNullOrWhiteSpace(UnionCode))
            {
                if (Manager.Startups.ContainsKey(this.UnionCode))
                {
                    Manager.Startups[this.UnionCode] = this;
                }
                else
                {
                    Manager.Startups.Add(this.UnionCode, this);
                }
                BuildConfigureStartup();
            }
        }
Example #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ViewLayout"/> class.
        /// </summary>
        /// <param name="section">The section.</param>
        public ViewLayout(Section section)
        {
            Verify.Argument.IsNotNull(section, nameof(section));

            _root = ToLayout(section.GetSection("Root"));

            var sides = section.TryGetSection("Sides");

            if (sides != null)
            {
                var left = sides.TryGetSection("Left");
                if (left != null)
                {
                    _left = new SideEntry(AnchorStyles.Left, left);
                }
                var top = sides.TryGetSection("Top");
                if (top != null)
                {
                    _top = new SideEntry(AnchorStyles.Top, top);
                }
                var right = sides.TryGetSection("Right");
                if (right != null)
                {
                    _right = new SideEntry(AnchorStyles.Right, right);
                }
                var bottom = sides.TryGetSection("Bottom");
                if (bottom != null)
                {
                    _bottom = new SideEntry(AnchorStyles.Bottom, bottom);
                }
            }
            var floats = section.TryGetSection("Floats");

            if (floats != null)
            {
                foreach (var f in floats.Sections)
                {
                    _floats.Add(new FloatEntry(f));
                }
            }
        }
Example #12
0
            public SplitEntry(Section section)
                : this()
            {
                Verify.Argument.IsNotNull(section, "section");

                _orientation = section.GetValue<Orientation>("Orientation");
                var splitters = section.GetSection("Splitters");
                foreach(var s in splitters.Parameters)
                {
                    _splitters.Add((double)s.Value);
                }
                var cells = section.GetSection("Cells");
                foreach(var c in cells.Sections)
                {
                    _cells.Add(ToLayout(c));
                }
            }
Example #13
0
 public static ITwitter Create()
 {
     return(Create(Section.GetSection()));
 }
Example #14
0
 public IAuthCredentials Get()
 {
     return(Section.GetSection().Auth);
 }
Example #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ViewLayout"/> class.
        /// </summary>
        /// <param name="section">The section.</param>
        public ViewLayout(Section section)
        {
            Verify.Argument.IsNotNull(section, "section");

            _root = ToLayout(section.GetSection("Root"));

            var sides = section.TryGetSection("Sides");
            if(sides != null)
            {
                var left = sides.TryGetSection("Left");
                if(left != null)
                {
                    _left = new SideEntry(AnchorStyles.Left, left);
                }
                var top = sides.TryGetSection("Top");
                if(top != null)
                {
                    _top = new SideEntry(AnchorStyles.Top, top);
                }
                var right = sides.TryGetSection("Right");
                if(right != null)
                {
                    _right = new SideEntry(AnchorStyles.Right, right);
                }
                var bottom = sides.TryGetSection("Bottom");
                if(bottom != null)
                {
                    _bottom = new SideEntry(AnchorStyles.Bottom, bottom);
                }
            }
            var floats = section.TryGetSection("Floats");
            if(floats != null)
            {
                foreach(var f in floats.Sections)
                {
                    _floats.Add(new FloatEntry(f));
                }
            }
        }
Example #16
0
            public HostEntry(Section section)
                : this()
            {
                Verify.Argument.IsNotNull(section, "section");

                _isRoot = section.GetValue<bool>("IsRoot");
                _isDocumentWell = section.GetValue<bool>("IsDocumentHost");
                var tools = section.GetSection("Views");
                foreach(var t in tools.Sections)
                {
                    _views.Add(new ViewEntry(t));
                }
            }
Example #17
0
            public FloatEntry(Section section)
            {
                Verify.Argument.IsNotNull(section, "section");

                _bounds = section.GetValue<Rectangle>("Bounds");
                _root = ToLayout(section.GetSection("Root"));
            }