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:
parent
71b1042e13
commit
48056bd888
6 changed files with 29 additions and 9 deletions
|
@ -13,7 +13,7 @@ namespace Nibriboard.Client
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current lines that haven't been completed yet.
|
/// The current lines that haven't been completed yet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Dictionary<Guid, DrawnLine> currentLines = new Dictionary<Guid, DrawnLine>();
|
private Dictionary<string, DrawnLine> currentLines = new Dictionary<string, DrawnLine>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The number of lines that this line incubator has completed.
|
/// 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.
|
/// Figures out whether an incomplete line with the given id exists or not.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="lineId">The line id to check for.</param>
|
/// <param name="lineId">The line id to check for.</param>
|
||||||
public bool LineExists(Guid lineId)
|
public bool LineExists(string lineId)
|
||||||
{
|
{
|
||||||
if(currentLines[lineId] != null)
|
if(currentLines[lineId] != null)
|
||||||
return true;
|
return true;
|
||||||
|
@ -49,7 +49,7 @@ namespace Nibriboard.Client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="lineId">The line id to add the points to.</param>
|
/// <param name="lineId">The line id to add the points to.</param>
|
||||||
/// <param name="points">The points to add to the lines.</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
|
// Create a new line if one doesn't exist already
|
||||||
if(!currentLines.ContainsKey(lineId))
|
if(!currentLines.ContainsKey(lineId))
|
||||||
|
@ -64,7 +64,7 @@ namespace Nibriboard.Client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="lineId">The id of the line to complete.</param>
|
/// <param name="lineId">The id of the line to complete.</param>
|
||||||
/// <returns>The completed line.</returns>
|
/// <returns>The completed line.</returns>
|
||||||
public DrawnLine CompleteLine(Guid lineId)
|
public DrawnLine CompleteLine(string lineId)
|
||||||
{
|
{
|
||||||
if(!currentLines.ContainsKey(lineId))
|
if(!currentLines.ContainsKey(lineId))
|
||||||
throw new KeyNotFoundException("Error: A line with that id wasn't found in this LineIncubator.");
|
throw new KeyNotFoundException("Error: A line with that id wasn't found in this LineIncubator.");
|
||||||
|
|
19
Nibriboard/Client/Messages/ErrorMessage.cs
Normal file
19
Nibriboard/Client/Messages/ErrorMessage.cs
Normal 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()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ namespace Nibriboard.Client.Messages
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The id of the line to complete
|
/// The id of the line to complete
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid LineId;
|
public string LineId;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The colour of the line. May be any valid colour accepted by the HTML5 Canvas API.
|
/// The colour of the line. May be any valid colour accepted by the HTML5 Canvas API.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Nibriboard.Client.Messages
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The id of the line to add the points to.
|
/// The id of the line to add the points to.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid LineId;
|
public string LineId;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The points to add to the line
|
/// The points to add to the line
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -98,6 +98,7 @@
|
||||||
<Compile Include="Client\Messages\LinePartMessage.cs" />
|
<Compile Include="Client\Messages\LinePartMessage.cs" />
|
||||||
<Compile Include="Client\LineIncubator.cs" />
|
<Compile Include="Client\LineIncubator.cs" />
|
||||||
<Compile Include="Client\Messages\LineCompleteMessage.cs" />
|
<Compile Include="Client\Messages\LineCompleteMessage.cs" />
|
||||||
|
<Compile Include="Client\Messages\ErrorMessage.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="ClientFiles\index.html" />
|
<EmbeddedResource Include="ClientFiles\index.html" />
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Nibriboard.RippleSpace
|
||||||
/// drawn at once may also have the same id. This is such that a single
|
/// 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.
|
/// line that was split across multiple chunks can still be referenced.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly Guid LineId;
|
public readonly string LineId;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The width of the line.
|
/// 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;
|
LineId = inLineId;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue