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 : WProject.cs
with MIT License
from 3F
with MIT License
from 3F
public override string Extract(object data)
{
var sb = new StringBuilder();
foreach(var prj in projecreplacedems)
{
sb.AppendLine(
$"Project(\"{prj.pType}\") = \"{prj.name}\", \"{prj.path}\", \"{prj.pGuid}\""
);
if(projectDependencies.Dependencies.ContainsKey(prj.pGuid)
&& projectDependencies.Dependencies[prj.pGuid].Count > 0)
{
sb.AppendLine($"{SP}ProjectSection(ProjectDependencies) = postProject");
projectDependencies.Dependencies[prj.pGuid]
.ForEach(dep => sb.AppendLine($"{SP}{SP}{dep} = {dep}"));
sb.AppendLine($"{SP}EndProjectSection");
}
sb.AppendLine("EndProject");
}
if(sb.Length > 1) {
return sb.ToString(0, sb.Length - 2);
}
return String.Empty;
}
19
Source : WProjectConfigurationPlatforms.cs
with MIT License
from 3F
with MIT License
from 3F
public override string Extract(object data)
{
var sb = new StringBuilder();
sb.AppendLine($"{SP}GlobalSection(ProjectConfigurationPlatforms) = postSolution");
foreach(var cfg in configs)
{
sb.AppendLine($"{SP}{SP}{cfg.PGuid}.{cfg.Sln}.ActiveCfg = {cfg}");
if(cfg.IncludeInBuild) {
sb.AppendLine($"{SP}{SP}{cfg.PGuid}.{cfg.Sln}.Build.0 = {cfg}");
}
if (cfg.IncludeInDeploy) {
sb.AppendLine($"{SP}{SP}{cfg.PGuid}.{cfg.Sln}.Deploy.0 = {cfg}");
}
}
sb.Append($"{SP}EndGlobalSection");
return sb.ToString();
}
19
Source : WProjectSolutionItems.cs
with MIT License
from 3F
with MIT License
from 3F
public override string Extract(object data)
{
var sb = new StringBuilder();
foreach(var folder in folders)
{
var prj = folder.header;
sb.AppendLine(
$"Project(\"{prj.pType}\") = \"{prj.name}\", \"{prj.path}\", \"{prj.pGuid}\""
);
sb.AppendLine($"{SP}ProjectSection(SolutionItems) = preProject");
folder.items.ForEach(item => sb.AppendLine($"{SP}{SP}{item} = {item}"));
sb.AppendLine($"{SP}EndProjectSection");
sb.AppendLine("EndProject");
}
if(sb.Length > 1) {
return sb.ToString(0, sb.Length - 2);
}
return String.Empty;
}
19
Source : WSolutionConfigurationPlatforms.cs
with MIT License
from 3F
with MIT License
from 3F
public override string Extract(object data)
{
var sb = new StringBuilder();
sb.AppendLine($"{SP}GlobalSection(SolutionConfigurationPlatforms) = preSolution");
configs.ForEach(cfg => sb.AppendLine($"{SP}{SP}{cfg} = {cfg}"));
sb.Append($"{SP}EndGlobalSection");
return sb.ToString();
}
19
Source : WVisualStudioVersion.cs
with MIT License
from 3F
with MIT License
from 3F
public override string Extract(object data)
{
var sb = new StringBuilder();
string fmt = String.Format("{0}.{1:00}", header.FormatVersion.Major, header.FormatVersion.Minor);
sb.AppendLine($"Microsoft Visual Studio Solution File, Format Version {fmt}");
if(header.ProgramVersion != null) {
sb.AppendLine($"# Visual Studio {header.ProgramVersion}");
}
if(header.VisualStudioVersion != null) {
sb.AppendLine($"VisualStudioVersion = {header.VisualStudioVersion.ToString()}");
}
if(header.MinimumVisualStudioVersion != null) {
sb.AppendLine($"MinimumVisualStudioVersion = {header.MinimumVisualStudioVersion.ToString()}");
}
return sb.ToString(0, sb.Length - 2);
}
19
Source : Program.cs
with GNU General Public License v3.0
from 3xpl01tc0d3r
with GNU General Public License v3.0
from 3xpl01tc0d3r
public static string ShellExecuteWithPath(string ShellCommand, string Path, string Username = "", string Domain = "", string Preplacedword = "")
{
if (ShellCommand == null || ShellCommand == "") return "";
string ShellCommandName = ShellCommand.Split(' ')[0];
string ShellCommandArguments = "";
if (ShellCommand.Contains(" "))
{
ShellCommandArguments = ShellCommand.Replace(ShellCommandName + " ", "");
}
System.Diagnostics.Process shellProcess = new System.Diagnostics.Process();
if (Username != "")
{
shellProcess.StartInfo.UserName = Username;
shellProcess.StartInfo.Domain = Domain;
System.Security.SecureString SecurePreplacedword = new System.Security.SecureString();
foreach (char c in Preplacedword)
{
SecurePreplacedword.AppendChar(c);
}
shellProcess.StartInfo.Preplacedword = SecurePreplacedword;
}
shellProcess.StartInfo.FileName = ShellCommandName;
shellProcess.StartInfo.Arguments = ShellCommandArguments;
shellProcess.StartInfo.WorkingDirectory = Path;
shellProcess.StartInfo.UseShellExecute = false;
shellProcess.StartInfo.CreateNoWindow = true;
shellProcess.StartInfo.RedirectStandardOutput = true;
shellProcess.StartInfo.RedirectStandardError = true;
var output = new StringBuilder();
shellProcess.OutputDataReceived += (sender, args) => { output.AppendLine(args.Data); };
shellProcess.ErrorDataReceived += (sender, args) => { output.AppendLine(args.Data); };
shellProcess.Start();
shellProcess.BeginOutputReadLine();
shellProcess.BeginErrorReadLine();
shellProcess.WaitForExit();
return output.ToString().TrimEnd();
}
19
Source : Program.cs
with GNU General Public License v3.0
from 3xpl01tc0d3r
with GNU General Public License v3.0
from 3xpl01tc0d3r
public static string ShellExecuteWithPath(string ShellCommand, string Path, string Username = "", string Domain = "", string Preplacedword = "")
{
if (ShellCommand == null || ShellCommand == "") return "";
string ShellCommandName = ShellCommand.Split(' ')[0];
string ShellCommandArguments = "";
if (ShellCommand.Contains(" "))
{
ShellCommandArguments = ShellCommand.Replace(ShellCommandName + " ", "");
}
System.Diagnostics.Process shellProcess = new System.Diagnostics.Process();
if (Username != "")
{
shellProcess.StartInfo.UserName = Username;
shellProcess.StartInfo.Domain = Domain;
System.Security.SecureString SecurePreplacedword = new System.Security.SecureString();
foreach (char c in Preplacedword)
{
SecurePreplacedword.AppendChar(c);
}
shellProcess.StartInfo.Preplacedword = SecurePreplacedword;
}
shellProcess.StartInfo.FileName = ShellCommandName;
shellProcess.StartInfo.Arguments = ShellCommandArguments;
shellProcess.StartInfo.WorkingDirectory = Path;
shellProcess.StartInfo.UseShellExecute = false;
shellProcess.StartInfo.CreateNoWindow = true;
shellProcess.StartInfo.RedirectStandardOutput = true;
shellProcess.StartInfo.RedirectStandardError = true;
var output = new StringBuilder();
shellProcess.OutputDataReceived += (sender, args) => { output.AppendLine(args.Data); };
shellProcess.ErrorDataReceived += (sender, args) => { output.AppendLine(args.Data); };
shellProcess.Start();
shellProcess.BeginOutputReadLine();
shellProcess.BeginErrorReadLine();
shellProcess.WaitForExit();
return output.ToString().TrimEnd();
}
19
Source : NotchSolutionDebugger.cs
with MIT License
from 5argon
with MIT License
from 5argon
void Update()
{
sb.Clear();
ClearRects();
switch (menu)
{
case Menu.Home:
export.gameObject.SetActive(true);
sb.AppendLine($"<b>-- PLEASE ROTATE THE DEVICE TO GET BOTH ORIENTATION'S DETAILS! --</b>\n");
var safeArea = RelativeToReal(NotchSolutionUtility.ShouldUseNotchSimulatorValue ? storedSimulatedSafeAreaRelative : NotchSolutionUtility.ScreenSafeAreaRelative);
PlaceRect(safeArea, Color.red);
if (Screen.orientation != NotchSolutionUtility.GetCurrentOrientation())
safeArea.Set(Screen.width - safeArea.x, Screen.height - safeArea.y, safeArea.width, safeArea.height);
sb.AppendLine($"Safe area : {safeArea}\n");
#if UNITY_2019_2_OR_NEWER
#if UNITY_EDITOR
var relativeCutouts = NotchSolutionUtility.ShouldUseNotchSimulatorValue ? storedSimulatedCutoutsRelative : NotchSolutionUtility.ScreenCutoutsRelative;
List<Rect> rectCutouts = new List<Rect>();
foreach (Rect rect in relativeCutouts) rectCutouts.Add(RelativeToReal(rect));
var cutouts = rectCutouts.ToArray();
#else
var cutouts = Screen.cutouts;
#endif
foreach (Rect r in cutouts) PlaceRect(r, Color.blue);
if (Screen.orientation != NotchSolutionUtility.GetCurrentOrientation())
{
foreach (Rect rect in cutouts) rect.Set(Screen.width - rect.x, Screen.height - rect.y, rect.width, rect.height);
}
sb.AppendLine($"Cutouts : {string.Join(" / ", cutouts.Select(x => x.ToString()))} \n");
#endif
sb.AppendLine($"Current resolution : {Screen.currentResolution}\n");
sb.AppendLine($"All Resolutions : {string.Join(" / ", Screen.resolutions.Select(x => x.ToString()))}\n");
sb.AppendLine($"DPI : {Screen.dpi} WxH : {Screen.width}x{Screen.height} Orientation : {Screen.orientation}\n");
var joinedProps = string.Join(" / ", typeof(SystemInfo).GetProperties(BindingFlags.Public | BindingFlags.Static).Select(x => $"{x.Name} : {x.GetValue(null)}"));
sb.AppendLine(joinedProps);
break;
case Menu.Extracting:
var screen = device.Screens.FirstOrDefault();
export.gameObject.SetActive(false);
if (screen.orientations.Count == 4)
{
string path = Application.persistentDataPath + "/" + device.Meta.friendlyName + ".device.json";
System.IO.File.WriteAllText(path, JsonUtility.ToJson(device));
sb.AppendLine("<b>Done</b>");
sb.AppendLine("");
sb.AppendLine($"File saved at <i>{path}</i>");
StartCoroutine(exportDone());
}
else sb.AppendLine("Extracting...");
break;
}
debugText.text = sb.ToString();
}
19
Source : Main.cs
with MIT License
from 5minlab
with MIT License
from 5minlab
void Start () {
var sb = new StringBuilder();
#if PLATFORM_WIN32_STEAMVR
sb.AppendLine("current platform is PLATFORM_WIN32_STEAMVR");
#endif
#if PLATFORM_WIN32_OCULUS
sb.AppendLine("current platform is PLATFORM_WIN32_OCULUS");
#endif
#if PLATFORM_UWP
sb.AppendLine("currnet platform is PLATFORM_UWP");
#endif
#if PLATFORM_PS4
sb.AppendLine("currnet platform is PLATFORM_PS4");
#endif
#if HELLO_WORLD
sb.AppendLine("hello world!");
#endif
if (Debug.isDebugBuild) {
sb.AppendLine("this is debug build");
} else {
sb.AppendLine("this is release build");
}
text.text = sb.ToString();
}
19
Source : LyricsFetcher.cs
with MIT License
from 71
with MIT License
from 71
private static void PopulateFromSrt(TextReader reader, List<Subreplacedle> subreplacedles)
{
// Parse using a simple state machine:
// 0: Parsing number
// 1: Parsing start / end time
// 2: Parsing text
byte state = 0;
float startTime = 0f,
endTime = 0f;
StringBuilder text = new StringBuilder();
string line;
while ((line = reader.ReadLine()) != null)
{
switch (state)
{
case 0:
if (string.IsNullOrEmpty(line))
// No number found; continue in same state.
continue;
if (!int.TryParse(line, out int _))
goto Invalid;
// Number found; continue to next state.
state = 1;
break;
case 1:
Match m = Regex.Match(line, @"(\d+):(\d+):(\d+,\d+) *--> *(\d+):(\d+):(\d+,\d+)");
if (!m.Success)
goto Invalid;
startTime = int.Parse(m.Groups[1].Value) * 3600
+ int.Parse(m.Groups[2].Value) * 60
+ float.Parse(m.Groups[3].Value.Replace(',', '.'), NumberStyles.Float, CultureInfo.InvariantCulture);
endTime = int.Parse(m.Groups[4].Value) * 3600
+ int.Parse(m.Groups[5].Value) * 60
+ float.Parse(m.Groups[6].Value.Replace(',', '.'), NumberStyles.Float, CultureInfo.InvariantCulture);
// Subreplacedle start / end found; continue to next state.
state = 2;
break;
case 2:
if (string.IsNullOrEmpty(line))
{
// End of text; continue to next state.
subreplacedles.Add(new Subreplacedle(text.ToString(), startTime, endTime));
text.Length = 0;
state = 0;
}
else
{
// Continuation of text; continue in same state.
text.AppendLine(line);
}
break;
default:
// Shouldn't happen.
throw new Exception();
}
}
Invalid:
Debug.Log("[Beat Singer] Invalid subtiles file found, cancelling load...");
subreplacedles.Clear();
}
19
Source : PlantumlDiagram.cs
with MIT License
from 8T4
with MIT License
from 8T4
public static string ToPumlString(this Diagram diagram, bool useStandardLibrary)
{
var path = GetPumlFilePath(diagram, useStandardLibrary);
var stream = new StringBuilder();
stream.AppendLine($"@startuml {diagram.Slug()}");
stream.AppendLine($"!include {path}");
stream.AppendLine();
if (diagram.LayoutWithLegend && !diagram.ShowLegend)
{
stream.AppendLine("LAYOUT_WITH_LEGEND()");
}
if (diagram.Layoutreplacedketch)
{
stream.AppendLine("LAYOUT_AS_SKETCH()");
}
stream.AppendLine($"{(diagram.FlowVisualization == DiagramLayout.TopDown ? "LAYOUT_TOP_DOWN()" : "LAYOUT_LEFT_RIGHT()")}");
stream.AppendLine();
if (!string.IsNullOrWhiteSpace(diagram.replacedle))
{
stream.AppendLine($"replacedle {diagram.replacedle}");
stream.AppendLine();
}
foreach (var structure in diagram.Structures)
{
stream.AppendLine(structure.ToPumlString());
}
stream.AppendLine();
foreach (var relationship in diagram.Relationships)
{
stream.AppendLine(relationship.ToPumlString());
}
if (diagram.ShowLegend)
{
stream.AppendLine();
stream.AppendLine("SHOW_LEGEND()");
}
stream.AppendLine("@enduml");
return stream.ToString();
}
19
Source : PlantumlStructure.cs
with MIT License
from 8T4
with MIT License
from 8T4
private static string ToPumlString(this SoftwareSystemBoundary boundary)
{
var stream = new StringBuilder();
stream.AppendLine();
stream.AppendLine($"System_Boundary({boundary.Alias}, \"{boundary.Label}\") {{");
foreach (var container in boundary.Containers)
{
stream.AppendLine($"{SpaceMethods.Indent()}{container.ToPumlString()}");
}
stream.AppendLine("}");
return stream.ToString();
}
19
Source : TextIndentationMethods.cs
with MIT License
from 8T4
with MIT License
from 8T4
internal static void AppendHorizontalLine(this StringBuilder builder, int size)
{
var line = string.Empty.PadLeft(size, '-');
builder.AppendLine(line);
}
19
Source : Scenario.cs
with MIT License
from 8T4
with MIT License
from 8T4
private ScenarioResult VerifyIfAllScenarioWereMapped()
{
var allExpressionMapped = true;
var result = new StringBuilder();
AppendScenarioDescription(ref result);
foreach (var (key, value) in Paradigms.Syntagmas)
{
if (!MappedParadigms.SyntagmaExists(value))
{
allExpressionMapped = false;
result.AppendLine(
$"{Colors.Reset(value.Metalanguage.Sign.Signifier.Value)} {Colors.Error("(NOT MAPPED)")}"
.Indent());
continue;
}
var mapped = MappedParadigms.GetSyntagma(key);
if (mapped.Sign.Signified.Value == null)
{
result.AppendLine($"{value.Metalanguage.Sign.Signifier.Value}");
continue;
}
result.AppendLine($"{value.Metalanguage.Sign.Signifier.Value}".Indent());
}
return allExpressionMapped
? ScenarioResult.Ok(result.ToString())
: ScenarioResult.Fail(result.ToString());
}
19
Source : Scenario.cs
with MIT License
from 8T4
with MIT License
from 8T4
private ScenarioResult VerifyIfAllScenarioWereMapped()
{
var allExpressionMapped = true;
var result = new StringBuilder();
AppendScenarioDescription(ref result);
foreach (var (key, value) in Paradigms.Syntagmas)
{
if (!MappedParadigms.SyntagmaExists(value))
{
allExpressionMapped = false;
result.AppendLine(
$"{Colors.Reset(value.Metalanguage.Sign.Signifier.Value)} {Colors.Error("(NOT MAPPED)")}"
.Indent());
continue;
}
var mapped = MappedParadigms.GetSyntagma(key);
if (mapped.Sign.Signified.Value == null)
{
result.AppendLine($"{value.Metalanguage.Sign.Signifier.Value}");
continue;
}
result.AppendLine($"{value.Metalanguage.Sign.Signifier.Value}".Indent());
}
return allExpressionMapped
? ScenarioResult.Ok(result.ToString())
: ScenarioResult.Fail(result.ToString());
}
19
Source : Scenario.cs
with MIT License
from 8T4
with MIT License
from 8T4
private void AppendScenarioDescription(ref StringBuilder builder)
{
builder.AppendHorizontalLine(60);
builder.AppendLine(Colors.Success(Description.ToUpper(CultureInfo.InvariantCulture)));
}
19
Source : PlantumlSession.cs
with MIT License
from 8T4
with MIT License
from 8T4
internal void Execute(string path, bool processWholeDirectory)
{
var directory = processWholeDirectory
? path
: new FileInfo(path)?.Directory?.FullName;
try
{
if (string.IsNullOrEmpty(directory))
{
throw new PlantumlException($"{nameof(PlantumlException)}: puml file not found.");
}
var results = new StringBuilder();
var jar = StandardLibraryBaseUrl
? $"-jar {FilePath} -verbose -o \"{directory}\" -charset UTF-8"
: $"-jar {FilePath} -DRELATIVE_INCLUDE=\".\" -verbose -o \"{directory}\" -charset UTF-8";
ProcessInfo.Arguments = $"{jar} {path}";
ProcessInfo.RedirectStandardOutput = true;
ProcessInfo.StandardOutputEncoding = Encoding.UTF8;
var process = new Process { StartInfo = ProcessInfo };
process.OutputDataReceived += (_, args) => { results.AppendLine(args.Data); };
process.Start();
process.WaitForExit();
}
catch (Exception e)
{
throw new PlantumlException($"{nameof(PlantumlException)}: puml file not found.", e);
}
}
19
Source : Scenario.cs
with MIT License
from 8T4
with MIT License
from 8T4
private ScenarioResult ExectueMappedParadigms()
{
var result = new StringBuilder();
result.AppendLine();
result.AppendHorizontalLine(60);
foreach (var (key, value) in Paradigms.Syntagmas)
{
try
{
var mapped = MappedParadigms.GetSyntagma(key);
if (mapped.Sign.Signified.Value == null)
{
result.AppendLine(mapped.Metalanguage.Sign.Signifier.Value);
continue;
}
mapped.Sign.Signified.Value.Invoke(Fixture);
result.AppendLine($"{mapped.Metalanguage.Sign.Signifier.Value}".Indent(4));
}
catch (Exception ex)
{
result.AppendLine(Colors.Error(value.Metalanguage.Sign.Signifier.Value.Indent(4)));
result.AppendLine(Colors.Error(ex.Message.Indent(4)));
result.Insert(0, Colors.Error(Description.ToUpper(CultureInfo.InvariantCulture)));
return ScenarioResult.Fail(result.ToString());
}
}
result.Insert(0, Colors.Success(Description.ToUpper(CultureInfo.InvariantCulture)));
return ScenarioResult.Ok(result.ToString());
}
19
Source : PlantumlStructure.cs
with MIT License
from 8T4
with MIT License
from 8T4
private static string ToPumlString(this ContainerBoundary boundary)
{
var stream = new StringBuilder();
stream.AppendLine();
stream.AppendLine($"Container_Boundary({boundary.Alias}, \"{boundary.Label}\") {{");
foreach (var component in boundary.Components)
{
stream.AppendLine($"{SpaceMethods.Indent()}{component.ToPumlString()}");
}
if (boundary.Relationships.Any())
{
stream.AppendLine();
foreach (var relationship in boundary.Relationships)
{
stream.AppendLine($"{SpaceMethods.Indent()}{relationship.ToPumlString()}");
}
}
stream.AppendLine("}");
return stream.ToString();
}
19
Source : PlantumlStructure.cs
with MIT License
from 8T4
with MIT License
from 8T4
private static string ToPumlString(this DeploymentNode deployment, int concat = 0)
{
var stream = new StringBuilder();
var spaces = SpaceMethods.Indent(concat);
if (concat == 0)
{
stream.AppendLine();
}
if (deployment.Properties != null)
{
foreach (var (key, value) in deployment.Properties)
{
stream.AppendLine($"{spaces}AddProperty(\"{key}\", \"{value}\")");
}
}
stream.AppendLine(deployment.Tags is null
? $"{spaces}Deployment_Node({deployment.Alias}, \"{deployment.Label}\", \"{deployment.Description}\") {{"
: $"{spaces}Deployment_Node({deployment.Alias}, \"{deployment.Label}\", \"{deployment.Description}\", $tags=\"{string.Join(',', deployment.Tags)}\") {{");
if (deployment.Nodes != null)
{
foreach (var node in deployment.Nodes)
{
stream.AppendLine($"{node.ToPumlString(concat + SpaceMethods.TabSize)}");
}
}
if (deployment.Container != null)
{
stream.AppendLine(SpaceMethods.Indent(concat) + deployment.Container.ToPumlString());
}
stream.Append(spaces + "}");
return stream.ToString();
}
19
Source : PlantumlStructure.cs
with MIT License
from 8T4
with MIT License
from 8T4
private static string ToPumlString(this DeploymentNode deployment, int concat = 0)
{
var stream = new StringBuilder();
var spaces = SpaceMethods.Indent(concat);
if (concat == 0)
{
stream.AppendLine();
}
if (deployment.Properties != null)
{
foreach (var (key, value) in deployment.Properties)
{
stream.AppendLine($"{spaces}AddProperty(\"{key}\", \"{value}\")");
}
}
stream.AppendLine(deployment.Tags is null
? $"{spaces}Deployment_Node({deployment.Alias}, \"{deployment.Label}\", \"{deployment.Description}\") {{"
: $"{spaces}Deployment_Node({deployment.Alias}, \"{deployment.Label}\", \"{deployment.Description}\", $tags=\"{string.Join(',', deployment.Tags)}\") {{");
if (deployment.Nodes != null)
{
foreach (var node in deployment.Nodes)
{
stream.AppendLine($"{node.ToPumlString(concat + SpaceMethods.TabSize)}");
}
}
if (deployment.Container != null)
{
stream.AppendLine(SpaceMethods.Indent(concat) + deployment.Container.ToPumlString());
}
stream.Append(spaces + "}");
return stream.ToString();
}
19
Source : Test.cs
with GNU General Public License v3.0
from a2659802
with GNU General Public License v3.0
from a2659802
public static void Visit(Transform t,int depth,Transform father,StringBuilder sb)
{
if (t == null)
return;
string prefix = "";
for(int i=0;i<depth;i++)
{
prefix += " ";
}
string name = father?.name +"/" +t.name;
string log = $"{prefix}{name}--->layer:{t.gameObject.layer}({((GlobalEnums.PhysLayers)t.gameObject.layer)})";
sb.AppendLine(log);
foreach(Transform child in t)
{
Visit(child, depth + 1,t,sb);
}
}
19
Source : LUTPanelOptions.cs
with MIT License
from a1xd
with MIT License
from a1xd
private string PointsToActiveValuesText(IEnumerable<Vec2<float>> points, int length)
{
StringBuilder builder = new StringBuilder();
for(int i = 0; i < length; i++)
{
var point = points.ElementAt(i);
builder.AppendLine($"{point.x},{point.y};");
}
return builder.ToString();
}
19
Source : SessionClientWrapper.cs
with Apache License 2.0
from AantCoder
with Apache License 2.0
from AantCoder
public string GetDescription(ServerInfoType infoType)
{
var sb = new StringBuilder();
sb.AppendLine("****************");
sb.Append("IP: ");
sb.Append(Chanel2Server.IP);
if (Chanel2Server.Port != SessionClient.DefaultPort)
{
sb.Append(":");
sb.Append(Chanel2Server.Port);
}
sb.AppendLine("Hosted by: @Aant");
if (!_sessionClient.IsLogined)
{
return Translator.ErrServerNotAvailable;
}
var serverInfo = _sessionClient.GetInfo(ServerInfoType.FullWithDescription);
if (serverInfo == null)
{
return Translator.ErrServerNotAvailable;
}
sb.AppendLine(serverInfo.Description);
if (infoType != ServerInfoType.FullWithDescription)
{
sb.AppendLine("Difficulty: " + serverInfo.Difficulty);
sb.AppendLine("MapSize: " + serverInfo.MapSize);
sb.AppendLine("PlanetCoverage: " + serverInfo.PlanetCoverage);
sb.AppendLine("Seed:" + serverInfo.Seed);
sb.AppendLine("VersionInfo" + serverInfo.VersionInfo);
sb.AppendLine("VersionNum" + serverInfo.VersionNum);
}
sb.AppendLine("****************");
sb.AppendLine();
sb.AppendLine();
return sb.ToString();
}
19
Source : SessionClientWrapper.cs
with Apache License 2.0
from AantCoder
with Apache License 2.0
from AantCoder
public string GetDescription(ServerInfoType infoType)
{
var sb = new StringBuilder();
sb.AppendLine("****************");
sb.Append("IP: ");
sb.Append(Chanel2Server.IP);
if (Chanel2Server.Port != SessionClient.DefaultPort)
{
sb.Append(":");
sb.Append(Chanel2Server.Port);
}
sb.AppendLine("Hosted by: @Aant");
if (!_sessionClient.IsLogined)
{
return Translator.ErrServerNotAvailable;
}
var serverInfo = _sessionClient.GetInfo(ServerInfoType.FullWithDescription);
if (serverInfo == null)
{
return Translator.ErrServerNotAvailable;
}
sb.AppendLine(serverInfo.Description);
if (infoType != ServerInfoType.FullWithDescription)
{
sb.AppendLine("Difficulty: " + serverInfo.Difficulty);
sb.AppendLine("MapSize: " + serverInfo.MapSize);
sb.AppendLine("PlanetCoverage: " + serverInfo.PlanetCoverage);
sb.AppendLine("Seed:" + serverInfo.Seed);
sb.AppendLine("VersionInfo" + serverInfo.VersionInfo);
sb.AppendLine("VersionNum" + serverInfo.VersionNum);
}
sb.AppendLine("****************");
sb.AppendLine();
sb.AppendLine();
return sb.ToString();
}
19
Source : Listener.cs
with Apache License 2.0
from AantCoder
with Apache License 2.0
from AantCoder
private bool TranslateChatToDiscordAsync(ulong channelId, IReadOnlyList<ChatPost> messages)
{
var channel = _dc.GetChannel(channelId) as IMessageChannel;
if (channel == null)
{
return false;
}
const int MAX_LENGTH_NESSAGE = 2000 - 100;
var sb = new StringBuilder(MAX_LENGTH_NESSAGE);
foreach (var chatPost in messages)
{
if (chatPost.Message.Length + sb.Length > MAX_LENGTH_NESSAGE)
{
// Limit for max Message Length = 2000
// Limit for max Message per Second =5 ( variable)
// https://github.com/discordapp/discord-api-docs/blob/master/docs/topics/Rate_Limits.md
Console.WriteLine(sb.ToString());
var res = channel.SendMessageAsync(sb.ToString());
res.Wait();
sb = new StringBuilder(MAX_LENGTH_NESSAGE);
}
sb.AppendLine("[" + chatPost.OwnerLogin + chatPost.Time.ToString(" dd.MM HH:mm") + "]: " + chatPost.Message);
}
if (sb.Length > 0)
{
var t2 = channel.SendMessageAsync(sb.ToString());
t2.Wait();
}
return true;
}
19
Source : FileChecker.cs
with Apache License 2.0
from AantCoder
with Apache License 2.0
from AantCoder
public static byte[] CreateListFolder(string directory)
{
var dirs = Directory.GetDirectories(directory).OrderBy(x => x);
var sb = new StringBuilder();
foreach (var dir in dirs)
{
// только для дебага, а то папка Online city каждый раз обновляется
var di = new DirectoryInfo(dir);
#if DEBUG
if (di.Name.Equals("OnlineCity"))
continue;
#endif
sb.AppendLine(di.Name);
}
var txt = sb.ToString();
var diRoot = new DirectoryInfo(directory);
File.WriteAllText(Path.Combine(Loger.PathLog, diRoot.Name + ".txt"), txt);
return Encoding.ASCII.GetBytes(txt);
}
19
Source : ServerInformation.cs
with Apache License 2.0
from AantCoder
with Apache License 2.0
from AantCoder
public ModelInfo GetInfo(ModelInt packet, ServiceContext context)
{
lock (context.Player)
{
switch (packet.Value)
{
case (long)ServerInfoType.Full:
{
var result = GetModelInfo(context.Player);
return result;
}
case (long)ServerInfoType.SendSave:
{
if (context.PossiblyIntruder)
{
context.Disconnect("Possibly intruder");
return null;
}
var result = new ModelInfo();
//передача файла игры, для загрузки WorldLoad();
// файл передать можно только в том случае если файлы прошли проверку
//!Для Pvp проверка нужна всегда, в PvE нет
if (ServerManager.ServerSettings.IsModsWhitelisted)
{
if ((int)context.Player.ApproveLoadWorldReason > 0)
{
context.Player.ExitReason = DisconnectReason.FilesMods;
Loger.Log($"Login : {context.Player.Public.Login} not all files checked,{context.Player.ApproveLoadWorldReason.ToString() } Disconnect");
result.SaveFileData = null;
return result;
}
}
result.SaveFileData = Repository.GetSaveData.LoadPlayerData(context.Player.Public.Login, 1);
if (result.SaveFileData != null)
{
if (context.Player.MailsConfirmationSave.Count > 0)
{
for (int i = 0; i < context.Player.MailsConfirmationSave.Count; i++)
context.Player.MailsConfirmationSave[i].NeedSaveGame = false;
Loger.Log($"MailsConfirmationSave add {context.Player.MailsConfirmationSave.Count} (mails={context.Player.Mails.Count})");
//Ого! Игрок не сохранился после приема письма, с обязательным сохранением после получения
//Отправляем письма ещё раз
if (context.Player.Mails.Count == 0)
{
context.Player.Mails = context.Player.MailsConfirmationSave.ToList();
}
else
{
var ms = context.Player.MailsConfirmationSave
.Where(mcs => context.Player.Mails.Any(m => m.GetHashBase() != mcs.GetHashBase()))
.ToList();
context.Player.Mails.AddRange(ms);
}
Loger.Log($"MailsConfirmationSave (mails={context.Player.Mails.Count})");
}
}
Loger.Log($"Load World for {context.Player.Public.Login}. (mails={context.Player.Mails.Count}, fMails={context.Player.FunctionMails.Count})");
return result;
}
case (long)ServerInfoType.FullWithDescription:
{
var result = GetModelInfo(context.Player);
//result.Description = "";
var displayAttributes = new List<Tuple<int, string>>();
foreach (var prop in typeof(ServerSettings).GetFields())
{
var attribute = prop.GetCustomAttributes(typeof(DisplayAttribute)).FirstOrDefault();
if (attribute is null || !prop.IsPublic)
{
continue;
}
var dispAtr = (DisplayAttribute)attribute;
var strvalue = string.IsNullOrEmpty(dispAtr.GetDescription()) ? prop.Name : dispAtr.GetDescription();
strvalue = strvalue + "=" + prop.GetValue(ServerManager.ServerSettings).ToString();
var order = dispAtr.GetOrder().HasValue ? dispAtr.GetOrder().Value : 0;
displayAttributes.Add(Tuple.Create(order, strvalue));
}
var sb = new StringBuilder();
var sorte = new List<string>(displayAttributes.OrderBy(x => x.Item1).Select(y => y.Item2)).AsReadOnly();
foreach (var prop in sorte)
{
sb.AppendLine(prop);
}
//result.Description = sb.ToString();
return result;
}
case (long)ServerInfoType.Short:
default:
{
// краткая (зарезервированно, пока не используется) fullInfo = false
var result = new ModelInfo();
return result;
}
}
}
}
19
Source : HelpCmd.cs
with Apache License 2.0
from AantCoder
with Apache License 2.0
from AantCoder
public ModelStatus Execute(ref PlayerServer player, Chat chat, List<string> param)
{
var userGrants = player.Public.Grants;
var sb = new StringBuilder();
foreach (var cmd in ChatManager.ChatCmds.Values.OrderBy(x => x.CmdID))
{
if (!Grants.NoPermissions.Equals(cmd.GrantsForRun & userGrants))
{
sb.AppendLine(cmd.Help);
}
}
return _chatManager.PostCommandPrivatPostActivChat(0, player.Public.Login, chat, sb.ToString());
}
19
Source : HtmlClipboard.cs
with MIT License
from Abdesol
with MIT License
from Abdesol
static string BuildHeader(int startHTML, int endHTML, int startFragment, int endFragment)
{
StringBuilder b = new StringBuilder();
b.AppendLine("Version:0.9");
b.AppendLine("StartHTML:" + startHTML.ToString("d8", CultureInfo.InvariantCulture));
b.AppendLine("EndHTML:" + endHTML.ToString("d8", CultureInfo.InvariantCulture));
b.AppendLine("StartFragment:" + startFragment.ToString("d8", CultureInfo.InvariantCulture));
b.AppendLine("EndFragment:" + endFragment.ToString("d8", CultureInfo.InvariantCulture));
return b.ToString();
}
19
Source : HtmlClipboard.cs
with MIT License
from Abdesol
with MIT License
from Abdesol
public static string CreateHtmlFragment(IDoreplacedent doreplacedent, IHighlighter highlighter, ISegment segment, HtmlOptions options)
{
if (doreplacedent == null)
throw new ArgumentNullException("doreplacedent");
if (options == null)
throw new ArgumentNullException("options");
if (highlighter != null && highlighter.Doreplacedent != doreplacedent)
throw new ArgumentException("Highlighter does not belong to the specified doreplacedent.");
if (segment == null)
segment = new SimpleSegment(0, doreplacedent.TextLength);
StringBuilder html = new StringBuilder();
int segmentEndOffset = segment.EndOffset;
IDoreplacedentLine line = doreplacedent.GetLineByOffset(segment.Offset);
while (line != null && line.Offset < segmentEndOffset) {
HighlightedLine highlightedLine;
if (highlighter != null)
highlightedLine = highlighter.HighlightLine(line.LineNumber);
else
highlightedLine = new HighlightedLine(doreplacedent, line);
SimpleSegment s = SimpleSegment.GetOverlap(segment, line);
if (html.Length > 0)
html.AppendLine("<br>");
html.Append(highlightedLine.ToHtml(s.Offset, s.EndOffset, options));
line = line.NextLine;
}
return html.ToString();
}
19
Source : Selection.cs
with MIT License
from Abdesol
with MIT License
from Abdesol
public string CreateHtmlFragment(HtmlOptions options)
{
if (options == null)
throw new ArgumentNullException("options");
IHighlighter highlighter = textArea.GetService(typeof(IHighlighter)) as IHighlighter;
StringBuilder html = new StringBuilder();
bool first = true;
foreach (ISegment selectedSegment in this.Segments) {
if (first)
first = false;
else
html.AppendLine("<br>");
html.Append(HtmlClipboard.CreateHtmlFragment(textArea.Doreplacedent, highlighter, selectedSegment, options));
}
return html.ToString();
}
19
Source : OVRPointerEventData.cs
with MIT License
from absurd-joy
with MIT License
from absurd-joy
public override string ToString()
{
var sb = new StringBuilder();
sb.AppendLine("<b>Position</b>: " + position);
sb.AppendLine("<b>delta</b>: " + delta);
sb.AppendLine("<b>eligibleForClick</b>: " + eligibleForClick);
sb.AppendLine("<b>pointerEnter</b>: " + pointerEnter);
sb.AppendLine("<b>pointerPress</b>: " + pointerPress);
sb.AppendLine("<b>lastPointerPress</b>: " + lastPress);
sb.AppendLine("<b>pointerDrag</b>: " + pointerDrag);
sb.AppendLine("<b>worldSpaceRay</b>: " + worldSpaceRay);
sb.AppendLine("<b>swipeStart</b>: " + swipeStart);
sb.AppendLine("<b>Use Drag Threshold</b>: " + useDragThreshold);
return sb.ToString();
}
19
Source : LanguageCompiler.cs
with MIT License
from ABTSoftware
with MIT License
from ABTSoftware
private static void CompileRule(LanguageRule languageRule,
StringBuilder regex,
ICollection<string> captures,
bool isFirstRule)
{
if (!isFirstRule)
{
regex.AppendLine();
regex.AppendLine();
regex.AppendLine("|");
regex.AppendLine();
}
regex.AppendFormat("(?-xis)(?m)({0})(?x)", languageRule.Regex);
int numberOfCaptures = GetNumberOfCaptures(languageRule.Regex);
for (int i = 0; i <= numberOfCaptures; i++)
{
string scope = null;
foreach (int captureIndex in languageRule.Captures.Keys)
{
if (i == captureIndex)
{
scope = languageRule.Captures[captureIndex];
break;
}
}
captures.Add(scope);
}
}
19
Source : HtmlExportHelper.cs
with MIT License
from ABTSoftware
with MIT License
from ABTSoftware
private static string ReplaceTagsWithExample(string lines, Example example)
{
lines = lines.Replace(replacedleTag, example.replacedle);
lines = lines.Replace(ImageTag, "scichart-wpf-chart-example-" + example.replacedle.ToLower().Replace(" ", "-") + ".png");
lines = lines.Replace(DescriptionTag, example.HtmlDescription);
lines = lines.Replace(ExamplePath, string.Format("{0} > {1} > {2}", example.TopLevelCategory, example.Group, example.replacedle));
lines = lines.Replace(CategoryTag, example.TopLevelCategory);
lines = lines.Replace(GroupTag, example.Group);
var sb = new StringBuilder();
foreach (var pair in example.SourceFiles)
{
sb.AppendLine(string.Format("<h4>{0}</h4>", pair.Key));
var code = pair.Value.Replace("<", "<").Replace(">", ">").Replace("\"", """);
if (pair.Key.ToUpper().EndsWith("XAML"))
{
sb.AppendLine(string.Format(@"<pre clreplaced=""brush: xml; gutter: true; first-line: 1; highlight: []; html-script: false"">{0}</pre>", code));
}
else
{
sb.AppendLine(string.Format(@"<pre clreplaced=""brush: csharp; gutter: true; first-line: 1; highlight: []; html-script: false"">{0}</pre>", code));
}
}
lines = lines.Replace(SourceCodeTag, sb.ToString());
return lines;
}
19
Source : LanguageCompiler.cs
with MIT License
from ABTSoftware
with MIT License
from ABTSoftware
private static void CompileRules(IList<LanguageRule> rules,
out Regex regex,
out IList<string> captures)
{
StringBuilder regexBuilder = new StringBuilder();
captures = new List<string>();
regexBuilder.AppendLine("(?x)");
captures.Add(null);
CompileRule(rules[0], regexBuilder, captures, true);
for (int i = 1; i < rules.Count; i++)
CompileRule(rules[i], regexBuilder, captures, false);
regex = new Regex(regexBuilder.ToString());
}
19
Source : ParticleEmitterInfo.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public override string ToString()
{
var sb = new StringBuilder();
sb.AppendLine("------------------");
sb.AppendLine($"ID: {Id:X8}");
sb.AppendLine("EmitterType: " + EmitterType);
sb.AppendLine("ParticleType: " + ParticleType);
sb.AppendLine($"GfxObjID: {GfxObjId:X8}");
sb.AppendLine($"HWGfxObjID: {HwGfxObjId:X8}");
sb.AppendLine("Birthrate: " + Birthrate);
sb.AppendLine("MaxParticles: " + MaxParticles);
sb.AppendLine("InitialParticles: " + InitialParticles);
sb.AppendLine("TotalParticles: " + TotalParticles);
sb.AppendLine("TotalSeconds: " + TotalSeconds);
sb.AppendLine("Lifespan: " + Lifespan);
sb.AppendLine("LifespanRand: " + LifespanRand);
sb.AppendLine("OffsetDir: " + OffsetDir);
sb.AppendLine("MinOffset: " + MinOffset);
sb.AppendLine("MaxOffset: " + MaxOffset);
sb.AppendLine("A: " + A);
sb.AppendLine("MinA: " + MinA);
sb.AppendLine("MaxA: " + MaxA);
sb.AppendLine("B: " + B);
sb.AppendLine("MinB: " + MinB);
sb.AppendLine("MaxB: " + MaxB);
sb.AppendLine("C: " + C);
sb.AppendLine("MinC: " + MinC);
sb.AppendLine("MaxC: " + MaxC);
sb.AppendLine("StartScale: " + StartScale);
sb.AppendLine("FinalScale: " + FinalScale);
sb.AppendLine("ScaleRand: " + ScaleRand);
sb.AppendLine("StartTrans: " + StartTrans);
sb.AppendLine("FinalTrans: " + FinalTrans);
sb.AppendLine("TransRand: " + TransRand);
sb.AppendLine("IsParentLocal: " + IsParentLocal);
return sb.ToString();
}
19
Source : ParticleEmitterInfo.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public override string ToString()
{
var sb = new StringBuilder();
sb.AppendLine("------------------");
sb.AppendLine($"ID: {Id:X8}");
sb.AppendLine("EmitterType: " + EmitterType);
sb.AppendLine("ParticleType: " + ParticleType);
sb.AppendLine($"GfxObjID: {GfxObjId:X8}");
sb.AppendLine($"HWGfxObjID: {HwGfxObjId:X8}");
sb.AppendLine("Birthrate: " + Birthrate);
sb.AppendLine("MaxParticles: " + MaxParticles);
sb.AppendLine("InitialParticles: " + InitialParticles);
sb.AppendLine("TotalParticles: " + TotalParticles);
sb.AppendLine("TotalSeconds: " + TotalSeconds);
sb.AppendLine("Lifespan: " + Lifespan);
sb.AppendLine("LifespanRand: " + LifespanRand);
sb.AppendLine("OffsetDir: " + OffsetDir);
sb.AppendLine("MinOffset: " + MinOffset);
sb.AppendLine("MaxOffset: " + MaxOffset);
sb.AppendLine("A: " + A);
sb.AppendLine("MinA: " + MinA);
sb.AppendLine("MaxA: " + MaxA);
sb.AppendLine("B: " + B);
sb.AppendLine("MinB: " + MinB);
sb.AppendLine("MaxB: " + MaxB);
sb.AppendLine("C: " + C);
sb.AppendLine("MinC: " + MinC);
sb.AppendLine("MaxC: " + MaxC);
sb.AppendLine("StartScale: " + StartScale);
sb.AppendLine("FinalScale: " + FinalScale);
sb.AppendLine("ScaleRand: " + ScaleRand);
sb.AppendLine("StartTrans: " + StartTrans);
sb.AppendLine("FinalTrans: " + FinalTrans);
sb.AppendLine("TransRand: " + TransRand);
sb.AppendLine("IsParentLocal: " + IsParentLocal);
return sb.ToString();
}
19
Source : RecordCast.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public void Output(string line)
{
var timestamp = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss,fff");
var timestamp_line = $"[{timestamp}] {line}";
Buffer.AppendLine(timestamp_line);
Console.WriteLine(timestamp_line);
}
19
Source : RawMotionState.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public string ToString(bool showFlags)
{
var sb = new StringBuilder();
if (showFlags)
sb.AppendLine($"Flags: {Flags}");
if ((Flags & RawMotionFlags.CurrentHoldKey) != 0)
sb.AppendLine($"CurrentHoldKey: {CurrentHoldKey}");
if ((Flags & RawMotionFlags.CurrentStyle) != 0)
sb.AppendLine($"CurrentStyle: {CurrentStyle}");
if ((Flags & RawMotionFlags.ForwardCommand) != 0)
sb.AppendLine($"ForwardCommand: {ForwardCommand}");
if ((Flags & RawMotionFlags.ForwardHoldKey) != 0)
sb.AppendLine($"ForwardHoldKey: {ForwardHoldKey}");
if ((Flags & RawMotionFlags.ForwardSpeed) != 0)
sb.AppendLine($"ForwardSpeed: {ForwardSpeed}");
if ((Flags & RawMotionFlags.SideStepCommand) != 0)
sb.AppendLine($"SidestepCommand: {SidestepCommand}");
if ((Flags & RawMotionFlags.SideStepHoldKey) != 0)
sb.AppendLine($"SidestepHoldKey: {SidestepHoldKey}");
if ((Flags & RawMotionFlags.SideStepSpeed) != 0)
sb.AppendLine($"SidestepSpeed: {SidestepSpeed}");
if ((Flags & RawMotionFlags.TurnCommand) != 0)
sb.AppendLine($"TurnCommand: {TurnCommand}");
if ((Flags & RawMotionFlags.TurnHoldKey) != 0)
sb.AppendLine($"TurnHoldKey: {TurnHoldKey}");
if ((Flags & RawMotionFlags.TurnSpeed) != 0)
sb.AppendLine($"TurnSpeed: {TurnSpeed}");
if (CommandListLength > 0)
{
sb.AppendLine($"CommandListLength: {CommandListLength}");
foreach (var command in Commands)
sb.Append(command);
}
sb.AppendLine("---");
return sb.ToString();
}
19
Source : ConnectionListener.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
private void OnDataReceive(IAsyncResult result)
{
EndPoint clientEndPoint = null;
try
{
clientEndPoint = new IPEndPoint(listeningHost, 0);
int dataSize = Socket.EndReceiveFrom(result, ref clientEndPoint);
IPEndPoint ipEndpoint = (IPEndPoint)clientEndPoint;
// TO-DO: generate ban entries here based on packet rates of endPoint, IP Address, and IP Address Range
if (packetLog.IsDebugEnabled)
{
byte[] data = new byte[dataSize];
Buffer.BlockCopy(buffer, 0, data, 0, dataSize);
StringBuilder sb = new StringBuilder();
sb.AppendLine($"Received Packet (Len: {data.Length}) [{ipEndpoint.Address}:{ipEndpoint.Port}=>{ListenerEndpoint.Address}:{ListenerEndpoint.Port}]");
sb.AppendLine(data.BuildPacketString());
packetLog.Debug(sb.ToString());
}
var packet = new ClientPacket();
if (packet.Unpack(buffer, dataSize))
NetworkManager.ProcessPacket(this, packet, ipEndpoint);
packet.ReleaseBuffer();
}
catch (SocketException socketException)
{
// If we get "Connection has been forcibly closed..." error, just eat the exception and continue on
// This gets sent when the remote host terminates the connection (on UDP? interesting...)
// TODO: There might be more, should keep an eye out. Logged message will help here.
if (socketException.SocketErrorCode == SocketError.MessageSize ||
socketException.SocketErrorCode == SocketError.NetworkReset ||
socketException.SocketErrorCode == SocketError.ConnectionReset)
{
log.DebugFormat("ConnectionListener.OnDataReceieve() has thrown {0}: {1} from client {2}", socketException.SocketErrorCode, socketException.Message, clientEndPoint != null ? clientEndPoint.ToString() : "Unknown");
}
else
{
log.FatalFormat("ConnectionListener.OnDataReceieve() has thrown {0}: {1} from client {2}", socketException.SocketErrorCode, socketException.Message, clientEndPoint != null ? clientEndPoint.ToString() : "Unknown");
return;
}
}
Listen();
}
19
Source : ConnectionListener.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
private void OnDataReceive(IAsyncResult result)
{
EndPoint clientEndPoint = null;
try
{
clientEndPoint = new IPEndPoint(listeningHost, 0);
int dataSize = Socket.EndReceiveFrom(result, ref clientEndPoint);
IPEndPoint ipEndpoint = (IPEndPoint)clientEndPoint;
// TO-DO: generate ban entries here based on packet rates of endPoint, IP Address, and IP Address Range
if (packetLog.IsDebugEnabled)
{
byte[] data = new byte[dataSize];
Buffer.BlockCopy(buffer, 0, data, 0, dataSize);
StringBuilder sb = new StringBuilder();
sb.AppendLine($"Received Packet (Len: {data.Length}) [{ipEndpoint.Address}:{ipEndpoint.Port}=>{ListenerEndpoint.Address}:{ListenerEndpoint.Port}]");
sb.AppendLine(data.BuildPacketString());
packetLog.Debug(sb.ToString());
}
var packet = new ClientPacket();
if (packet.Unpack(buffer, dataSize))
NetworkManager.ProcessPacket(this, packet, ipEndpoint);
packet.ReleaseBuffer();
}
catch (SocketException socketException)
{
// If we get "Connection has been forcibly closed..." error, just eat the exception and continue on
// This gets sent when the remote host terminates the connection (on UDP? interesting...)
// TODO: There might be more, should keep an eye out. Logged message will help here.
if (socketException.SocketErrorCode == SocketError.MessageSize ||
socketException.SocketErrorCode == SocketError.NetworkReset ||
socketException.SocketErrorCode == SocketError.ConnectionReset)
{
log.DebugFormat("ConnectionListener.OnDataReceieve() has thrown {0}: {1} from client {2}", socketException.SocketErrorCode, socketException.Message, clientEndPoint != null ? clientEndPoint.ToString() : "Unknown");
}
else
{
log.FatalFormat("ConnectionListener.OnDataReceieve() has thrown {0}: {1} from client {2}", socketException.SocketErrorCode, socketException.Message, clientEndPoint != null ? clientEndPoint.ToString() : "Unknown");
return;
}
}
Listen();
}
19
Source : NetworkSession.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
private void SendPacketRaw(ServerPacket packet)
{
byte[] buffer = ArrayPool<byte>.Shared.Rent((int)(PacketHeader.HeaderSize + (packet.Data?.Length ?? 0) + (packet.Fragments.Count * PacketFragment.MaxFragementSize)));
try
{
var socket = connectionListener.Socket;
packet.CreateReadyToSendPacket(buffer, out var size);
packetLog.Debug(packet.ToString());
if (packetLog.IsDebugEnabled)
{
var listenerEndpoint = (System.Net.IPEndPoint)socket.LocalEndPoint;
var sb = new StringBuilder();
sb.AppendLine(String.Format("[{5}] Sending Packet (Len: {0}) [{1}:{2}=>{3}:{4}]", size, listenerEndpoint.Address, listenerEndpoint.Port, session.EndPoint.Address, session.EndPoint.Port, session.Network.ClientId));
sb.AppendLine(buffer.BuildPacketString(0, size));
packetLog.Debug(sb.ToString());
}
try
{
socket.SendTo(buffer, size, SocketFlags.None, session.EndPoint);
}
catch (SocketException ex)
{
// Unhandled Exception: System.Net.Sockets.SocketException: A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself
// at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName)
// at System.Net.Sockets.Socket.SendTo(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, EndPoint remoteEP)
var listenerEndpoint = (System.Net.IPEndPoint)socket.LocalEndPoint;
var sb = new StringBuilder();
sb.AppendLine(ex.ToString());
sb.AppendLine(String.Format("[{5}] Sending Packet (Len: {0}) [{1}:{2}=>{3}:{4}]", buffer.Length, listenerEndpoint.Address, listenerEndpoint.Port, session.EndPoint.Address, session.EndPoint.Port, session.Network.ClientId));
log.Error(sb.ToString());
session.Terminate(SessionTerminationReason.SendToSocketException, null, null, ex.Message);
}
}
finally
{
ArrayPool<byte>.Shared.Return(buffer, true);
}
}
19
Source : MotionItem.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public override string ToString()
{
var sb = new StringBuilder();
sb.AppendLine($"MotionCommand: {MotionCommand}");
sb.AppendLine($"IsAutonomous: {IsAutonomous}");
sb.AppendLine($"Speed: {Speed}");
return sb.ToString();
}
19
Source : JumpPack.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public override string ToString()
{
var sb = new StringBuilder();
sb.AppendLine("Extent: " + Extent);
sb.AppendLine("Velocity: " + Velocity);
sb.AppendLine("InstanceSequence: " + InstanceSequence);
sb.AppendLine("ServerControlSequence: " + ServerControlSequence);
sb.AppendLine("TeleportSequence: " + TeleportSequence);
sb.AppendLine("ForcePositionSequence: " + ForcePositionSequence);
return sb.ToString();
}
19
Source : JumpPack.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public override string ToString()
{
var sb = new StringBuilder();
sb.AppendLine("Extent: " + Extent);
sb.AppendLine("Velocity: " + Velocity);
sb.AppendLine("InstanceSequence: " + InstanceSequence);
sb.AppendLine("ServerControlSequence: " + ServerControlSequence);
sb.AppendLine("TeleportSequence: " + TeleportSequence);
sb.AppendLine("ForcePositionSequence: " + ForcePositionSequence);
return sb.ToString();
}
19
Source : NetworkSession.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
private void SendPacketRaw(ServerPacket packet)
{
byte[] buffer = ArrayPool<byte>.Shared.Rent((int)(PacketHeader.HeaderSize + (packet.Data?.Length ?? 0) + (packet.Fragments.Count * PacketFragment.MaxFragementSize)));
try
{
var socket = connectionListener.Socket;
packet.CreateReadyToSendPacket(buffer, out var size);
packetLog.Debug(packet.ToString());
if (packetLog.IsDebugEnabled)
{
var listenerEndpoint = (System.Net.IPEndPoint)socket.LocalEndPoint;
var sb = new StringBuilder();
sb.AppendLine(String.Format("[{5}] Sending Packet (Len: {0}) [{1}:{2}=>{3}:{4}]", size, listenerEndpoint.Address, listenerEndpoint.Port, session.EndPoint.Address, session.EndPoint.Port, session.Network.ClientId));
sb.AppendLine(buffer.BuildPacketString(0, size));
packetLog.Debug(sb.ToString());
}
try
{
socket.SendTo(buffer, size, SocketFlags.None, session.EndPoint);
}
catch (SocketException ex)
{
// Unhandled Exception: System.Net.Sockets.SocketException: A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself
// at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName)
// at System.Net.Sockets.Socket.SendTo(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, EndPoint remoteEP)
var listenerEndpoint = (System.Net.IPEndPoint)socket.LocalEndPoint;
var sb = new StringBuilder();
sb.AppendLine(ex.ToString());
sb.AppendLine(String.Format("[{5}] Sending Packet (Len: {0}) [{1}:{2}=>{3}:{4}]", buffer.Length, listenerEndpoint.Address, listenerEndpoint.Port, session.EndPoint.Address, session.EndPoint.Port, session.Network.ClientId));
log.Error(sb.ToString());
session.Terminate(SessionTerminationReason.SendToSocketException, null, null, ex.Message);
}
}
finally
{
ArrayPool<byte>.Shared.Return(buffer, true);
}
}
19
Source : WorldObject.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public string DebugOutputString(WorldObject obj)
{
var sb = new StringBuilder();
sb.AppendLine("ACE Debug Output:");
sb.AppendLine("ACE Clreplaced File: " + GetType().Name + ".cs");
sb.AppendLine("Guid: " + obj.Guid.Full + " (0x" + obj.Guid.Full.ToString("X") + ")");
sb.AppendLine("----- Private Fields -----");
foreach (var prop in obj.GetType().GetFields(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).OrderBy(field => field.Name))
{
if (prop.GetValue(obj) == null)
continue;
sb.AppendLine($"{prop.Name.Replace("<", "").Replace(">k__BackingField", "")} = {prop.GetValue(obj)}");
}
sb.AppendLine("----- Public Properties -----");
foreach (var prop in obj.GetType().GetProperties().OrderBy(property => property.Name))
{
if (prop.GetValue(obj, null) == null)
continue;
switch (prop.Name.ToLower())
{
case "guid":
sb.AppendLine($"{prop.Name} = {obj.Guid.Full} (GuidType.{obj.Guid.Type.ToString()})");
break;
case "descriptionflags":
sb.AppendLine($"{prop.Name} = {ObjectDescriptionFlags.ToString()}" + " (" + (uint)ObjectDescriptionFlags + ")");
break;
case "weenieflags":
var weenieFlags = CalculateWeenieHeaderFlag();
sb.AppendLine($"{prop.Name} = {weenieFlags.ToString()}" + " (" + (uint)weenieFlags + ")");
break;
case "weenieflags2":
var weenieFlags2 = CalculateWeenieHeaderFlag2();
sb.AppendLine($"{prop.Name} = {weenieFlags2.ToString()}" + " (" + (uint)weenieFlags2 + ")");
break;
case "itemtype":
sb.AppendLine($"{prop.Name} = {obj.ItemType.ToString()}" + " (" + (uint)obj.ItemType + ")");
break;
case "creaturetype":
sb.AppendLine($"{prop.Name} = {obj.CreatureType.ToString()}" + " (" + (uint)obj.CreatureType + ")");
break;
case "containertype":
sb.AppendLine($"{prop.Name} = {obj.ContainerType.ToString()}" + " (" + (uint)obj.ContainerType + ")");
break;
case "usable":
sb.AppendLine($"{prop.Name} = {obj.ItemUseable.ToString()}" + " (" + (uint)obj.ItemUseable + ")");
break;
case "radarbehavior":
sb.AppendLine($"{prop.Name} = {obj.RadarBehavior.ToString()}" + " (" + (uint)obj.RadarBehavior + ")");
break;
case "physicsdescriptionflag":
var physicsDescriptionFlag = CalculatedPhysicsDescriptionFlag();
sb.AppendLine($"{prop.Name} = {physicsDescriptionFlag.ToString()}" + " (" + (uint)physicsDescriptionFlag + ")");
break;
case "physicsstate":
var physicsState = PhysicsObj.State;
sb.AppendLine($"{prop.Name} = {physicsState.ToString()}" + " (" + (uint)physicsState + ")");
break;
//case "propertiesspellid":
// foreach (var item in obj.PropertiesSpellId)
// {
// sb.AppendLine($"PropertySpellId.{Enum.GetName(typeof(Spell), item.SpellId)} ({item.SpellId})");
// }
// break;
case "validlocations":
sb.AppendLine($"{prop.Name} = {obj.ValidLocations}" + " (" + (uint)obj.ValidLocations + ")");
break;
case "currentwieldedlocation":
sb.AppendLine($"{prop.Name} = {obj.CurrentWieldedLocation}" + " (" + (uint)obj.CurrentWieldedLocation + ")");
break;
case "priority":
sb.AppendLine($"{prop.Name} = {obj.ClothingPriority}" + " (" + (uint)obj.ClothingPriority + ")");
break;
case "radarcolor":
sb.AppendLine($"{prop.Name} = {obj.RadarColor}" + " (" + (uint)obj.RadarColor + ")");
break;
case "location":
sb.AppendLine($"{prop.Name} = {obj.Location.ToLOCString()}");
break;
case "destination":
sb.AppendLine($"{prop.Name} = {obj.Destination.ToLOCString()}");
break;
case "instantiation":
sb.AppendLine($"{prop.Name} = {obj.Instantiation.ToLOCString()}");
break;
case "sanctuary":
sb.AppendLine($"{prop.Name} = {obj.Sanctuary.ToLOCString()}");
break;
case "home":
sb.AppendLine($"{prop.Name} = {obj.Home.ToLOCString()}");
break;
case "portalsummonloc":
sb.AppendLine($"{prop.Name} = {obj.PortalSummonLoc.ToLOCString()}");
break;
case "houseboot":
sb.AppendLine($"{prop.Name} = {obj.HouseBoot.ToLOCString()}");
break;
case "lastoutsidedeath":
sb.AppendLine($"{prop.Name} = {obj.LastOutsideDeath.ToLOCString()}");
break;
case "linkedlifestone":
sb.AppendLine($"{prop.Name} = {obj.LinkedLifestone.ToLOCString()}");
break;
case "channelsactive":
sb.AppendLine($"{prop.Name} = {(Channel)obj.GetProperty(PropertyInt.ChannelsActive)}" + " (" + (uint)obj.GetProperty(PropertyInt.ChannelsActive) + ")");
break;
case "channelsallowed":
sb.AppendLine($"{prop.Name} = {(Channel)obj.GetProperty(PropertyInt.ChannelsAllowed)}" + " (" + (uint)obj.GetProperty(PropertyInt.ChannelsAllowed) + ")");
break;
case "playerkillerstatus":
sb.AppendLine($"{prop.Name} = {obj.PlayerKillerStatus}" + " (" + (uint)obj.PlayerKillerStatus + ")");
break;
default:
sb.AppendLine($"{prop.Name} = {prop.GetValue(obj, null)}");
break;
}
}
sb.AppendLine("----- Property Dictionaries -----");
foreach (var item in obj.GetAllPropertyBools())
sb.AppendLine($"PropertyBool.{Enum.GetName(typeof(PropertyBool), item.Key)} ({(int)item.Key}) = {item.Value}");
foreach (var item in obj.GetAllPropertyDataId())
sb.AppendLine($"PropertyDataId.{Enum.GetName(typeof(PropertyDataId), item.Key)} ({(int)item.Key}) = {item.Value}");
foreach (var item in obj.GetAllPropertyFloat())
sb.AppendLine($"PropertyFloat.{Enum.GetName(typeof(PropertyFloat), item.Key)} ({(int)item.Key}) = {item.Value}");
foreach (var item in obj.GetAllPropertyInstanceId())
sb.AppendLine($"PropertyInstanceId.{Enum.GetName(typeof(PropertyInstanceId), item.Key)} ({(int)item.Key}) = {item.Value}");
foreach (var item in obj.GetAllPropertyInt())
sb.AppendLine($"PropertyInt.{Enum.GetName(typeof(PropertyInt), item.Key)} ({(int)item.Key}) = {item.Value}");
foreach (var item in obj.GetAllPropertyInt64())
sb.AppendLine($"PropertyInt64.{Enum.GetName(typeof(PropertyInt64), item.Key)} ({(int)item.Key}) = {item.Value}");
foreach (var item in obj.GetAllPropertyString())
sb.AppendLine($"PropertyString.{Enum.GetName(typeof(PropertyString), item.Key)} ({(int)item.Key}) = {item.Value}");
sb.AppendLine("\n");
return sb.ToString().Replace("\r", "");
}
19
Source : WorldObject.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public string DebugOutputString(WorldObject obj)
{
var sb = new StringBuilder();
sb.AppendLine("ACE Debug Output:");
sb.AppendLine("ACE Clreplaced File: " + GetType().Name + ".cs");
sb.AppendLine("Guid: " + obj.Guid.Full + " (0x" + obj.Guid.Full.ToString("X") + ")");
sb.AppendLine("----- Private Fields -----");
foreach (var prop in obj.GetType().GetFields(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).OrderBy(field => field.Name))
{
if (prop.GetValue(obj) == null)
continue;
sb.AppendLine($"{prop.Name.Replace("<", "").Replace(">k__BackingField", "")} = {prop.GetValue(obj)}");
}
sb.AppendLine("----- Public Properties -----");
foreach (var prop in obj.GetType().GetProperties().OrderBy(property => property.Name))
{
if (prop.GetValue(obj, null) == null)
continue;
switch (prop.Name.ToLower())
{
case "guid":
sb.AppendLine($"{prop.Name} = {obj.Guid.Full} (GuidType.{obj.Guid.Type.ToString()})");
break;
case "descriptionflags":
sb.AppendLine($"{prop.Name} = {ObjectDescriptionFlags.ToString()}" + " (" + (uint)ObjectDescriptionFlags + ")");
break;
case "weenieflags":
var weenieFlags = CalculateWeenieHeaderFlag();
sb.AppendLine($"{prop.Name} = {weenieFlags.ToString()}" + " (" + (uint)weenieFlags + ")");
break;
case "weenieflags2":
var weenieFlags2 = CalculateWeenieHeaderFlag2();
sb.AppendLine($"{prop.Name} = {weenieFlags2.ToString()}" + " (" + (uint)weenieFlags2 + ")");
break;
case "itemtype":
sb.AppendLine($"{prop.Name} = {obj.ItemType.ToString()}" + " (" + (uint)obj.ItemType + ")");
break;
case "creaturetype":
sb.AppendLine($"{prop.Name} = {obj.CreatureType.ToString()}" + " (" + (uint)obj.CreatureType + ")");
break;
case "containertype":
sb.AppendLine($"{prop.Name} = {obj.ContainerType.ToString()}" + " (" + (uint)obj.ContainerType + ")");
break;
case "usable":
sb.AppendLine($"{prop.Name} = {obj.ItemUseable.ToString()}" + " (" + (uint)obj.ItemUseable + ")");
break;
case "radarbehavior":
sb.AppendLine($"{prop.Name} = {obj.RadarBehavior.ToString()}" + " (" + (uint)obj.RadarBehavior + ")");
break;
case "physicsdescriptionflag":
var physicsDescriptionFlag = CalculatedPhysicsDescriptionFlag();
sb.AppendLine($"{prop.Name} = {physicsDescriptionFlag.ToString()}" + " (" + (uint)physicsDescriptionFlag + ")");
break;
case "physicsstate":
var physicsState = PhysicsObj.State;
sb.AppendLine($"{prop.Name} = {physicsState.ToString()}" + " (" + (uint)physicsState + ")");
break;
//case "propertiesspellid":
// foreach (var item in obj.PropertiesSpellId)
// {
// sb.AppendLine($"PropertySpellId.{Enum.GetName(typeof(Spell), item.SpellId)} ({item.SpellId})");
// }
// break;
case "validlocations":
sb.AppendLine($"{prop.Name} = {obj.ValidLocations}" + " (" + (uint)obj.ValidLocations + ")");
break;
case "currentwieldedlocation":
sb.AppendLine($"{prop.Name} = {obj.CurrentWieldedLocation}" + " (" + (uint)obj.CurrentWieldedLocation + ")");
break;
case "priority":
sb.AppendLine($"{prop.Name} = {obj.ClothingPriority}" + " (" + (uint)obj.ClothingPriority + ")");
break;
case "radarcolor":
sb.AppendLine($"{prop.Name} = {obj.RadarColor}" + " (" + (uint)obj.RadarColor + ")");
break;
case "location":
sb.AppendLine($"{prop.Name} = {obj.Location.ToLOCString()}");
break;
case "destination":
sb.AppendLine($"{prop.Name} = {obj.Destination.ToLOCString()}");
break;
case "instantiation":
sb.AppendLine($"{prop.Name} = {obj.Instantiation.ToLOCString()}");
break;
case "sanctuary":
sb.AppendLine($"{prop.Name} = {obj.Sanctuary.ToLOCString()}");
break;
case "home":
sb.AppendLine($"{prop.Name} = {obj.Home.ToLOCString()}");
break;
case "portalsummonloc":
sb.AppendLine($"{prop.Name} = {obj.PortalSummonLoc.ToLOCString()}");
break;
case "houseboot":
sb.AppendLine($"{prop.Name} = {obj.HouseBoot.ToLOCString()}");
break;
case "lastoutsidedeath":
sb.AppendLine($"{prop.Name} = {obj.LastOutsideDeath.ToLOCString()}");
break;
case "linkedlifestone":
sb.AppendLine($"{prop.Name} = {obj.LinkedLifestone.ToLOCString()}");
break;
case "channelsactive":
sb.AppendLine($"{prop.Name} = {(Channel)obj.GetProperty(PropertyInt.ChannelsActive)}" + " (" + (uint)obj.GetProperty(PropertyInt.ChannelsActive) + ")");
break;
case "channelsallowed":
sb.AppendLine($"{prop.Name} = {(Channel)obj.GetProperty(PropertyInt.ChannelsAllowed)}" + " (" + (uint)obj.GetProperty(PropertyInt.ChannelsAllowed) + ")");
break;
case "playerkillerstatus":
sb.AppendLine($"{prop.Name} = {obj.PlayerKillerStatus}" + " (" + (uint)obj.PlayerKillerStatus + ")");
break;
default:
sb.AppendLine($"{prop.Name} = {prop.GetValue(obj, null)}");
break;
}
}
sb.AppendLine("----- Property Dictionaries -----");
foreach (var item in obj.GetAllPropertyBools())
sb.AppendLine($"PropertyBool.{Enum.GetName(typeof(PropertyBool), item.Key)} ({(int)item.Key}) = {item.Value}");
foreach (var item in obj.GetAllPropertyDataId())
sb.AppendLine($"PropertyDataId.{Enum.GetName(typeof(PropertyDataId), item.Key)} ({(int)item.Key}) = {item.Value}");
foreach (var item in obj.GetAllPropertyFloat())
sb.AppendLine($"PropertyFloat.{Enum.GetName(typeof(PropertyFloat), item.Key)} ({(int)item.Key}) = {item.Value}");
foreach (var item in obj.GetAllPropertyInstanceId())
sb.AppendLine($"PropertyInstanceId.{Enum.GetName(typeof(PropertyInstanceId), item.Key)} ({(int)item.Key}) = {item.Value}");
foreach (var item in obj.GetAllPropertyInt())
sb.AppendLine($"PropertyInt.{Enum.GetName(typeof(PropertyInt), item.Key)} ({(int)item.Key}) = {item.Value}");
foreach (var item in obj.GetAllPropertyInt64())
sb.AppendLine($"PropertyInt64.{Enum.GetName(typeof(PropertyInt64), item.Key)} ({(int)item.Key}) = {item.Value}");
foreach (var item in obj.GetAllPropertyString())
sb.AppendLine($"PropertyString.{Enum.GetName(typeof(PropertyString), item.Key)} ({(int)item.Key}) = {item.Value}");
sb.AppendLine("\n");
return sb.ToString().Replace("\r", "");
}
19
Source : SolarAnalysisManager.cs
with GNU Lesser General Public License v3.0
from acnicholas
with GNU Lesser General Public License v3.0
from acnicholas
private string GetViewInfo(View view)
{
var info = new StringBuilder();
if (!ViewIsIso(view))
{
info.AppendLine("Not a 3d view...");
info.AppendLine(string.Empty);
info.AppendLine("Please select a 3d view to rotate");
info.AppendLine("or use the create winter views feature");
return info.ToString();
}
var sunSettings = view.SunAndShadowSettings;
var frame = sunSettings.ActiveFrame;
var azimuth = sunSettings.GetFrameAzimuth(frame);
var alreplacedude = sunSettings.GetFrameAlreplacedude(frame);
azimuth += position.Angle;
var azdeg = azimuth * 180 / Math.PI;
var altdeg = alreplacedude * 180 / Math.PI;
info.AppendLine("Date - " + sunSettings.ActiveFrameTime.ToLocalTime().ToLongDateString());
info.AppendLine("Time - " + sunSettings.ActiveFrameTime.ToLocalTime().ToLongTimeString());
info.AppendLine("Sunrise - " +
sunSettings.GetSunrise(sunSettings.ActiveFrameTime).ToLocalTime().ToLongTimeString());
info.AppendLine("Sunset - " +
sunSettings.GetSunset(sunSettings.ActiveFrameTime).ToLocalTime().ToLongTimeString());
info.AppendLine("Sun Alreplacedude - " + altdeg.ToString(CultureInfo.InvariantCulture));
info.AppendLine("Sun Azimuth - " + azdeg.ToString(CultureInfo.InvariantCulture));
return info.ToString();
}
See More Examples