public string GetSectionMarkup(string name, XmlTag section, List <CustomWrapper> lstWrapper, int Mode) { string html = ""; if (Enum.IsDefined(typeof(SectionTypes), name.ToUpper())) { SectionTypes _type = (SectionTypes)Enum.Parse(typeof(SectionTypes), name.ToUpper()); try { switch (_type) { case SectionTypes.TOP: html = GetTopMarkup(section, lstWrapper, Mode); break; case SectionTypes.MIDDLE: html = GetMiddleWrapper(section, lstWrapper, Mode); break; case SectionTypes.BOTTOM: html = GetBottomMarkup(section, lstWrapper, Mode); break; } } catch (Exception ex) { throw ex; } } return(html); }
public string GetSectionMarkup(string name, XmlTag section) { string html = ""; if (Enum.IsDefined(typeof(SectionTypes), name.ToUpper())) { SectionTypes _type = (SectionTypes)Enum.Parse(typeof(SectionTypes), name.ToUpper()); switch (_type) { case SectionTypes.SFHEADER: html = GetTopMarkup(section); break; case SectionTypes.SFCONTENT: html = GetMiddleWrapper(section); break; case SectionTypes.SFFOOTER: html = GetBottomMarkup(section); break; } } return(html); }
public static void SectionProcess(Section section, SectionTypes sectionTypes, ICheckRoles checkRoles) { section.Options = section.Options?.MakeJsonTextNotNull(); if (checkRoles != null) { section.Roles = checkRoles.CheckAndSetRoles(section.Roles); } var options = new Dictionary <string, object>(); if (sectionTypes.SectionServerTypes.TryGetValue(section.Type, out Type sectionServerType)) { AddFields(section.Options, sectionServerType, options); } if (sectionTypes.SectionClientTypes.TryGetValue(section.Type, out Type sectionClientType)) { AddFields(section.Options, sectionClientType, options); } section.Options = JsonSerializer.Serialize(options); void AddFields(string optionsJson, Type sectionType, Dictionary <string, object> optionsToAdd) { var dataObject = JsonSerializer.Deserialize(optionsJson, sectionType); var properties = sectionType.GetProperties(); foreach (var propertyInfo in properties) { ConfigItemAttribute configItemAttribute = propertyInfo.GetCustomAttribute <ConfigItemAttribute>(); string name = propertyInfo.Name; string typeName = configItemAttribute.ConfigItemType.Name.Split(".")[^ 1].Replace("Item", "");
public SectionsAdminManager( ICheckRoles checkRoles, SectionTypes sectionTypes, DataBaseConnection db) : base(db) { this.sectionTypes = sectionTypes; this.checkRoles = checkRoles; }
internal WasmModuleSection(SectionTypes type) : this() { if (!Enum.IsDefined(typeof(SectionTypes), type)) { throw new ArgumentException(); } Type = type; }
public SectionsCache( IDataBaseFactory dataBaseFactory, IRolesCache rolesCache, SectionTypes sectionTypes) { this.rolesCache = rolesCache; this.dataBaseFactory = dataBaseFactory; this.sectionTypes = sectionTypes; Initialize(); }
public void Track_ShouldTake_TwoParameters() { var param1 = "TestTrack1"; var param2 = new SectionTypes[0]; Track track = new Track(param1, param2); Assert.IsNotNull(track); Assert.AreEqual(track.Name, "TestTrack1"); Assert.IsTrue(track.Sections.Count == param2.Length); }
public void Track_SectionTypeArrayToList_ShouldReturn_List() { SectionTypes[] sectionTypesArray = new SectionTypes[2] { SectionTypes.StartGrid, SectionTypes.Straight }; LinkedList <Section> result = _track.SectionTypeArrayToList(sectionTypesArray); Assert.IsNotNull(result); Assert.IsTrue(result.Count == 2); }
/// <summary> /// Подсчет площадей блок-секций и типов /// </summary> public void Calc() { // Разбивка секций на типы и подсчет общей площади счекций одного типа Dictionary <string, SectionType> types = new Dictionary <string, SectionType>(); foreach (var section in _service.Sections) { SectionType secType; string key = section.Name.ToUpper(); if (!types.TryGetValue(key, out secType)) { secType = new SectionType(section.Name, section.Floors); types.Add(key, secType); } secType.AddSection(section); KP_GNS_BKFN += section.AreaGNS; KP_GNS_Typical += section.AreaGNS * (section.Floors - 1); } KP_GNS_Total = KP_GNS_BKFN + KP_GNS_Typical; SectionTypes = types.Values.ToList(); SectionTypes.Sort(); // Подсчет общих значений для всех типов секций var bsByFloor = SectionTypes.SelectMany(b => b.Sections).GroupBy(g => g.Floors); var totalFloors = bsByFloor.Sum(s => s.Key * s.Count()); AverageFloors = totalFloors / (double)bsByFloor.Sum(s => s.Count()); TotalAreaApart = SectionTypes.Sum(s => s.AreaApartTotal); TotalAreaBKFN = SectionTypes.Sum(s => s.AreaBKFN); TotalArea = TotalAreaApart + TotalAreaBKFN; // По классификатору if (_service.Classes.Count > 0) { var landClass = _service.Classes.Find(c => c.ClassType.ClassName == ClassTypeService.Site); if (landClass != null) { FC_LandArea = landClass.Area * 0.0001; FC_QuarterArea = FC_LandArea; foreach (var item in _service.Classes) { double val = GetreduceArea(item); if (val != 0) { FC_QuarterArea -= val * 0.0001; } } FC_Density = KP_GNS_Total / FC_QuarterArea; } } }
public void GetGoodGraphics_Should_ReturnFinishHorizontal() { //setup SectionTypes section = SectionTypes.Finish; int direction = 1; int direction2 = 3; //Actions var result = Visualisatie.GetGoodGraphics(section, direction); var result2 = Visualisatie.GetGoodGraphics(section, direction2); //Assertions Assert.AreEqual(result, _finishHorizontal); Assert.AreEqual(result2, _finishHorizontal); }
public void GetGoodGraphics_Should_ReturnStartVertical() { //setup SectionTypes section = SectionTypes.StartGrid; int direction = 0; int direction2 = 2; //Actions var result = Visualisatie.GetGoodGraphics(section, direction); var result2 = Visualisatie.GetGoodGraphics(section, direction2); //Assertions Assert.AreEqual(result, _startVertical); Assert.AreEqual(result2, _startVertical); }
public void GetGoodGraphics_Should_ReturnStraightHorizontal() { //setup SectionTypes section = SectionTypes.Straight; int direction = 1; int direction2 = 3; //Actions var result = Visualisatie.GetGoodGraphics(section, direction); var result2 = Visualisatie.GetGoodGraphics(section, direction2); //Assertions Assert.AreEqual(result, _horizontalTrack); Assert.AreEqual(result2, _horizontalTrack); }
public void GetGoodGraphics_Should_ReturnSouthToEast() { //setup SectionTypes section = SectionTypes.RightCorner; SectionTypes section2 = SectionTypes.LeftCorner; int direction = 0; int direction2 = 3; //Actions var result = Visualisatie.GetGoodGraphics(section, direction); var result2 = Visualisatie.GetGoodGraphics(section2, direction2); //Assertions Assert.AreEqual(result, _southToEast); Assert.AreEqual(result2, _southToEast); }
/// <summary> /// Create a section entry from file /// </summary> /// <param name="entries"></param> /// <param name="reader"></param> /// <param name="mainHeader"></param> public SectionEntry(List <Entry> entries, Reader reader, Header mainHeader) { this.sectionId = id++; this.reader = reader; this.header = new SectionHeader(entries, this.reader, mainHeader); this.rawData = this.reader.readBytes(this.header.pointerToRawData.getValue(), this.header.sizeOfRawData.getValue()); // TODO : fix order characteristics check (see how it handle .data dir) this.type = (this.header.characteristics.getValue() & (int)SectionFlags.IMAGE_SCN_MEM_EXECUTE) > 0 ? SectionTypes.CODE_SECTION : SectionTypes.DATA_SECTION; // TODO : handle more things ? }
/// <summary> /// Update the headers when adding a section to the executable /// </summary> /// <param name="type">The section type</param> private void updateHeader(SectionTypes type) { int virtualAddressBase = this.header.optionalHeader.BaseOfCode.getValue(); // BaseOfData doesn't exist in x64 if (this.header.is32Bit) { // select the virtual address from section type virtualAddressBase = type == SectionTypes.CODE_SECTION ? this.header.optionalHeader.BaseOfCode.getValue() : this.header.optionalHeader.BaseOfData.getValue(); } bool isFirstSection = this.header.peHeader.NumberOfSection.getValue() < 1; // fix PE header size in the header this.header.optionalHeader.SizeOfHeaders.setValue(getSectionDataBaseAddress()); int sizeOfAllCodeSections = 0; int sizeOfAllDataSections = 0; // collects all raw section sizes getCodeSections().ForEach(s => sizeOfAllCodeSections += s.header.sizeOfRawData.getValue()); getDataSections().ForEach(s => sizeOfAllDataSections += s.header.sizeOfRawData.getValue()); // update all sections size in PE header this.header.optionalHeader.SizeOfCode.setValue(sizeOfAllCodeSections); this.header.optionalHeader.SizeOfInitializedData.setValue(sizeOfAllDataSections); // update the image size if (!isFirstSection) { // last section virtualAddress = size of virtual section's allocation segment // + padding due to the last section size int sizeOfImage = getLastEntry().header.virtualAddress.getValue() + getLastEntry().header.virtualSize.getValue(); // update the image size this.header.optionalHeader.SizeOfImage.setValue(sizeOfImage); } else { // set the default image size this.header.optionalHeader.SizeOfImage.setValue(virtualAddressBase); } }
public void TrackConstructorShould() { string name = "circuitje niffo"; SectionTypes[] section = new SectionTypes[] { SectionTypes.StartGrid, SectionTypes.Finish, SectionTypes.RightCorner, SectionTypes.Straight, SectionTypes.LeftCorner, SectionTypes.Straight, SectionTypes.Straight, SectionTypes.RightCorner, SectionTypes.RightCorner, SectionTypes.Straight, SectionTypes.Straight, SectionTypes.LeftCorner, SectionTypes.RightCorner, SectionTypes.Straight, SectionTypes.LeftCorner, SectionTypes.RightCorner, SectionTypes.RightCorner, SectionTypes.LeftCorner, SectionTypes.Straight, SectionTypes.RightCorner, SectionTypes.Straight, SectionTypes.Straight, SectionTypes.Straight, SectionTypes.RightCorner, SectionTypes.StartGrid, SectionTypes.StartGrid }; Track cool = new Track(name, section); LinkedList <Section> sections = cool.ConvertArrayToLinkedList(section); Assert.AreEqual(name, cool.Name); Assert.AreEqual(sections, cool.Sections); }
// get graphics functions public static string[] GetGoodGraphics(SectionTypes section, int direction) { switch (section) { case SectionTypes.StartGrid: return(GetStartGrid(direction)); case SectionTypes.LeftCorner: return(GetLeftCorner(direction)); case SectionTypes.RightCorner: return(GetRightCorner(direction)); case SectionTypes.Straight: return(GetStraight(direction)); case SectionTypes.Finish: return(GetFinish(direction)); } return(null); }
public string GetSectionMarkup(string name, XmlTag section, List <CustomWrapper> lstWrapper, int Mode) { string html = ""; if (Enum.IsDefined(typeof(SectionTypes), name.ToUpper())) { SectionTypes _type = (SectionTypes)Enum.Parse(typeof(SectionTypes), name.ToUpper()); try { switch (_type) { case SectionTypes.SFHEADER: html = GetTopMarkup(section, lstWrapper, Mode); break; case SectionTypes.SFCONTENT: html = GetMiddleWrapper(section, lstWrapper, Mode); break; case SectionTypes.SFFOOTER: html = GetBottomMarkup(section, lstWrapper, Mode); break; default: html = GetBottomMarkup(section, lstWrapper, Mode); break; } } catch (Exception ex) { throw ex; } } else { html = GetBottomMarkup(section, lstWrapper, Mode); } return(html); }
/// <summary> /// Creates named memory mapping object that then can be opened by the same call from another process. /// </summary> public void Create(uint size, string name, ulong offset, SectionTypes section, AccessTypes access) { hMappedFile = Create(InvalidHandleValue, ref size, ref offset, name, section, access); // in case of error try to open an existing shared memory object: if (hMappedFile == IntPtr.Zero && Marshal.GetLastWin32Error() != 0) { hMappedFile = OpenFileMapping(access, false, name); } if (hMappedFile != IntPtr.Zero) { lpMemoryAddress = MapViewOfFile(hMappedFile, access, (uint)(offset >> 32) & 0xFFFFFFFF, (uint)(offset & 0xFFFFFFFF), size); } if (lpMemoryAddress != IntPtr.Zero) { memoryOffset = offset; memorySize = size; OnCreateMapping(true); } }
/// <summary> /// Подсчет площадей блок-секций и типов /// </summary> public void Calc() { // Разбивка секций на типы и подсчет общей площади счекций одного типа Dictionary <string, SectionType> types = new Dictionary <string, SectionType>(); foreach (var section in _service.Sections) { SectionType secType; string key = section.Name.ToUpper(); if (!types.TryGetValue(key, out secType)) { secType = new SectionType(section.Name, section.NumberFloor); types.Add(key, secType); } secType.AddSection(section); } SectionTypes = types.Values.ToList(); SectionTypes.Sort(); // Подсчет общих значений для всех типов секций AverageFloors = SectionTypes.Average(s => s.NumberFloor); TotalAreaApart = SectionTypes.Sum(s => s.AreaApartTotal); TotalAreaBKFN = SectionTypes.Sum(s => s.AreaBKFN); }
public TableSection(SectionTypes sectionType) : base() { SectionType = sectionType; }
public Section(SectionTypes sectionType) { this.SectionType = sectionType; }
public static int GetContents(SectionTypes sectionType) { return SectionIDTable.table[sectionType]; }
public SectionsSeeder(DataContainer dataContainer, string configDir) { this.configDir = configDir; this.dataContainer = dataContainer; sectionTypes = new SectionTypes(); }
public SectionsAdminPresenter( SectionTypes sectionTypes, DataBaseConnection db) : base(db) { this.sectionTypes = sectionTypes; }
/// <summary> /// Creates named memory object with given properties. /// </summary> protected virtual IntPtr Create(IntPtr handle, ref uint size, ref ulong offset, string name, SectionTypes section, AccessTypes access) { ProtectionTypes protection; switch (access) { case AccessTypes.Copy: protection = ProtectionTypes.PageWriteCopy; break; case AccessTypes.ReadOnly: protection = ProtectionTypes.PageReadOnly; break; default: protection = ProtectionTypes.PageReadWrite; break; } return(CreateFileMapping(handle, 0, (uint)protection | (uint)section, 0, size, name)); }
/// <summary> /// Init constructor. /// </summary> public SharedMemory(uint size, string name, ulong offset, SectionTypes section, AccessTypes access) { Create(size, name, offset, section, access); }
public Section(SectionTypes section) { SectionType = section; }
//constructor public Section(SectionTypes type) { SectionType = type; }
public UMLSequenceBlockSection(string text, SectionTypes sectionTypes, int lineNumber) : base(lineNumber) { Text = text; Entities = new List <UMLOrderedEntity>(); SectionType = sectionTypes; }
private static string[] GetSectionType(SectionTypes s) { switch (s) { case SectionTypes.Straight: if (Orientation == 1 || Orientation == 3) { return(_straightHorizontal); } else { return(_straightVertical); } case SectionTypes.LeftCorner: switch (Orientation) { case 0: return(_cornerLeft0); case 1: return(_cornerLeft1); case 2: return(_cornerLeft2); case 3: return(_cornerLeft3); default: return(null); } case SectionTypes.RightCorner: switch (Orientation) { case 0: return(_cornerRight0); case 1: return(_cornerRight1); case 2: return(_cornerRight2); case 3: return(_cornerRight3); default: return(null); } case SectionTypes.StartGrid: return(_start); case SectionTypes.Finish: if (Orientation == 1 || Orientation == 3) { return(_finishHorizontal); } else { return(_finishVertical); } default: return(null); } }