Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
Fix system type keyword use
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxar-tc committed Oct 24, 2016
1 parent 61c1db6 commit 9b3bda6
Show file tree
Hide file tree
Showing 24 changed files with 103 additions and 108 deletions.
2 changes: 1 addition & 1 deletion EssentialsPlugin/ChatHandlers/Admin/HandleAdminVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public override bool HandleCommand( ulong userId, string[] words )
//Version version = typeof( Essentials ).Assembly.GetName( ).Version;
//Communication.SendPrivateInformation( userId, (String)version );

Communication.SendPrivateInformation( userId, String.Format("Plugin '{0}' initialized. (Version: {1} ID: {2})",
Communication.SendPrivateInformation( userId, string.Format("Plugin '{0}' initialized. (Version: {1} ID: {2})",
Essentials.Instance.Name, Essentials.Instance.Version, Essentials.Instance.Id) );

return true;
Expand Down
26 changes: 12 additions & 14 deletions EssentialsPlugin/ChatHandlers/ChatHandlerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public ChatHandlerBase( )
Log.Debug( $"Added chat handler: {GetCommandText()}" );
}

public virtual Boolean CanHandle(ulong steamId, String[] words, ref int commandCount)
public virtual bool CanHandle(ulong steamId, string[] words, ref int commandCount)
{
// Administrator Command
if (IsAdminCommand())
Expand All @@ -39,7 +39,7 @@ public virtual Boolean CanHandle(ulong steamId, String[] words, ref int commandC
{
commandCount = GetCommandText().Split(new char[] { ' ' }).Count();
if (words.Length > commandCount - 1)
return String.Join(" ", words).ToLower().StartsWith(GetCommandText());
return string.Join(" ", words).ToLower().StartsWith(GetCommandText());
}
else
{
Expand All @@ -49,7 +49,7 @@ public virtual Boolean CanHandle(ulong steamId, String[] words, ref int commandC
commandCount = command.Split(new char[] { ' ' }).Count();
if (words.Length > commandCount - 1)
{
found = String.Join(" ", words).ToLower().StartsWith(command);
found = string.Join(" ", words).ToLower().StartsWith(command);
if (found)
break;
}
Expand All @@ -65,18 +65,16 @@ public virtual Boolean CanHandle(ulong steamId, String[] words, ref int commandC

public virtual Communication.ServerDialogItem GetHelpDialog( )
{
Communication.ServerDialogItem DialogItem = new Communication.ServerDialogItem();
DialogItem.title = "Help";
DialogItem.header = GetCommandText();
DialogItem.content = GetHelp();
DialogItem.buttonText = "close";
return DialogItem;
return new Communication.ServerDialogItem
{
title = "Help",
header = GetCommandText( ),
content = GetHelp( ),
buttonText = "close"
};
}

public virtual String GetCommandText()
{
return "";
}
public abstract string GetCommandText( );

public virtual string[] GetMultipleCommandText()
{
Expand All @@ -98,7 +96,7 @@ public virtual bool IsClientOnly()
return false;
}

public virtual bool HandleCommand(ulong userId, String[] words)
public virtual bool HandleCommand(ulong userId, string[] words)
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion EssentialsPlugin/ChatHandlers/Dock/HandleAdminUndockAll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public override bool HandleCommand(ulong userId, string[] words)
{
foreach (DockingItem dockingItem in Docking.Instance.DockingItems)
{
string dockedShipFileName = Essentials.PluginPath + String.Format("\\Docking\\docked_{0}_{1}_{2}.sbc", dockingItem.PlayerId, dockingItem.TargetEntityId, dockingItem.DockedEntityId);
string dockedShipFileName = Essentials.PluginPath + string.Format("\\Docking\\docked_{0}_{1}_{2}.sbc", dockingItem.PlayerId, dockingItem.TargetEntityId, dockingItem.DockedEntityId);

DockingItem dockedShip = dockingItem;
IMyEntity entity = MyAPIGateway.Entities.GetEntity(x => x.EntityId == dockedShip.TargetEntityId && x is IMyCubeGrid);
Expand Down
4 changes: 2 additions & 2 deletions EssentialsPlugin/ChatHandlers/Dock/HandleDockDock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public override bool HandleCommand(ulong userId, string[] words)
m_docking = true;
try
{
String pylonName = String.Join(" ", words);
string pylonName = string.Join(" ", words);

/*
int timeLeft;
Expand All @@ -92,7 +92,7 @@ public override bool HandleCommand(ulong userId, string[] words)

long playerId = PlayerMap.Instance.GetPlayerIdsFromSteamId(userId).First();

Dictionary<String, List<IMyCubeBlock>> testList;
Dictionary<string, List<IMyCubeBlock>> testList;
List<IMyCubeBlock> beaconList;
DockingZone.FindByName(pylonName, out testList, out beaconList, playerId);
if (beaconList.Count == 4)
Expand Down
4 changes: 2 additions & 2 deletions EssentialsPlugin/ChatHandlers/Dock/HandleDockList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public override bool HandleCommand(ulong userId, string[] words)
return true;
}

String pylonName = String.Join(" ", words);
string pylonName = string.Join(" ", words);
if (PlayerMap.Instance.GetPlayerIdsFromSteamId(userId).Count < 1)
{
Communication.SendPrivateInformation(userId, string.Format("Unable to find player Id: {0}", userId));
Expand All @@ -60,7 +60,7 @@ public override bool HandleCommand(ulong userId, string[] words)

long playerId = PlayerMap.Instance.GetPlayerIdsFromSteamId(userId).First();

Dictionary<String, List<IMyCubeBlock>> testList;
Dictionary<string, List<IMyCubeBlock>> testList;
List<IMyCubeBlock> beaconList;
DockingZone.FindByName(pylonName, out testList, out beaconList, playerId);

Expand Down
6 changes: 3 additions & 3 deletions EssentialsPlugin/ChatHandlers/Dock/HandleDockUndock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public override bool HandleCommand(ulong userId, string[] words)
m_undocking = true;
try
{
String pylonName = String.Join( " ", words );
string pylonName = string.Join( " ", words );
if ( PlayerMap.Instance.GetPlayerIdsFromSteamId( userId ).Count < 1 )
{
Communication.SendPrivateInformation( userId, string.Format( "Unable to find player Id: {0}", userId ) );
Expand All @@ -83,7 +83,7 @@ public override bool HandleCommand(ulong userId, string[] words)

long playerId = PlayerMap.Instance.GetPlayerIdsFromSteamId( userId ).First( );

Dictionary<String, List<IMyCubeBlock>> testList;
Dictionary<string, List<IMyCubeBlock>> testList;
List<IMyCubeBlock> beaconList;
DockingZone.FindByName( pylonName, out testList, out beaconList, playerId );

Expand Down Expand Up @@ -150,7 +150,7 @@ public override bool HandleCommand(ulong userId, string[] words)
}
}

String dockedShipFileName = Essentials.PluginPath + String.Format( "\\Docking\\docked_{0}_{1}_{2}.sbc", ownerId, dockingItem.TargetEntityId, dockingItem.DockedEntityId );
string dockedShipFileName = Essentials.PluginPath + string.Format( "\\Docking\\docked_{0}_{1}_{2}.sbc", ownerId, dockingItem.TargetEntityId, dockingItem.DockedEntityId );

// Load Entity From File and add to game
FileInfo fileInfo = new FileInfo( dockedShipFileName );
Expand Down
4 changes: 2 additions & 2 deletions EssentialsPlugin/ChatHandlers/Dock/HandleDockValidate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public override bool HandleCommand(ulong userId, string[] words)
}

// Grab shared beacon name and playerId
String pylonName = String.Join(" ", words);
string pylonName = string.Join(" ", words);
if (PlayerMap.Instance.GetPlayerIdsFromSteamId(userId).Count < 1)
{
Communication.SendPrivateInformation(userId, "Failed to retrieve your playerId. Command failed.");
Expand All @@ -62,7 +62,7 @@ public override bool HandleCommand(ulong userId, string[] words)
long playerId = PlayerMap.Instance.GetPlayerIdsFromSteamId(userId).First();

// Find shared beacon area
Dictionary<String, List<IMyCubeBlock>> testList;
Dictionary<string, List<IMyCubeBlock>> testList;
List<IMyCubeBlock> beaconList;
DockingZone.FindByName(pylonName, out testList, out beaconList, playerId);
if (beaconList.Count == 4)
Expand Down
2 changes: 1 addition & 1 deletion EssentialsPlugin/ChatHandlers/HandleInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public override bool HandleCommand(ulong userId, string[] words)

private static void ShowTopicList(ulong userId)
{
String noticeList = "";
string noticeList = "";
foreach (InformationItem item in PluginSettings.Instance.InformationItems)
{
if (!item.Enabled)
Expand Down
10 changes: 5 additions & 5 deletions EssentialsPlugin/Essentials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ public void Init( )
DoInit( Path.GetDirectoryName( Assembly.GetExecutingAssembly( ).Location ) + "\\" );
}

public void InitWithPath( String modPath )
public void InitWithPath( string modPath )
{
//register object builder assembly
string path = System.IO.Path.Combine( AppDomain.CurrentDomain.BaseDirectory, "SpaceEngineers.ObjectBuilders.DLL" );
Expand Down Expand Up @@ -1561,7 +1561,7 @@ private void HandleHelpCommand( ulong remoteUserId, IReadOnlyCollection<string>
// Again, we should get handler to just return string[] of command Text
if ( handler.GetMultipleCommandText( ).Length < 1 )
{
if ( String.Equals( handler.GetCommandText( ), helpTarget, StringComparison.CurrentCultureIgnoreCase ) )
if ( string.Equals( handler.GetCommandText( ), helpTarget, StringComparison.CurrentCultureIgnoreCase ) )
{
Communication.SendPrivateInformation( remoteUserId, handler.GetHelp( ) );
found = true;
Expand All @@ -1571,7 +1571,7 @@ private void HandleHelpCommand( ulong remoteUserId, IReadOnlyCollection<string>
{
foreach ( string cmd in handler.GetMultipleCommandText( ) )
{
if ( String.Equals( cmd, helpTarget, StringComparison.CurrentCultureIgnoreCase ) )
if ( string.Equals( cmd, helpTarget, StringComparison.CurrentCultureIgnoreCase ) )
{
Communication.SendPrivateInformation( remoteUserId, handler.GetHelp( ) );
found = true;
Expand Down Expand Up @@ -1668,7 +1668,7 @@ private void HandleHelpDialog(ulong remoteUserId, IReadOnlyCollection<string> co
// Again, we should get handler to just return string[] of command Text
if (handler.GetMultipleCommandText().Length < 1)
{
if (String.Equals(handler.GetCommandText(), helpTarget, StringComparison.CurrentCultureIgnoreCase))
if (string.Equals(handler.GetCommandText(), helpTarget, StringComparison.CurrentCultureIgnoreCase))
{
Communication.DisplayDialog(remoteUserId, handler.GetHelpDialog());
found = true;
Expand All @@ -1678,7 +1678,7 @@ private void HandleHelpDialog(ulong remoteUserId, IReadOnlyCollection<string> co
{
foreach (string cmd in handler.GetMultipleCommandText())
{
if (String.Equals(cmd, helpTarget, StringComparison.CurrentCultureIgnoreCase))
if (string.Equals(cmd, helpTarget, StringComparison.CurrentCultureIgnoreCase))
{
Communication.DisplayDialog(remoteUserId, handler.GetHelpDialog());
found = true;
Expand Down
4 changes: 2 additions & 2 deletions EssentialsPlugin/GameModes/Conquest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private static void Load()
{
try
{
String fileName = Essentials.PluginPath + "Essentials-Conquest.xml";
string fileName = Essentials.PluginPath + "Essentials-Conquest.xml";
if (File.Exists(fileName))
{
using (StreamReader reader = new StreamReader(fileName))
Expand All @@ -187,7 +187,7 @@ private static void Save()
{
lock (Instance)
{
String fileName = Essentials.PluginPath + "Essentials-Conquest.xml";
string fileName = Essentials.PluginPath + "Essentials-Conquest.xml";
using (StreamWriter writer = new StreamWriter(fileName))
{
XmlSerializer x = new XmlSerializer(typeof(Conquest));
Expand Down
2 changes: 1 addition & 1 deletion EssentialsPlugin/ProcessHandlers/ProcessDockingZone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void CheckPlayerInDockingZone(IMyPlayer player)
// Does this grid contain a docking zone?
if (m_zoneCache.Contains(cubeGrid))
{
Dictionary<String, List<IMyCubeBlock>> zoneList = DockingZone.GetZonesInGrid(cubeGrid);
Dictionary<string, List<IMyCubeBlock>> zoneList = DockingZone.GetZonesInGrid(cubeGrid);
if (zoneList == null)
continue;

Expand Down
2 changes: 1 addition & 1 deletion EssentialsPlugin/ProcessHandlers/ProcessRestart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private void DoRestart()
if (Environment.UserInteractive)
{
string restartText = "%windir%/system32/timeout /t 30\r\n";
restartText += String.Format("cd /d \"{0}\"\r\n", Path.GetDirectoryName(Application.ExecutablePath));
restartText += string.Format("cd /d \"{0}\"\r\n", Path.GetDirectoryName(Application.ExecutablePath));
restartText += PluginSettings.Instance.RestartAddedProcesses + "\r\n";
restartText += Path.GetFileName(Application.ExecutablePath) + " " + Server.Instance.CommandLineArgs.Args + "\r\n";

Expand Down
2 changes: 1 addition & 1 deletion EssentialsPlugin/Settings/SettingsGreetingDialogItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public override string ToString()

public event PropertyChangedEventHandler PropertyChanged;

private void NotifyPropertyChanged(String propertyName = "")
private void NotifyPropertyChanged(string propertyName = "")
{
if (PropertyChanged != null)
{
Expand Down
29 changes: 13 additions & 16 deletions EssentialsPlugin/Settings/SettingsProtectedItem.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
namespace EssentialsPlugin.Settings
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Xml.Serialization;
using VRage.Serialization;

Expand All @@ -30,6 +27,7 @@ public enum ProtectionModeEnum
GridSetStation,
GridSetDynamic,
GridDelete,
BlockSettings,
}

[Serializable]
Expand All @@ -53,33 +51,32 @@ public class ProtectionSettings

public SerializableDictionary<ProtectionModeEnum,ProtectionSettings> ProtectionSettingsDict = new SerializableDictionary<ProtectionModeEnum, ProtectionSettings>();

private bool enabled = true;
private bool _enabled = true;
public bool Enabled
{
get { return enabled; }
set { enabled = value; }
get { return _enabled; }
set { _enabled = value; }
}

private long entityId;
private long _entityId;
public long EntityId
{
get { return entityId; }
set { entityId = value; }
get { return _entityId; }
set { _entityId = value; }
}

private bool logOnly;
private bool _logOnly;
public bool LogOnly
{
get { return logOnly; }
set { logOnly = value; }
get { return _logOnly; }
set { _logOnly = value; }
}

private bool protectDamage = true;
private bool _protectDamage = true;
public bool ProtectDamage
{
get { return protectDamage; }
set
{protectDamage = value;}
get { return _protectDamage; }
set { _protectDamage = value; }
}
}
}
4 changes: 2 additions & 2 deletions EssentialsPlugin/Utility/DockingItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public Quaternion SaveQuat
set { _saveQuat = value; }
}

private String _dockedName;
public String DockedName
private string _dockedName;
public string DockedName
{
get { return _dockedName; }
set { _dockedName = value; }
Expand Down
8 changes: 4 additions & 4 deletions EssentialsPlugin/Utility/DockingZone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static bool IsGridInside(IMyCubeGrid dockingEntity, List<IMyCubeBlock> be

public static Dictionary<string, List<IMyCubeBlock>> GetZonesInGrid(IMyCubeGrid cubeGrid)
{
Dictionary<String, List<IMyCubeBlock>> testList = new Dictionary<string, List<IMyCubeBlock>>();
Dictionary<string, List<IMyCubeBlock>> testList = new Dictionary<string, List<IMyCubeBlock>>();
List<IMySlimBlock> cubeBlocks = new List<IMySlimBlock>();
cubeGrid.GetBlocks(cubeBlocks);
foreach (IMySlimBlock entityBlock in cubeBlocks)
Expand Down Expand Up @@ -73,8 +73,8 @@ public static Dictionary<string, List<IMyCubeBlock>> GetZonesInGrid(IMyCubeGrid
}
}

Dictionary<String, List<IMyCubeBlock>> resultList = new Dictionary<string, List<IMyCubeBlock>>();
foreach (KeyValuePair<String, List<IMyCubeBlock>> p in testList)
Dictionary<string, List<IMyCubeBlock>> resultList = new Dictionary<string, List<IMyCubeBlock>>();
foreach (KeyValuePair<string, List<IMyCubeBlock>> p in testList)
{
if (p.Value.Count == 4)
{
Expand All @@ -90,7 +90,7 @@ static public bool DoesGridContainZone(IMyCubeGrid cubeGrid)
return GetZonesInGrid(cubeGrid).Count > 0;
}

static public void FindByName(String pylonName, out Dictionary<String, List<IMyCubeBlock>> testList, out List<IMyCubeBlock> beaconList, long playerId)
static public void FindByName(string pylonName, out Dictionary<string, List<IMyCubeBlock>> testList, out List<IMyCubeBlock> beaconList, long playerId)
{
IMyCubeGrid beaconParent = null;
testList = new Dictionary<string, List<IMyCubeBlock>>();
Expand Down
8 changes: 4 additions & 4 deletions EssentialsPlugin/Utility/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class Entity
{
private static readonly Logger Log = LogManager.GetLogger( "PluginLog" );
static public Boolean GreaterThan( Vector3D v, Vector3D container )
static public bool GreaterThan( Vector3D v, Vector3D container )
{
if (v.X > container.X || v.Y > container.Y || v.Z > container.Z)
return false;
Expand Down Expand Up @@ -51,9 +51,9 @@ static public Boolean CheckCoolDown(String name, out int timeLeft)
}
*/

static public bool CheckForIntersection(Dictionary<String, List<IMyCubeBlock>> testList, List<IMyCubeBlock> beaconList, out int intersectElement)
static public bool CheckForIntersection(Dictionary<string, List<IMyCubeBlock>> testList, List<IMyCubeBlock> beaconList, out int intersectElement)
{
Boolean intersects = false;
bool intersects = false;
intersectElement = 0;
OrientedBoundingBoxD targetTestBounding = GetBoundingBox(beaconList);
if (testList.Count > 0)
Expand Down Expand Up @@ -133,7 +133,7 @@ static public OrientedBoundingBoxD GetBoundingBox(List<IMyCubeBlock> cubeList)
return new OrientedBoundingBoxD(bb.Center, bb.HalfExtents, Quaternion.CreateFromRotationMatrix(parent.WorldMatrix.GetOrientation()));
}

static public Boolean CheckOwnership(IMyCubeBlock entity, long playerId)
static public bool CheckOwnership(IMyCubeBlock entity, long playerId)
{
MyRelationsBetweenPlayerAndBlock relation = entity.GetUserRelationToOwner(playerId);

Expand Down
Loading

0 comments on commit 9b3bda6

Please sign in to comment.