1
0
Fork 0

Multilang errors, Client logs

master
sheychen 2016-11-17 13:59:30 +01:00
parent ae6754a832
commit 14ce77fe62
20 changed files with 59 additions and 29 deletions

View File

@ -34,4 +34,19 @@ TooShort;Trop court;Too short
TooLong;Trop long;Too long
Update;Actualiser;Update
AnyParty;Aucune partie;Any party
Password;Mot de passe;Password
Password;Mot de passe;Password
ClientSide;Cote client;Client side
CantFind:Introuvable;Can't find
Connected:Connecte;Connected
AllreadyTaken;Deja pris;Allready taken
AnyCommand;Aucune commande;Any command
IncorrectArgs;Arguements incorrects;Incorrect Arguements
ExecuteException;Exception d'execution;Execute exception
Access;Acces refuse;Access denied
Allready;Deja fait;Allready do
Format;Format incorrect;Incorrect format
Full;Plein;Full
Close;Fermee;Close
Owner;Proprietaire;Owner
AnyMessage;Aucun message;Any message
MustBeConnected;Doit etre connecte;Must be connected
Can't render this file because it has a wrong number of fields in line 39.

View File

@ -59,11 +59,13 @@ namespace Galactic_Colors_Control_Console
if (host[0] == '*')
{
host = host.Substring(1);
logger.Write("Validate error " + host, Logger.logType.error);
Common.ConsoleWrite(host, ConsoleColor.Red);
client.ResetHost();
}
else
{
logger.Write("Validate " + host, Logger.logType.info);
Common.ConsoleWrite(multilang.Get("Use", config.lang) + " " + host + "? y/n");
ConsoleKeyInfo c = new ConsoleKeyInfo();
while (c.Key != ConsoleKey.Y && c.Key != ConsoleKey.N)
@ -82,7 +84,8 @@ namespace Galactic_Colors_Control_Console
}
Common.ConsoleWrite(multilang.Get("Loading", config.lang));
if (client.ConnectHost()) //Try connection
{//TODO Cleaner
{
logger.Write("Connected", Logger.logType.warm);
run = true;
bool connected = false;
//Identifaction
@ -93,9 +96,10 @@ namespace Galactic_Colors_Control_Console
if (username.Length > 3)
{
ResultData res = client.Request(new string[2] { "connect", username });
if(res.type == ResultTypes.OK) { connected = true; }
if(res.type == ResultTypes.OK) { connected = true; logger.Write("Identification", Logger.logType.info); }
else
{
logger.Write("Identification error " + res.result, Logger.logType.info);
Common.ConsoleWrite(multilang.GetResultText(res, config.lang));
}
}
@ -152,6 +156,7 @@ namespace Galactic_Colors_Control_Console
}
}
}
logger.Write("Play", Logger.logType.info, Logger.logConsole.hide);
Common.ConsoleWrite(multilang.Get("Play", config.lang));
while (run)
{
@ -162,6 +167,7 @@ namespace Galactic_Colors_Control_Console
}
else
{
logger.Write("Connection error", Logger.logType.error);
Common.ConsoleWrite(multilang.Get("CantConnect", config.lang), ConsoleColor.Red);
}
run = false;

View File

