Exemplo n.º 1
0
 public ExprAlloc(SugarType type, string name, Expr expr, AllocType style)
 {
     this.Type = type;
     this.Name = new List<string> { name };
     this.ExprList = new List<Expr> { expr };
     this.Style = style;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Constructs an object with all buffers allocated and ready to load with data.
        /// (See: <see cref="Load"/>)
        /// </summary>
        /// <param name="maxVerts">
        /// The maximum vertices the vertex buffer will hold. [Limit: >= 3]
        /// </param>
        /// <param name="maxTris">
        /// The maximum triangles the triangle buffer  will hold. [Limit: > 0]
        /// </param>
        /// <param name="maxMeshes">
        /// The maximum sub-meshes the mesh buffer will hold. [Limit: > 0]
        /// </param>
        private PolyMeshDetail(int maxVerts
                               , int maxTris
                               , int maxMeshes)
        {
            if (maxVerts < 3 || maxTris < 1 || maxMeshes < 1)
            {
                return;
            }

            mResourceType = AllocType.Local;

            mMaxVerts  = maxVerts;
            mMaxTris   = maxTris;
            mMaxMeshes = maxMeshes;

            int size = sizeof(float) * mMaxVerts * 3;

            mVerts = UtilEx.GetBuffer(size, true);

            size  = sizeof(byte) * mMaxTris * 4;
            mTris = UtilEx.GetBuffer(size, true);

            size    = sizeof(uint) * mMaxMeshes * 4;
            mMeshes = UtilEx.GetBuffer(size, true);
        }
Exemplo n.º 3
0
        public PagedList <ResourceDto> GetMyResources(Guid?managerId, AllocType allocType, DateTime startDate,
                                                      DateTime endDate, PagingParams pagingParams = null, string name = null, string designation = null, Guid?skillsetId = null)
        {
            var resources = _appDbContext.Resources.AsQueryable();

            if (pagingParams == null)
            {
                pagingParams = new PagingParams();
            }

            var spResult = _appDbContext.ResourceSpResult.FromSql($"CALL getresourceallocations({managerId}, {(int)allocType}, {startDate.ToString("yyyy-MM-dd")}, {endDate.ToString("yyyy-MM-dd")}, {name},{skillsetId},{designation},{pagingParams.PageNumber})").ToList();

            var query = _appDbContext.Resources
                        .Include(a => a.Manager)
                        .Include(a => a.ResourceOwner)
                        .Include(a => a.Skillset)
                        .Include(a => a.ProjectResources)
                        .ThenInclude(a => a.AllocationType)
                        .Include(a => a.ProjectResources)
                        .ThenInclude(a => a.Project)
                        .AsQueryable();

            var result = (from t in spResult
                          join p in query on t.ResourceId equals p.Id
                          orderby t.TotalAllocationPerc
                          select new ResourceDto
            {
                ResourceId = p.Id,
                EmpCode = p.EmpCode,
                Name = p.FirstName + ' ' + p.LastName,
                Designation = p.Designation,
                Skill = p.Skillset.Name,
                ReportingManagerId = p.Manager == null ? null : p.ManagerId,
                ReportingManager = p.Manager == null ? null : (p.Manager.FirstName + ' ' + p.Manager.LastName),
                ResourceOwner = p.ResourceOwner == null ? null : (p.ResourceOwner.FirstName + ' ' + p.ResourceOwner.LastName),
                ResourceOwnerId = null,
                AvailableFullDays = t.Available100Days,
                TotalAllocationPerc = Convert.ToInt32(t.TotalAllocationPerc),
                TotalDays = t.TotalDays,
                AllocatedProjects = p.ProjectResources.Select(q => new AllocatedProject
                {
                    ProjectResourceId = q.Id,
                    ProjectName = q.Project.Name,
                    ProjectId = q.ProjectId,
                    AllocationType = q.AllocationType.Name,
                    AllocationPercentage = q.AllocationPercent,
                    EndDate = q.AllocationEndDate,
                    StartDate = q.AllocationStartDate,
                    AllocationTypeId = q.AllocationTypeId,
                    ProjectLocationBillingRoleId = q.ProjectLocationBillingRoleId
                }).ToList()
            }).ToList();

            PagedList <ResourceDto> resourceDto = new PagedList <ResourceDto>(result, 0, pagingParams.PageNumber, 10);

            return(resourceDto);
        }
Exemplo n.º 4
0
 public ExprAlloc(SugarType type, List<string> name, List<Expr> expr_list, AllocType style)
 {
     this.Type = type;
     this.Name = name;
     if (expr_list != null)
     {
         this.ExprList = expr_list;
     }
     this.Style = style;
 }
Exemplo n.º 5
0
 public ExprAlloc(SugarType type, List <string> name, List <Expr> expr_list, AllocType style)
 {
     this.Type = type;
     this.Name = name;
     if (expr_list != null)
     {
         this.ExprList = expr_list;
     }
     this.Style = style;
 }
Exemplo n.º 6
0
 public GlobalAlloc(SugarType type, string name, Expr expr, List<Attr> attr, AllocType style)
 {
     this.Type = type;
     this.Name.Add(name);
     this.ExprList.Add(expr);
     if (attr != null)
     {
         this.Attribute = attr;
     }
     this.Style = style;
 }
Exemplo n.º 7
0
 public ExprAlloc(SugarType type, string name, Expr expr, AllocType style)
 {
     this.Type = type;
     this.Name = new List <string> {
         name
     };
     this.ExprList = new List <Expr> {
         expr
     };
     this.Style = style;
 }
Exemplo n.º 8
0
 public GlobalAlloc(SugarType type, string name, Expr expr, List <Attr> attr, AllocType style)
 {
     this.Type = type;
     this.Name.Add(name);
     this.ExprList.Add(expr);
     if (attr != null)
     {
         this.Attribute = attr;
     }
     this.Style = style;
 }
Exemplo n.º 9
0
 public GlobalAlloc(SugarType type, List<string> name, List<Expr> expr_list, List<Attr> attr, AllocType style)
 {
     this.Type = type;
     this.Name = name;
     if (expr_list != null)
     {
         this.ExprList = expr_list;
     }
     if (attr != null)
     {
         this.Attribute = attr;
     }
     this.Style = style;
 }
Exemplo n.º 10
0
 public GlobalAlloc(SugarType type, List <string> name, List <Expr> expr_list, List <Attr> attr, AllocType style)
 {
     this.Type = type;
     this.Name = name;
     if (expr_list != null)
     {
         this.ExprList = expr_list;
     }
     if (attr != null)
     {
         this.Attribute = attr;
     }
     this.Style = style;
 }
 public static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, IntPtr dwSize, AllocType flAllocType, MemoryProtection flProtect);
