Here are the examples of the csharp api System.Text.StringBuilder.AppendLine(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
9950 Examples
19
Source : BadgesController.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
private string BasicBadges(Enreplacedy[] enreplacedies)
{
if (!enreplacedies.Any())
{
return string.Empty;
}
var container = new TagBuilder("div");
container.AddCssClreplaced("badges");
var badgeContent = enreplacedies.Aggregate(new StringBuilder(), (sb, e) => sb.AppendLine(Badge(e))).ToString();
if (string.IsNullOrWhiteSpace(badgeContent))
{
return string.Empty;
}
container.InnerHtml += badgeContent;
return container.ToString();
}
19
Source : PaymentHandler.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
protected virtual void LogPaymentRequest(HttpContext context, PortalConfigurationDataAdapterDependencies dataAdapterDependencies, Tuple<Guid, string> quoteAndReturnUrl, Exception exception)
{
var log = new StringBuilder();
log.AppendLine(GetType().FullName).AppendLine().AppendLine();
log.AppendFormat("Exception: {0}", exception);
LogPaymentRequest(context, dataAdapterDependencies, quoteAndReturnUrl, "Payment Exception", log.ToString());
}
19
Source : ContentFieldBuilder.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
public ContentFieldBuilder Append(string content)
{
if (string.IsNullOrWhiteSpace(content))
{
return this;
}
_builder.AppendLine(NormalizeWhitespace(StripLiquid(StripHtml(content))));
_builder.AppendLine();
return this;
}
19
Source : SiteMapExtensions.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
private static IHtmlString Breadcrumb(Func<IEnumerable<Tuple<SiteMapNode, SiteMapNodeType>>> getSiteMapPath)
{
var path = getSiteMapPath().ToList();
if (!path.Any())
{
return null;
}
var items = new StringBuilder();
foreach (var node in path)
{
var li = new TagBuilder("li");
if (node.Item2 == SiteMapNodeType.Current)
{
li.AddCssClreplaced("active");
li.SetInnerText(node.Item1.replacedle);
}
else
{
var breadCrumbUrl = node.Item1.Url;
if (ContextLanguageInfo.IsCrmMultiLanguageEnabledInWebsite(PortalContext.Current.Website)
&& ContextLanguageInfo.DisplayLanguageCodeInUrl)
{
breadCrumbUrl = ContextLanguageInfo
.PrependLanguageCode(ApplicationPath.Parse(node.Item1.Url))
.AbsolutePath;
}
var a = new TagBuilder("a");
a.Attributes["href"] = breadCrumbUrl;
a.SetInnerText(node.Item1.replacedle);
li.InnerHtml += a.ToString();
}
items.AppendLine(li.ToString());
}
var ul = new TagBuilder("ul");
ul.AddCssClreplaced("breadcrumb");
ul.InnerHtml += items.ToString();
return new HtmlString(ul.ToString());
}
19
Source : StyleExtensions.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
private static IHtmlString ContentStyles(HtmlHelper html, IEnumerable<string> except, IEnumerable<KeyValuePair<string, string>> only)
{
ADXTrace.Instance.TraceInfo(TraceCategory.Application, "Begin");
var portalViewContext = PortalExtensions.GetPortalViewContext(html);
var siteMapProvider = portalViewContext.SiteMapProvider as ContentMapCrmSiteMapProvider;
var node = siteMapProvider == null
? null
: siteMapProvider.CurrentNode ?? siteMapProvider.RootNode;
if (siteMapProvider != null && (node == null || (((CrmSiteMapNode)node).StatusCode == System.Net.HttpStatusCode.Forbidden) && node.Equals(node.RootNode)))
{
// If home root node has been secured then we need to retrieve the root without security validation in order to get the content stylesheets to be referenced.
node = siteMapProvider.FindSiteMapNodeWithoutSecurityValidation("/");
}
var hrefs = ContentStyles(portalViewContext, node, html.ViewContext.TempData, except, only)
.Distinct()
.ToArray();
if (!hrefs.Any())
{
ADXTrace.Instance.TraceInfo(TraceCategory.Application, "End: No content styles found.");
return null;
}
var output = new StringBuilder();
foreach (var href in hrefs)
{
var link = new TagBuilder("link");
link.Attributes["rel"] = "stylesheet";
link.Attributes["href"] = href;
output.AppendLine(link.ToString(TagRenderMode.SelfClosing));
}
ADXTrace.Instance.TraceInfo(TraceCategory.Application, "End");
return new HtmlString(output.ToString());
}
19
Source : BundleConfig.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
public string Process(string includedVirtualPath, string input)
{
var minifier = new Microsoft.Ajax.Utilities.Minifier();
var result = minifier.MinifyJavaScript(input);
if (minifier.ErrorList.Count > 0)
{
System.Text.StringBuilder errorMessage = new System.Text.StringBuilder();
errorMessage.AppendLine("/* Minification failed. Returning unminified contents.");
foreach (var error in minifier.ErrorList)
{
errorMessage.AppendLine(error.ToString());
}
errorMessage.AppendLine(" */");
errorMessage.Append(input);
return errorMessage.ToString();
}
return result;
}
19
Source : BundleConfig.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
public string Process(string includedVirtualPath, string input)
{
var minifier = new Microsoft.Ajax.Utilities.Minifier();
var result = minifier.MinifyJavaScript(input);
if (minifier.ErrorList.Count > 0)
{
System.Text.StringBuilder errorMessage = new System.Text.StringBuilder();
errorMessage.AppendLine("/* Minification failed. Returning unminified contents.");
foreach (var error in minifier.ErrorList)
{
errorMessage.AppendLine(error.ToString());
}
errorMessage.AppendLine(" */");
errorMessage.Append(input);
return errorMessage.ToString();
}
return result;
}
19
Source : RestSharpException.cs
with MIT License
from adrenak
with MIT License
from adrenak
public static RestSharpException New(IRestResponse response) {
Exception innerException = null;
var sb = new StringBuilder();
var uri = response.ResponseUri;
sb.AppendLine(string.Format("Processing request [{0}] resulted with following errors:", uri));
if (response.StatusCode.IsSuccess() == false) {
sb.AppendLine("- Server responded with unsuccessfull status code: " + response.StatusCode + ": " + response.StatusDescription);
sb.AppendLine("- " + response.Content);
}
if (response.ErrorException != null) {
sb.AppendLine("- An exception occurred while processing request: " + response.ErrorMessage);
innerException = response.ErrorException;
}
return new RestSharpException(response.StatusCode, uri, response.Content, sb.ToString(), innerException);
}
19
Source : RestSharpException.cs
with MIT License
from adrenak
with MIT License
from adrenak
public static RestSharpException New(IRestResponse response) {
Exception innerException = null;
var sb = new StringBuilder();
var uri = response.ResponseUri;
sb.AppendLine(string.Format("Processing request [{0}] resulted with following errors:", uri));
if (response.StatusCode.IsSuccess() == false) {
sb.AppendLine("- Server responded with unsuccessfull status code: " + response.StatusCode + ": " + response.StatusDescription);
sb.AppendLine("- " + response.Content);
}
if (response.ErrorException != null) {
sb.AppendLine("- An exception occurred while processing request: " + response.ErrorMessage);
innerException = response.ErrorException;
}
return new RestSharpException(response.StatusCode, uri, response.Content, sb.ToString(), innerException);
}
19
Source : StringExtensions.cs
with MIT License
from adriangodong
with MIT License
from adriangodong
public static string HydrateRsaVariable(this string input)
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine("-----BEGIN RSA PRIVATE KEY-----");
stringBuilder.AppendLine(input);
stringBuilder.AppendLine("-----END RSA PRIVATE KEY-----");
return stringBuilder.ToString();
}
19
Source : Appender.cs
with Apache License 2.0
from adrianiftode
with Apache License 2.0
from adrianiftode
public static void AppendHeaders(StringBuilder messageBuilder, IEnumerable<KeyValuePair<string, IEnumerable<string>>> headers)
{
foreach (var header in headers)
{
foreach (var headerValue in header.Value)
{
messageBuilder.AppendLine($"{header.Key}: {headerValue}");
}
}
}
19
Source : BinaryContentProcessor.cs
with Apache License 2.0
from adrianiftode
with Apache License 2.0
from adrianiftode
protected override Task Handle(StringBuilder contentBuilder)
{
var contentLength = _httpContent.Headers?.ContentLength ?? (_httpContent.TryGetContentLength(out var length) ? length : 0);
contentBuilder.AppendLine(string.Format(ContentFormatterOptions.ContentIsSomeTypeHavingLength, _dataType, contentLength));
return Task.CompletedTask;
}
19
Source : FallbackProcessor.cs
with Apache License 2.0
from adrianiftode
with Apache License 2.0
from adrianiftode
protected override async Task Handle(StringBuilder contentBuilder)
{
if (contentBuilder.Length > 0)
{
return;
}
if (_httpContent.IsDisposed())
{
contentBuilder.AppendLine();
contentBuilder.AppendLine(ContentFormatterOptions.WarningMessageWhenDisposed);
return;
}
var content = await _httpContent.SafeReadreplacedtringAsync();
var contentLength = _httpContent.Headers.ContentLength;
if (contentLength >= ContentFormatterOptions.MaximumReadableBytes)
{
contentBuilder.AppendLine();
contentBuilder.AppendLine(ContentFormatterOptions.WarningMessageWhenContentIsTooLarge);
content = content.Substring(ContentFormatterOptions.MaximumPrintableBytes);
}
contentBuilder.Append(content);
}
19
Source : MultipartProcessor.cs
with Apache License 2.0
from adrianiftode
with Apache License 2.0
from adrianiftode
protected override async Task Handle(StringBuilder contentBuilder)
{
var multipartContent = (MultipartFormDataContent)_httpContent;
var boundary = multipartContent.Headers?.ContentType?.Parameters.FirstOrDefault(c => c.Name == "boundary")?.Value?.Trim('\"');
foreach (var content in multipartContent)
{
contentBuilder.AppendLine();
contentBuilder.AppendLine(boundary);
Appender.AppendHeaders(contentBuilder, content.Headers);
await Appender.AppendContent(contentBuilder, content);
contentBuilder.AppendLine();
}
contentBuilder.AppendLine();
contentBuilder.AppendLine($"{boundary}--");
}
19
Source : MultipartProcessor.cs
with Apache License 2.0
from adrianiftode
with Apache License 2.0
from adrianiftode
protected override async Task Handle(StringBuilder contentBuilder)
{
var multipartContent = (MultipartFormDataContent)_httpContent;
var boundary = multipartContent.Headers?.ContentType?.Parameters.FirstOrDefault(c => c.Name == "boundary")?.Value?.Trim('\"');
foreach (var content in multipartContent)
{
contentBuilder.AppendLine();
contentBuilder.AppendLine(boundary);
Appender.AppendHeaders(contentBuilder, content.Headers);
await Appender.AppendContent(contentBuilder, content);
contentBuilder.AppendLine();
}
contentBuilder.AppendLine();
contentBuilder.AppendLine($"{boundary}--");
}
19
Source : AssertionsFailuresFormatter.cs
with Apache License 2.0
from adrianiftode
with Apache License 2.0
from adrianiftode
public void Format(object value,
FormattedObjectGraph formattedGraph,
FormattingContext context,
FormatChild formatChild)
{
var replacedertionsFailures = (replacedertionsFailures)value;
var messageBuilder = new StringBuilder();
messageBuilder.AppendLine();
messageBuilder.AppendLine();
foreach (var failure in replacedertionsFailures.FailuresMessages)
{
messageBuilder.AppendLine($" - { failure.ReplaceFirstWithLowercase() }");
}
formattedGraph.AddFragment(messageBuilder.ToString());
}
19
Source : HttpResponseMessageFormatter.cs
with Apache License 2.0
from adrianiftode
with Apache License 2.0
from adrianiftode
public void Format(object value,
FormattedObjectGraph formattedGraph,
FormattingContext context,
FormatChild formatChild)
{
var response = (HttpResponseMessage)value;
var messageBuilder = new StringBuilder();
messageBuilder.AppendLine();
messageBuilder.AppendLine();
messageBuilder.AppendLine("The HTTP response was:");
Func<Task> contentResolver = async () => await AppendHttpResponseMessage(messageBuilder, response);
contentResolver.ExecuteInDefaultSynchronizationContext().GetAwaiter().GetResult();
formattedGraph.AddFragment(messageBuilder.ToString());
}
19
Source : HttpResponseMessageFormatter.cs
with Apache License 2.0
from adrianiftode
with Apache License 2.0
from adrianiftode
private static async Task AppendRequest(StringBuilder messageBuilder, HttpResponseMessage response)
{
var request = response.RequestMessage;
messageBuilder.AppendLine();
if (request == null)
{
messageBuilder.AppendLine("The originated HTTP request was <null>.");
return;
}
messageBuilder.AppendLine("The originated HTTP request was:");
messageBuilder.AppendLine();
messageBuilder.AppendLine($"{request.Method.ToString().ToUpper()} {request.RequestUri} HTTP {request.Version}");
Appender.AppendHeaders(messageBuilder, request.GetHeaders());
AppendContentLength(messageBuilder, request);
messageBuilder.AppendLine();
await AppendRequestContent(messageBuilder, request.Content);
}
19
Source : HttpResponseMessageFormatter.cs
with Apache License 2.0
from adrianiftode
with Apache License 2.0
from adrianiftode
private static void AppendProtocolAndStatusCode(StringBuilder messageBuilder, HttpResponseMessage response)
{
messageBuilder.AppendLine();
messageBuilder.AppendLine($@"HTTP/{response.Version} {(int)response.StatusCode} {response.StatusCode}");
}
19
Source : HttpResponseMessageFormatter.cs
with Apache License 2.0
from adrianiftode
with Apache License 2.0
from adrianiftode
private static void AppendContentLength(StringBuilder messageBuilder, HttpResponseMessage response)
{
if (!response.GetHeaders().Any(c => string.Equals(c.Key, "Content-Length", StringComparison.OrdinalIgnoreCase)))
{
messageBuilder.AppendLine($"Content-Length: {response.Content?.Headers.ContentLength ?? 0}");
}
}
19
Source : HttpResponseMessageFormatter.cs
with Apache License 2.0
from adrianiftode
with Apache License 2.0
from adrianiftode
private static void AppendContentLength(StringBuilder messageBuilder, HttpRequestMessage request)
{
if (!request.GetHeaders()
.Any(c => string.Equals(c.Key, "Content-Length", StringComparison.OrdinalIgnoreCase))
)
{
request.Content.TryGetContentLength(out long contentLength);
messageBuilder.AppendLine($"Content-Length: {contentLength}");
}
}
19
Source : TestFramework.cs
with MIT License
from adrianoc
with MIT License
from adrianoc
public static void Execute(string executable, string args)
{
var processInfo = new ProcessStartInfo(executable, args);
processInfo.CreateNoWindow = true;
processInfo.RedirectStandardError = true;
processInfo.RedirectStandardOutput = true;
processInfo.UseShellExecute = false;
var process = Process.Start(processInfo);
var err = new StringBuilder();
var @out = new StringBuilder();
process.ErrorDataReceived += (sender, arg) => err.AppendLine(arg.Data);
process.OutputDataReceived += (sender, arg) => @out.AppendLine(arg.Data);
process.BeginErrorReadLine();
process.BeginOutputReadLine();
process.EnableRaisingEvents = true;
process.WaitForExit();
if (!string.IsNullOrWhiteSpace(@out.ToString()))
{
Console.WriteLine($"{Environment.NewLine}Output: {@out}");
}
if (!string.IsNullOrWhiteSpace(err.ToString()))
{
throw new ApplicationException("Error: " + err + $"{Environment.NewLine}Executable: {executable}");
}
}
19
Source : Model.cs
with MIT License
from advancedmonitoring
with MIT License
from advancedmonitoring
private static void ServiceFill(object o)
{
var ww = (UIPerformWorkWindow) o;
var sb = new StringBuilder();
var services = ServiceController.GetServices();
var managerHandle = Win32Native.OpenSCManager(null, null, 0x20004);
for (var i = 0; i < services.Length; i++)
{
var service = services[i];
try
{
var localSb = new StringBuilder();
localSb.AppendLine($"{service.DisplayName} ({service.ServiceName})");
var serviceHandle = Win32Native.OpenService(managerHandle, service.ServiceName, 0x20000);
uint sdSize;
var result = Win32Native.QueryServiceObjectSecurity(serviceHandle, 7, null, 0, out sdSize);
var gle = Marshal.GetLastWin32Error();
if (result || (gle != 122))
{
Win32Native.CloseServiceHandle(serviceHandle);
throw new System.ComponentModel.Win32Exception(gle);
}
var binarySd = new byte[sdSize];
result = Win32Native.QueryServiceObjectSecurity(serviceHandle, 7, binarySd, binarySd.Length, out sdSize);
gle = Marshal.GetLastWin32Error();
if (!result)
{
Win32Native.CloseServiceHandle(serviceHandle);
throw new System.ComponentModel.Win32Exception(gle);
}
var cd = new CommonSecurityDescriptor(false, false, binarySd, 0);
localSb.AppendLine(cd.GetSddlForm(AccessControlSections.All));
sb.AppendLine(localSb.ToString());
Win32Native.CloseServiceHandle(serviceHandle);
ww.Percentage = (int) ((i + 0.0) * 100.0 / (services.Length + 0.0));
if (ww.AbortEvent.WaitOne(0))
break;
}
catch
{
// continue
}
}
Win32Native.CloseServiceHandle(managerHandle);
_fillData = sb.ToString();
ww.AbortEvent.Set();
}
19
Source : Model.cs
with MIT License
from advancedmonitoring
with MIT License
from advancedmonitoring
private static void UpdateDirectory(string path)
{
var localSb = new StringBuilder();
localSb.AppendLine(path);
_currentFiles++;
var sddlString = "Unable obtain SDDL";
try
{
sddlString = Directory.GetAccessControl(path).GetSecurityDescriptorSddlForm(AccessControlSections.All);
}
catch
{
// ignore
}
localSb.AppendLine(sddlString);
_sb.AppendLine(localSb.ToString());
foreach (var dir in DirectorySearcher.MyGetDirectories(path))
{
try
{
if (_isRecursing)
UpdateDirectory(dir);
else
{
localSb.Clear();
localSb.AppendLine(dir);
_currentFiles++;
localSb.AppendLine(Directory.GetAccessControl(dir).GetSecurityDescriptorSddlForm(AccessControlSections.All));
_sb.AppendLine(localSb.ToString());
}
}
catch
{
// ignore
}
_ww.Percentage = (int)((_currentFiles + 0.0) * 100.0 / (_maxFiles + 0.0));
if (_ww.AbortEvent.WaitOne(0))
return;
}
if (_isFileInclude)
foreach (var file in DirectorySearcher.MyGetFiles(path))
{
try
{
localSb.Clear();
localSb.AppendLine(file);
_currentFiles++;
localSb.AppendLine(File.GetAccessControl(file).GetSecurityDescriptorSddlForm(AccessControlSections.All));
_sb.AppendLine(localSb.ToString());
}
catch
{
// ignore
}
_ww.Percentage = (int)((_currentFiles + 0.0) * 100.0 / (_maxFiles + 0.0));
if (_ww.AbortEvent.WaitOne(0))
return;
}
}
19
Source : Model.cs
with MIT License
from advancedmonitoring
with MIT License
from advancedmonitoring
private static void UpdateDirectory(string path)
{
var localSb = new StringBuilder();
localSb.AppendLine(path);
_currentFiles++;
var sddlString = "Unable obtain SDDL";
try
{
sddlString = Directory.GetAccessControl(path).GetSecurityDescriptorSddlForm(AccessControlSections.All);
}
catch
{
// ignore
}
localSb.AppendLine(sddlString);
_sb.AppendLine(localSb.ToString());
foreach (var dir in DirectorySearcher.MyGetDirectories(path))
{
try
{
if (_isRecursing)
UpdateDirectory(dir);
else
{
localSb.Clear();
localSb.AppendLine(dir);
_currentFiles++;
localSb.AppendLine(Directory.GetAccessControl(dir).GetSecurityDescriptorSddlForm(AccessControlSections.All));
_sb.AppendLine(localSb.ToString());
}
}
catch
{
// ignore
}
_ww.Percentage = (int)((_currentFiles + 0.0) * 100.0 / (_maxFiles + 0.0));
if (_ww.AbortEvent.WaitOne(0))
return;
}
if (_isFileInclude)
foreach (var file in DirectorySearcher.MyGetFiles(path))
{
try
{
localSb.Clear();
localSb.AppendLine(file);
_currentFiles++;
localSb.AppendLine(File.GetAccessControl(file).GetSecurityDescriptorSddlForm(AccessControlSections.All));
_sb.AppendLine(localSb.ToString());
}
catch
{
// ignore
}
_ww.Percentage = (int)((_currentFiles + 0.0) * 100.0 / (_maxFiles + 0.0));
if (_ww.AbortEvent.WaitOne(0))
return;
}
}
19
Source : Model.cs
with MIT License
from advancedmonitoring
with MIT License
from advancedmonitoring
public static void ButtonFillFilesClicked()
{
var dlg = new OpenFileDialog
{
Multiselect = true,
Filter = "All files (*.*)|*.*"
};
if (dlg.ShowDialog() ?? false)
{
MW.SetContent();
if (MW.CmbxRightsType.SelectedIndex != 2)
MW.CmbxRightsType.SelectedIndex = 2;
var sb = new StringBuilder();
foreach (var file in dlg.FileNames)
{
try
{
if ((string.IsNullOrWhiteSpace(file)) || (!File.Exists(file)))
continue;
var localSb = new StringBuilder();
localSb.AppendLine($"{file}");
var sddlString = "Unable obtain SDDL";
try
{
sddlString = File.GetAccessControl(file).GetSecurityDescriptorSddlForm(AccessControlSections.All);
}
catch
{
// ignore
}
localSb.AppendLine(sddlString);
sb.AppendLine(localSb.ToString());
}
catch
{
// continue
}
}
MW.SetContent(sb.ToString());
}
}
19
Source : Model.cs
with MIT License
from advancedmonitoring
with MIT License
from advancedmonitoring
private static void UpdateRegKey(RegistryKey key)
{
var localSb = new StringBuilder();
localSb.AppendLine(key.Name);
_currentFiles++;
var sddlString = "Unable obtain SDDL";
try
{
sddlString = key.GetAccessControl().GetSecurityDescriptorSddlForm(AccessControlSections.All);
}
catch
{
// ignore
}
localSb.AppendLine(sddlString);
_sb.AppendLine(localSb.ToString());
if (key.SubKeyCount != 0)
foreach (var sub in key.GetSubKeyNames())
{
try
{
var oKey = key.OpenSubKey(sub);
if (oKey != null)
if (_isRecursing)
UpdateRegKey(oKey);
else
{
localSb.Clear();
localSb.AppendLine(oKey.Name);
_currentFiles++;
localSb.AppendLine(
oKey.GetAccessControl().GetSecurityDescriptorSddlForm(AccessControlSections.All));
_sb.AppendLine(localSb.ToString());
}
}
catch
{
// ignored
}
_ww.Percentage = (int) ((_currentFiles + 0.0) * 100.0 / (_maxFiles + 0.0));
if (_ww.AbortEvent.WaitOne(0))
return;
}
}
19
Source : ReportModel.cs
with MIT License
from advancedmonitoring
with MIT License
from advancedmonitoring
public static string MakeReport(string sddl, List<string> SIDs, List<string> rights, bool isIncludeAllow, bool isIncludeDeny, bool translateSID)
{
var lines = sddl.Split(new[] {'\r', '\n'}, StringSplitOptions.RemoveEmptyEntries);
var prev = "";
var sb = new StringBuilder();
foreach (var line in lines)
{
if (!string.IsNullOrWhiteSpace(line))
{
var sd = new SecurityDescriptor(line.Trim());
if (sd.IsOk)
{
var r = GetLineForReport(sd, SIDs, rights, isIncludeAllow, isIncludeDeny, translateSID);
if (!string.IsNullOrWhiteSpace(r))
{
if (!string.IsNullOrWhiteSpace(prev))
sb.AppendLine(prev);
sb.AppendLine(r);
sb.AppendLine();
}
prev = "";
continue;
}
prev = line;
}
}
return sb.ToString();
}
19
Source : ReportModel.cs
with MIT License
from advancedmonitoring
with MIT License
from advancedmonitoring
public static string GetHelperText(string line, int rightsType, out Tuple<string, string, TreeViewItem[]> details, bool translateSID)
{
var sd = new SecurityDescriptor(line);
if (sd.IsOk)
{
var lSIDs = sd.GetAllSIDs();
var lRights = sd.GetAllRights();
var sb = new StringBuilder();
if (lSIDs.Count != 0)
{
sb.AppendLine();
sb.AppendLine("SIDs:");
sb.AppendLine("-----");
foreach (var lSID in lSIDs)
sb.AppendLine(SecurityDescriptor.SIDToLong(lSID, translateSID));
sb.AppendLine("-----");
}
if (lRights.Count != 0)
{
sb.AppendLine();
sb.AppendLine("Rights (" + ACE.RightType(rightsType)+"):");
sb.AppendLine("-----");
foreach (var lRight in lRights)
sb.AppendLine(ACE.RigthToLong(lRight, rightsType));
sb.AppendLine("-----");
}
var aces = sd.GetACEs();
var treeElements = new TreeViewItem[aces.Count];
for (var i = 0; i < aces.Count; i++)
treeElements[i] = ACEToTreeViewItem(aces[i], rightsType, translateSID);
details = new Tuple<string, string, TreeViewItem[]>(sd.GetOwner(), sd.GetGroup(), treeElements);
return sb.ToString();
}
details = new Tuple<string, string, TreeViewItem[]>("", "", new TreeViewItem[0]);
return string.Empty;
}
19
Source : ReportModel.cs
with MIT License
from advancedmonitoring
with MIT License
from advancedmonitoring
public static string GetHelperText(string line, int rightsType, out Tuple<string, string, TreeViewItem[]> details, bool translateSID)
{
var sd = new SecurityDescriptor(line);
if (sd.IsOk)
{
var lSIDs = sd.GetAllSIDs();
var lRights = sd.GetAllRights();
var sb = new StringBuilder();
if (lSIDs.Count != 0)
{
sb.AppendLine();
sb.AppendLine("SIDs:");
sb.AppendLine("-----");
foreach (var lSID in lSIDs)
sb.AppendLine(SecurityDescriptor.SIDToLong(lSID, translateSID));
sb.AppendLine("-----");
}
if (lRights.Count != 0)
{
sb.AppendLine();
sb.AppendLine("Rights (" + ACE.RightType(rightsType)+"):");
sb.AppendLine("-----");
foreach (var lRight in lRights)
sb.AppendLine(ACE.RigthToLong(lRight, rightsType));
sb.AppendLine("-----");
}
var aces = sd.GetACEs();
var treeElements = new TreeViewItem[aces.Count];
for (var i = 0; i < aces.Count; i++)
treeElements[i] = ACEToTreeViewItem(aces[i], rightsType, translateSID);
details = new Tuple<string, string, TreeViewItem[]>(sd.GetOwner(), sd.GetGroup(), treeElements);
return sb.ToString();
}
details = new Tuple<string, string, TreeViewItem[]>("", "", new TreeViewItem[0]);
return string.Empty;
}
19
Source : DirectoryLookupResult.cs
with MIT License
from Adyen
with MIT License
from Adyen
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("clreplaced DirectoryLookupResult {");
sb.Append(" paymentMethods: ").AppendLine(this.PaymentMethods.ToIndentedString());
sb.AppendLine("}");
return sb.ToString();
}
19
Source : DirectoryLookupResult.cs
with MIT License
from Adyen
with MIT License
from Adyen
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("clreplaced DirectoryLookupResult {");
sb.Append(" paymentMethods: ").AppendLine(this.PaymentMethods.ToIndentedString());
sb.AppendLine("}");
return sb.ToString();
}
19
Source : PaymentMethod.cs
with MIT License
from Adyen
with MIT License
from Adyen
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("clreplaced PaymentMethod {\n");
sb.Append(" brandCode: ").AppendLine(this.BrandCode.ToIndentedString());
sb.Append(" name: ").AppendLine(this.Name.ToIndentedString());
sb.Append(" issuers: ").AppendLine(this.Issuers.ToIndentedString());
sb.Append("}");
return sb.ToString();
}
19
Source : Extensions.cs
with MIT License
from Adyen
with MIT License
from Adyen
public static string ToClreplacedDefinitionString(this object o)
{
try
{
var t = o.GetType();
var propertyString = new StringBuilder().AppendLine($"clreplaced {o.GetType().Name} {{");
foreach (var prop in t.GetProperties())
{
var propertyValue = prop.GetValue(o, null);
propertyString.Append("\t")
.AppendLine(propertyValue != null
? $"{prop.Name}: {propertyValue}".ToIndentedString()
: $"{prop.Name}: null");
}
propertyString.AppendLine("}");
return propertyString.ToString();
}
catch
{
return o.ToString();
}
}
19
Source : ILASTTree.cs
with GNU General Public License v3.0
from Aekras1a
with GNU General Public License v3.0
from Aekras1a
public override string ToString()
{
var ret = new StringBuilder();
foreach(var st in this)
ret.AppendLine(st.ToString());
ret.AppendLine();
ret.Append("[");
for(var i = 0; i < StackRemains.Length; i++)
{
if(i != 0)
ret.Append(", ");
ret.Append(StackRemains[i]);
}
ret.AppendLine("]");
return ret.ToString();
}
19
Source : ILASTTree.cs
with GNU General Public License v3.0
from Aekras1a
with GNU General Public License v3.0
from Aekras1a
public override string ToString()
{
var ret = new StringBuilder();
foreach(var st in this)
ret.AppendLine(st.ToString());
ret.AppendLine();
ret.Append("[");
for(var i = 0; i < StackRemains.Length; i++)
{
if(i != 0)
ret.Append(", ");
ret.Append(StackRemains[i]);
}
ret.AppendLine("]");
return ret.ToString();
}
19
Source : ScopeBlock.cs
with GNU General Public License v3.0
from Aekras1a
with GNU General Public License v3.0
from Aekras1a
public override string ToString()
{
var ret = new StringBuilder();
if(Type == ScopeType.Try)
ret.AppendLine("try @ " + ToString(ExceptionHandler) + " {");
else if(Type == ScopeType.Handler)
ret.AppendLine("handler @ " + ToString(ExceptionHandler) + " {");
else if(Type == ScopeType.Filter)
ret.AppendLine("filter @ " + ToString(ExceptionHandler) + " {");
else
ret.AppendLine("{");
if(Children.Count > 0)
foreach(var child in Children)
ret.AppendLine(child.ToString());
else
foreach(var child in Content)
ret.AppendLine(child.ToString());
ret.AppendLine("}");
return ret.ToString();
}
19
Source : ScopeBlock.cs
with GNU General Public License v3.0
from Aekras1a
with GNU General Public License v3.0
from Aekras1a
public override string ToString()
{
var ret = new StringBuilder();
if(Type == ScopeType.Try)
ret.AppendLine("try @ " + ToString(ExceptionHandler) + " {");
else if(Type == ScopeType.Handler)
ret.AppendLine("handler @ " + ToString(ExceptionHandler) + " {");
else if(Type == ScopeType.Filter)
ret.AppendLine("filter @ " + ToString(ExceptionHandler) + " {");
else
ret.AppendLine("{");
if(Children.Count > 0)
foreach(var child in Children)
ret.AppendLine(child.ToString());
else
foreach(var child in Content)
ret.AppendLine(child.ToString());
ret.AppendLine("}");
return ret.ToString();
}
19
Source : HumanSkin.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
public override string ToString()
{
StringBuilder str = new StringBuilder();
foreach (KeyValuePair<int, SkinElement> pair in elements)
{
if (pair.Value.Path != string.Empty)
{
str.AppendLine($"{((HumanParts)pair.Key).ToString()} = {pair.Value.Path}");
}
}
return str.ToString();
}
19
Source : ChatHistoryPanel.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
protected override void OnPanelEnable()
{
if (!AnarchyManager.Pause.IsActive)
{
IN_GAME_MAIN_CAMERA.isPausing = true;
InputManager.MenuOn = true;
if (Screen.lockCursor)
{
Screen.lockCursor = false;
}
if (!Screen.showCursor)
{
Screen.showCursor = true;
}
}
rect = Helper.GetSmartRects(WindowPosition, 1)[0];
scroll = Optimization.Caching.Vectors.v2zero;
scrollRect = new SmartRect(0f, 0f, rect.width, rect.height, 0f, Style.VerticalMargin);
scrollArea = new Rect(rect.x, rect.y, rect.width, WindowPosition.height - (4 * (Style.Height + Style.VerticalMargin)) - (Style.WindowTopOffset + Style.WindowBottomOffset) - 10f);
scrollAreaView = new Rect(0f, 0f, rect.width, int.MaxValue);
var bld = new StringBuilder();
foreach(string str in messages)
{
bld.AppendLine(str);
}
showString = bld.ToString();
}
19
Source : Chat.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
public static string GetLastMessages()
{
int i = Instance.messages.Count - 11;
int end = Instance.messages.Count - 1;
var bld = new System.Text.StringBuilder();
for (; i < end; i++)
{
bld.AppendLine(Instance.messages[i].RemoveHTML());
}
return bld.ToString();
}
19
Source : SingleRunStats.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
public override string ToString()
{
var bld = new StringBuilder();
bld.AppendLine($"Time: {TimeStamp.ToString("F3")}, last kill at {LastKillTime.ToString("F2")}");
bld.AppendLine($"Name: {Name}");
bld.AppendLine($"Statistics");
bld.AppendLine($"Kills: {Kills}. Average kill time: {KillTimeAverage.ToString("F2")}");
bld.AppendLine($"Total damage: {TotalDamage}. Average total damage: {TotalPerKill.ToString("F2")}");
bld.AppendLine($"Max damage: {MaxDamage}");
bld.AppendLine($"Misc statistics");
bld.AppendLine($"Physics update: {UnityEngine.Mathf.RoundToInt(1f / FixedDeltaTime)}/sec. ({FixedDeltaTime.ToString("F3")} ms)");
bld.AppendLine($"Refills. Refills count: {GasRefillsCount}. Last refill at: {LastRefill.ToString("F2")}");
bld.AppendLine($"Reloads. Reloads count: {Reloads}. Last reload at: {LastReload.ToString("F2")}");
bld.AppendLine($"Hero stats. Name: {Stats.name}");
bld.AppendLine($"Spd: {Stats.Spd}, Bla: {Stats.Bla}, Acl {Stats.Acl}, Gas: {Stats.Acl}, Skill: {Stats.skillID}");
bld.AppendLine($"Anarchy version: {Version}");
return bld.ToString();
}
19
Source : GameModes.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
public static void HandleRpc(Hashtable hash)
{
if (oldHash.Equals(hash))
{
return;
}
int count = 0;
StringBuilder bld = new StringBuilder();
foreach (var set in allGameSettings)
{
set.ReadFromHashtable(hash);
if (set.HasChangedReceived)
{
set.ApplyReceived();
if (count > 0)
{
bld.Append("\n");
}
bld.Append(set.ToStringLocal());
count++;
}
}
if (hash.ContainsKey("motd") && oldHash.ContainsKey("motd") &&
oldHash["motd"] as string != hash["motd"] as string)
{
if (count > 0)
{
bld.Append("\n");
}
bld.Append("MOTD: " + hash["motd"]);
oldHash["motd"] = hash["motd"];
}
else if(hash.ContainsKey("motd") && oldHash.ContainsKey("motd") == false)
{
bld.AppendLine("MOTD: " + hash["motd"]);
oldHash.Add("motd", hash["motd"]);
}
oldHash = new Hashtable();
Dictionary<object, object> clone = (Dictionary<object, object>)hash.Clone();
foreach (KeyValuePair<object, object> pair in clone)
{
oldHash.Add(pair.Key, pair.Value);
}
Chat.Add(bld.ToString());
PhotonNetwork.SetModProperties();
}
19
Source : PlayerList.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
public void Update()
{
if (!PhotonNetwork.inRoom)
{
return;
}
var bld = new StringBuilder();
if (GameModes.TeamMode.Enabled && !GameModes.InfectionMode.Enabled)
{
var individual = new StringBuilder();
var cyan = new StringBuilder();
var magenta = new StringBuilder();
int[] cyanStats = new int[4];
int[] magentaStats = new int[4];
//int[] individualStats = new int[4];
for (int i = 0; i < PhotonNetwork.playerList.Length; i++)
{
StringBuilder local = null;
PhotonPlayer player = PhotonNetwork.playerList[i];
int[] teamArray = null;
switch (PhotonNetwork.playerList[i].RCteam)
{
default:
case 0:
local = individual;
//teamArray = individualStats;
break;
case 1:
local = cyan;
teamArray = cyanStats;
break;
case 2:
local = magenta;
teamArray = magentaStats;
break;
}
if (teamArray != null)
{
teamArray[0] += player.Kills;
teamArray[1] += player.Deaths;
teamArray[2] += player.MaximumDamage;
teamArray[3] += player.TotalDamage;
}
local.AppendLine(PlayerToString(PhotonNetwork.playerList[i]));
}
bld.AppendLine($"\n<color=cyan>Team cyan</color> {GetStatString(cyanStats)}\n{cyan.ToString()}");
bld.AppendLine($"<color=magenta>Team magenta</color> {GetStatString(magentaStats)}\n{magenta.ToString()}");
bld.Append($"<color=lime>Individuals</color>\n{individual.ToString()}");
}
else
{
for (int i = 0; i < PhotonNetwork.playerList.Length; i++)
{
if (i >= 25)
{
bld.Append("And " + (PhotonNetwork.playerList.Length - 25) + " players...");
break;
}
bld.AppendLine(PlayerToString(PhotonNetwork.playerList[i]));
}
}
Labels.TopLeft = bld.ToString().ToHTMLFormat();
}
19
Source : RoomInformation.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
public void UpdateLabels()
{
var bld = new StringBuilder();
bld.AppendLine(lang.Format("time", (IN_GAME_MAIN_CAMERA.GameType == GameType.Single ? (FengGameManagerMKII.FGM.logic.RoundTime).ToString("F0") : (FengGameManagerMKII.FGM.logic.ServerTime).ToString("F0"))));
if (IN_GAME_MAIN_CAMERA.GameMode != GameMode.Racing)
{
bld.AppendLine(lang.Format("score", FengGameManagerMKII.FGM.logic.HumanScore.ToString(), FengGameManagerMKII.FGM.logic.replacedanScore.ToString()));
string difficulty = (IN_GAME_MAIN_CAMERA.Difficulty >= 0) ? ((IN_GAME_MAIN_CAMERA.Difficulty != 0) ? ((IN_GAME_MAIN_CAMERA.Difficulty != 1) ? lang["abnormal"] : lang["hard"]) : lang["normal"]) : lang["training"];
bld.Append(FengGameManagerMKII.Level.Name);
bld.Append(": ");
bld.AppendLine(difficulty);
}
bld.AppendLine(lang.Format("cameraChange", InputManager.Settings[InputCode.CameraChange].ToString(), IN_GAME_MAIN_CAMERA.CameraMode.ToString()));
if (PhotonNetwork.inRoom)
{
bld.AppendLine(lang.Format("room", PhotonNetwork.room.UIName.Split('/')[0].ToHTMLFormat()));
bld.AppendLine(lang.Format("slots", PhotonNetwork.room.PlayerCount.ToString(), PhotonNetwork.room.MaxPlayers.ToString().ToString()));
}
bld.Append(lang.Format("fps", FengGameManagerMKII.FPS.FPS.ToString()));
if (PhotonNetwork.player.Properties.ContainsKey(PhotonPlayerProperty.anarchyFlags))
{
int anarchyInt = (int)PhotonNetwork.player.Properties[PhotonPlayerProperty.anarchyFlags];
if (anarchyInt > 0)
{
bld.Append($"\nAnarchy functions were used: {anarchyInt}");
}
}
Labels.TopRight = "<color=#" + User.MainColor.Value + ">" + bld.ToString() + "</color>";
}
19
Source : RoomInformation.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
public void UpdateLabels()
{
var bld = new StringBuilder();
bld.AppendLine(lang.Format("time", (IN_GAME_MAIN_CAMERA.GameType == GameType.Single ? (FengGameManagerMKII.FGM.logic.RoundTime).ToString("F0") : (FengGameManagerMKII.FGM.logic.ServerTime).ToString("F0"))));
if (IN_GAME_MAIN_CAMERA.GameMode != GameMode.Racing)
{
bld.AppendLine(lang.Format("score", FengGameManagerMKII.FGM.logic.HumanScore.ToString(), FengGameManagerMKII.FGM.logic.replacedanScore.ToString()));
string difficulty = (IN_GAME_MAIN_CAMERA.Difficulty >= 0) ? ((IN_GAME_MAIN_CAMERA.Difficulty != 0) ? ((IN_GAME_MAIN_CAMERA.Difficulty != 1) ? lang["abnormal"] : lang["hard"]) : lang["normal"]) : lang["training"];
bld.Append(FengGameManagerMKII.Level.Name);
bld.Append(": ");
bld.AppendLine(difficulty);
}
bld.AppendLine(lang.Format("cameraChange", InputManager.Settings[InputCode.CameraChange].ToString(), IN_GAME_MAIN_CAMERA.CameraMode.ToString()));
if (PhotonNetwork.inRoom)
{
bld.AppendLine(lang.Format("room", PhotonNetwork.room.UIName.Split('/')[0].ToHTMLFormat()));
bld.AppendLine(lang.Format("slots", PhotonNetwork.room.PlayerCount.ToString(), PhotonNetwork.room.MaxPlayers.ToString().ToString()));
}
bld.Append(lang.Format("fps", FengGameManagerMKII.FPS.FPS.ToString()));
if (PhotonNetwork.player.Properties.ContainsKey(PhotonPlayerProperty.anarchyFlags))
{
int anarchyInt = (int)PhotonNetwork.player.Properties[PhotonPlayerProperty.anarchyFlags];
if (anarchyInt > 0)
{
bld.Append($"\nAnarchy functions were used: {anarchyInt}");
}
}
Labels.TopRight = "<color=#" + User.MainColor.Value + ">" + bld.ToString() + "</color>";
}
19
Source : Profiler.cs
with The Unlicense
from aeroson
with The Unlicense
from aeroson
private void OnGUI()
{
if (!show)
return;
stringBuilder.Clear();
foreach (var pair in sampleNameToGUIText.OrderBy((pair) => pair.Key))
{
stringBuilder.AppendLine(pair.Key + " " + pair.Value);
}
GUILayout.Label(stringBuilder.ToString());
}
19
Source : SqlServerDataBase.cs
with Mozilla Public License 2.0
from agebullhu
with Mozilla Public License 2.0
from agebullhu
public static void TraceSql(string sql, IEnumerable<SqlParameter> args)
{
if (!LogRecorder.LogDataSql)
return;
if (string.IsNullOrWhiteSpace(sql))
return;
StringBuilder code = new StringBuilder();
code.AppendLine($"/******************************{DateTime.Now}*********************************/");
var sqlParameters = args as SqlParameter[] ?? args.ToArray();
foreach (var par in sqlParameters.Where(p => p != null))
{
code.AppendLine($"declare @{par.ParameterName} {par.SqlDbType};");
}
foreach (var par in sqlParameters.Where(p => p != null))
{
code.AppendLine($"SET @{par.ParameterName} = '{par.Value}';");
}
code.AppendLine(sql);
code.AppendLine("GO");
LogRecorder.RecordDataLog(code.ToString());
}
19
Source : MySqlDataBase.cs
with Mozilla Public License 2.0
from agebullhu
with Mozilla Public License 2.0
from agebullhu
public static void TraceSql(string sql, IEnumerable<MySqlParameter> args)
{
if (!LogRecorder.LogDataSql)
return;
StringBuilder code = new StringBuilder();
code.AppendLine("/***************************************************************/");
var parameters = args as MySqlParameter[] ?? args.ToArray();
foreach (var par in parameters.Where(p => p != null))
{
code.AppendLine($"declare ?{par.ParameterName} {par.MySqlDbType};");
}
foreach (var par in parameters.Where(p => p != null))
{
code.AppendLine($"SET ?{par.ParameterName} = '{par.Value}';");
}
code.AppendLine(sql);
LogRecorder.RecordDataLog(code.ToString());
}
19
Source : GlobalContext.cs
with Mozilla Public License 2.0
from agebullhu
with Mozilla Public License 2.0
from agebullhu
public void AppendMessage(string msg)
{
if (_messageBuilder == null)
_messageBuilder = new StringBuilder(_status.ClientMessage);
_messageBuilder.AppendLine(msg);
_messageChanged = true;
}
See More Examples