@ -8,6 +8,7 @@ using Microsoft.Xna.Framework.Input;
using MyMonoGame.GUI;
using System;
using System.IO;
using System.Reflection;
namespace Galactic_Colors_Control_GUI
{
@ -74,6 +75,7 @@ namespace Galactic_Colors_Control_GUI
protected override void Initialize()
{
config = config.Load();
logger.Write("Galactic Colors Control GUI " + Assembly.GetEntryAssembly().GetName().Version.ToString(), Logger.logType.fatal);
logger.Initialise(config.logPath, config.logBackColor, config.logForeColor, config.logLevel, Program._debug, Program._dev);
multilang.Load();
if (Program._debug) { logger.Write("CLIENT IS IN DEBUG MODE !", Logger.logType.error, Logger.logConsole.show); }

View File

@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics;
using MyMonoGame.GUI;
using System.Threading;
using System;
using Galactic_Colors_Control_Common;
namespace Galactic_Colors_Control_GUI.States
{
@ -119,7 +120,8 @@ namespace Galactic_Colors_Control_GUI.States
message.title = Game.singleton.multilang.Get("Error", Game.singleton.config.lang);
message.text = Host;
showOKMessage = true;
Game.singleton.client.ResetHost(); ;
Game.singleton.client.ResetHost();
Game.singleton.logger.Write("Validate : " + Host, Logger.logType.info);
}
else
{
@ -135,10 +137,12 @@ namespace Galactic_Colors_Control_GUI.States
showLoading = true;
if (Game.singleton.client.ConnectHost())
{
Game.singleton.logger.Write("Connected", Logger.logType.info);
Game.singleton.gameState = new IndentificationState();
}
else
{
Game.singleton.logger.Write("Connect error", Logger.logType.error);
message.title = Game.singleton.multilang.Get("Error", Game.singleton.config.lang);
message.text = string.Empty;
showOKMessage = true;

View File

@ -1,5 +1,4 @@
//TODO add party support
using Galactic_Colors_Control_Common;
using Galactic_Colors_Control_Common;
using Galactic_Colors_Control_Common.Protocol;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@ -97,6 +96,7 @@ namespace Galactic_Colors_Control_GUI.States
EventData eve = ((EventDataArgs)e).Data;
if (eve.type == EventTypes.ServerKick)
{
Game.singleton.logger.Write("Server kick" + eve.data, Logger.logType.warm);
message.title = Game.singleton.multilang.Get("ServerKick", Game.singleton.config.lang);
message.text = Common.ArrayToString(eve.data);
showOKMessage = true;

View File

@ -5,6 +5,7 @@ using MyMonoGame.GUI;
using System.Reflection;
using Galactic_Colors_Control;
using System.Threading;
using Galactic_Colors_Control_Common;
namespace Galactic_Colors_Control_GUI.States
{
@ -43,6 +44,7 @@ namespace Galactic_Colors_Control_GUI.States
{
locked = true;
Game.singleton.GUI.ResetFocus();
Game.singleton.logger.Write("Game exit", Logger.logType.warm);
Game.singleton.gameState = new TitleState();
new Thread(() =>
{

View File

@ -131,7 +131,6 @@ namespace Galactic_Colors_Control_GUI.States
private void PartyJoin()
{
//TODO
showLoading = true;
if (id != -1)
{
@ -139,10 +138,12 @@ namespace Galactic_Colors_Control_GUI.States
ResultData res = Game.singleton.client.Request(request);
if (res.type == ResultTypes.OK)
{
Game.singleton.logger.Write("Join party " + id.ToString(), Logger.logType.info);
Game.singleton.gameState = new GameState();
}
else
{
Game.singleton.logger.Write("Join error " + res.result, Logger.logType.error);
message.title = Game.singleton.multilang.Get("Error", Game.singleton.config.lang);
message.text = Common.ArrayToString(res.result);
showOKMessage = true;

View File

@ -28,7 +28,7 @@ namespace Galactic_Colors_Control_Server.Commands
}
else
{
return new RequestResult(ResultTypes.Error, Common.Strings("Client Side"));
return new RequestResult(ResultTypes.Error, Common.Strings("ClientSide"));
}
}
}

View File

@ -25,7 +25,7 @@ namespace Galactic_Colors_Control_Server.Commands
if (Utilities.GetName(client) == args[2]) { target = client; }
}
if (target == null)
return new RequestResult(ResultTypes.Error, Common.Strings("Can't find"));
return new RequestResult(ResultTypes.Error, Common.Strings("CantFind"));
Program.logger.Write(args[2] + " was kick by server.", Logger.logType.info, Logger.logConsole.show);
if (args.Length > 2)

View File

@ -27,7 +27,7 @@ namespace Galactic_Colors_Control_Server.Commands
if (Utilities.GetName(client) == args[2]) { target = client; }
}
if (target == null)
return new RequestResult(ResultTypes.Error, Common.Strings("Can't find"));
return new RequestResult(ResultTypes.Error, Common.Strings("CantFind"));
string text = "";
text += ("Name : " + Utilities.GetName(target) + Environment.NewLine);

View File

@ -24,7 +24,7 @@ namespace Galactic_Colors_Control_Server.Commands
return new RequestResult(ResultTypes.Error, Common.Strings("Connected"));
if (args[1].Length < 3)
return new RequestResult(ResultTypes.Error, Common.Strings("Too Short"));
return new RequestResult(ResultTypes.Error, Common.Strings("TooShort"));
Program.logger.Write("Identifiaction request from " + Utilities.GetName(soc), Logger.logType.debug);
bool allreadyconnected = false;
@ -34,7 +34,7 @@ namespace Galactic_Colors_Control_Server.Commands
if (client.pseudo == args[1]) { allreadyconnected = true; break; }
}
if (allreadyconnected)
return new RequestResult(ResultTypes.Error, Common.Strings("Taken"));
return new RequestResult(ResultTypes.Error, Common.Strings("AllreadyTaken"));
Program.clients[soc].status = 0;
Program.clients[soc].pseudo = args[1];

View File

@ -66,10 +66,10 @@ namespace Galactic_Colors_Control_Server.Commands
ICommand command = null;
args = args.Skip(1).ToArray();
if (!Manager.TryGetCommand(args, ref command))
return new RequestResult(ResultTypes.Error, Common.Strings("Any Command"));
return new RequestResult(ResultTypes.Error, Common.Strings("AnyCommand"));
if (!Manager.CanAccess(command, soc, server))
return new RequestResult(ResultTypes.Error, Common.Strings("Any Command"));
return new RequestResult(ResultTypes.Error, Common.Strings("AnyCommand"));
return new RequestResult(ResultTypes.OK, Common.Strings(command.HelpText));
}

View File

@ -27,7 +27,7 @@ namespace Galactic_Colors_Control_Server.Commands
}
else
{
return new RequestResult(ResultTypes.Error, Common.Strings("Incorrect argument"));
return new RequestResult(ResultTypes.Error, Common.Strings("IncorrectArgs"));
}
}
}

View File

@ -14,7 +14,7 @@ namespace Galactic_Colors_Control_Server.Commands
public enum CommandGroup { root, server, party, client }
private static RequestResult AnyCommand = new RequestResult(ResultTypes.Error, Common.Strings("Any Command"));
private static RequestResult AnyCommand = new RequestResult(ResultTypes.Error, Common.Strings("AnyCommand"));
/// <summary>
/// Find all ICommand and add them to commands
@ -46,13 +46,13 @@ namespace Galactic_Colors_Control_Server.Commands
return AnyCommand;
if (!server && command.IsClientSide)
return new RequestResult(ResultTypes.Error, Common.Strings("Client Side"));
return new RequestResult(ResultTypes.Error, Common.Strings("ClientSide"));
if (args.Length - (command.Group == 0 ? 0 : 1) <= command.minArgs)
return new RequestResult(ResultTypes.Error, new string[2] { "Too Short", command.minArgs.ToString() });
return new RequestResult(ResultTypes.Error, new string[2] { "TooShort", command.minArgs.ToString() });
if (args.Length - (command.Group == 0 ? 1 : 2) > command.maxArgs)
return new RequestResult(ResultTypes.Error, new string[2] { "Too Long", command.maxArgs.ToString() });
return new RequestResult(ResultTypes.Error, new string[2] { "TooLong", command.maxArgs.ToString() });
try
{
@ -61,7 +61,7 @@ namespace Galactic_Colors_Control_Server.Commands
catch (Exception e)
{
Program.logger.Write("Command " + args[0] + " Exception : " + e.Message, Logger.logType.error);
return new RequestResult(ResultTypes.Error, Common.Strings("Execute Exception"));
return new RequestResult(ResultTypes.Error, Common.Strings("ExecuteException"));
}
}

View File

@ -27,10 +27,10 @@ namespace Galactic_Colors_Control_Server.Commands
return new RequestResult(ResultTypes.Error, Common.Strings("Format"));
if (size < 1)
return new RequestResult(ResultTypes.Error, Common.Strings("Too Small"));
return new RequestResult(ResultTypes.Error, Common.Strings("TooSmall"));
if (size > Program.config.size)
return new RequestResult(ResultTypes.Error, Common.Strings("Too Big"));
return new RequestResult(ResultTypes.Error, Common.Strings("TooBig"));
if (Program.parties.Count >= Program.config.partysize)
return new RequestResult(ResultTypes.Error, Common.Strings("Full"));

View File

@ -25,10 +25,10 @@ namespace Galactic_Colors_Control_Server.Commands
int id;
if (!int.TryParse(args[2], out id))
return new RequestResult(ResultTypes.Error, Common.Strings("Any Party"));
return new RequestResult(ResultTypes.Error, Common.Strings("Format"));
if (!Program.parties.ContainsKey(id))
return new RequestResult(ResultTypes.Error, Common.Strings("Can't Find"));
return new RequestResult(ResultTypes.Error, Common.Strings("CantFind"));
Party party = Program.parties[id];
if (args.Length == 3)

View File

@ -29,7 +29,7 @@ namespace Galactic_Colors_Control_Server.Commands
if (Utilities.GetName(client) == args[2]) { target = client; }
}
if (target == null)
return new RequestResult(ResultTypes.Error, Common.Strings("Can't find"));
return new RequestResult(ResultTypes.Error, Common.Strings("CantFind"));
Utilities.Send(target, new EventData(EventTypes.PartyKick, args.Length > 3 ? Common.Strings(args[2]) : null));
return Manager.Execute(new string[2] { "party", "leave" }, target, false);

View File

@ -31,7 +31,7 @@ namespace Galactic_Colors_Control_Server.Commands
}
if (!Program.parties[partyId].SetPassword(args[2], args[3]))
return new RequestResult(ResultTypes.Error, Common.Strings("Can't Change"));
return new RequestResult(ResultTypes.Error, Common.Strings("Password"));
return new RequestResult(ResultTypes.OK);
}

View File

@ -19,7 +19,7 @@ namespace Galactic_Colors_Control_Server.Commands
public RequestResult Execute(string[] args, Socket soc, bool server = false)
{
return new RequestResult(ResultTypes.Error, Common.Strings("Client Side"));
return new RequestResult(ResultTypes.Error, Common.Strings("ClientSide"));
}
}
}

View File

@ -20,10 +20,10 @@ namespace Galactic_Colors_Control_Server.Commands
public RequestResult Execute(string[] args, Socket soc, bool server = false)
{
if (args[1].Length == 0)
return new RequestResult(ResultTypes.Error, Common.Strings("Any Message"));
return new RequestResult(ResultTypes.Error, Common.Strings("AnyMessage"));
if (!Utilities.IsConnect(soc))
return new RequestResult(ResultTypes.Error, Common.Strings("Must Be Connected"));
return new RequestResult(ResultTypes.Error, Common.Strings("MustBeConnected"));
int party = -1;
party = Utilities.GetParty(soc);