Fixed stuff
This commit is contained in:
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace ErgometerLibrary
|
namespace ErgometerLibrary
|
||||||
{
|
{
|
||||||
class FileHandler
|
public class FileHandler
|
||||||
{
|
{
|
||||||
public static int GenerateSession()
|
public static int GenerateSession()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace ErgometerLibrary
|
|||||||
{
|
{
|
||||||
public class NetCommand
|
public class NetCommand
|
||||||
{
|
{
|
||||||
public enum CommandType { LOGIN, DATA, CHAT, LOGOUT };
|
public enum CommandType { LOGIN, DATA, CHAT, LOGOUT, SESSION };
|
||||||
|
|
||||||
|
|
||||||
public double Timestamp { get; set; }
|
public double Timestamp { get; set; }
|
||||||
@@ -20,6 +20,12 @@ namespace ErgometerLibrary
|
|||||||
public string ChatMessage { get; set; }
|
public string ChatMessage { get; set; }
|
||||||
public Meting Meting { get; set; }
|
public Meting Meting { get; set; }
|
||||||
|
|
||||||
|
public NetCommand(int session)
|
||||||
|
{
|
||||||
|
Type = CommandType.SESSION;
|
||||||
|
Session = session;
|
||||||
|
Timestamp = (DateTime.Now - DateTime.Parse("1/1/1870 0:0:0")).TotalMilliseconds;
|
||||||
|
}
|
||||||
|
|
||||||
public NetCommand(CommandType commandtype, int session)
|
public NetCommand(CommandType commandtype, int session)
|
||||||
{
|
{
|
||||||
@@ -79,11 +85,19 @@ namespace ErgometerLibrary
|
|||||||
return ParseChatMessage(session, args);
|
return ParseChatMessage(session, args);
|
||||||
case 4:
|
case 4:
|
||||||
return ParseLogoutRequest(session, args);
|
return ParseLogoutRequest(session, args);
|
||||||
|
case 5:
|
||||||
|
return ParseSession(session);
|
||||||
default:
|
default:
|
||||||
throw new FormatException("Error in NetCommand: " + comType + " is not a valid command type.");
|
throw new FormatException("Error in NetCommand: " + comType + " is not a valid command type.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private NetCommand ParseSession(int session)
|
||||||
|
{
|
||||||
|
NetCommand temp = new NetCommand(CommandType.SESSION, session);
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
private NetCommand ParseLogoutRequest(int session, string[] args)
|
private NetCommand ParseLogoutRequest(int session, string[] args)
|
||||||
{
|
{
|
||||||
if (args.Length != 1)
|
if (args.Length != 1)
|
||||||
@@ -153,6 +167,9 @@ namespace ErgometerLibrary
|
|||||||
case CommandType.LOGOUT:
|
case CommandType.LOGOUT:
|
||||||
command += "4»ses" + Session + "»logout";
|
command += "4»ses" + Session + "»logout";
|
||||||
break;
|
break;
|
||||||
|
case CommandType.SESSION:
|
||||||
|
command += "5»ses" + Session;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new FormatException("Error in NetCommand: Cannot find type of command");
|
throw new FormatException("Error in NetCommand: Cannot find type of command");
|
||||||
|
|||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.0.2")]
|
[assembly: AssemblyVersion("1.0.1.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0.2")]
|
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||||
|
|||||||
Reference in New Issue
Block a user