/// <summary>
        /// The add section to user group.
        /// </summary>
        /// <param name="formulateSection">
        /// The formulate section.
        /// </param>
        /// <param name="userGroup">
        /// The user group.
        /// </param>
        private void AddSectionToUserGroup(ISection formulateSection, IUserGroup userGroup)
        {
            if (userGroup == null)
            {
                Logger.Warn <HandleInstallAndUpgradeComponent>(
                    $"Skipping permit access. No user group was found.");
                return;
            }

            if (userGroup.AllowedSections.Contains(formulateSection.Alias))
            {
                Logger.Info <HandleInstallAndUpgradeComponent>(
                    $"Skipping permit access. {formulateSection.Name} Section already exists on User Group, {userGroup.Name}.");
                return;
            }

            try
            {
                userGroup.AddAllowedSection(formulateSection.Alias);
                UserService.Save(userGroup);

                Logger.Info <HandleInstallAndUpgradeComponent>(
                    $"Successfully added {formulateSection.Name} Section to User Group, {userGroup.Name}.");
            }
            catch (Exception ex)
            {
                Logger.Error <HandleInstallAndUpgradeComponent>(ex, $"Error adding {formulateSection.Name} Section to User Group, {userGroup.Name}.");
            }
        }
Esempio n. 2
0
        public void SetUp()
        {
            var leftNode  = new Mock <INode>();
            var rightNode = new Mock <INode>();
            var material  = new Mock <IMaterial>();
            var section   = new Mock <ISection>();

            section.Setup(s => s.Area).Returns(3);
            section.Setup(s => s.MomentOfInteria).Returns(11);
            material.Setup(m => m.YoungModulus).Returns(5);
            material.Setup(m => m.Density).Returns(7);
            leftNode.Setup(ln => ln.HorizontalMovementNumber).Returns(0);
            leftNode.Setup(ln => ln.VerticalMovementNumber).Returns(1);
            leftNode.Setup(ln => ln.LeftRotationNumber).Returns(2);
            leftNode.Setup(ln => ln.RightRotationNumber).Returns(3);
            leftNode.Setup(ln => ln.ConcentratedForces).Returns(new List <INodeLoad>());
            rightNode.Setup(rn => rn.HorizontalMovementNumber).Returns(4);
            rightNode.Setup(rn => rn.VerticalMovementNumber).Returns(5);
            rightNode.Setup(rn => rn.LeftRotationNumber).Returns(6);
            rightNode.Setup(rn => rn.RightRotationNumber).Returns(7);
            rightNode.Setup(rn => rn.ConcentratedForces).Returns(new List <INodeLoad>());

            _leftNode  = leftNode.Object;
            _rightNode = rightNode.Object;
            _material  = material.Object;
            _section   = section.Object;
        }
Esempio n. 3
0
        /// <summary>
        /// To write a single section with rules from handlers.
        /// </summary>
        /// <param name="section"></param>
        public void Write(ISection section)
        {
            if (section == null)
            {
                throw new ArgumentNullException();
            }

            if (section.Ignore)
            {
                return;
            }

            if (section.Handler == null)
            {
                Write(section.Raw.data);
                return;
            }

            var tid = section.Handler.GetType();

            Write
            (
                (Handlers.ContainsKey(tid) && Handlers[tid].handler != null) ?
                Handlers[tid].handler.Extract(Handlers[tid].value)
                    : section.Raw.data
            );
        }
Esempio n. 4
0
        public override void Read(EndianBinaryReader reader, ISection section = null)
        {
            reader.PushBaseOffset();

            int signature = reader.ReadInt32();

            if (signature != 0x03505854)
            {
                reader.Endianness = Endianness = Endianness.BigEndian;
                signature         = EndiannessSwapUtilities.Swap(signature);
            }

            if (signature != 0x03505854)
            {
                throw new InvalidDataException("Invalid signature (expected TXP with type 3)");
            }

            int textureCount            = reader.ReadInt32();
            int textureCountWithRubbish = reader.ReadInt32();

            Textures.Capacity = textureCount;
            for (int i = 0; i < textureCount; i++)
            {
                reader.ReadOffset(() => { Textures.Add(new Texture(reader)); });
            }

            reader.PopBaseOffset();
        }
Esempio n. 5
0
        public void ShapeFactoryReturnsValueForAngleParsed()
        {
            AiscShapeFactory factory = new AiscShapeFactory();
            ISection         section = factory.GetShape("L3-1/2X3X1/4");

            Assert.IsTrue(section is ISectionAngle);
        }
Esempio n. 6
0
 public override void Write(EndianBinaryWriter writer, ISection section = null)
 {
     foreach (var str in Strings)
     {
         writer.AddStringToStringTable(str);
     }
 }
Esempio n. 7
0
        public void ShapeFactoryReturnsValueForUnequalAngle()
        {
            AiscShapeFactory factory = new AiscShapeFactory();
            ISection         section = factory.GetShape("L3-1/2X3X1/4", Entities.ShapeTypeSteel.Angle);

            Assert.IsTrue(section != null);
        }
Esempio n. 8
0
        public void ShapeFactoryReturnsValueForCircHSSParsed()
        {
            AiscShapeFactory factory = new AiscShapeFactory();
            ISection         section = factory.GetShape("HSS6X.500");

            Assert.IsTrue(section is ISectionPipe);
        }
