public void FormatDiceOrdered() { var result = FormattingHelper.FormatDiceOrdered(_dice); // you have a bug in your spec, expected result is not "1 1 2 2 3 4 4 5 5 6 6" (number 4 is only once in the input) Assert.Equal("1 1 2 2 3 4 5 5 6 6", result); }
private void AddContactData(PublicOrder order, ContactModel billingContact) { order.BillingEmail = Normalize(billingContact.Email); order.BillingFirstName = Normalize(billingContact.FirstName); order.BillingLastName = Normalize(billingContact.LastName); order.BillingAddress = Normalize(billingContact.Address); order.BillingAddress2 = Normalize(billingContact.Address2); order.BillingZip = Normalize(billingContact.Zip); order.BillingCity = Normalize(billingContact.City); order.BillingCountry = Normalize(billingContact.Country); var fax = FormattingHelper.FormatPhoneNumber(billingContact.Fax, billingContact.Country); order.BillingFax = Normalize(fax); var phone = FormattingHelper.FormatPhoneNumber(billingContact.Phone, billingContact.Country); order.BillingPhone = Normalize(phone); if (billingContact.CustomerType == "individual" && billingContact.IndividualInfo != null) { order.BillingCompanyNumber = Normalize(billingContact.IndividualInfo.IdentityNumber); } else if (billingContact.CustomerType == "company" && billingContact.CompanyInfo != null) { order.BillingCompany = Normalize(billingContact.CompanyInfo.CompanyName); order.BillingCompanyNumber = Normalize(billingContact.CompanyInfo.IdentityNumber); } }
private void BtnUp_Clicked(object?sender, EventArgs e) { var indices = GtkHelper.GetSelectedIndices(lvFiles); if (indices.Length > 0 && indices[0] > 0) { var ent = GtkHelper.GetValueAt <InProgressDownloadItem>(lvFiles, indices[0] - 1, 3); if (ent == null) { return; } var index = indices[indices.Length - 1]; GtkHelper.RemoveAt(filesListStore, indices[0] - 1); filesListStore.InsertWithValues(index, ent.Name, FormattingHelper.FormatSize(ent.Size), ent.Status.ToString(), ent); } //var indices = GtkHelper.getse lvFiles.GetSelectedIndices(); //if (indices.Length > 0 && indices[0] > 0) //{ // var item = this.downloads[indices[0] - 1]; // var index = indices[indices.Length - 1]; // this.downloads.Remove(item); // this.downloads.Insert(index, item); // //var index1 = indices[0] - 1; // //var index2 = indices[0] + lvFiles.SelectedItems.Count - 1; // //var value = this.downloads[index1]; // //this.downloads.RemoveAt(index1); // //this.downloads.Insert(index2, value); //} }
protected void lnkConfirm_Command(object sender, CommandEventArgs e) { Session["CurrentTab"] = "1"; string aid = FormattingHelper.EncryptQueryString(e.CommandArgument.ToString().Trim()); Response.Redirect("~/web/auctions/confirmauctionevent.aspx?aid=" + aid); }
public static async Task Main(string[] args) { var httpClient = new HttpClient(); var httpClient2 = new HttpClient(); var clientDiceRoll = new DiceRoll(httpClient, TimeSpan.FromSeconds(1)); var dice = await clientDiceRoll.GetDiceRolled(); if (dice != null) { var diceCount = FormattingHelper.FormatDiceCount(dice); foreach (var line in diceCount) { Console.WriteLine(line); } string ordered = FormattingHelper.FormatDiceOrdered(dice); Console.Error.WriteLine(ordered); var json = FormattingHelper.FormatToJsonOrdered(dice); var clientRequestBin = new RequestBin(httpClient2, TimeSpan.FromSeconds(1)); if (!await clientRequestBin.Post(json)) { Console.Error.WriteLine("Post to request bin service failed"); } } }
public string Print(PrintOption option) { var str = FormattingHelper.FormatValue(value) ?? string.Empty; var stars = new string('*', str.Length); return($"{name}={stars}"); }
public string Print(PrintOption option) { if (suffix != null) { return($"{name}={FormattingHelper.FormatValue(value, format)}{suffix}"); } return($"{name}={FormattingHelper.FormatValue(value, format)}"); }
public static Server.ResponseType Stacktrace(this DebugServer self, NameValueCollection query, StringBuilder sb) { using var writer = new JsonWriter(sb); using var root = writer.Array; if (self.vm == null) { return(Server.ResponseType.Json); } var cache = new StringBuilder(); for (var i = self.vm.callFrameStack.count - 1; i >= 0; i--) { var callframe = self.vm.callFrameStack.buffer[i]; switch (callframe.type) { case CallFrame.Type.EntryPoint: break; case CallFrame.Type.Function: using (var st = root.Object) { var codeIndex = System.Math.Max(callframe.codeIndex - 1, 0); var sourceContentIndex = self.vm.chunk.sourceSlices.buffer[codeIndex].index; var source = self.sources.buffer[self.vm.chunk.FindSourceIndex(codeIndex)]; var pos = FormattingHelper.GetLineAndColumn( source.content, sourceContentIndex ); cache.Clear(); self.vm.chunk.FormatFunction(callframe.functionIndex, cache); st.String("name", cache.ToString()); st.Number("line", pos.lineIndex + 1); st.Number("column", pos.columnIndex + 1); st.String("sourceUri", source.uri.value); } break; case CallFrame.Type.NativeFunction: using (var st = root.Object) { cache.Clear(); cache.Append("native "); self.vm.chunk.FormatNativeFunction(callframe.functionIndex, cache); st.String("name", cache.ToString()); } break; } } return(Server.ResponseType.Json); }
private void UpdateProgressOnUI(string id, int progress, double speed, long eta) { var downloadEntry = ApplicationContext.MainWindow.FindInProgressItem(id); if (downloadEntry != null) { downloadEntry.Progress = progress; downloadEntry.DownloadSpeed = FormattingHelper.FormatSize(speed) + "/s"; downloadEntry.ETA = FormattingHelper.ToHMS(eta); } }
protected void gvAuctionEvents_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton lnkARN = (LinkButton)e.Row.FindControl("lblAuctionEvents"); HyperLink lnkParticipate = (HyperLink)e.Row.FindControl("lnkParticipate"); string qs = FormattingHelper.EncryptQueryString(lnkARN.CommandArgument); string url = String.Format("javascript:onclick=showWindow('onlineauctionpopup.aspx?qs={0}', '{1}');", qs, lnkARN.CommandArgument); lnkParticipate.NavigateUrl = url; } }
private static List <BaseFieldDeclarationSyntax> DeclarationSplitter( Document document, VariableDeclarationSyntax declaration, Func <VariableDeclarationSyntax, BaseFieldDeclarationSyntax> declarationFactory, SyntaxTriviaList declarationTrailingTrivia) { SeparatedSyntaxList <VariableDeclaratorSyntax> variables = declaration.Variables; VariableDeclaratorSyntax first = variables.First(); BaseFieldDeclarationSyntax previous = null; var newFieldDeclarations = new List <BaseFieldDeclarationSyntax>(variables.Count); foreach (SyntaxNodeOrToken nodeOrToken in variables.GetWithSeparators()) { if (previous == null) { VariableDeclaratorSyntax variable = (VariableDeclaratorSyntax)nodeOrToken.AsNode(); variable = variable.WithIdentifier(variable.Identifier.WithoutLeadingWhitespace()); var variableDeclarator = SyntaxFactory.SingletonSeparatedList(variable); previous = declarationFactory(declaration.WithVariables(variableDeclarator)); if (variable != first) { var triviaList = previous.GetLeadingTrivia().WithoutDirectiveTrivia(); previous = previous.WithLeadingTrivia(triviaList); } } else { SyntaxToken commaToken = nodeOrToken.AsToken(); SyntaxTriviaList trailingTrivia = commaToken.TrailingTrivia; if (trailingTrivia.Any()) { if (!trailingTrivia.Last().IsKind(SyntaxKind.EndOfLineTrivia)) { trailingTrivia = trailingTrivia.WithoutTrailingWhitespace().Add(FormattingHelper.GetNewLineTrivia(document)); } } else { trailingTrivia = SyntaxTriviaList.Create(FormattingHelper.GetNewLineTrivia(document)); } newFieldDeclarations.Add(previous.WithTrailingTrivia(trailingTrivia)); previous = null; } } newFieldDeclarations.Add(previous.WithTrailingTrivia(declarationTrailingTrivia)); return(newFieldDeclarations); }
public void FormatDiceCount() { var result = FormattingHelper.FormatDiceCount(_dice).ToArray(); var expected = new string[] { "1 -> 2", "2 -> 2", "3 -> 1", "4 -> 1", "5 -> 2", "6 -> 2" }; Assert.True(expected.All(shouldItem => result.Any(isItem => isItem == shouldItem))); }
protected override async Task <SyntaxNode> FixAllInDocumentAsync(FixAllContext fixAllContext, Document document, ImmutableArray <Diagnostic> diagnostics) { if (diagnostics.IsEmpty) { return(null); } var syntaxRoot = await document.GetSyntaxRootAsync(fixAllContext.CancellationToken).ConfigureAwait(false); var settings = SettingsHelper.GetStyleCopSettings(document.Project.AnalyzerOptions, syntaxRoot.SyntaxTree, fixAllContext.CancellationToken); var newLine = FormattingHelper.GetNewLineTrivia(document); var nodes = diagnostics.Select(diagnostic => syntaxRoot.FindNode(diagnostic.Location.SourceSpan).Parent); return(syntaxRoot.ReplaceNodes(nodes, (originalNode, rewrittenNode) => ReformatConstructorDeclaration((ConstructorDeclarationSyntax)rewrittenNode, settings.Indentation, newLine))); }
public void ShowPropertiesDialog(DownloadItemBase ent, ShortState?state) { using var propWin = PropertiesDialog.CreateFromGladeFile(GetMainWindow(), GetWindowGroup()); propWin.FileName = ent.Name; propWin.Folder = ent.TargetDir ?? FileHelper.GetDownloadFolderByFileName(ent.Name); propWin.Address = ent.PrimaryUrl; propWin.FileSize = FormattingHelper.FormatSize(ent.Size); propWin.DateAdded = ent.DateAdded.ToLongDateString() + " " + ent.DateAdded.ToLongTimeString(); propWin.DownloadType = ent.DownloadType; propWin.Referer = ent.RefererUrl; propWin.Cookies = state?.Cookies ?? state?.Cookies1 ?? new Dictionary <string, string>(); propWin.Headers = state?.Headers ?? state?.Headers1 ?? new Dictionary <string, List <string> >(); propWin.Run(); propWin.Destroy(); propWin.Dispose(); }
private static async Task <Document> GetTransformedDocumentAsync(Document document, Diagnostic diagnostic, CancellationToken cancellationToken) { var syntaxRoot = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var settings = SettingsHelper.GetStyleCopSettings(document.Project.AnalyzerOptions, syntaxRoot.SyntaxTree, cancellationToken); var newLine = FormattingHelper.GetNewLineTrivia(document); var constructorInitializer = (ConstructorInitializerSyntax)syntaxRoot.FindNode(diagnostic.Location.SourceSpan); var constructorDeclaration = (ConstructorDeclarationSyntax)constructorInitializer.Parent; var newConstructorDeclaration = ReformatConstructorDeclaration(constructorDeclaration, settings.Indentation, newLine); var newSyntaxRoot = syntaxRoot.ReplaceNode(constructorDeclaration, newConstructorDeclaration); return(document.WithSyntaxRoot(newSyntaxRoot)); }
private void BtnDown_Clicked(object?sender, EventArgs e) { var indices = GtkHelper.GetSelectedIndices(lvFiles); if (indices.Length > 0 && indices[indices.Length - 1] < this.filesListStore.IterNChildren() - 1) { var index = indices[indices.Length - 1] + 1; var ent = GtkHelper.GetValueAt <InProgressDownloadItem>(lvFiles, index, 3); if (ent == null) { return; } GtkHelper.RemoveAt(filesListStore, index); filesListStore.InsertWithValues(indices[0], ent.Name, FormattingHelper.FormatSize(ent.Size), ent.Status.ToString(), ent); } }
private static ExtractAccountIdAndServerIdFromTokenResult?ExtractAccountIdAndServerIdFromToken(string tokenId) { if (tokenId == null) { return(null); } if (tokenId.IndexOf('-') >= 0) { // retrieve the account id string firstValue = tokenId.Substring(0, tokenId.IndexOf('-')); // remove the first value from the token tokenId = tokenId.Substring(tokenId.IndexOf("-") + 1); // verify that the first value (account id) is not a number; that would mean that we're looking at a root token instead of an account token if (firstValue.All(char.IsDigit)) { return(new ExtractAccountIdAndServerIdFromTokenResult() { AccountId = null, AccountServerId = firstValue }); } // verify that the first value is a valid account name (i.e. does not contain invalid characters) if (firstValue != null && FormattingHelper.ContainsOnlyAllowedIdentifierCharacters(firstValue) == false) { return(null); } if (tokenId.IndexOf('-') >= 0) { string secondValue = tokenId.Substring(0, tokenId.IndexOf('-')); // verify that the second value is a number (i.e. the server id) if (secondValue.All(char.IsDigit)) { return(new ExtractAccountIdAndServerIdFromTokenResult { AccountId = firstValue, AccountServerId = secondValue }); } } } // if we reach here, the token is not valid return(null); }
/// <summary> /// Amend order with main contact data collected from customer. /// </summary> public override PublicOrder AmendOrder(PublicOrder order, PublicOrderContext orderContext) { var mainContact = orderContext.ContactData.OfType <MainContactModel>().First(); order.Email = Normalize(mainContact.Email); order.FirstName = Normalize(mainContact.FirstName); order.LastName = Normalize(mainContact.LastName); order.Address = Normalize(mainContact.Address); order.Address2 = Normalize(mainContact.Address2); order.Zip = Normalize(mainContact.Zip); order.City = Normalize(mainContact.City); order.Country = Normalize(mainContact.Country); var fax = FormattingHelper.FormatPhoneNumber(mainContact.Fax, mainContact.Country); order.Fax = Normalize(fax); var phone = FormattingHelper.FormatPhoneNumber(mainContact.Phone, mainContact.Country); order.Phone = Normalize(phone); if (mainContact.CustomerType == "individual" && mainContact.IndividualInfo != null) { order.CompanyNumber = Normalize(mainContact.IndividualInfo.IdentityNumber); } else if (mainContact.CustomerType == "company" && mainContact.CompanyInfo != null) { order.Company = Normalize(mainContact.CompanyInfo.CompanyName); order.CompanyNumber = Normalize(mainContact.CompanyInfo.IdentityNumber); order.LegalNumber = Normalize(mainContact.CompanyInfo.VatNumber); } if (AtomiaCommon.Instance.SeparateUsernameAndEmail) { var customAttributes = new List <PublicOrderCustomData>(order.CustomData); customAttributes.Add(new PublicOrderCustomData { Name = "Username", Value = Normalize(mainContact.Username) }); order.CustomData = customAttributes.ToArray(); } return(order); }
public void ShowPropertiesDialog(DownloadItemBase ent, ShortState?state) { var propertiesWindow = new DownloadPropertiesWindow { FileName = ent.Name, Folder = ent.TargetDir ?? FileHelper.GetDownloadFolderByFileName(ent.Name), Address = ent.PrimaryUrl, FileSize = FormattingHelper.FormatSize(ent.Size), DateAdded = ent.DateAdded.ToLongDateString() + " " + ent.DateAdded.ToLongTimeString(), DownloadType = ent.DownloadType, Referer = ent.RefererUrl, Cookies = state?.Cookies ?? state?.Cookies1 ?? new Dictionary <string, string>(), Headers = state?.Headers ?? state?.Headers1 ?? new Dictionary <string, List <string> >(), Owner = GetMainWindow() }; propertiesWindow.ShowDialog(GetMainWindow()); }
protected override async Task <SyntaxNode> FixAllInDocumentAsync(FixAllContext fixAllContext, Document document) { var diagnostics = await fixAllContext.GetDocumentDiagnosticsAsync(document).ConfigureAwait(false); if (diagnostics.IsEmpty) { return(null); } var syntaxRoot = await document.GetSyntaxRootAsync(fixAllContext.CancellationToken).ConfigureAwait(false); var indentationOptions = IndentationOptions.FromDocument(document); var newLine = FormattingHelper.GetNewLineTrivia(document); var nodes = diagnostics.Select(diagnostic => syntaxRoot.FindNode(diagnostic.Location.SourceSpan).Parent); return(syntaxRoot.ReplaceNodes(nodes, (originalNode, rewrittenNode) => ReformatConstructorDeclaration((ConstructorDeclarationSyntax)rewrittenNode, indentationOptions, newLine))); }
private string GetFormattedCell(object value) { string cell = "<td"; string cellValue = FormattingHelper.GetFormattedValue(value); if (value is decimal || value is double || value is float) { cell += " class='right aligned'>"; } else { cell += ">"; } cell += cellValue + "</td>"; return(cell); }
private static string GetUpdateText() { if (Updates == null || Updates.Count < 1) { return(TextResource.GetText("MSG_NO_UPDATE")); } var text = new StringBuilder(); var size = 0L; text.Append((ComponentsInstalled ? "Update available: " : "XDM require FFmpeg and YoutubeDL to download streaming videos") + Environment.NewLine); foreach (var update in Updates) { text.Append(update.Name + " " + update.TagName + Environment.NewLine); size += update.Size; } text.Append(Environment.NewLine + "Total download: " + FormattingHelper.FormatSize(size) + Environment.NewLine); text.Append("Would you like to continue?"); return(text.ToString()); }
public void RefreshView() { if (GtkHelper.GetSelectedValue <DownloadQueue>(LbQueues, 1) is DownloadQueue queue) { filesListStore.Clear(); var realQueue = QueueManager.GetQueue(queue.ID); if (realQueue != null) { foreach (var id in realQueue.DownloadIds) { var ent = ApplicationContext.Application.GetInProgressDownloadEntry(id); if (ent != null) { filesListStore.AppendValues(ent.Name, FormattingHelper.FormatSize(ent.Size), ent.Status.ToString(), ent); } } } } }
public void AddRelNofollowToAnchorsTests(string @in, string @out, bool awaitException) { try { var res = FormattingHelper.AddRelNofollowToAnchors(@in); Console.WriteLine(res); Assert.AreEqual(res, @out); } catch (Exception e) { Console.WriteLine(e.GetType().Name); if (awaitException) { Assert.That(e is PhoneValidationException); } else { throw; } } }
private string GetFormattedCell(object value, string expression) { string cell = "<td"; string cellValue = FormattingHelper.GetFormattedValue(value, expression); if (value is decimal || value is double || value is float) { cell += " data-value='" + value + "'"; cell += " class='right aligned decimal number'>"; } else if (value is DateTime || value is DateTimeOffset) { cell += " class='unformatted date'>"; } else { cell += ">"; } cell += cellValue + "</td>"; return(cell); }
private void LoadQueueDetails(DownloadQueue queue) { lvFiles.Selection.UnselectAll(); filesListStore.Clear(); foreach (var id in queue.DownloadIds) { var ent = ApplicationContext.Application.GetInProgressDownloadEntry(id); if (ent != null) { filesListStore.AppendValues(ent.Name, FormattingHelper.FormatSize(ent.Size), ent.Status.ToString(), ent); } } if (queue.Schedule.HasValue) { this.SchedulerPanel.Schedule = queue.Schedule.Value; } else { this.SchedulerPanel.Schedule = this.defaultSchedule; } ChkEnableScheduler.Active = queue.Schedule.HasValue; }
private string DataTableToHtml(DataSource dataSource, GridView grid, Report report) { var html = new StringBuilder(); html.Append("<table "); if (!string.IsNullOrWhiteSpace(grid.CssStyle)) { html.Append("style='" + grid.CssStyle + "' "); } if (!string.IsNullOrWhiteSpace(grid.CssClass)) { html.Append("class='" + grid.CssClass + "'"); } html.Append(">"); html.Append("<thead>"); html.Append("<tr>"); for (int i = 0; i < dataSource.Data.Columns.Count; i++) { string columnName = dataSource.Data.Columns[i].ColumnName; columnName = ResourceManager.GetString(report.Tenant, "ScrudResource", columnName); html.Append("<th>" + columnName + "</th>"); } html.Append("</tr>"); html.Append("</thead>"); if (dataSource.RunningTotalTextColumnIndex != null && dataSource.RunningTotalTextColumnIndex > 0) { int index = dataSource.RunningTotalTextColumnIndex.Value; var candidates = dataSource.RunningTotalFieldIndices; html.Append("<tfoot>"); html.Append("<tr>"); html.Append("<th class='right aligned' colspan='"); html.Append(index + 1); html.Append("'>Total</th>"); for (int i = index + 1; i < dataSource.Data.Columns.Count; i++) { html.Append("<th class='right aligned'>"); if (candidates.Contains(i)) { decimal sum = ExpressionHelper.GetSum(dataSource.Data, i); html.Append(FormattingHelper.GetFormattedValue(sum)); } html.Append("</th>"); } html.Append("</tr>"); html.Append("</tfoot>"); } html.Append("<tbody>"); for (int i = 0; i < dataSource.Data.Rows.Count; i++) { html.Append("<tr>"); for (int j = 0; j < dataSource.Data.Columns.Count; j++) { var value = dataSource.Data.Rows[i][j]; html.Append(this.GetFormattedCell(value)); } html.Append("</tr>"); } html.Append("</tbody>"); html.Append("</table>"); return(html.ToString()); }
public static string /*!*/ __format__(CodeContext /*!*/ context, BigInteger /*!*/ self, [NotNull] string /*!*/ formatSpec) { StringFormatSpec spec = StringFormatSpec.FromString(formatSpec); if (spec.Precision != null) { throw PythonOps.ValueError("Precision not allowed in integer format specifier"); } BigInteger val = self; if (self < 0) { val = -self; } string digits; switch (spec.Type) { case 'n': CultureInfo culture = context.LanguageContext.NumericCulture; if (culture == CultureInfo.InvariantCulture) { // invariant culture maps to CPython's C culture, which doesn't // include any formatting info. goto case 'd'; } digits = FormattingHelper.ToCultureString(val, context.LanguageContext.NumericCulture.NumberFormat, spec); break; case null: case 'd': if (spec.ThousandsComma) { var width = spec.Width ?? 0; // If we're inserting commas, and we're padding with leading zeros. // AlignNumericText won't know where to place the commas, // so force .Net to help us out here. if (spec.Fill.HasValue && spec.Fill.Value == '0' && width > 1) { digits = val.ToString(FormattingHelper.ToCultureString(self, FormattingHelper.InvariantCommaNumberInfo, spec)); } else { digits = val.ToString("#,0", CultureInfo.InvariantCulture); } } else { digits = val.ToString("D", CultureInfo.InvariantCulture); } break; case '%': if (spec.ThousandsComma) { digits = val.ToString("#,0.000000%", CultureInfo.InvariantCulture); } else { digits = val.ToString("0.000000%", CultureInfo.InvariantCulture); } break; case 'e': if (spec.ThousandsComma) { digits = val.ToString("#,0.000000e+00", CultureInfo.InvariantCulture); } else { digits = val.ToString("0.000000e+00", CultureInfo.InvariantCulture); } break; case 'E': if (spec.ThousandsComma) { digits = val.ToString("#,0.000000E+00", CultureInfo.InvariantCulture); } else { digits = val.ToString("0.000000E+00", CultureInfo.InvariantCulture); } break; case 'f': case 'F': if (spec.ThousandsComma) { digits = val.ToString("#,########0.000000", CultureInfo.InvariantCulture); } else { digits = val.ToString("#########0.000000", CultureInfo.InvariantCulture); } break; case 'g': if (val >= 1000000) { digits = val.ToString("0.#####e+00", CultureInfo.InvariantCulture); } else if (spec.ThousandsComma) { goto case 'd'; } else { digits = val.ToString(CultureInfo.InvariantCulture); } break; case 'G': if (val >= 1000000) { digits = val.ToString("0.#####E+00", CultureInfo.InvariantCulture); } else if (spec.ThousandsComma) { goto case 'd'; } else { digits = val.ToString(CultureInfo.InvariantCulture); } break; case 'X': digits = AbsToHex(val, false); break; case 'x': digits = AbsToHex(val, true); break; case 'o': // octal digits = ToOctal(val, true); break; case 'b': // binary digits = ToBinary(val, false, true); break; case 'c': // single char int iVal; if (spec.Sign != null) { throw PythonOps.ValueError("Sign not allowed with integer format specifier 'c'"); } else if (!self.AsInt32(out iVal)) { throw PythonOps.OverflowError("long int too large to convert to int"); } else if (iVal < 0 || iVal > 0xFF) { throw PythonOps.OverflowError("%c arg not in range(0x10000)"); } digits = ScriptingRuntimeHelpers.CharToString((char)iVal); break; default: throw PythonOps.ValueError("Unknown format code '{0}'", spec.Type.ToString()); } Debug.Assert(digits[0] != '-'); return(spec.AlignNumericText(digits, self.IsZero(), self.IsPositive())); }
public string Format(string date) { return(FormattingHelper.FormatDateToString(Convert.ToDateTime(date))); }
public void FormatDiceToJsonOrdered() { var result = FormattingHelper.FormatToJsonOrdered(_dice); Assert.Equal("{ \"dice\": [ 1,1,2,2,3,4,5,5,6,6 ] }", result); }