Skip to content

Commit

Permalink
Add some comments, fix some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Dec 21, 2020
1 parent ce0223a commit 2c68707
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 17 deletions.
2 changes: 1 addition & 1 deletion MCGalaxy/Database/SqlQuery.cs
Expand Up @@ -20,7 +20,7 @@

namespace MCGalaxy.SQL {

/// <summary> Executes an SQL command or query, that takes named parameters/arguments. </summary>
/// <summary> Executes an SQL command or query using the given parameters/arguments. </summary>
public static class SqlQuery {

/// <summary> Executes an SQL command that does not return any results. </summary>
Expand Down
1 change: 1 addition & 0 deletions MCGalaxy/Drawing/Brushes/Brush.cs
Expand Up @@ -26,6 +26,7 @@ public abstract class Brush {

/// <summary> Returns the next block that should be placed in the world,
/// based on the draw operation's current state. </summary>
/// <remarks> Returns Block.Invalid if no block should be placed. </remarks>
public abstract BlockID NextBlock(DrawOp op);
}
}
1 change: 1 addition & 0 deletions MCGalaxy/Drawing/Flip.cs
Expand Up @@ -20,6 +20,7 @@
using BlockID = System.UInt16;

namespace MCGalaxy.Drawing {
/// <summary> Utility methods for rotating and mirroring a CopyState. </summary>
public static class Flip {

static string[] rotX_90_270 = new string[] { "NS", "UD" };
Expand Down
3 changes: 3 additions & 0 deletions MCGalaxy/Network/Utils/NetUtils.cs
Expand Up @@ -23,14 +23,17 @@ namespace MCGalaxy {
public static class NetUtils {
public const int StringSize = 64;

/// <summary> Reads a signed 16 bit big endian integer. </summary>
public static short ReadI16(byte[] array, int offset) {
return (short)(array[offset] << 8 | array[offset + 1]);
}

/// <summary> Reads an unsigned 16 bit big endian integer. </summary>
public static ushort ReadU16(byte[] array, int offset) {
return (ushort)(array[offset] << 8 | array[offset + 1]);
}

/// <summary> Reads a signed 32 bit big endian integer. </summary>
public static int ReadI32(byte[] array, int offset) {
return array[offset] << 24 | array[offset + 1] << 16
| array[offset + 2] << 8 | array[offset + 3];
Expand Down
4 changes: 2 additions & 2 deletions MCGalaxy/Player/Ban.cs
Expand Up @@ -21,8 +21,8 @@

namespace MCGalaxy {

/// <summary> Can check the info about someone's ban, find out if there's info about someone,
/// and add / remove someone to the baninfo (NOT THE BANNED.TXT !) </summary>
/// <summary> Retrieves or updates a user's ban/unban information. </summary>
/// <remarks> This is NOT the list of banned players (ranks/banned.txt) </remarks>
public static class Ban {

static PlayerMetaList bans = new PlayerMetaList("text/bans.txt");
Expand Down
9 changes: 5 additions & 4 deletions MCGalaxy/Plugins/Plugin.cs
Expand Up @@ -19,7 +19,8 @@

namespace MCGalaxy {

/// <summary> Importance. Higher priority plugins have their handlers called before lower priority plugins. </summary>
/// <summary> Importance of a plugin event handler (See IPluginEvent). </summary>
/// <remarks> Higher priority handlers are called before lower priority handlers. </remarks>
public enum Priority : byte {
Low = 0,
Normal = 1,
Expand Down Expand Up @@ -49,11 +50,11 @@ public abstract partial class Plugin {
public abstract string name { get; }
/// <summary> Your website. </summary>
public virtual string website { get { return ""; } }
/// <summary> Oldest version of MCGalaxy the plugin is compatible with. </summary>
/// <summary> Oldest version of MCGalaxy this plugin is compatible with. </summary>
public abstract string MCGalaxy_Version { get; }
/// <summary> Version of your plugin. </summary>
/// <summary> Version of this plugin. </summary>
public virtual int build { get { return 0; } }
/// <summary> Message to display once plugin is loaded. </summary>
/// <summary> Message to display once this plugin is loaded. </summary>
public virtual string welcome { get { return ""; } }
/// <summary> The creator/author of this plugin. (Your name) </summary>
public virtual string creator { get { return ""; } }
Expand Down
1 change: 1 addition & 0 deletions MCGalaxy/Server/Maintenance/Backup.cs
Expand Up @@ -21,6 +21,7 @@
using MCGalaxy.SQL;

namespace MCGalaxy {
/// <summary> Utility methods for backing up and restoring a server. </summary>
public static class Backup {
const string zipPath = "MCGalaxy.zip", sqlPath = "SQL.sql", dbPath = "MCGalaxy.db";

Expand Down
1 change: 1 addition & 0 deletions MCGalaxy/Server/Maintenance/Updater.cs
Expand Up @@ -24,6 +24,7 @@
using MCGalaxy.Tasks;

namespace MCGalaxy {
/// <summary> Checks for and applies software updates. </summary>
public static class Updater {

static string exeName = Path.GetFileName(Assembly.GetEntryAssembly().Location);
Expand Down
1 change: 1 addition & 0 deletions MCGalaxy/Server/Maintenance/ZipReader.cs
Expand Up @@ -59,6 +59,7 @@ sealed class ZipReaderStream : Stream {
public override void Close() { stream = null; }
}

/// <summary> Reads entries from a ZIP archive. </summary>
public sealed class ZipReader {
BinaryReader reader;
Stream stream;
Expand Down
1 change: 1 addition & 0 deletions MCGalaxy/Server/Maintenance/ZipWriter.cs
Expand Up @@ -111,6 +111,7 @@ sealed class ZipWriterStream : Stream {
}
}

/// <summary> Writes entries into a ZIP archive. </summary>
public sealed class ZipWriter {
BinaryWriter writer;
Stream stream;
Expand Down
2 changes: 2 additions & 0 deletions MCGalaxy/util/Extensions/DateExts.cs
Expand Up @@ -20,6 +20,8 @@
using MCGalaxy.SQL;

namespace MCGalaxy {

/// <summary> Extension methods relating to dates. </summary>
public static class DateExts {

public static TimeSpan ParseOldDBTimeSpent(this string value) {
Expand Down
6 changes: 4 additions & 2 deletions MCGalaxy/util/Extensions/StringExts.cs
Expand Up @@ -18,10 +18,11 @@
using System;

namespace MCGalaxy {


/// <summary> Extension methods relating to strings. </summary>
public static class StringExts {

/// <summary> Sets the first character of the input string touppercase. </summary>
/// <summary> Sets the first character of the input string to uppercase. </summary>
public static string Capitalize(this string str) {
if (String.IsNullOrEmpty(str)) return str;

Expand All @@ -38,6 +39,7 @@ public static class StringExts {
return str.Substring(0, str.Length - 1);
}

/// <summary> Returns whether line is empty or starts with a #. </summary>
public static bool IsCommentLine(this string line) {
return line.Length == 0 || line[0] == '#';
}
Expand Down
2 changes: 2 additions & 0 deletions MCGalaxy/util/Extensions/TimeExts.cs
Expand Up @@ -18,6 +18,8 @@
using System;

namespace MCGalaxy {

/// <summary> Extension methods relating to timespans. </summary>
public static class TimeExts {

public static string Shorten(this TimeSpan value,
Expand Down
4 changes: 2 additions & 2 deletions MCGalaxy/util/ExtrasCollection.cs
Expand Up @@ -20,8 +20,8 @@

namespace MCGalaxy {

/// <summary> You can use this class to store extra information for/about the player/level/server.
/// For example: This is useful if you want to store the value "lives" for a player. </summary>
/// <summary> Stores extra information for/about a player/level/server. </summary>
/// <example> Storing a "lives" value for a player. </example>
public sealed class ExtrasCollection {
readonly Dictionary<string, object> dict = new Dictionary<string, object>();
readonly object locker = new object();
Expand Down
2 changes: 2 additions & 0 deletions MCGalaxy/util/FastList.cs
Expand Up @@ -18,6 +18,8 @@
using System;

namespace MCGalaxy.Util {

/// <summary> A faster alternative to List&lt;T&gt; that does no error checking </summary>
public class FastList<T> {

public T[] Items;
Expand Down
2 changes: 1 addition & 1 deletion MCGalaxy/util/Formatting/Matcher.cs
Expand Up @@ -24,7 +24,7 @@

namespace MCGalaxy {

/// <summary> Finds partial matches of a 'name' against the names of the items an enumerable. </summary>
/// <summary> Finds partial matches of a 'name' against the names of the items in an enumerable. </summary>
/// <remarks> returns number of matches found, and the matching item if only 1 match is found. </remarks>
public static class Matcher {

Expand Down
4 changes: 2 additions & 2 deletions MCGalaxy/util/SparseBitSet.cs
Expand Up @@ -18,8 +18,8 @@
using System;

namespace MCGalaxy.Util {
/// <summary> Sparsely represents 1 bit of data per voxel in a 3D volume. </summary>
/// <remarks> Typically this means 1 bit per block in a level. </remarks>
/// <summary> Sparsely represents 1 bit of data per voxel for a 3D volume. </summary>
/// <remarks> Typically this means 1 bit per block for a level. </remarks>
/// <remarks> Does NOT perform any bounds checking. </remarks>
public sealed class SparseBitSet {

Expand Down
6 changes: 3 additions & 3 deletions MCGalaxy/util/Threading/Scheduler.cs
Expand Up @@ -22,7 +22,7 @@
namespace MCGalaxy.Tasks {
public delegate void SchedulerCallback(SchedulerTask task);

public sealed partial class Scheduler {
public sealed class Scheduler {

readonly List<SchedulerTask> tasks = new List<SchedulerTask>();
readonly AutoResetEvent handle = new AutoResetEvent(false);
Expand Down Expand Up @@ -59,8 +59,8 @@ public sealed partial class Scheduler {
}
}

/// <summary> Rechecks minimum delay for next task.
/// Useful for when external code changes the delay of a scheduled task. </summary>
/// <summary> Recalculates the delay until there is a task to execute. </summary>
/// <remarks> Useful for when external code changes the delay of a scheduled task. </remarks>
public void Recheck() {
lock (taskLock) {
handle.Set();
Expand Down

0 comments on commit 2c68707

Please sign in to comment.