Esempio n. 9
0
        private static void AddBaseType(IList <byte> d, TypeSpec ts, IBinaryFile of, ISection os, ref ulong offset, Target t,
                                        TysilaState s)
        {
            if (ts.other != null && ts.stype != TypeSpec.SpecialType.Boxed)
            {
                var bt = ts.other.Box;

                var ext_reloc = of.CreateRelocation();
                ext_reloc.Addend    = 0;
                ext_reloc.DefinedIn = os;
                ext_reloc.Offset    = offset;
                ext_reloc.Type      = t.GetDataToDataReloc();

                var ext_sym = of.CreateSymbol();
                ext_sym.Name = bt.MangleType();

                ext_reloc.References = ext_sym;
                of.AddRelocation(ext_reloc);

                s.r.VTableRequestor.Request(bt);
            }
            for (int i = 0; i < t.GetPointerSize(); i++, offset++)
            {
                d.Add(0);
            }
        }
Esempio n. 10
0
        public void ShapeFactoryReturnsValueForIBeam()
        {
            AiscShapeFactory factory = new AiscShapeFactory();
            ISection         section = factory.GetShape("W18X35", Entities.ShapeTypeSteel.IShapeRolled);

            Assert.IsTrue(section != null);
        }
        public override void Write(EndianBinaryWriter writer, ISection section = null)
        {
            writer.Write(1);
            writer.ScheduleWriteOffset(16, AlignmentMode.Left, () =>
            {
                foreach (var motionSetEntry in MotionSets)
                {
                    bool first = motionSetEntry == MotionSets[0];
                    bool last  = motionSetEntry == MotionSets[MotionSets.Count - 1];

                    motionSetEntry.Write(writer, first, last);
                }

                writer.WriteNulls(16);
            });
            writer.ScheduleWriteOffset(16, AlignmentMode.Left, () =>
            {
                foreach (var motionSetEntry in MotionSets)
                {
                    writer.Write(motionSetEntry.Id);
                }
            });
            writer.Write(MotionSets.Count);
            writer.ScheduleWriteOffset(16, AlignmentMode.Center, () =>
            {
                foreach (string boneName in BoneNames)
                {
                    writer.AddStringToStringTable(boneName);
                }
            });
            writer.Write(BoneNames.Count);
            writer.WriteAlignmentPadding(64);
        }
Esempio n. 12
0
        public override void Read(EndianBinaryReader reader, ISection section = null)
        {
            var paramReader = new ParameterReader(reader);

            while (paramReader.Read())
            {
                switch (paramReader.HeadToken)
                {
                case "scale":
                    Scale = paramReader.ReadSingle();
                    break;

                case "cycle":
                    Cycle = paramReader.ReadSingle();
                    break;

                case "rot":
                    Rotation = paramReader.ReadVector2();
                    break;

                case "bias":
                    Bias = paramReader.ReadSingle();
                    break;

                case "spc":
                    Spc[paramReader.ReadInt32()] = paramReader.ReadVector2();
                    break;
                }
            }
        }
Esempio n. 13
0
        public override void Write(EndianBinaryWriter writer, ISection section = null)
        {
            // Update the format if needed for future parsing
            if (!ScriptUtilities.GetScriptFormats(Format).Contains(ScriptFormat))
            {
                ScriptFormat = ScriptUtilities.GetDefaultScriptFormat(Format);
            }

            bool modern = BinaryFormatUtilities.IsModern(Format);

            if (modern)
            {
                // TODO: write header
                throw new NotImplementedException();
            }
            else
            {
                writer.Write(ScriptFormat);
            }

            WriteCommands(writer);

            if (modern)
            {
                // TODO: write EOFC
                throw new NotImplementedException();
            }
        }
Esempio n. 14
0
        private ISection GetSectionElementForMember(Theme theme, object view, MemberInfo member, List <Binding> bindings)
        {
            var      caption       = GetCaption(member);
            Type     memberType    = GetTypeForMember(member);
            ISection section       = null;
            var      isMultiselect = member.GetCustomAttribute <MultiSelectionAttribute>() != null;
            var      isSelect      = member.GetCustomAttribute <SelectionAttribute>() != null;

            if (memberType.IsEnum)
            {
                SetDefaultConverter(view, member, "DataContext", new EnumConverter(), memberType, bindings);

                var pop = member.GetCustomAttribute <PopOnSelectionAttribute>() != null;

                var currentValue = member.GetValue(view);
                var enumValues   = Enum.GetValues(memberType);

                section = CreateEnumSection(theme, member, enumValues, currentValue, pop, bindings);
            }
            else if (typeof(EnumCollection).IsAssignableFrom(memberType))
            {
                section = CreateEnumCollectionSection(member, caption, view, bindings);
            }
            else if (isMultiselect)
            {
                section = CreateMultiselectCollectionSection(member, caption, view, bindings);
            }
            else if (isSelect)
            {
                section = CreateSelectCollectionSection(member, caption, view, bindings);
            }

            return(section);
        }
Esempio n. 15
0
        public override void Write(EndianBinaryWriter writer, ISection section = null)
        {
            writer.Write(AetSets.Count);
            writer.ScheduleWriteOffset(16, AlignmentMode.Left, () =>
            {
                for (int i = 0; i < AetSets.Count; i++)
                {
                    var aetSetInfo = AetSets[i];
                    writer.Write(aetSetInfo.Id);
                    writer.AddStringToStringTable(aetSetInfo.Name);
                    writer.AddStringToStringTable(aetSetInfo.FileName);
                    writer.Write(i);
                    writer.Write(aetSetInfo.SpriteSetId);
                }
            });
            writer.Write(AetSets.Sum(x => x.Aets.Count));
            writer.ScheduleWriteOffset(16, AlignmentMode.Left, () =>
            {
                for (int i = 0; i < AetSets.Count; i++)
                {
                    var aetSetInfo = AetSets[i];

                    foreach (var aetInfo in aetSetInfo.Aets)
                    {
                        writer.Write(aetInfo.Id);
                        writer.AddStringToStringTable(aetInfo.Name);
                        writer.Write((i << 16) | aetInfo.Index);
                    }
                }
            });
        }
