1
0
Fork 0
mirror of https://github.com/sbrl/Nibriboard.git synced 2018-01-10 21:33:49 +00:00

[server] Guid -> string for line ids

This commit is contained in:
Starbeamrainbowlabs 2017-04-23 17:11:46 +01:00
parent 71b1042e13
commit 48056bd888
6 changed files with 29 additions and 9 deletions

View file

@ -13,7 +13,7 @@ namespace Nibriboard.Client
/// <summary>
/// The current lines that haven't been completed yet.
/// </summary>
private Dictionary<Guid, DrawnLine> currentLines = new Dictionary<Guid, DrawnLine>();
private Dictionary<string, DrawnLine> currentLines = new Dictionary<string, DrawnLine>();
/// <summary>
/// The number of lines that this line incubator has completed.
@ -37,7 +37,7 @@ namespace Nibriboard.Client
/// Figures out whether an incomplete line with the given id exists or not.
/// </summary>
/// <param name="lineId">The line id to check for.</param>
public bool LineExists(Guid lineId)
public bool LineExists(string lineId)
{
if(currentLines[lineId] != null)
return true;
@ -49,7 +49,7 @@ namespace Nibriboard.Client
/// </summary>
/// <param name="lineId">The line id to add the points to.</param>
/// <param name="points">The points to add to the lines.</param>
public void AddBit(Guid lineId, List<LocationReference> points)
public void AddBit(string lineId, List<LocationReference> points)
{
// Create a new line if one doesn't exist already
if(!currentLines.ContainsKey(lineId))
@ -64,7 +64,7 @@ namespace Nibriboard.Client
/// </summary>
/// <param name="lineId">The id of the line to complete.</param>
/// <returns>The completed line.</returns>
public DrawnLine CompleteLine(Guid lineId)
public DrawnLine CompleteLine(string lineId)
{
if(!currentLines.ContainsKey(lineId))
throw new KeyNotFoundException("Error: A line with that id wasn't found in this LineIncubator.");

View file

@ -0,0 +1,19 @@
using System;
namespace Nibriboard.Client.Messages
{
/// <summary>
/// Represents a complaint (usually by the server) about something that the other party
/// has done that probably shouldn't have.
/// </summary>
public class ErrorMessage
{
/// <summary>
/// The message describing the error that has occurred.
/// </summary>
string Message;
public ErrorMessage()
{
}
}
}

View file

@ -6,7 +6,7 @@ namespace Nibriboard.Client.Messages
/// <summary>
/// The id of the line to complete
/// </summary>
public Guid LineId;
public string LineId;
/// <summary>
/// The colour of the line. May be any valid colour accepted by the HTML5 Canvas API.
/// </summary>

View file

@ -14,7 +14,7 @@ namespace Nibriboard.Client.Messages
/// <summary>
/// The id of the line to add the points to.
/// </summary>
public Guid LineId;
public string LineId;
/// <summary>
/// The points to add to the line
/// </summary>

View file

@ -98,6 +98,7 @@
<Compile Include="Client\Messages\LinePartMessage.cs" />
<Compile Include="Client\LineIncubator.cs" />
<Compile Include="Client\Messages\LineCompleteMessage.cs" />
<Compile Include="Client\Messages\ErrorMessage.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ClientFiles\index.html" />

View file

@ -14,7 +14,7 @@ namespace Nibriboard.RippleSpace
/// drawn at once may also have the same id. This is such that a single
/// line that was split across multiple chunks can still be referenced.
/// </summary>
public readonly Guid LineId;
public readonly string LineId;
/// <summary>
/// The width of the line.
@ -59,10 +59,10 @@ namespace Nibriboard.RippleSpace
}
}
public DrawnLine() : this(Guid.NewGuid())
public DrawnLine() : this(Guid.NewGuid().ToString("N"))
{
}
protected DrawnLine(Guid inLineId)
protected DrawnLine(string inLineId)
{
LineId = inLineId;
}