public FlowDocument GetFlowDocument() { FlowDocument doc = (FlowDocument)Application.LoadComponent( new Uri("/Daytimer.DatabaseHelpers;component/Templates/NoteTemplate.xaml", UriKind.Relative)); NotebookSection section = NoteDatabase.GetSection(_page.SectionID); Notebook notebook = NoteDatabase.GetNotebook(section.NotebookID); ((Paragraph)doc.FindName("Title")).Inlines.Add(_page.Title); ((Paragraph)doc.FindName("Created")).Inlines.Add(FormatHelpers.FormatDate(_page.Created.Date) + " " + RandomFunctions.FormatTime(_page.Created.TimeOfDay)); ((Paragraph)doc.FindName("Notebook")).Inlines.Add(notebook.Title); ((Paragraph)doc.FindName("Section")).Inlines.Add(section.Title); Section details = (Section)doc.FindName("Details"); FlowDocument detailsDoc = _page.DetailsDocument; if (detailsDoc != null) { BlockCollection blocks = _page.DetailsDocument.Copy().Blocks; while (blocks.Count > 0) { details.Blocks.Add(blocks.FirstBlock); } } return(doc); }
public string GetContributions(DiscordGuild guild, DiscordMember dMember) { var data = MultiBotDb.Transactions.AsQueryable() .Join( MultiBotDb.Mcmember, trans => trans.UserId, mem => mem.UserId, (trans, mem) => new { memberName = mem.Username, discordID = mem.DiscordId, orgId = mem.OrgId.GetValueOrDefault(), amount = trans.Amount, merits = trans.Merits, xp = mem.Xp, } ).FirstOrDefault(x => x.orgId == new OrgController().GetOrgId(guild) && (x.amount != 0 || x.merits != 0) && x.discordID == dMember.Id.ToString()); if (data == null) { return($"Could not find Transactions for **{ dMember.Nickname ?? dMember.DisplayName}**"); } else { return($"**Contribution by User:** {dMember.Nickname ?? dMember.DisplayName} \n " + $"**CREDITS:** {FormatHelpers.FormattedNumber(data.amount.ToString())}" + $"\n**MERITS:** {FormatHelpers.FormattedNumber(data.merits.ToString())}" + $"\n**ORG XP:** {FormatHelpers.FormattedNumber(data.xp.ToString())}"); } }
internal void TransitionImageLayout( VkCommandBuffer cb, uint baseMipLevel, uint levelCount, uint baseArrayLayer, uint layerCount, VkImageLayout newLayout) { if (_stagingBuffer != Vulkan.VkBuffer.Null) { return; } VkImageLayout oldLayout = _imageLayouts[CalculateSubresource(baseMipLevel, baseArrayLayer)]; #if DEBUG for (uint level = 0; level < levelCount; level++) { for (uint layer = 0; layer < layerCount; layer++) { if (_imageLayouts[CalculateSubresource(baseMipLevel + level, baseArrayLayer + layer)] != oldLayout) { throw new VeldridException("Unexpected image layout."); } } } #endif if (oldLayout != newLayout) { VkImageAspectFlags aspectMask; if ((Usage & TextureUsage.DepthStencil) != 0) { aspectMask = FormatHelpers.IsStencilFormat(Format) ? aspectMask = VkImageAspectFlags.Depth | VkImageAspectFlags.Stencil : aspectMask = VkImageAspectFlags.Depth; } else { aspectMask = VkImageAspectFlags.Color; } VulkanUtil.TransitionImageLayout( cb, OptimalDeviceImage, baseMipLevel, levelCount, baseArrayLayer, layerCount, aspectMask, _imageLayouts[CalculateSubresource(baseMipLevel, baseArrayLayer)], newLayout); for (uint level = 0; level < levelCount; level++) { for (uint layer = 0; layer < layerCount; layer++) { _imageLayouts[CalculateSubresource(baseMipLevel + level, baseArrayLayer + layer)] = newLayout; } } } }
private async Task <List <SchoolFinancialDataModel> > GetFinancialDataHistoricallyAsync(string matCode, MatFinancingType matFinancing) { var models = new List <SchoolFinancialDataModel>(); var latestYear = _financialDataService.GetLatestDataYearForTrusts(); var taskList = new List <Task <IEnumerable <Document> > >(); for (int i = ChartHistory.YEARS_OF_HISTORY - 1; i >= 0; i--) { var term = FormatHelpers.FinancialTermFormatAcademies(latestYear - i); var task = _financialDataService.GetMATDataDocumentAsync(matCode, term, matFinancing); taskList.Add(task); } for (int i = ChartHistory.YEARS_OF_HISTORY - 1; i >= 0; i--) { var term = FormatHelpers.FinancialTermFormatAcademies(latestYear - i); var taskResult = await taskList[ChartHistory.YEARS_OF_HISTORY - 1 - i]; var resultDocument = taskResult?.FirstOrDefault(); if (resultDocument != null && resultDocument.GetPropertyValue <bool>("DNS")) { var emptyDoc = new Document(); emptyDoc.SetPropertyValue("DNS", true); resultDocument = emptyDoc; } models.Add(new SchoolFinancialDataModel(matCode, term, resultDocument, SchoolFinancialType.Academies)); } return(models); }
public async Task Update_Book_Formats() { var book = await BookHelpers.CreateValidBookWithAllProperties(); var repository = new BookRepository(_fixture.Context); (await repository.ExistsAsync(book.Id)).Should().BeTrue(); var sut = await repository.LoadAsync(book.Id); var bookId = sut.Id; sut.Should().NotBeNull(); sut.Formats.Count.Should().Be(2); var format1 = await FormatHelpers.CreateValidFormat(); var format2 = await FormatHelpers.CreateValidFormat(); var formats = new List <Format> { format1, format2 }; await BookHelpers.UpdateFormats(sut.Id, formats); sut = await repository.LoadAsync(book.Id); await _fixture.Context.Entry(sut).ReloadAsync(); sut.Formats.Count.Should().Be(4); sut.Id.Should().Be(bookId); }
/// <inheritdoc/> public string Create(string value, uint length) { Guard.MustBeBetweenOrEqualTo <uint>(length, 2, 64, nameof(length)); using (var hashAlgorithm = SHA256.Create()) { int len = (int)length; // Concatenate the hash bytes into one long string. int byteCount = Encoding.ASCII.GetByteCount(value); byte[] buffer = ArrayPool <byte> .Shared.Rent(byteCount); Encoding.ASCII.GetBytes(value, 0, value.Length, buffer, 0); byte[] hash = hashAlgorithm.ComputeHash(buffer, 0, byteCount); ArrayPool <byte> .Shared.Return(buffer); var sb = new StringBuilder(len); for (int i = 0; i < len / 2; i++) { sb.Append(hash[i].ToString("X2")); } sb.AppendFormat(".{0}", FormatHelpers.GetExtensionOrDefault(this.options.Configuration, value)); return(sb.ToString()); } }
private List <ToplineViewModel> BindToplinesViewModel(List <BPSR_Topline> toplines, DateTime dueDate, string approverName, bool isAdmin, bool isApprover) { var results = new List <ToplineViewModel>(); foreach (var t in toplines) { var item = new ToplineViewModel() { ToplineId = t.BPSR_ToplineID, StoreId = t.LocalStoreID, Status = FormatHelpers.FormatStatus(t.BPSR_StatusID), PeriodEndDate = FormatHelpers.FormatPeriodDate(t.PeriodEndDate), NetSales = FormatHelpers.FormatMoney(t.NetSales), FranCalcRoyalty = FormatHelpers.FormatMoney(t.FranCalcRoyalty), FranCalcAdvertising = FormatHelpers.FormatMoney(t.FranCalcAdvertising), TotalTickets = FormatHelpers.FormatNumber(t.TotalTickets), SalesTypeCode = FormatHelpers.FormatSalesType(t.SalesTypeID), //t.SalesType.SalesTypeCode, //FormatSalesType IsPastDue = this.IsPastDue(dueDate, t.PeriodEndDate), //CanEdit = this.CanEditTopline(t.BPSR_StatusID, isAdmin, isApprover), //CanApprove = this.CanApproveTopline(t.BPSR_StatusID, isAdmin, isApprover), //CanSubmit = this.CanSubmitTopline(t.BPSR_StatusID, isAdmin, isApprover) CanEdit = this.CanEditTopline(t.BPSR_StatusID, isAdmin, isApprover), CanApprove = this.CanApproveTopline(t.BPSR_StatusID, isAdmin, isApprover), CanSubmit = this.CanSubmitTopline(t.BPSR_StatusID, t.SubmitterName, approverName, isAdmin, isApprover) }; results.Add(item); } return(results); }
public override void UpdateTextureCube( Texture textureCube, IntPtr source, uint sizeInBytes, CubeFace face, uint x, uint y, uint width, uint height, uint mipLevel, uint arrayLayer) { Texture2D deviceTexture = Util.AssertSubtype <Texture, D3D11Texture>(textureCube).DeviceTexture; ResourceRegion resourceRegion = new ResourceRegion( left: (int)x, right: (int)x + (int)width, top: (int)y, bottom: (int)y + (int)height, front: 0, back: 1); uint srcRowPitch = FormatHelpers.GetSizeInBytes(textureCube.Format) * width; int subresource = GetSubresource(face, mipLevel, textureCube.MipLevels); _context.UpdateSubresource(deviceTexture, subresource, resourceRegion, source, (int)srcRowPitch, 0); }
public Tuple <string, string> Reconcile(CommandContext ctx, string merits, string credits) { var bank = MultiBotDb.Bank.Single(x => x.OrgId == new OrgController().GetOrgId(ctx.Guild)); var differenceMerits = Math.Abs(bank.Merits - int.Parse(merits)).ToString(); var differenceCredits = Math.Abs((int)bank.Balance - int.Parse(credits)).ToString(); if (int.Parse(credits) < (int)bank.Balance) { differenceCredits = $"-{differenceCredits}"; } if (int.Parse(merits) < (int)bank.Merits) { differenceMerits = $"-{differenceMerits}"; } bank.Merits = int.Parse(merits); bank.Balance = int.Parse(credits); MultiBotDb.Bank.Update(bank); MultiBotDb.SaveChanges(); return(new Tuple <string, string>(FormatHelpers.FormattedNumber(differenceCredits.ToString()), FormatHelpers.FormattedNumber(differenceMerits.ToString()))); }
public async Task <IActionResult> Put(int id, [FromBody] Client client) { try { if (id <= 0) { return(BadRequest("Invalid ID.")); } if (!ModelState.IsValid) { return(BadRequest(FormatHelpers.FormatValidationErrorMessage(ModelState.Values))); } var updatedClient = await _clientsDataService.UpdateClient(id, client); return(Ok(updatedClient)); } catch (ClientNotFoundException e) { _logger.LogError(0, e, e.Message); return(NotFound(e.Message)); } catch (Exception e) { _logger.LogError(0, e, e.Message); return(BadRequest(e.Message)); } }
internal uint GetSubresourceSize(uint mipLevel, uint arrayLayer) { uint pixelSize = FormatHelpers.GetSizeInBytes(Format); Util.GetMipDimensions(this, mipLevel, out uint width, out uint height, out uint depth); return(pixelSize * width * height * depth); }
public void SetIndices(IntPtr indices, IndexFormat format, int count, int elementOffset) { int elementSizeInBytes = FormatHelpers.GetIndexFormatElementByteSize(format); SetData(indices, elementSizeInBytes * count, elementOffset * elementSizeInBytes); IndexType = VkFormats.VeldridToVkIndexFormat(format); }
public override MTLRenderPassDescriptor CreateRenderPassDescriptor() { MTLRenderPassDescriptor ret = MTLRenderPassDescriptor.New(); for (int i = 0; i < ColorTargets.Count; i++) { FramebufferAttachment colorTarget = ColorTargets[i]; MTLTexture mtlTarget = Util.AssertSubtype <Texture, MTLTexture>(colorTarget.Target); MTLRenderPassColorAttachmentDescriptor colorDescriptor = ret.colorAttachments[(uint)i]; colorDescriptor.texture = mtlTarget.DeviceTexture; colorDescriptor.loadAction = MTLLoadAction.Load; colorDescriptor.slice = (UIntPtr)colorTarget.ArrayLayer; } if (DepthTarget != null) { MTLTexture mtlDepthTarget = Util.AssertSubtype <Texture, MTLTexture>(DepthTarget.Value.Target); MTLRenderPassDepthAttachmentDescriptor depthDescriptor = ret.depthAttachment; depthDescriptor.loadAction = MTLLoadAction.Load; depthDescriptor.storeAction = MTLStoreAction.Store; depthDescriptor.texture = mtlDepthTarget.DeviceTexture; depthDescriptor.slice = (UIntPtr)DepthTarget.Value.ArrayLayer; if (FormatHelpers.IsStencilFormat(mtlDepthTarget.Format)) { MTLRenderPassStencilAttachmentDescriptor stencilDescriptor = ret.stencilAttachment; stencilDescriptor.loadAction = MTLLoadAction.Load; stencilDescriptor.storeAction = MTLStoreAction.Store; stencilDescriptor.texture = mtlDepthTarget.DeviceTexture; stencilDescriptor.slice = (UIntPtr)DepthTarget.Value.ArrayLayer; } } return(ret); }
public DiscordEmbed GetBankBalanceEmbed(DiscordGuild guild) { DiscordEmbedBuilder builder = new DiscordEmbedBuilder(); builder.Title = $"{guild.Name} Bank"; builder.Timestamp = DateTime.Now; builder.AddField("Current Balance:", $"{FormatHelpers.FormattedNumber(GetBankBalance(guild).ToString())} aUEC", true); builder.AddField("Current Merits:", $"{FormatHelpers.FormattedNumber(GetBankMeritBalance(guild).ToString())}", true); builder.AddField("\nTop Contributors", "Keep up the good work!", false).WithColor(DiscordColor.Red); foreach (var trans in new TransactionController().GetTopTransactions(guild)) { builder.AddField(trans.MemberName, $"Credits: {FormatHelpers.FormattedNumber(trans.Amount.ToString())} aUEC"); } builder.AddField("Top Merits Contributors", "Keep up the good work!", true).WithColor(DiscordColor.Red); foreach (var trans in new TransactionController().GetTopMeritTransactions(guild)) { builder.AddField(trans.MemberName, $"{FormatHelpers.FormattedNumber(trans.Merits.ToString())} Merits"); } return(builder.Build()); }
public async Task <ActionResult> Index(string matNo, string name, UnitType unit = UnitType.AbsoluteMoney, RevenueGroupType tab = RevenueGroupType.Expenditure, MatFinancingType financing = MatFinancingType.TrustAndAcademies, ChartFormat format = ChartFormat.Charts) { ChartGroupType chartGroup; switch (tab) { case RevenueGroupType.Expenditure: chartGroup = ChartGroupType.TotalExpenditure; break; case RevenueGroupType.Income: chartGroup = ChartGroupType.TotalIncome; break; case RevenueGroupType.Balance: chartGroup = ChartGroupType.InYearBalance; break; default: chartGroup = ChartGroupType.All; break; } var latestYear = _financialDataService.GetLatestDataYearForTrusts(); var term = FormatHelpers.FinancialTermFormatAcademies(latestYear); var dataResponse = _financialDataService.GetAcademiesByMatNumber(term, matNo); var sponsorVM = await BuildSponsorVMAsync(matNo, name, dataResponse, tab, chartGroup, financing); List <string> terms = _financialDataService.GetActiveTermsForMatCentral(); var latestTerm = terms.First(); UnitType unitType; switch (tab) { case RevenueGroupType.Workforce: unitType = UnitType.AbsoluteCount; break; case RevenueGroupType.Balance: unitType = unit == UnitType.AbsoluteMoney || unit == UnitType.PerPupil || unit == UnitType.PerTeacher ? unit : UnitType.AbsoluteMoney; break; default: unitType = unit; break; } _fcService.PopulateHistoricalChartsWithSchoolData(sponsorVM.HistoricalCharts, sponsorVM.HistoricalSchoolFinancialDataModels, latestTerm, tab, unitType, SchoolFinancialType.Academies); ViewBag.Tab = tab; ViewBag.ChartGroup = chartGroup; ViewBag.UnitType = unitType; ViewBag.Financing = financing; ViewBag.ChartFormat = format; return(View(sponsorVM)); }
public override void UpdateTexture( Texture texture, IntPtr source, uint sizeInBytes, uint x, uint y, uint z, uint width, uint height, uint depth, uint mipLevel, uint arrayLayer) { Texture2D deviceTexture = Util.AssertSubtype <Texture, D3D11Texture>(texture).DeviceTexture; ResourceRegion resourceRegion = new ResourceRegion( left: (int)x, top: (int)y, front: (int)z, right: (int)(x + width), bottom: (int)(y + height), back: (int)(z + depth)); uint srcRowPitch = FormatHelpers.GetSizeInBytes(texture.Format) * width; _context.UpdateSubresource(deviceTexture, (int)mipLevel, resourceRegion, source, (int)srcRowPitch, 0); }
public unsafe void GetTextureData(int mipLevel, IntPtr destination, int storageSizeInBytes) { int width = MipmapHelper.GetDimension(Width, mipLevel); int height = MipmapHelper.GetDimension(Height, mipLevel); Bind(); GL.GetTexImage(TextureTarget.Texture2D, mipLevel, OpenTK.Graphics.OpenGL.PixelFormat.Alpha, _pixelType, destination); GL.BindTexture(TextureTarget.Texture2D, 0); GL.PixelStore(PixelStoreParameter.PackAlignment, 1); // Need to reverse the rows vertically. int pixelSizeInBytes = FormatHelpers.GetPixelSizeInBytes(_veldridFormat); int rowBytes = width * pixelSizeInBytes; IntPtr stagingRow = Marshal.AllocHGlobal(rowBytes); byte * stagingPtr = (byte *)stagingRow.ToPointer(); byte * sourcePtr = (byte *)destination.ToPointer(); for (int y = height - 1, destY = 0; y > (height / 2); y--) { Buffer.MemoryCopy(sourcePtr + (y * rowBytes), stagingPtr, rowBytes, rowBytes); Buffer.MemoryCopy(sourcePtr + (destY * rowBytes), sourcePtr + (y * rowBytes), rowBytes, rowBytes); Buffer.MemoryCopy(stagingPtr, sourcePtr + (destY * rowBytes), rowBytes, rowBytes); destY++; } // Reset to default value. GL.PixelStore(PixelStoreParameter.PackAlignment, 4); }
/// <summary> /// Creates a new <see cref="Pipeline"/> object. /// </summary> /// <param name="description">The desired properties of the created object.</param> /// <returns>A new <see cref="Pipeline"/> which, when bound to a CommandList, is used to dispatch draw commands.</returns> public Pipeline CreateGraphicsPipeline(ref GraphicsPipelineDescription description) { #if VALIDATE_USAGE if (!description.RasterizerState.DepthClipEnabled && !Features.DepthClipDisable) { throw new VeldridException( "RasterizerState.DepthClipEnabled must be true if GraphicsDeviceFeatures.DepthClipDisable is not supported."); } if (description.RasterizerState.FillMode == PolygonFillMode.Wireframe && !Features.FillModeWireframe) { throw new VeldridException( "PolygonFillMode.Wireframe requires GraphicsDeviceFeatures.FillModeWireframe."); } if (!Features.IndependentBlend) { if (description.BlendState.AttachmentStates.Length > 0) { BlendAttachmentDescription attachmentState = description.BlendState.AttachmentStates[0]; for (int i = 1; i < description.BlendState.AttachmentStates.Length; i++) { if (!attachmentState.Equals(description.BlendState.AttachmentStates[i])) { throw new VeldridException( $"If GraphcsDeviceFeatures.IndependentBlend is false, then all members of BlendState.AttachmentStates must be equal."); } } } } foreach (VertexLayoutDescription layoutDesc in description.ShaderSet.VertexLayouts) { bool hasExplicitLayout = false; uint minOffset = 0; foreach (VertexElementDescription elementDesc in layoutDesc.Elements) { if (hasExplicitLayout && elementDesc.Offset == 0) { throw new VeldridException( $"If any vertex element has an explicit offset, then all elements must have an explicit offset."); } if (elementDesc.Offset != 0 && elementDesc.Offset < minOffset) { throw new VeldridException( $"Vertex element \"{elementDesc.Name}\" has an explicit offset which overlaps with the previous element."); } minOffset = elementDesc.Offset + FormatHelpers.GetSizeInBytes(elementDesc.Format); hasExplicitLayout |= elementDesc.Offset != 0; } if (minOffset > layoutDesc.Stride) { throw new VeldridException( $"The vertex layout's stride ({layoutDesc.Stride}) is less than the full size of the vertex ({minOffset})"); } } #endif return(CreateGraphicsPipelineCore(ref description)); }
public async Task Format_inserted_to_database() { var format = await FormatHelpers.CreateValidFormat(); var repository = new FormatRepository(_fixture.Context); (await repository.ExistsAsync(format.Id)).Should().BeTrue(); }
internal void GetSubresourceLayout(uint mipLevel, uint arrayLayer, out uint rowPitch, out uint depthPitch) { uint pixelSize = FormatHelpers.GetSizeInBytes(Format); Util.GetMipDimensions(this, mipLevel, out uint mipWidth, out uint mipHeight, out uint mipDepth); rowPitch = mipWidth * pixelSize; depthPitch = rowPitch * Height; }
private static Quote GetQuote(XmlNode node) { return(new Quote( FormatHelpers.ParseShortDateTime(node.Attributes[XmlDatabase.IdAttribute].Value), node.Attributes[TitleAttribute].Value, node.Attributes[ContentAttribute].Value, node.Attributes[AuthorAttribute].Value)); }
public Quote(DateTime date, string title, string content, string author) { _id = FormatHelpers.DateTimeToShortString(date); Date = date; Title = title; Content = content; Author = author; }
public void FormatHashSet_single_item_HashSet_returns_single_item_ToString() { var nodeTypes = new HashSet <NodeType> { NodeType.Publisher }; Assert.AreEqual(NodeType.Publisher.ToString(), FormatHelpers.FormatHashSet(nodeTypes)); }
public void FormatValidationErrorMessage_ShouldThrowArgumentNullException_WhenParamIsNull() { // Arrange // Act Action action = () => FormatHelpers.FormatValidationErrorMessage(null); // Assert action.Should().Throw <ArgumentNullException>(); }
public OpenGLVertexInputElement(VertexInputElement genericElement, int offset) { SizeInBytes = genericElement.SizeInBytes; ElementCount = FormatHelpers.GetElementCount(genericElement.ElementFormat); Type = GetGenericFormatType(genericElement.ElementFormat); Offset = offset; Normalized = genericElement.SemanticType == VertexSemanticType.Color && genericElement.ElementFormat == VertexElementFormat.Byte4; InstanceStepRate = genericElement.InstanceStepRate; }
public MTLTexture(ref TextureDescription description, MTLGraphicsDevice _gd) { Width = description.Width; Height = description.Height; Depth = description.Depth; ArrayLayers = description.ArrayLayers; MipLevels = description.MipLevels; Format = description.Format; Usage = description.Usage; Type = description.Type; SampleCount = description.SampleCount; bool isDepth = (Usage & TextureUsage.DepthStencil) == TextureUsage.DepthStencil; MTLPixelFormat = MTLFormats.VdToMTLPixelFormat(Format, isDepth); MTLTextureType = MTLFormats.VdToMTLTextureType( Type, ArrayLayers, SampleCount != TextureSampleCount.Count1, (Usage & TextureUsage.Cubemap) != 0); if (Usage != TextureUsage.Staging) { MTLTextureDescriptor texDescriptor = MTLTextureDescriptor.New(); texDescriptor.width = (UIntPtr)Width; texDescriptor.height = (UIntPtr)Height; texDescriptor.depth = (UIntPtr)Depth; texDescriptor.mipmapLevelCount = (UIntPtr)MipLevels; texDescriptor.arrayLength = (UIntPtr)ArrayLayers; texDescriptor.sampleCount = (UIntPtr)FormatHelpers.GetSampleCountUInt32(SampleCount); texDescriptor.textureType = MTLTextureType; texDescriptor.pixelFormat = MTLPixelFormat; texDescriptor.textureUsage = MTLFormats.VdToMTLTextureUsage(Usage); texDescriptor.storageMode = MTLStorageMode.Private; DeviceTexture = _gd.Device.newTextureWithDescriptor(texDescriptor); ObjectiveCRuntime.release(texDescriptor.NativePtr); } else { uint blockSize = FormatHelpers.IsCompressedFormat(Format) ? 4u : 1u; uint totalStorageSize = 0; for (uint level = 0; level < MipLevels; level++) { Util.GetMipDimensions(this, level, out uint levelWidth, out uint levelHeight, out uint levelDepth); uint storageWidth = Math.Max(levelWidth, blockSize); uint storageHeight = Math.Max(levelHeight, blockSize); totalStorageSize += levelDepth * FormatHelpers.GetDepthPitch( FormatHelpers.GetRowPitch(levelWidth, Format), levelHeight, Format); } totalStorageSize *= ArrayLayers; StagingBuffer = _gd.Device.newBufferWithLengthOptions( (UIntPtr)totalStorageSize, MTLResourceOptions.StorageModeShared); } }
public string[] GetTextDocument() { return(new string[] { "Subject:\t" + _task.Subject, "Start Date:\t" + (_task.StartDate.HasValue? FormatHelpers.FormatDate(_task.StartDate.Value) : "None"), "Due Date:\t" + (_task.DueDate.HasValue ? FormatHelpers.FormatDate(_task.DueDate.Value) : "None"), "Status:\t\t" + _task.Status.ConvertToString(), "Priority:\t" + _task.Priority.ToString(), "Progress:\t" + _task.Progress.ToString() + "%", "Details:\t" + _task.Details }); }
public void FormatHashSet_two_items_HashSet_contains_both_items_as_ToString() { var nodeTypes = new HashSet <NodeType> { NodeType.Publisher, NodeType.Subscriber }; var formatted = FormatHelpers.FormatHashSet(nodeTypes); Assert.IsTrue(formatted.Contains(NodeType.Publisher.ToString()), formatted); Assert.IsTrue(formatted.Contains(NodeType.Subscriber.ToString()), formatted); }
public DamageTrackerFormatter(DamageTracker damageTracker, FormatHelpers formatHelpers) { var placeHolders = new List <KeyValuePair <string, object> >(); placeHolders.Add(new KeyValuePair <string, object>("Boss", damageTracker.Name ?? string.Empty)); placeHolders.Add(new KeyValuePair <string, object>("Time", formatHelpers.FormatTimeSpan(damageTracker.Duration))); Placeholders = placeHolders.ToDictionary(x => x.Key, y => y.Value); FormatProvider = formatHelpers.CultureInfo; }
/// <summary> /// This returns the names of tables that have a set of foreign keys which map to all of the primary keys of the from/to tables /// </summary> /// <param name="fromKeys"></param> /// <param name="toKeys"></param> /// <param name="fromTableName"></param> /// <param name="toTableName"></param> /// <returns></returns> private IEnumerable <string> AllManyToManyTablesThatHaveTheRightForeignKeys( IEnumerable <EfColumnInfo> fromKeys, IEnumerable <EfColumnInfo> toKeys, string fromTableName, string toTableName) { //we form all the keys that we expect to see in the ReferencedTable/Col part of the many-to-many table var allKeys = fromKeys.Select(x => FormatHelpers.CombineTableAndColumnNames(fromTableName, x.SqlColumnName)).ToList(); allKeys.AddRange(toKeys .Select(x => FormatHelpers.CombineTableAndColumnNames(toTableName, x.SqlColumnName))); return(_foreignKeysGroupByParentTableName.Where(x => x.Item2.SequenceEqual(allKeys.OrderBy(y => y))).Select(x => x.Item1)); }