Esempio n. 16
0
        private static void ParseIni(IObject iniObj, TextReader textReader)
        {
            if (iniObj == null)
            {
                throw new ArgumentNullException("iniObj");
            }

            if (textReader == null)
            {
                throw new ArgumentNullException("textReader");
            }

            ISection tempSection = null;

            while (textReader.Peek() != -1)
            {
                string line = textReader.ReadLine();
                if (string.IsNullOrEmpty(line) == false && Regices[2].IsMatch(line) == false)
                {
                    Match match = Regices[0].Match(line);
                    if (match.Success)
                    {
                        tempSection = new ISection(match.Groups[1].Value);
                        iniObj.Add(tempSection);
                        continue;
                    }

                    match = Regices[1].Match(line);
                    if (match.Success)
                    {
                        tempSection.Add(match.Groups[1].Value.Trim(), match.Groups[2].Value);
                    }
                }
            }
        }
Esempio n. 17
0
        public override void Read(EndianBinaryReader reader, ISection section = null)
        {
            uint signature           = reader.ReadUInt32();
            int  skeletonCount       = reader.ReadInt32();
            long skeletonsOffset     = reader.ReadOffset();
            long skeletonNamesOffset = reader.ReadOffset();

            reader.ReadAtOffset(skeletonsOffset, () =>
            {
                Skeletons.Capacity = skeletonCount;
                for (int i = 0; i < skeletonCount; i++)
                {
                    reader.ReadAtOffset(reader.ReadUInt32(), () =>
                    {
                        var skeletonEntry = new SkeletonEntry();
                        skeletonEntry.Read(reader);
                        Skeletons.Add(skeletonEntry);
                    });
                }
            });

            reader.ReadAtOffset(skeletonNamesOffset, () =>
            {
                foreach (var skeletonEntry in Skeletons)
                {
                    skeletonEntry.Name = reader.ReadStringOffset(StringBinaryFormat.NullTerminated);
                }
            });
        }
Esempio n. 18
0
        /// <summary>
        /// Writes the response entry.
        /// </summary>
        /// <param name="responseHeaderId">The response header id.</param>
        /// <param name="section">The section.</param>
        /// <param name="question">The question.</param>
        /// <param name="answer">The answer.</param>
        /// <param name="responseText">The response text.</param>
        private void WriteResponseEntry(int responseHeaderId, ISection section, IQuestion question, IAnswer answer, string responseText)
        {
            var surveyRepository = new SurveyRepository();
            var response         = surveyRepository.CreateResponse(responseHeaderId, 1);

            response.SurveyId              = this.SurveyId;
            response.SurveyText            = this.Text;
            response.ShowSurveyText        = this.ShowText;
            response.TitleOption           = this.TitleOption;
            response.SectionText           = section.Text;
            response.SectionRelativeOrder  = section.RelativeOrder;
            response.ShowSectionText       = false;
            response.SectionId             = section.SectionId;
            response.SectionRelativeOrder  = section.RelativeOrder;
            response.SectionFormatOption   = this.SectionFormatOption;
            response.QuestionId            = question.QuestionId;
            response.QuestionText          = question.Text;
            response.QuestionRelativeOrder = question.RelativeOrder;
            response.QuestionFormatOption  = this.QuestionFormatOption;
            response.ControlType           = question.ControlType;
            if (answer != null)
            {
                response.AnswerId            = answer.AnswerId;
                response.AnswerText          = answer.Text;
                response.AnswerRelativeOrder = answer.RelativeOrder;
                response.AnswerIsCorrect     = answer.IsCorrect;
            }

            response.UserResponse = responseText;

            surveyRepository.SubmitChanges();

            Debug.WriteLine(response.ResponseId);
        }
        internal CatalogSection(string ShapeId, string AngleOrientation = "LongLegVertical", string AngleRotation = "FlatLegTop")
        {
            AiscShapeFactory factory = new AiscShapeFactory();
            AngleOrientation ori     = new AngleOrientation();
            AngleRotation    rot     = new Kodestruct.Common.AngleRotation();

            ShapeId = ShapeId.ToUpper();

            AngleOrientation _AngleOrientation;
            bool             IsValidInputString = Enum.TryParse(AngleOrientation, true, out _AngleOrientation);

            if (IsValidInputString == false)
            {
                throw new Exception("Failed to convert string. Specifuy AngleOrientation. Please check input");
            }


            AngleRotation _AngleRotation;
            bool          IsValidInputRotation = Enum.TryParse(AngleRotation, true, out _AngleRotation);

            if (IsValidInputRotation == false)
            {
                throw new Exception("Failed to convert string. Errormessage. Please check input");
            }


            ISection section = factory.GetShape(ShapeId, _AngleOrientation, _AngleRotation);

            //PredefinedSectionI catI = section as PredefinedSectionI;
            //ISliceableSection secI = new shapes.SectionIRolled("", catI.d, catI.b_fTop, catI.t_f, catI.t_w, catI.k);
            //Section = secI;
            Section = section;
        }
 public override void Write(EndianBinaryWriter writer, ISection section = null)
 {
     writer.Write(Objects.Count);
     writer.Write(Unknown);
     writer.ScheduleWriteOffset(16, AlignmentMode.Left, () =>
     {
         foreach (var objectEntry in Objects)
         {
             writer.AddStringToStringTable(objectEntry.Name);
             writer.Write(objectEntry.Id);
             writer.WriteNulls(2);
             writer.AddStringToStringTable(objectEntry.FileName);
             writer.AddStringToStringTable(objectEntry.TextureFileName);
             writer.AddStringToStringTable(objectEntry.ArchiveFileName);
             writer.WriteNulls(16);
         }
     });
     writer.Write(Objects.Sum(x => x.Meshes.Count));
     writer.ScheduleWriteOffset(16, AlignmentMode.Left, () =>
     {
         foreach (var objectEntry in Objects)
         {
             foreach (var meshEntry in objectEntry.Meshes)
             {
                 writer.Write(meshEntry.Id);
                 writer.Write(objectEntry.Id);
                 writer.AddStringToStringTable(meshEntry.Name);
             }
         }
     });
 }
Esempio n. 21
0
 public override void Write(EndianBinaryWriter writer, ISection section = null)
 {
     writer.Write(Stages.Count);
     writer.ScheduleWriteOffset(16, AlignmentMode.Left, () =>
     {
         foreach (var stageEntry in Stages)
         {
             stageEntry.WriteFirst(writer, Format);
         }
     });
     writer.ScheduleWriteOffset(16, AlignmentMode.Left, () =>
     {
         foreach (var stageEntry in Stages)
         {
             stageEntry.WriteSecond(writer);
         }
     });
     writer.ScheduleWriteOffset(16, AlignmentMode.Left, () =>
     {
         foreach (var stageEntry in Stages)
         {
             stageEntry.WriteThird(writer);
         }
     });
     writer.ScheduleWriteOffset(16, AlignmentMode.Left, () =>
     {
         for (int i = 0; i < Stages.Count; i++)
         {
             writer.Write(i);
             Stages[i].WriteFourth(writer);
         }
     });
 }
Esempio n. 22
0
        public override void Read(EndianBinaryReader reader, ISection section = null)
        {
            var offsets = new List <long>();

            // Try to determine endianness (apparently DT uses big endian string arrays)
            uint stringOffset = reader.ReadUInt32();

            if (stringOffset >= reader.Length)
            {
                reader.Endianness = Endianness.BigEndian;
                stringOffset      = EndiannessSwapUtilities.Swap(stringOffset);
            }

            Endianness = reader.Endianness;

            do
            {
                offsets.Add(stringOffset);
                stringOffset = reader.ReadUInt32();
            } while (reader.Position < offsets[0] && stringOffset != 0);

            foreach (var offset in offsets)
            {
                reader.SeekBegin(offset);
                Strings.Add(reader.ReadString(StringBinaryFormat.NullTerminated));
            }
        }
Esempio n. 23
0
        bool IELF.TryGetSection(int index, out ISection section)
        {
            var result = TryGetSection(index, out Section <T> sectionConcrete);

            section = sectionConcrete;
            return(result);
        }
Esempio n. 24
0
        /// <summary>
        /// Set time with <see cref="ISection" /> value.
        /// </summary>
        /// <param name="value">Value for the specified time section.</param>
        /// <returns><see cref="ICron" /></returns>
        /// <inheritdoc cref="ICron" />
        public ICron Set(ISection value)
        {
            GetFieldInfo(value.Time)
            .SetValue(this, value, null);

            return(this);
        }
Esempio n. 25
0
        public static void Setup()
        {
            ScoringSections.Clear();

            // Get all types in the executing assembly (Scoring Report)
            Type[] allTypes = Assembly.GetExecutingAssembly().GetTypes();

            foreach (Type type in allTypes)
            {
                // Some types for some reason do not have namespaces, skip
                if (type.Namespace == null)
                {
                    continue;
                }

                // Filter to parent namespace "Scoring_Report.Scoring.Sections"
                if (type.Namespace.StartsWith("Scoring_Report.Scoring.Sections"))
                {
                    // Filter to types with child interface ISection
                    if (type.GetInterfaces().Contains(typeof(ISection)))
                    {
                        // Create instance
                        ISection instance = Activator.CreateInstance(type) as ISection;

                        // Add to list
                        ScoringSections.Add(instance);
                    }
                }
            }

            // Sort in order of integer value of enumerator 'Type'
            ScoringSections.Sort((x, y) => (x.Type.CompareTo(y.Type)));
        }
Esempio n. 26
0
        bool IELF.TryGetSection(string name, out ISection section)
        {
            var result = TryGetSection(name, out Section <T> concreteSection);

            section = concreteSection;
            return(result);
        }
Esempio n. 27
0
        internal static IAssemblyReferenceEntry[] GetDependentAssemblies(ActivationContext activationContext)
        {
            IAssemblyReferenceEntry[] entries = null;
            ICMS appManifest = activationContext.ApplicationComponentManifest;

            if (appManifest == null)
            {
                return(null);
            }

            ISection dependencySection = appManifest.AssemblyReferenceSection;
            uint     count             = (dependencySection != null) ? dependencySection.Count : 0;

            if (count > 0)
            {
                uint fetched = 0;
                entries = new IAssemblyReferenceEntry[count];
                IEnumUnknown dependencyEnum = (IEnumUnknown)dependencySection._NewEnum;
                int          hr             = dependencyEnum.Next(count, entries, ref fetched);
                if (fetched != count || hr < 0)
                {
                    return(null); //
                }
            }
            return(entries);
        }