Exemplo n.º 12
0
 public static extern IntPtr VirtualAlloc(IntPtr Addr, int Size, AllocType AType = AllocType.Commit, MemProtection Prot = MemProtection.ReadWrite);
 private PolyMeshDetail(AllocType resourceType)
 {
     mResourceType = resourceType;
 }
        /// <summary>
        /// Constructs an object with all buffers allocated and ready to load with data. 
        /// (See: <see cref="Load"/>)
        /// </summary>
        /// <param name="maxVerts">
        /// The maximum vertices the vertex buffer will hold. [Limit: >= 3]
        /// </param>
        /// <param name="maxTris">
        /// The maximum triangles the triangle buffer  will hold. [Limit: > 0]
        /// </param>
        /// <param name="maxMeshes">
        /// The maximum sub-meshes the mesh buffer will hold. [Limit: > 0]
        /// </param>
        private PolyMeshDetail(int maxVerts
            , int maxTris
            , int maxMeshes)
        {
            if (maxVerts < 3 || maxTris < 1 || maxMeshes < 1)
                return;

            mResourceType = AllocType.Local;

            mMaxVerts = maxVerts;
            mMaxTris = maxTris;
            mMaxMeshes = maxMeshes;

            int size = sizeof(float) * mMaxVerts * 3;
            mVerts = UtilEx.GetBuffer(size, true);

            size = sizeof(byte) * mMaxTris * 4;
            mTris = UtilEx.GetBuffer(size, true);

            size = sizeof(uint) * mMaxMeshes * 4;
            mMeshes = UtilEx.GetBuffer(size, true);
        }
Exemplo n.º 15
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="resourceType">The type of unmanaged resource.</param>
 public ManagedObject(AllocType resourceType)
 {
     this.mResourceType = resourceType;
 }
Exemplo n.º 16
0
 internal NavmeshQueryFilter(IntPtr filter, AllocType type)
         : base(type)
 {
     root = filter;
     mAreaCount = Navmesh.MaxArea + 1;
 }
Exemplo n.º 17
0
 private static extern IntPtr VirtualAlloc(IntPtr lpAddress, UIntPtr dwSize, AllocType flAllocationType, MemoryProtection flProtect);
Exemplo n.º 18
0
 private PolyMesh(AllocType resourceType)
     : base(resourceType)
 {
 }
Exemplo n.º 19
0
 private PolyMesh(AllocType resourceType)
     : base(resourceType)
 {
 }
Exemplo n.º 20
0
 internal NavmeshQuery(IntPtr query, bool isConstant, AllocType type)
     : base(type)
 {
     mIsRestricted = isConstant;
     root = query;
 }
Exemplo n.º 21
0
 private PolyMeshDetail(AllocType resourceType)
 {
     mResourceType = resourceType;
 }
