Esempio n. 1
0
        /// <exception cref="System.ArgumentException" />
        public virtual void ReadFrom(YSection section)
        {
            this.Logger.Trace($"executing {nameof(ProjectItem)}.{nameof(this.ReadFrom)} ({this.Name})...");

            var name = section.GetNodeAsString("Name");

            if (name == this.Name)
            {
                var hint = section.GetNodeAsString("Hint");
                if (!string.IsNullOrEmpty(hint))
                {
                    this.HintPath = new PathString(hint);
                }
            }
            else
            {
                throw new ArgumentException(string.Format(
                                                ErrorMessages.ProjectItem_ReadFrom_DoesNotMatch,
                                                this.Name,
                                                name
                                                ), nameof(section));
            }

            this.Logger.Trace($"completed {nameof(ProjectItem)}.{nameof(this.ReadFrom)} ({this.Name})...");
        }
Esempio n. 2
0
        /// <exception cref="System.ArgumentException" />
        public override void ReadFrom(YSection section)
        {
            base.ReadFrom(section);
            this.Logger.Trace($"executing {nameof(ItemGroup)}.{nameof(this.ReadFrom)} ({this.Name})...");
            var kind = ((FolderKind)(section.GetNodeAsNumber("FolderKind")));

            _         = kind == FolderKind.Invalid && Enum.TryParse(section.GetNodeAsString("FolderKind"), out kind);
            this.Kind = kind;
            this.Logger.Trace($"completed {nameof(ItemGroup)}.{nameof(this.ReadFrom)} ({this.Name})...");
        }
Esempio n. 3
0
        public override void ReadFrom(YSection section)
        {
            base.ReadFrom(section);

            var typeName = section.GetNodeAsString("Type");

            try {
                this.Type = Type.GetType(typeName, true);
            } catch (Exception e) {
                throw new ArgumentException(string.Format(
                                                ErrorMessages.ProjectItem_ReadFrom_InvalidType,
                                                this.Name,
                                                typeName
                                                ), nameof(section), e);
            }
        }