Esempio n. 28
0
        /// <summary>
        /// Get the compilers used to create an ELF binary.
        /// </summary>
        /// <param name="elf">ELF binary</param>
        /// <returns>List of compiler tools from the .comment section</returns>
        internal static ELFCompiler[] GetELFCompilers(IELF elf)
        {
            ISection commentSection = elf.Sections.Where(s => s.Name == ".comment").FirstOrDefault();

            if (commentSection != null)
            {
                try
                {
                    string[] commentData = NullTermAsciiToStrings(commentSection.GetContents());
                    var      compilers   = new ELFCompiler[commentData.Length];
                    for (int i = 0; i < commentData.Length; i++)
                    {
                        compilers[i] = new ELFCompiler(commentData[i]);
                    }
                    return(compilers);
                }
                // Catch cases when the .comment section is not formatted the way we expect it to be.
                catch (Exception ex) when(ex is ArgumentException || ex is ArgumentNullException)
                {
                    return(new ELFCompiler[] { new ELFCompiler(string.Empty) });
                }
            }
            else
            {
                return(new ELFCompiler[] { new ELFCompiler(string.Empty) });
            }
        }
Esempio n. 29
0
 private static ISection CreateExpressionSection <T>(ISection section, string value) =>
 section.SectionType == CronSectionType.Time
         ? (ISection)
 new TimeSection <T>(section.Time,
                     value)
         : new DateSection <T>(section.Time,
                               value);
        // Token: 0x06004FF4 RID: 20468 RVA: 0x00119534 File Offset: 0x00117734
        internal static IAssemblyReferenceEntry[] GetDependentAssemblies(ActivationContext activationContext)
        {
            IAssemblyReferenceEntry[] array   = null;
            ICMS applicationComponentManifest = activationContext.ApplicationComponentManifest;

            if (applicationComponentManifest == null)
            {
                return(null);
            }
            ISection assemblyReferenceSection = applicationComponentManifest.AssemblyReferenceSection;
            uint     num = (assemblyReferenceSection != null) ? assemblyReferenceSection.Count : 0U;

            if (num > 0U)
            {
                uint num2 = 0U;
                array = new IAssemblyReferenceEntry[num];
                IEnumUnknown enumUnknown = (IEnumUnknown)assemblyReferenceSection._NewEnum;
                int          num3        = enumUnknown.Next(num, array, ref num2);
                if (num2 != num || num3 < 0)
                {
                    return(null);
                }
            }
            return(array);
        }
Esempio n. 31
0
 public PredefinedSectionCHS(
 double D,
 double t,ISection section): base(section)
 {
     this._D = D;
     this._t=t;
     this._t_des = t_des;
 }
Esempio n. 32
0
 public SectionRangeToken(ILocation location, ISection section, int idx, int length, TokenEnum code)
 {
     _location = location;
     _code = code;
     _section = section;
     _idx = idx;
     _length = length;
 }
 public AffectedElementInFlexure(ISection section, double F_y, double F_u, bool HasHolesInTensionFlange, double A_fg, double A_fn, bool IsCompactDoublySymmetricForFlexure,  bool IsRolled=false)
     : base(F_y, F_u)
 {
     SteelMaterial material = new SteelMaterial(F_y, F_u, SteelConstants.ModulusOfElasticity, SteelConstants.ShearModulus);
     this.Section = new SteelGeneralSection(section, material);
     this.A_fg = A_fg;
     this.A_fn = A_fn;
     this.HasHolesInTensionFlange = HasHolesInTensionFlange;
     this.IsCompactDoublySymmetricForFlexure = IsCompactDoublySymmetricForFlexure;
     this.IsRolled=IsRolled;
 }
Esempio n. 34
0
		/// <summary>
		/// Tries to get the section with the name <paramref name="sectionName"/> from this template.
		/// </summary>
		/// <param name="context">The <see cref="IMansionContext"/>.</param>
		/// <param name="sectionName">The name of the section.</param>
		/// <param name="section">The section when found.</param>
		/// <returns>Returns true when the section was found, otherwise false.</returns>
		public bool TryGet(IMansionContext context, string sectionName, out ISection section)
		{
			// validate arguments
			if (context == null)
				throw new ArgumentNullException("context");
			if (string.IsNullOrEmpty(sectionName))
				throw new ArgumentNullException("sectionName");

			// get the section
			section = sections.SingleOrDefault(candidate => sectionName.Equals(candidate.Name, StringComparison.OrdinalIgnoreCase));
			return section != null;
		}
Esempio n. 35
0
        //TODO: Unit test all this!!! :/

        public static bool AuthorizeAccess(ISection dashboardSection, IUser user, ISectionService sectionService)
        {
            if (user.Id.ToString() == 0.ToInvariantString())
            {
                return true;
            }

            var denyTypes = dashboardSection.AccessRights.Rules.Where(x => x.Action == AccessType.Deny).ToArray();
            var grantedTypes = dashboardSection.AccessRights.Rules.Where(x => x.Action == AccessType.Grant).ToArray();
            var grantedBySectionTypes = dashboardSection.AccessRights.Rules.Where(x => x.Action == AccessType.GrantBySection).ToArray();

            return CheckUserAccessByRules(user, sectionService, denyTypes, grantedTypes, grantedBySectionTypes);
        }
Esempio n. 36
0
	//	[EnableSearch(true, IncrementalSearch = false)]
		public List<ISection> Search(ISection[] sections, string searchText)
		{
			var result = new List<ISection>();

			foreach(var section in sections)
				foreach(var element in section.Elements)
			{
				if (element.Caption.Contains(searchText))
					result.Add(new Section() { element });		
			}

			return result;
		}
