本文整理汇总了C#中StringBuilder.AppendStringBuilder方法的典型用法代码示例。如果您正苦于以下问题:C# StringBuilder.AppendStringBuilder方法的具体用法?C# StringBuilder.AppendStringBuilder怎么用?C# StringBuilder.AppendStringBuilder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringBuilder
的用法示例。
在下文中一共展示了StringBuilder.AppendStringBuilder方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MyGuiScreenProgress
public MyGuiScreenProgress(StringBuilder text, MyStringId? cancelText = null)
: base(MySpaceTexts.Blank, cancelText)
{
// Copy
Text = new StringBuilder(text.Length);
Text.AppendStringBuilder(text);
}
示例2: AddServerItem
bool AddServerItem(GameServerItem server, Action onAddedServerItem, bool isFiltered = false)
{
if (m_allowedGroups.IsChecked && !SteamAPI.Instance.Friends.IsUserInGroup(server.GetGameTagByPrefixUlong("groupId")))
return false;
if (server.AppID != MySteam.AppId)
return false;
if (!isFiltered && !string.IsNullOrWhiteSpace(m_blockSearch.Text)) // this must be here for filtering LAN games
{
if (!server.Name.ToLower().Contains(m_blockSearch.Text.ToLower()))
return false;
}
string sessionName = server.Map;
int appVersion = server.ServerVersion;
m_gameTypeText.Clear();
m_gameTypeToolTip.Clear();
// Skip world without name (not fully initialized)
if (string.IsNullOrEmpty(sessionName))
return false;
// Show only same app versions
if (m_showOnlyCompatibleGames.IsChecked && appVersion != MyFinalBuildConstants.APP_VERSION)
return false;
// Show only if the game data match
string remoteHash = server.GetGameTagByPrefix("datahash");
if (m_showOnlyWithSameMods.IsChecked && MyFakes.ENABLE_MP_DATA_HASHES && remoteHash != "" && remoteHash != MyDataIntegrityChecker.GetHashBase64())
return false;
var gamemodeSB = new StringBuilder();
var gamemodeToolTipSB = new StringBuilder();
string gamemode = server.GetGameTagByPrefix("gamemode");
if (gamemode == "C")
{
gamemodeSB.Append(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeCreative));
gamemodeToolTipSB.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeCreative));
}
else if (gamemode == "B")
{
IPEndPoint endpoint = server.NetAdr;
if (endpoint == null)
return false;
// Started battle write key value "BattleCanBeJoinedTag" "0" to server which can be accessed asynchronously from rules.
MySandboxGame.Services.SteamService.SteamAPI.GetServerRules(endpoint.Address.ToIPv4NetworkOrder(), (ushort)endpoint.Port, delegate(Dictionary<string, string> rules)
{
if (rules == null)
return;
bool canBeJoined = true;
string strCanBeJoined;
if (rules.TryGetValue(MyMultiplayer.BattleCanBeJoinedTag, out strCanBeJoined))
{
canBeJoined = strCanBeJoined != 0.ToString();
}
if (canBeJoined)
{
gamemodeSB.Append(MyTexts.Get(MySpaceTexts.WorldSettings_Battle));
gamemodeToolTipSB.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_Battle));
AddServerItem(server, sessionName, gamemodeSB, gamemodeToolTipSB);
if (onAddedServerItem != null)
onAddedServerItem();
}
},
delegate() { });
return false;
}
else if(!string.IsNullOrWhiteSpace(gamemode))
{
var multipliers = gamemode.Substring(1);
var split = multipliers.Split('-');
//TODO: refactor
if (split.Length == 3 && server.AppID == 244850)
{
gamemodeSB.Append(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeSurvival)).Append(" ").Append(multipliers);
gamemodeToolTipSB.AppendFormat(MyTexts.Get(MySpaceTexts.JoinGame_GameTypeToolTip_MultipliersFormat).ToString(), split[0], split[1], split[2]);
}
else
{
gamemodeSB.Append(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeSurvival));
gamemodeToolTipSB.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeSurvival));
}
}
AddServerItem(server, sessionName, gamemodeSB, gamemodeToolTipSB);
if (onAddedServerItem != null)
onAddedServerItem();
return true;
}
示例3: WriteLockStateValue
public void WriteLockStateValue(StringBuilder sb)
{
if (InConstraint && Connected)
sb.AppendStringBuilder(MyTexts.Get(MySpaceTexts.BlockPropertyValue_Locked));
else if (InConstraint)
sb.AppendStringBuilder(MyTexts.Get(MySpaceTexts.BlockPropertyValue_ReadyToLock));
else
sb.AppendStringBuilder(MyTexts.Get(MySpaceTexts.BlockPropertyValue_Unlocked));
}
示例4: WriteLockStateValue
private void WriteLockStateValue(StringBuilder sb)
{
if (LockMode == LandingGearMode.Locked)
sb.AppendStringBuilder(MyTexts.Get(MySpaceTexts.BlockPropertyValue_Locked));
else if (LockMode == LandingGearMode.ReadyToLock)
sb.AppendStringBuilder(MyTexts.Get(MySpaceTexts.BlockPropertyValue_ReadyToLock));
else
sb.AppendStringBuilder(MyTexts.Get(MySpaceTexts.BlockPropertyValue_Unlocked));
}
示例5: GetText
public void GetText(StringBuilder result)
{
result.AppendStringBuilder(m_text);
}
示例6: RefreshMedicalRooms
private void RefreshMedicalRooms()
{
List<MyMedicalRoom> medicalRooms;
GetAvailableMedicalRooms(MySession.LocalPlayerId, out medicalRooms);
foreach (var medRoom in medicalRooms)
{
var row = new MyGuiControlTable.Row(medRoom);
row.AddCell(new MyGuiControlTable.Cell(text: medRoom.CustomName));
var ownerText = new StringBuilder();
if (MySession.Static.Settings.EnableOxygen)
{
ownerText.Append("O2 ");
ownerText.Append((medRoom.GetOxygenLevel() * 100).ToString("F0"));
ownerText.Append("% ");
}
ownerText.AppendStringBuilder(GetOwnerDisplayName(medRoom));
row.AddCell(new MyGuiControlTable.Cell(text: ownerText));
m_respawnsTable.Add(row);
}
}
示例7: RefreshMedicalRooms
void RefreshMedicalRooms(List<MyMedicalRoomInfo> medicalRooms)
{
m_respawnsTable.Clear();
foreach (var medRoom in medicalRooms)
{
var row = new MyGuiControlTable.Row(medRoom);
row.AddCell(new MyGuiControlTable.Cell(text: medRoom.MedicalRoomName));
var ownerText = new StringBuilder();
if (MySession.Static.Settings.EnableOxygen)
{
ownerText.Append("O2 ");
ownerText.Append((medRoom.OxygenLevel * 100).ToString("F0"));
ownerText.Append("% ");
}
ownerText.AppendStringBuilder(GetOwnerDisplayName(medRoom.OwnerId));
row.AddCell(new MyGuiControlTable.Cell(text: ownerText));
m_respawnsTable.Add(row);
}
if (!MySession.Static.Settings.DisableRespawnShips && !MySession.Static.Settings.Scenario)
{
RefreshSpawnShips();
AddRespawnInSuit();
}
if (m_respawnsTable.RowsCount > 0)
{
m_respawnsTable.SelectedRowIndex = 0;
OnTableItemSelected(null, new MyGuiControlTable.EventArgs());
m_noRespawnText.Visible = false;
}
else
{
m_noRespawnText.Visible = true;
}
}
示例8: AddServerItem
bool AddServerItem(GameServerItem server, bool isFiltered = false)
{
if (m_allowedGroups.IsChecked && !SteamAPI.Instance.Friends.IsUserInGroup(server.GetGameTagByPrefixUlong("groupId")))
return false;
if (server.AppID != MySteam.AppId)
return false;
if (!isFiltered && !string.IsNullOrWhiteSpace(m_blockSearch.Text)) // this must be here for filtering LAN games
{
if (!server.Name.ToLower().Contains(m_blockSearch.Text.ToLower()))
return false;
}
var row = new MyGuiControlTable.Row(server);
string sessionName = server.Map;
int appVersion = server.ServerVersion;
m_gameTypeText.Clear();
m_gameTypeToolTip.Clear();
// Skip world without name (not fully initialized)
if (string.IsNullOrEmpty(sessionName))
return false;
// Show only same app versions
if (m_showOnlyCompatibleGames.IsChecked && appVersion != MyFinalBuildConstants.APP_VERSION)
return false;
// Show only if the game data match
string remoteHash = server.GetGameTagByPrefix("datahash");
if (m_showOnlyWithSameMods.IsChecked && MyFakes.ENABLE_MP_DATA_HASHES && remoteHash != "" && remoteHash != MyDataIntegrityChecker.GetHashBase64())
return false;
var gamemodeSB = new StringBuilder();
var gamemodeToolTipSB = new StringBuilder();
string gamemode = server.GetGameTagByPrefix("gamemode");
if (gamemode == "C")
{
gamemodeSB.Append(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeCreative));
gamemodeToolTipSB.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeCreative));
}
else if(!string.IsNullOrWhiteSpace(gamemode))
{
var multipliers = gamemode.Substring(1);
var split = multipliers.Split('-');
//TODO: refactor
if (split.Length == 3 && server.AppID == 244850)
{
gamemodeSB.Append(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeSurvival)).Append(" ").Append(multipliers);
gamemodeToolTipSB.AppendFormat(MyTexts.Get(MySpaceTexts.JoinGame_GameTypeToolTip_MultipliersFormat).ToString(), split[0], split[1], split[2]);
}
else
{
gamemodeSB.Append(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeSurvival));
gamemodeToolTipSB.AppendStringBuilder(MyTexts.Get(MySpaceTexts.WorldSettings_GameModeSurvival));
}
}
ulong modCount = server.GetGameTagByPrefixUlong(MyMultiplayer.ModCountTag);
string limit = server.MaxPlayers.ToString();
StringBuilder userCount = new StringBuilder(server.Players + "/" + limit);
var viewDistance = server.GetGameTagByPrefix(MyMultiplayer.ViewDistanceTag);
//TODO: refactor
if (!String.IsNullOrEmpty(viewDistance) && server.AppID == 244850)
{
gamemodeToolTipSB.AppendLine();
gamemodeToolTipSB.AppendFormat(MyTexts.Get(MySpaceTexts.JoinGame_GameTypeToolTip_ViewDistance).ToString(), viewDistance);
}
row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(sessionName), userData: server.SteamID, toolTip: m_textCache.ToString()));
row.AddCell(new MyGuiControlTable.Cell(text: gamemodeSB, toolTip: gamemodeToolTipSB.ToString()));
row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(server.Name), toolTip: m_gameTypeToolTip.Clear().AppendLine(server.Name).Append(server.NetAdr.ToString()).ToString()));
row.AddCell(new MyGuiControlTable.Cell(text: userCount, toolTip: userCount.ToString()));
row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(server.Ping), toolTip: m_textCache.ToString()));
row.AddCell(new MyGuiControlTable.Cell(text: m_textCache.Clear().Append(modCount == 0 ? "---" : modCount.ToString()), toolTip: MyTexts.GetString(MySpaceTexts.JoinGame_SelectServerToShowModList)));
m_gamesTable.Add(row);
var selectedRow = m_gamesTable.SelectedRow;
m_gamesTable.Sort(false);
m_gamesTable.SelectedRowIndex = m_gamesTable.FindRow(selectedRow);
return true;
}
示例9: RefreshMedicalRoomsResponse_Implementation
static void RefreshMedicalRoomsResponse_Implementation(List<MyMedicalRoomInfo> medicalRooms)
{
foreach (var medRoom in medicalRooms)
{
var row = new MyGuiControlTable.Row(medRoom);
row.AddCell(new MyGuiControlTable.Cell(text: medRoom.MedicalRoomName));
var ownerText = new StringBuilder();
if (MySession.Static.Settings.EnableOxygen)
{
ownerText.Append("O2 ");
ownerText.Append((medRoom.OxygenLevel * 100).ToString("F0"));
ownerText.Append("% ");
}
ownerText.AppendStringBuilder(GetOwnerDisplayName(medRoom.OwnerId));
row.AddCell(new MyGuiControlTable.Cell(text: ownerText));
MyGuiScreenMedicals.Static.m_respawnsTable.Add(row);
}
}
示例10: Log
public void Log(MyLogSeverity severity, StringBuilder builder)
{
StringBuilder sb = new StringBuilder();
sb.AppendFormat("{0}: ", severity);
sb.AppendStringBuilder(builder);
sb.Append('\n');
WriteStringBuilder(sb);
if ((int)severity >= (int)AssertLevel)
SystemTrace.Fail(sb.ToString());
}