Exemplo n.º 22
0
 public static extern Int32 VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, int dwSize, AllocType flAllocationType, Protect flProtect);
Exemplo n.º 23
0
 internal NavmeshQueryFilter(IntPtr filter, AllocType type)
     : base(type)
 {
     root       = filter;
     mAreaCount = Navmesh.MaxArea + 1;
 }
Exemplo n.º 24
0
 public static extern IntPtr VirtualAlloc(IntPtr Addr, uint Size, AllocType AType, MemProtection Protect);
Exemplo n.º 25
0
        async Task Process(AllocType at, Socket client, Action <int> onmessage, bool stop = false)
        {
            Print.AsInfo(at.ToString() + Environment.NewLine);

            try
            {
                Print.AsInfo("New client" + Environment.NewLine);

                IMemoryHighway hw    = null;
                var            lanes = new int[] { 1025, 2048 };

                switch (at)
                {
                case AllocType.Heap:
                    hw = new HeapHighway(lanes);
                    break;

                case AllocType.MMF:
                    hw = new MappedHighway(lanes);
                    break;

                case AllocType.Marshal:
                    hw = new MarshalHighway(lanes);
                    break;

                default:
                    throw new ArgumentNullException();
                }

                using (hw)
                    using (var ns = new NetworkStream(client))
                    {
                        var header   = new byte[4];
                        var spoon    = new byte[16000];
                        var total    = 0;
                        var read     = 0;
                        var frameLen = 0;

                        while (!stop)
                        {
                            total = 0;
                            read  = await ns.ReadAsync(header, 0, 4).ConfigureAwait(false);

                            Print.AsInfo("Received header bytes: {0}.{1}.{2}.{3}", header[0], header[1], header[2], header[3]);

                            // The other side is gone.
                            // As long as the sender is not disposed/closed the ReadAsync will wait
                            if (read < 1)
                            {
                                Print.AsError("The client is gone.");
                                break;
                            }

                            frameLen = BitConverter.ToInt32(header, 0);

                            if (frameLen < 1)
                            {
                                Print.AsError("Bad header, thread {0}", Thread.CurrentThread.ManagedThreadId);
                                break;
                            }

                            using (var frag = hw.AllocFragment(frameLen))
                            {
                                Print.AsInfo("Frame length:{0}", frameLen);

                                // The sip length guards against jumping into the next frame
                                var sip = 0;
                                while (total < frameLen && !stop)
                                {
                                    sip = frameLen - total;
                                    if (sip > spoon.Length)
                                    {
                                        sip = spoon.Length;
                                    }

                                    // the read amount could be smaller than the sip
                                    read = await ns.ReadAsync(spoon, 0, sip).ConfigureAwait(false);

                                    frag.Write(spoon, total, read);
                                    total += read;

                                    Print.AsInnerInfo("read {0} on thread {1}", read, Thread.CurrentThread.ManagedThreadId);

                                    if (total >= frameLen)
                                    {
                                        onmessage?.Invoke(total);
                                        break;
                                    }
                                }
                            }
                        }
                    }
            }
            catch (MemoryLaneException mex)
            {
                Print.AsError(mex.Message);
                Print.AsError(mex.ErrorCode.ToString());
                Print.AsError(mex.StackTrace);
            }
            catch (Exception ex)
            {
                Print.AsError(ex.Message);
            }
        }
Exemplo n.º 26
0
        public static extern uint ZwAllocateVirtualMemory(IntPtr Proc, ref IntPtr Addr, int ZeroBits, ref IntPtr RegionSize,
			AllocType AType = AllocType.Commit | AllocType.Reserve, MemProtection Prot = MemProtection.ReadWrite);
Exemplo n.º 27
0
 public PagedList <ResourceDto> GetMyResources(Guid?managerId, AllocType allocType, DateTime startDate,
                                               DateTime endDate, PagingParams pagingParams = null, string name = null, string designation = null, Guid?skillsetId = null)
 {
     return(_resourceRepository.GetMyResources(managerId, allocType, startDate, endDate, pagingParams, name, designation, skillsetId));
 }
Exemplo n.º 28
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="resourceType">The type of unmanaged resource.</param>
 public ManagedObject(AllocType resourceType)
 {
     this.mResourceType = resourceType;
 }
Exemplo n.º 29
0
 public static extern uint ZwAllocateVirtualMemory(IntPtr Proc, ref IntPtr Addr, int ZeroBits, ref IntPtr RegionSize,
                                                   AllocType AType = AllocType.Commit | AllocType.Reserve, MemProtection Prot = MemProtection.ReadWrite);
Exemplo n.º 30
0
 public static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, uint dwSize,
                                            AllocType flAllocationType, ThreadPermission flProtect);