Esempio n. 37
0
        public SectionViewModel(ISection section)
        {
            if (section == null)
                return;

            _section = section;

            if (section.Notes == null)
                return;

            _notes = new ObservableCollection<NoteViewModel>(
                section.Notes.Select(note => new NoteViewModel(note)).ToList()
                );
        }
Esempio n. 38
0
		public List<ISection> Execute(ISection[] sections, string searchText)
		{
			List<ISection> result = null;
			
			try
			{
				if (_Execute.GetParameters().Any())
					result = _Execute.Invoke(_ViewModel, new object[] { sections, searchText }) as List<ISection>;
			}
			catch(Exception ex) 
			{
				throw new Exception(string.Format("{0} in {2}", ex.Message,_Execute.Name));
			}

			return result;
		}
Esempio n. 39
0
 public SectionPredefinedBase(ISection sec)
 {
    this.A                  = sec.A                        ;
    this._I_x      = sec.I_x            ;
    this._I_y      = sec.I_y            ;
    this._S_x_Top    = sec.S_xTop         ;
    this._S_xBot    = sec.S_xBot          ;
    this._S_yLeft   = sec.S_yLeft         ;
    this._S_yRight  = sec.S_yRight        ;
    this._Z_x= sec.Z_x      ;
    this._Z_y= sec.Z_y      ;
    this._r_x     = sec.r_x           ;
    this._r_y     = sec.r_y           ;
    this.elasticCentroidCoordinate.X = sec.x_Bar;
    this.elasticCentroidCoordinate.Y = sec.y_Bar;
    this.plasticCentroidCoordinate.X     = sec.x_pBar           ;
    this.plasticCentroidCoordinate.Y    = sec.y_pBar         ;
    this._C_w       = sec.C_w             ;
    this._J     = sec.J           ;
 }
Esempio n. 40
0
 public static void RenderViewSection(this HtmlHelper html, ISection section, Action<Exception> handleException = null)
 {
     IEnumerable<ISlot> items =
         section.Slots.Where(x => x.SectionSlotInfo.Enabled)
         .OrderBy(x => x.SectionSlotInfo.Ordinal)
         .ToList();
     if (!items.Any()) return;
     foreach (var item in items)
     {
         try
         {
             var toRender = item.Module as IHtmlHelperRendersMe;
             toRender?.Render(html);
         }
         catch (Exception ex)
         {
             handleException?.Invoke(ex);
         }
     }
 }
Esempio n. 41
0
 public PredefinedSectionAngle(
                             double Height,
                             double Thickness,
                             double Width,
                             double MomentOfInertiaPrincipalMajor,
                             double MomentOfInertiaPrincipalMinor,
                             double SectionModulusPrincipalMajor,
                             double SectionModulusPrincipalMinor,
                             double RadiusOfGyrationPrincipalMajor,
                             double RadiusOfGyrationPrincipalMinor, ISection section)
     : base(section)
 {
     this._d                         =Height                         ;
     this._t                      =Thickness                      ;
     this._b                          =Width                          ;
     this._I_w  =MomentOfInertiaPrincipalMajor  ;
     this._I_z  =MomentOfInertiaPrincipalMinor  ;
     this._S_w   =SectionModulusPrincipalMajor   ;
     this._S_z   =SectionModulusPrincipalMinor   ;
     this._r_w =RadiusOfGyrationPrincipalMajor ;
     this._r_z =RadiusOfGyrationPrincipalMinor ;
 }
