/// <inheritdoc/> public override string ToString() => FormattableString.Invariant($"CieLuv({this.L:#0.##}, {this.U:#0.##}, {this.V:#0.##})");
public void AddSvgStart(VecInt width, VecInt height) { state.Output.AppendLine(FormattableString.Invariant( $"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"{width.Value}\" height=\"{height.Value}\">" )); }
public override string ToString() { return(FormattableString.Invariant($"({X}, {Y}, {Z})")); }
/// <inheritdoc /> public override string ToString() { return(FormattableString.Invariant($"R32G32B32A32_FLOAT({this.R}, {this.G}, {this.B}, {this.A})")); }
public static string StaticMethod(int p1 = 1, string p2 = "test", decimal p3 = 3.14m) { return(FormattableString.Invariant($"{p1}, {p2}, {p3}")); }
void HandleEncryptRequest(IPacketMsg packetMsg) { var request = new Msg <MsgChannelEncryptRequest>(packetMsg); var connectedUniverse = request.Body.Universe; var protoVersion = request.Body.ProtocolVersion; DebugLog.WriteLine(nameof(EnvelopeEncryptedConnection), "Got encryption request. Universe: {0} Protocol ver: {1}", connectedUniverse, protoVersion); DebugLog.Assert(protoVersion == 1, nameof(EnvelopeEncryptedConnection), "Encryption handshake protocol version mismatch!"); DebugLog.Assert(connectedUniverse == universe, nameof(EnvelopeEncryptedConnection), FormattableString.Invariant($"Expected universe {universe} but server reported universe {connectedUniverse}")); byte[] randomChallenge; if (request.Payload.Length >= 16) { randomChallenge = request.Payload.ToArray(); } else { randomChallenge = null; } var publicKey = KeyDictionary.GetPublicKey(connectedUniverse); if (publicKey == null) { DebugLog.WriteLine(nameof(EnvelopeEncryptedConnection), "HandleEncryptRequest got request for invalid universe! Universe: {0} Protocol ver: {1}", connectedUniverse, protoVersion); Disconnect(userInitiated: false); } var response = new Msg <MsgChannelEncryptResponse>(); var tempSessionKey = CryptoHelper.GenerateRandomBlock(32); byte[] encryptedHandshakeBlob = null; using (var rsa = new RSACrypto(publicKey)) { if (randomChallenge != null) { var blobToEncrypt = new byte[tempSessionKey.Length + randomChallenge.Length]; Array.Copy(tempSessionKey, blobToEncrypt, tempSessionKey.Length); Array.Copy(randomChallenge, 0, blobToEncrypt, tempSessionKey.Length, randomChallenge.Length); encryptedHandshakeBlob = rsa.Encrypt(blobToEncrypt); } else { encryptedHandshakeBlob = rsa.Encrypt(tempSessionKey); } } var keyCrc = CryptoHelper.CRCHash(encryptedHandshakeBlob); response.Write(encryptedHandshakeBlob); response.Write(keyCrc); response.Write(( uint )0); if (randomChallenge != null) { encryption = new NetFilterEncryptionWithHMAC(tempSessionKey); } else { encryption = new NetFilterEncryption(tempSessionKey); } state = EncryptionState.Challenged; Send(response.Serialize()); }
public void ConvertTo_NotNetFramework(float width, float height) { TestConvertToString(new SizeF(width, height), FormattableString.Invariant($"{width}, {height}")); }
private static T MakeInstanceOfAsn1Object <T>(long nodeStartOffset, Asn1Class asn1Class, bool constructed, int tag, SubStream content) where T : Asn1ObjectBase { T foundObject; Asn1ObjectBase shouldBeType = null; if (asn1Class == Asn1Class.ContextSpecific) { shouldBeType = new Asn1ContextSpecific(constructed, tag, content); } else { switch ((Asn1Type)tag) { case Asn1Type.Eoc: shouldBeType = new Asn1Eoc(); break; case Asn1Type.Boolean: shouldBeType = new Asn1Boolean(content, constructed); break; case Asn1Type.Integer: shouldBeType = new Asn1Integer(content, constructed); break; case Asn1Type.BitString: shouldBeType = new Asn1BitString(content, constructed); break; case Asn1Type.OctetString: shouldBeType = new Asn1OctetString(content, constructed); break; case Asn1Type.Null: shouldBeType = new Asn1Null(constructed); break; case Asn1Type.ObjectIdentifier: shouldBeType = new Asn1ObjectIdentifier(content, constructed); break; case Asn1Type.Real: shouldBeType = new Asn1Real(content, constructed); break; case Asn1Type.Enumerated: shouldBeType = new Asn1Enumerated(content, constructed); break; case Asn1Type.Utf8String: shouldBeType = new Asn1Utf8String(content, constructed); break; case Asn1Type.RelativeOid: shouldBeType = new Asn1RelativeOid(content, constructed); break; case Asn1Type.Sequence: shouldBeType = new Asn1Sequence(asn1Class, content, constructed); break; case Asn1Type.Set: shouldBeType = new Asn1Set(asn1Class, content, constructed); break; case Asn1Type.NumericString: shouldBeType = new Asn1NumericString(content, constructed); break; case Asn1Type.PrintableString: shouldBeType = new Asn1PrintableString(content, constructed); break; case Asn1Type.T61String: shouldBeType = new Asn1T61String(content, constructed); break; case Asn1Type.Ia5String: shouldBeType = new Asn1Ia5String(content, constructed); break; case Asn1Type.UtcTime: shouldBeType = new Asn1UtcTime(content, constructed); break; case Asn1Type.GeneralizedTime: shouldBeType = new Asn1GeneralizedTime(content, constructed); break; case Asn1Type.GraphicString: shouldBeType = new Asn1GraphicString(content, constructed); break; case Asn1Type.GeneralString: shouldBeType = new Asn1GeneralString(content, constructed); break; case Asn1Type.UniversalString: shouldBeType = new Asn1UniversalString(content, constructed); break; case Asn1Type.BmpString: shouldBeType = new Asn1BmpString(content, constructed); break; case Asn1Type.ObjectDescriptor: case Asn1Type.External: case Asn1Type.EmbeddedPdv: case Asn1Type.VideotexString: case Asn1Type.VisibleString: case Asn1Type.CharacterString: case Asn1Type.LongForm: default: throw new NotSupportedException($"ASN.1 tag {tag} is unsupported."); } } foundObject = shouldBeType as T; // sanity check if (foundObject == null) { throw new FormatException(FormattableString.Invariant($"ASN.1 node at offset {nodeStartOffset} is of type {shouldBeType.GetType()} but expected type was {typeof(T)}")); } return(foundObject); }
public async Task <byte[]> GetStatsImageAsync() { var binanceClient = new BinanceClient(); var btcMcoPrice = await binanceClient.Get24HPriceAsync("MCOBTC"); var ethMcoPrice = await binanceClient.Get24HPriceAsync("MCOETH"); var btcUsdtPrice = await binanceClient.Get24HPriceAsync("BTCUSDT"); var mcoDollarPrice = btcMcoPrice.Data.LastPrice * btcUsdtPrice.Data.LastPrice; var mcoDollarPercentage = ((1 + btcMcoPrice.Data.PriceChangePercent / 100) * (1 + btcUsdtPrice.Data.PriceChangePercent / 100) - 1) * 100m; var greenColor = Color.FromArgb(112, 168, 0); var redColor = Color.FromArgb(234, 0, 112); var mcoBlueColor = Color.FromArgb(0, 45, 114); var mcoGrayColor = Color.FromArgb(33, 37, 41); var lightGrayColor = Color.FromArgb(128, 128, 128); var largeFont = new Font("Roboto Medium", 28); var mediumFont = new Font("Roboto Medium", 12); var smallFont = new Font("Roboto", 8); var mcoBluebrush = new SolidBrush(mcoBlueColor); var blackBrush = new SolidBrush(mcoGrayColor); var redBrush = new SolidBrush(redColor); var greenBrush = new SolidBrush(greenColor); var grayBrush = new SolidBrush(lightGrayColor); var reservations = await McoLifeService.GetReservations(); var left = 10; var leftFix = 1; var top = 67; using (var bg = Bitmap.FromFile("MCO_bg.png")) { using (var memStr = new MemoryStream()) { var gr = Graphics.FromImage(bg); gr.TextRenderingHint = TextRenderingHint.AntiAlias; gr.DrawString(FormattableString.Invariant($"MCO Stats on {DateTime.UtcNow:yyyy-MM-dd HH:mm:ss} UTC"), smallFont, grayBrush, 186, 11); var usdPercentage = FormattableString.Invariant($"{mcoDollarPercentage:0.00}%"); var usdPercentageSize = gr.MeasureString(usdPercentage, mediumFont); gr.DrawString(usdPercentage, mediumFont, mcoDollarPercentage >= 0m ? greenBrush : redBrush, bg.Width - usdPercentageSize.Width - left, top + 35); var usdPrice = FormattableString.Invariant($"${mcoDollarPrice:0.00}"); var usdPriceSize = gr.MeasureString(usdPrice, largeFont); gr.DrawString(usdPrice, largeFont, mcoBluebrush, bg.Width - usdPriceSize.Width - left - usdPercentageSize.Width + 8, top + 16); gr.DrawString("Price", smallFont, grayBrush, left + leftFix, top += 10); var btcPrice = FormattableString.Invariant($"{btcMcoPrice.Data.LastPrice:0.000000} BTC"); var btcPriceSize = gr.MeasureString(btcPrice, mediumFont); gr.DrawString(btcPrice, mediumFont, blackBrush, left, top += 10); gr.DrawString(FormattableString.Invariant($"{btcMcoPrice.Data.PriceChangePercent:0.00}%"), mediumFont, btcMcoPrice.Data.PriceChangePercent >= 0 ? greenBrush : redBrush, left + btcPriceSize.Width, top); var ethPrice = FormattableString.Invariant($"{ethMcoPrice.Data.LastPrice:0.000000} ETH"); var ethPriceSize = gr.MeasureString(ethPrice, mediumFont); gr.DrawString(ethPrice, mediumFont, blackBrush, left, top += 15); gr.DrawString(FormattableString.Invariant($"{ethMcoPrice.Data.PriceChangePercent:0.00}%"), mediumFont, ethMcoPrice.Data.PriceChangePercent >= 0 ? greenBrush : redBrush, left + ethPriceSize.Width, top); gr.DrawString("24H Volume (Binance)", smallFont, grayBrush, left + leftFix, top += 20); gr.DrawString(FormattableString.Invariant($"{btcMcoPrice.Data.QuoteVolume:0.00} BTC / {btcMcoPrice.Data.Volume:#,##0.00} MCO"), mediumFont, blackBrush, left, top += 11); gr.DrawString(FormattableString.Invariant($"{ethMcoPrice.Data.QuoteVolume:0.00} ETH / {ethMcoPrice.Data.Volume:#,##0.00} MCO"), mediumFont, blackBrush, left, top += 15); gr.DrawString("Reservations", smallFont, grayBrush, left + leftFix, top += 20); gr.DrawString(FormattableString.Invariant($"Total: {reservations.Total:#,###}"), mediumFont, blackBrush, left, top += 10); gr.DrawString(FormattableString.Invariant($"Today: {reservations.Today:#,##0}"), mediumFont, blackBrush, left, top += 15); gr.DrawString("BTC Price", smallFont, grayBrush, left + leftFix, top += 20); gr.DrawString(FormattableString.Invariant($"${btcUsdtPrice.Data.LastPrice:#,###,###.00}"), mediumFont, blackBrush, left, top += 10); gr.Save(); bg.Save(memStr, ImageFormat.Png); return(memStr.ToArray()); } } }
/// <inheritdoc/> public override string ToString() => FormattableString.Invariant($"CieLab({this.L:#0.##}, {this.A:#0.##}, {this.B:#0.##})");
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddControllersWithViews(); services.AddGraphQL( SchemaBuilder.New() .AddQueryType <Query>() .AddAuthorizeDirectiveType()); services .AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) // NOTE: This is an enhanced version of AddJwtBearer that have some utility functions and defaults for Microsoft account. // This parses ClaimsPrincipal from Bearer Authorization header. .AddMicrosoftWebApi(config => { }, config => { Configuration.Bind("Authentication:Microsoft", config); }) // NOTE: cookie authentication and OIDC is used to handle authentication in web browser .AddCookie(config => { // NOTE: This is used needed if you want to automatically trigger Microsoft OIDC below for authentication config.ForwardChallenge = "Microsoft"; // Alternatively, you can have a sign in page to allow user to choose among different identity provider //config.LoginPath = "/Login"; }) .AddOpenIdConnect("Microsoft", config => { config.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; Configuration.Bind("Authentication:Microsoft", config); // NOTE: For multitenant, the issuer is of the form https://login.microsoftonline.com/{tenantid}/v2.0. // Hence, we cannot preset ValidIssuers. // In this case, a custom validation is needed. config.TokenValidationParameters.IssuerValidator = new IssuerValidator((issuer, token, parameters) => { // Accepts any issuer of the form "https://login.microsoftonline.com/{tenantid}/v2.0", // where tenantid is the tid from the token. if (token is JwtSecurityToken jwt) { if (jwt.Payload.TryGetValue("tid", out var value) && value is string tokenTenantId) { var issuers = (parameters.ValidIssuers ?? Enumerable.Empty <string>()) .Append(parameters.ValidIssuer) .Where(i => !string.IsNullOrEmpty(i)); if (issuers.Any(i => i.Replace("{tenantid}", tokenTenantId) == issuer)) { return(issuer); } } } // Recreate the exception that is thrown by default // when issuer validation fails var validIssuer = parameters.ValidIssuer ?? "null"; var validIssuers = parameters.ValidIssuers == null ? "null" : !parameters.ValidIssuers.Any() ? "empty" : string.Join(", ", parameters.ValidIssuers); string errorMessage = FormattableString.Invariant( $"IDX10205: Issuer validation failed. Issuer: '{issuer}'. Did not match: validationParameters.ValidIssuer: '{validIssuer}' or validationParameters.ValidIssuers: '{validIssuers}'."); throw new SecurityTokenInvalidIssuerException(errorMessage) { InvalidIssuer = issuer }; }); }); services.AddAuthorization(config => { // NOTE: this is needed to change the default policy of all AuthorizeAttribute to use both JWT and Cookie for authentication scheme var defaultAuthorizationPolicyBuilder = new AuthorizationPolicyBuilder( JwtBearerDefaults.AuthenticationScheme, CookieAuthenticationDefaults.AuthenticationScheme ); defaultAuthorizationPolicyBuilder = defaultAuthorizationPolicyBuilder.RequireAuthenticatedUser(); config.DefaultPolicy = defaultAuthorizationPolicyBuilder.Build(); }); }
private void DrawMonthCalendar(int month, int year) { TimeTableGrid.Visibility = Visibility.Collapsed; MonthLabel.Content = monthsNames[month]; YearLabel.Content = FormattableString.Invariant($"{year}"); BtnLastValue.Content = "Last Month"; BtnNextValue.Content = "Next Month"; NameDaysLabels(); int firstDay = GetFirstDayValue(year, month); daysInMonth = DateTime.DaysInMonth(year, month); int totalCollumns = 7; int totalRows = 7; int dateNumber = 1; List <Schedule> ScheduleList = GetAllSchedules(); CalendarGrid.Children.Clear(); BuildRows("MONTH"); AddWeekendBackgrounds(); for (int FirstRowCollumn = firstDay; FirstRowCollumn < totalCollumns; FirstRowCollumn++) { Grid daygrid = new Grid(); daygrid.RowDefinitions.Add(new RowDefinition()); daygrid.RowDefinitions.Add(new RowDefinition()); CalendarGrid.Children.Add(daygrid); Grid.SetRow(daygrid, 0); Grid.SetColumn(daygrid, FirstRowCollumn); Label label = new Label { Content = dateNumber }; label.MouseDoubleClick += (s, e) => BtnFocusWeek(s, e); daygrid.Children.Add(label); if (ScheduleList.Exists(x => x.CheckStartingDate(currentYear, currentMonth, dateNumber))) { Schedule schedule = ScheduleList.Find(x => x.CheckStartingDate(currentYear, currentMonth, dateNumber)); Border ScheduleBorder = new Border() { Background = Brushes.Blue, Child = new TextBlock() { Text = schedule.GetTitle(), Foreground = Brushes.White } }; daygrid.Children.Add(ScheduleBorder); Grid.SetRow(ScheduleBorder, 1); } dateNumber++; } for (int row = 1; row < totalRows; row++) { for (int collumn = 0; collumn < totalCollumns; collumn++) { if (dateNumber <= daysInMonth) { Grid daygrid = new Grid(); daygrid.RowDefinitions.Add(new RowDefinition()); daygrid.RowDefinitions.Add(new RowDefinition()); CalendarGrid.Children.Add(daygrid); Grid.SetRow(daygrid, row); Grid.SetColumn(daygrid, collumn); Label label = new Label { Content = dateNumber }; label.MouseDoubleClick += (s, e) => BtnFocusWeek(s, e); daygrid.Children.Add(label); if (ScheduleList.Exists(x => x.CheckStartingDate(currentYear, currentMonth, dateNumber))) { Schedule schedule = ScheduleList.Find(x => x.CheckStartingDate(currentYear, currentMonth, dateNumber)); Border ScheduleBorder = new Border() { Background = Brushes.Blue, Child = new TextBlock() { Text = schedule.GetTitle(), Foreground = Brushes.White } }; daygrid.Children.Add(ScheduleBorder); Grid.SetRow(ScheduleBorder, 1); } dateNumber++; } } } }
public static string GetCoordString(this Point p) => FormattableString.Invariant($"{p.X},{p.Y}");
/// <summary> /// Adds the Cache-Control and Pragma HTTP headers by applying the specified cache profile to the HTTP context. /// </summary> /// <param name="context">The HTTP context.</param> /// <param name="cacheProfile">The cache profile.</param> /// <returns>The same HTTP context.</returns> /// <exception cref="System.ArgumentNullException">context or cacheProfile.</exception> public static HttpContext ApplyCacheProfile(this HttpContext context, CacheProfile cacheProfile) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (cacheProfile == null) { throw new ArgumentNullException(nameof(cacheProfile)); } var headers = context.Response.Headers; if (!string.IsNullOrEmpty(cacheProfile.VaryByHeader)) { headers[HeaderNames.Vary] = cacheProfile.VaryByHeader; } if (cacheProfile.NoStore == true) { // Cache-control: no-store, no-cache is valid. if (cacheProfile.Location == ResponseCacheLocation.None) { headers[HeaderNames.CacheControl] = NoStoreNoCache; headers[HeaderNames.Pragma] = NoCache; } else { headers[HeaderNames.CacheControl] = NoStore; } } else { string cacheControlValue; var duration = cacheProfile.Duration.GetValueOrDefault().ToString(CultureInfo.InvariantCulture); switch (cacheProfile.Location) { case ResponseCacheLocation.Any: cacheControlValue = PublicMaxAge + duration; break; case ResponseCacheLocation.Client: cacheControlValue = PrivateMaxAge + duration; break; case ResponseCacheLocation.None: cacheControlValue = NoCacheMaxAge + duration; headers[HeaderNames.Pragma] = NoCache; break; default: var exception = new NotImplementedException(FormattableString.Invariant($"Unknown {nameof(ResponseCacheLocation)}: {cacheProfile.Location}")); Debug.Fail(exception.ToString()); throw exception; } headers[HeaderNames.CacheControl] = cacheControlValue; } return(context); }
private static string Invariant(double value) { return(FormattableString.Invariant($"{value}")); }
private async Task ToolbarEditorClick(Syncfusion.Blazor.Navigations.ClickEventArgs args) { var diagram = Parent.DiagramContent.Diagram; var commandType = args.Item.TooltipText.ToLower(new CultureInfo("en-US")); switch (commandType) { case "undo": await diagram.Undo().ConfigureAwait(true); break; case "redo": await diagram.Redo().ConfigureAwait(true); break; case "zoom in(ctrl + +)": await Parent.DiagramContent.DiagramZoomIn().ConfigureAwait(true); ZoomItemDropdownContent = FormattableString.Invariant($"{Math.Round(Parent.DiagramContent.CurrentZoom * 100)}") + "%"; break; case "zoom out(ctrl + -)": await Parent.DiagramContent.DiagramZoomOut().ConfigureAwait(true); ZoomItemDropdownContent = FormattableString.Invariant($"{Math.Round(Parent.DiagramContent.CurrentZoom * 100)}") + "%"; break; case "pan tool": Parent.DiagramContent.DiagramTool = DiagramTools.ZoomPan; await diagram.ClearSelection().ConfigureAwait(true); await jsRuntime.InvokeAsync <object>("UtilityMethods_objectTypeChange", "diagram").ConfigureAwait(true); break; case "pointer": Parent.DiagramContent.DiagramDrawingObject = new object() { }; Parent.DiagramContent.DiagramTool = DiagramTools.SingleSelect | DiagramTools.MultipleSelect; break; case "text tool": Parent.DiagramContent.DiagramDrawingObject = new DiagramNode() { Shape = new DiagramShape() { Type = Shapes.Text } }; Parent.DiagramContent.DiagramTool = DiagramTools.ContinuousDraw; break; case "delete": await DeleteData().ConfigureAwait(true); break; case "lock": await LockObject().ConfigureAwait(true); break; case "group": await Group().ConfigureAwait(true); break; case "ungroup": await Ungroup().ConfigureAwait(true); break; case "align left": case "align right": case "align top": case "align bottom": case "align middle": case "align center": //selectedItem.isModified = true; #pragma warning disable CA1307 // Specify StringComparison string alignType = commandType.Replace("align ", ""); #pragma warning restore CA1307 // Specify StringComparison alignType = char.ToUpper(alignType[0], new CultureInfo("en-US")) + alignType.Substring(1); await diagram.Align((AlignmentOptions)Enum.Parse(typeof(AlignmentOptions), alignType)).ConfigureAwait(true); break; case "distribute objects vertically": await Distribute("RightToLeft").ConfigureAwait(true); break; case "distribute objects horizontally": await Distribute("BottomToTop").ConfigureAwait(true); break; case "show layers": await ShowLayers().ConfigureAwait(true); break; case "themes": await ShowLayers().ConfigureAwait(true); break; } Parent.DiagramContent.StateChanged(); if (commandType == "pan tool" || commandType == "pointer" || commandType == "text tool") { #pragma warning disable CA1307 // Specify StringComparison if (args.Item.CssClass.IndexOf("tb-item-selected") == -1) #pragma warning restore CA1307 // Specify StringComparison { if (commandType == "pan tool") { PanItemCssClass += " tb-item-selected"; } if (commandType == "pointer") { PointerItemCssClass += " tb-item-selected"; } if (commandType == "text tool") { TextItemCssClass += " tb-item-selected"; } await removeSelectedToolbarItem("").ConfigureAwait(true); } } }
public static void Invariant_Null_ThrowsArgumentNullException() { AssertExtensions.Throws <ArgumentNullException>("formattable", () => FormattableString.Invariant(null)); }
/// <summary> /// Returns a result string in which arguments are formatted by using the conventions /// of the invariant culture. /// /// Note: This is intentionally reimplemented here to allow a single using static for current /// and invariant cultures. /// /// Ex.: /// using static Toolkit.Common.Strings.StringHelper; /// InvariantCulture($"{UnlockedCount}/{TotalCount}"); /// </summary> /// <param name="formattable">The object to convert to a result string.</param> /// <returns>The string that results from formatting the current instance by using the conventions of the invariant culture.</returns> public static string InvariantCulture(FormattableString formattable) { return(FormattableString.Invariant(formattable)); }
public void ConvertFrom(float width, float height) { TestConvertFromString(new SizeF(width, height), FormattableString.Invariant($"{width:G9}, {height:G9}")); }
public override string ToString() { FormattableString formattableString = $"{Speed,7:0.0},{Power,7:0.0},{Cadence,7:0.0},{Heartrate,7:0.0},{Lon,7:0.0},{Lat,7:0.0},{Alt,7:0.0}"; return(FormattableString.Invariant(formattableString)); }
public void ConvertToInvariantString_NotNetFramework(float width, float height) { var str = Converter.ConvertToInvariantString(new SizeF(width, height)); Assert.Equal(FormattableString.Invariant($"{width}, {height}"), str); }
private void addPathData(TextWriter writer, IHasPath pathData, Vector2 position) { PathType?lastType = null; for (int i = 0; i < pathData.Path.ControlPoints.Count; i++) { PathControlPoint point = pathData.Path.ControlPoints[i]; if (point.Type.Value != null) { if (point.Type.Value != lastType) { switch (point.Type.Value) { case PathType.Bezier: writer.Write("B|"); break; case PathType.Catmull: writer.Write("C|"); break; case PathType.PerfectCurve: writer.Write("P|"); break; case PathType.Linear: writer.Write("L|"); break; } lastType = point.Type.Value; } else { // New segment with the same type - duplicate the control point writer.Write(FormattableString.Invariant($"{position.X + point.Position.Value.X}:{position.Y + point.Position.Value.Y}|")); } } if (i != 0) { writer.Write(FormattableString.Invariant($"{position.X + point.Position.Value.X}:{position.Y + point.Position.Value.Y}")); writer.Write(i != pathData.Path.ControlPoints.Count - 1 ? "|" : ","); } } var curveData = pathData as IHasPathWithRepeats; writer.Write(FormattableString.Invariant($"{(curveData?.RepeatCount ?? 0) + 1},")); writer.Write(FormattableString.Invariant($"{pathData.Path.Distance},")); if (curveData != null) { for (int i = 0; i < curveData.NodeSamples.Count; i++) { writer.Write(FormattableString.Invariant($"{(int)toLegacyHitSoundType(curveData.NodeSamples[i])}")); writer.Write(i != curveData.NodeSamples.Count - 1 ? "|" : ","); } for (int i = 0; i < curveData.NodeSamples.Count; i++) { writer.Write(getSampleBank(curveData.NodeSamples[i], true)); writer.Write(i != curveData.NodeSamples.Count - 1 ? "|" : ","); } } }
string MethodInfoDefaultParametersInterface.InterfaceMethod(int p1, string p2, decimal p3) { return(FormattableString.Invariant($"{p1}, {p2}, {p3}")); }
/// <inheritdoc /> public override readonly string ToString() { var vector = this.ToVector4(); return(FormattableString.Invariant($"Byte4({vector.X:#0.##}, {vector.Y:#0.##}, {vector.Z:#0.##}, {vector.W:#0.##})")); }
/// <inheritdoc /> public override string ToString() { var vector = this.ToVector2(); return(FormattableString.Invariant($"Rg32({vector.X:#0.##}, {vector.Y:#0.##})")); }
public static string ToQueryParameter(this LatLng latLng) => FormattableString.Invariant($"{latLng.Longitude},{latLng.Latitude}");
public static string ToQueryParameter(this MapOptions mapOptions) { var zoom = FormattableString.Invariant($"{mapOptions.Zoom}"); return($"{mapOptions.Center.ToQueryParameter()},{zoom},0/{mapOptions.Size.Width}x{mapOptions.Size.Height}"); }
/// <inheritdoc/> public override string ToString() { var tagAndLength = base.ToString(); return(FormattableString.Invariant($"{tagAndLength} - {this.Content}")); }
private static void GenerateError(string flag) { Console.Error.WriteLine(FormattableString.Invariant($"Value for flag:'{flag}' is missing or incorrect.")); HelpMessage(); }
/// <inheritdoc /> public override readonly string ToString() { var vector = this.ToVector2(); return(FormattableString.Invariant($"NormalizedShort2({vector.X:#0.##}, {vector.Y:#0.##})")); }