Esempio n. 42
0
 public static bool IsDoublySymmetric(ISection section)
 {
     if (section is ISectionI)
     {
         ISectionI s = section as ISectionI;
         double bfTop = s.b_fTop;
         double bfBot = s.b_fBot;
         double tfTop = s.t_fTop;
         double tfBot = s.t_fBot;
         if (bfTop == bfBot && tfTop == tfBot)
         {
             return true;
         }
         else
         {
             return false;
         } 
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Esempio n. 43
0
		/// <summary>
		/// Constructs an active section.
		/// </summary>
		/// <param name="templateService">The <see cref="ITemplateServiceInternal"/>.</param>
		/// <param name="section">The section which is being rendered.</param>
		/// <param name="targetField">The target field.</param>
		public ActiveSection(ITemplateServiceInternal templateService, ISection section, IField targetField)
		{
			// validate arguments
			if (templateService == null)
				throw new ArgumentNullException("templateService");
			if (section == null)
				throw new ArgumentNullException("section");
			if (targetField == null)
				throw new ArgumentNullException("targetField");

			// set values
			TemplateService = templateService;
			Section = section;
			TargetField = targetField;

			// initialize
			foreach (var placeholder in (from candidate in Section.Expression.Expressions
			                             where candidate is PlaceholderExpression && !((PlaceholderExpression) candidate).Name.StartsWith("@", StringComparison.OrdinalIgnoreCase)
			                             select (PlaceholderExpression) candidate).Where(placeholder => !fields.ContainsKey(placeholder.Name)))
			{
				// create a field
				fields.Add(placeholder.Name, new StringBufferField());
			}
		}
Esempio n. 44
0
		/// <summary>
		/// Inserts a new section into the RootElement
		/// </summary>
		/// <param name="idx">
		/// The index where the section is added <see cref="System.Int32"/>
		/// </param>
		/// <param name="newSections">
		/// A <see cref="Section[]"/> list of sections to insert
		/// </param>
		/// <remarks>
		///    This inserts the specified list of sections (a params argument) into the
		///    root using the Fade animation.
		/// </remarks>
		public void Insert(int idx, ISection section)
		{
			Insert(idx, UITableViewRowAnimation.None, section);
		}
Esempio n. 45
0
        public AffectedElementInShear(ISection Section, ISteelMaterial Material, ICalcLog CalcLog)
            :base(Section,Material, CalcLog)
        {

        }
            private void SetupDefaultSection()
            {
                section = report.AddSection();
                section.PageSize = PageSizes.Letter;
                section.PageMargins.All = 35;

                if (pageOrientation == "portrait")
                {
                    section.PageOrientation = PageOrientation.Portrait;
                }
                else
                {
                    section.PageOrientation = PageOrientation.Landscape;
                }
            }
        //SteelMaterial mat 

        public ISteelCompressionMember GetCompressionMember(ISection Shape, ISteelMaterial mat,  double L_ex, double L_ey, double L_ez,  bool IsRolledShape = true)
        {
            return GetCompressionMember(Shape, L_ex, L_ey, L_ez, mat.YieldStress, mat.ModulusOfElasticity, IsRolledShape);
        }
Esempio n. 48
0
 public SectionInfo(ISection section) : base(section)
 {
     this.InTrash = section.InTrash;
 }
Esempio n. 49
0
 public SteelGeneralSection(ISection Section, ISteelMaterial Material)
        :base(Material)
    {
        this.section = Section;
    }
Esempio n. 50
0
 public AffectedElement(ISection Section, ISteelMaterial Material, ICalcLog CalcLog)
     :base(CalcLog)
 {
     this.section = new SteelGeneralSection(Section, Material); 
 }
Esempio n. 51
0
        public ISteelBeamFlexure GetBeam(ISection Shape, ISteelMaterial Material, ICalcLog Log, MomentAxis MomentAxis,
                 FlexuralCompressionFiberPosition compressionFiberPosition, bool IsRolledMember=true)
        {
            ISteelBeamFlexure beam = null;

            if (MomentAxis == Common.Entities.MomentAxis.XAxis)
	        {
                    if (Shape is ISectionI)
                    {
                        ISectionI IShape = Shape as ISectionI;
                        SteelSectionI SectionI = new SteelSectionI(IShape, Material);
                        if (IShape.b_fBot == IShape.b_fTop && IShape.t_fBot == IShape.t_fTop) // doubly symmetric
                        {
                            DoublySymmetricIBeam dsBeam = new DoublySymmetricIBeam(SectionI, Log, compressionFiberPosition, IsRolledMember);
                            beam = dsBeam.GetBeamCase();
                        }
                        else
                        {
                            SinglySymmetricIBeam ssBeam = new SinglySymmetricIBeam(SectionI, IsRolledMember, compressionFiberPosition, Log );
                            beam = ssBeam.GetBeamCase();
                        }
                    }
                    else if (Shape is ISolidShape)
                    {
                        ISolidShape solidShape = Shape as ISolidShape;
                        SteelSolidSection SectionSolid = new SteelSolidSection(solidShape, Material);
                        beam = new BeamSolid(SectionSolid, Log, MomentAxis);
                    }

                    else if (Shape is ISectionChannel)
                    {
                        ISectionChannel ChannelShape = Shape as ISectionChannel;
                        SteelChannelSection ChannelSection = new SteelChannelSection(ChannelShape, Material);
                        beam = new BeamChannel(ChannelSection, IsRolledMember, Log);


                        IShapeCompactness compactness = new ShapeCompactness.ChannelMember(ChannelSection, IsRolledMember, compressionFiberPosition);

                        CompactnessClassFlexure flangeCompactness = compactness.GetFlangeCompactnessFlexure();
                        CompactnessClassFlexure webCompactness = compactness.GetWebCompactnessFlexure();

                        if (flangeCompactness != CompactnessClassFlexure.Compact || webCompactness != CompactnessClassFlexure.Compact)
                        {
                            throw new Exception("Channels with non-compact and slender flanges or webs are not supported. Revise input.");
                        }
                    }


                    else if (Shape is ISectionPipe)
                    {
                        ISectionPipe SectionPipe = Shape as ISectionPipe;
                        SteelPipeSection PipeSection = new SteelPipeSection(SectionPipe, Material);
                        beam = new BeamCircularHss(PipeSection, Log);
                    }

                    else if (Shape is ISectionTube)
                    {
                        ISectionTube TubeShape = Shape as ISectionTube;
                        SteelRhsSection RectHSS_Section = new SteelRhsSection(TubeShape, Material);
                        beam = new BeamRectangularHss(RectHSS_Section,compressionFiberPosition, MomentAxis, Log);
                    }


                    else if (Shape is ISectionBox)
                    {
                        ISectionBox BoxShape = Shape as ISectionBox;
                        SteelBoxSection BoxSection = new SteelBoxSection(BoxShape, Material);
                        beam = new BeamRectangularHss(BoxSection, compressionFiberPosition, MomentAxis, Log);
                    }

                    else if (Shape is ISectionTee)
                    {
                        ISectionTee TeeShape = Shape as ISectionTee;
                        SteelTeeSection TeeSection = new SteelTeeSection(TeeShape, Material);
                        beam = new BeamTee(TeeSection, Log);
                    }
                    else if (Shape is ISectionAngle)
                    {
                        ISectionAngle Angle = Shape as ISectionAngle;
                        SteelAngleSection AngleSection = new SteelAngleSection(Angle,Material);
                        beam = new BeamAngle(AngleSection, Log, Angle.AngleRotation, MomentAxis, Angle.AngleOrientation);
                    }
                    else if (Shape is ISolidShape)
                    {
                        ISolidShape SolidShape = Shape as ISolidShape;
                        SteelSolidSection SolidSection = new SteelSolidSection(SolidShape, Material);
                        beam = new BeamSolid(SolidSection, Log,MomentAxis);
                        
                    }
                    else
                    {
                        throw new Exception("Specified section type is not supported for this node.");
                    }
	        }
            else  // weak axis
	        {
                if (Shape is ISectionI)
                {
                    ISectionI IShape = Shape as ISectionI;
                    SteelSectionI SectionI = new SteelSectionI(IShape, Material);

                    beam = new BeamIWeakAxis(SectionI, IsRolledMember, Log);
                }
                else
                {
                    throw new NotImplementedException();
                }
	        }

            return beam;
        }
Esempio n. 52
0
		public void Remove(ISection s, UITableViewRowAnimation anim)
		{
			if (s == null)
				return;
			int idx = Sections.IndexOf(s);
			if (idx == -1)
				return;
			RemoveAt(idx, anim);
		}
        public ISteelCompressionMember GetCompressionMember(ISection Shape, double L_ex, double L_ey, double L_ez, double F_y, double E, bool IsRolledShape = true)
        {
            string DEFAULT_EXCEPTION_STRING = "Selected shape is not supported. Select a different shape.";
            ISteelCompressionMember col = null;
            CalcLog log = new CalcLog();
            SteelMaterial Material = new SteelMaterial(F_y, E);

            if (Shape is ISectionI)
            {
                ISectionI IShape = Shape as ISectionI;
                SteelSectionI SectionI = new SteelSectionI(IShape, Material);
                IShapeFactory IShapeFactory = new IShapeFactory();
                return IShapeFactory.GetIshape(SectionI, IsRolledShape, L_ex, L_ey, L_ez, log);
 
            }


            else if (Shape is ISectionChannel)
            {
                ISectionChannel ChannelShape = Shape as ISectionChannel;
                SteelChannelSection ChannelSection = new SteelChannelSection(ChannelShape, Material);
                throw new Exception(DEFAULT_EXCEPTION_STRING);
 
            }


            else if (Shape is ISectionPipe)
            {
                ISectionPipe SectionPipe = Shape as ISectionPipe;
                SteelPipeSection PipeSection = new SteelPipeSection(SectionPipe, Material);
                ChsShapeFactory ChsFactory = new ChsShapeFactory();
                return ChsFactory.GetChsShape(PipeSection, L_ex, L_ey, L_ez, log);
 
            }

            else if (Shape is ISectionTube)
            {
                ISectionTube TubeShape = Shape as ISectionTube;
                SteelRhsSection RectHSS_Section = new SteelRhsSection(TubeShape, Material);
                RhsShapeFactory RhsFactory = new RhsShapeFactory();
                return RhsFactory.GetRhsShape(RectHSS_Section, L_ex, L_ey, L_ez, log);
 
            }


            else if (Shape is ISectionBox)
            {
                ISectionBox BoxShape = Shape as ISectionBox;
                SteelBoxSection BoxSection = new SteelBoxSection(BoxShape, Material);

                RhsShapeFactory RhsFactory = new RhsShapeFactory();
                return RhsFactory.GetRhsShape(BoxSection, L_ex, L_ey, L_ez, log);
 
            }

            else if (Shape is ISectionTee)
            {
                ISectionTee TeeShape = Shape as ISectionTee;
                SteelTeeSection TeeSection = new SteelTeeSection(TeeShape, Material);
                throw new Exception(DEFAULT_EXCEPTION_STRING);
            }
            else
            {
                throw new Exception(DEFAULT_EXCEPTION_STRING);
            }


        }
Esempio n. 54
0
 public ArticleController(IEzine ezine, ISection section, IArticle article)
 {
     ezineRepository = ezine;
     sectionRepository = section;
     articleRepository = article;
 }
Esempio n. 55
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 public bool Equals(ISection other)
 {
     return Equals((Section)other);
 }
Esempio n. 56
0
 protected Resource(int apiVersion, EventHandler handler, ISection section, Stream s)
     : base(apiVersion, handler, section, s)
 {
 }
Esempio n. 57
0
		public int IndexOf(ISection target)
		{
			int idx = 0;
			foreach (ISection s in Sections)
			{
				if (s == target)
					return idx;
				idx++;
			}
			return -1;
		}
Esempio n. 58
0
		/// <summary>
		/// Adds a new section to this RootElement
		/// </summary>
		/// <param name="section">
		/// The section to add, if the root is visible, the section is inserted with no animation
		/// </param>
		public void Add(ISection section)
		{
			if (section == null)
				return;

			Sections.Add(section);
			section.Parent = this;
			if (TableView == null)
				return;

			TableView.InsertSections(MakeIndexSet(Sections.Count - 1, 1), UITableViewRowAnimation.None);
		}
Esempio n. 59
0
 private void FillElements(ISection section, IEnumerable<ElementDescription> elementDescriptions)
 {
     if (elementDescriptions != null)
     {
         foreach (var elementDescription in elementDescriptions)
         {
             var element = Build(elementDescription);
             if (element != null)
                 section.Add(element);
             }
     }
 }
Esempio n. 60
0
		public void Reload(ISection section, UITableViewRowAnimation animation)
		{
			if (section == null)
				throw new ArgumentNullException("section");
			if (section.Parent == null || section.Parent != this)
				throw new ArgumentException("Section is not attached to this root");
			
			int idx = 0;
			foreach (var sect in Sections)
			{
				if (sect == section)
				{
					TableView.ReloadSections(new NSIndexSet((uint)idx), animation);
					return;
				}
				idx++;
			}
		}