Log channels, PHP script diffs when told.
This commit is contained in:
@@ -201,7 +201,7 @@ namespace OpenRA
|
||||
|
||||
if (Health > maxHP) Health = maxHP;
|
||||
|
||||
// Log.Write("InflictDamage: {0} #{1} -> {2} #{3} raw={4} adj={5} hp={6} mod={7}",
|
||||
// Log.Write("debug", "InflictDamage: {0} #{1} -> {2} #{3} raw={4} adj={5} hp={6} mod={7}",
|
||||
// attacker.Info.Name, attacker.ActorID, Info.Name, ActorID, rawDamage, damage, Health, modifier);
|
||||
|
||||
var newState = GetDamageState();
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace OpenRA
|
||||
a( x );
|
||||
var dt = sw.ElapsedTime() - t;
|
||||
if( dt > time )
|
||||
Log.Write( text, x, dt*1000 );
|
||||
Log.Write("debug", text, x, dt * 1000);
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace OpenRA
|
||||
static internal bool scrollDown = false;
|
||||
static internal bool scrollLeft = false;
|
||||
static internal bool scrollRight = false;
|
||||
|
||||
|
||||
static void LoadModPackages(Manifest manifest)
|
||||
{
|
||||
FileSystem.UnmountAll();
|
||||
@@ -175,13 +175,12 @@ namespace OpenRA
|
||||
internal static string CurrentHost = "";
|
||||
internal static int CurrentPort = 0;
|
||||
|
||||
internal static void JoinServer(int id, string host, int port)
|
||||
internal static void JoinServer(string host, int port)
|
||||
{
|
||||
if (orderManager != null) orderManager.Dispose();
|
||||
|
||||
CurrentHost = host;
|
||||
CurrentPort = port;
|
||||
MasterGameID = id;
|
||||
|
||||
orderManager = new OrderManager(new NetworkConnection(host, port), ChooseReplayFilename());
|
||||
}
|
||||
@@ -255,12 +254,12 @@ namespace OpenRA
|
||||
var f = syncReports.FirstOrDefault(a => a.First == frame);
|
||||
if (f == null)
|
||||
{
|
||||
Log.Write("No sync report available!");
|
||||
Log.Write("sync", "No sync report available!");
|
||||
return;
|
||||
}
|
||||
|
||||
Log.Write("Sync for net frame {0} -------------", f.First);
|
||||
Log.Write("{0}", f.Second);
|
||||
Log.Write("sync", "Sync for net frame {0} -------------", f.First);
|
||||
Log.Write("sync", "{0}", f.Second);
|
||||
}
|
||||
|
||||
static void Tick()
|
||||
@@ -601,6 +600,8 @@ namespace OpenRA
|
||||
LoadShellMap(new Manifest(LobbyInfo.GlobalSettings.Mods).ShellmapUid);
|
||||
|
||||
ResetTimer();
|
||||
|
||||
Log.AddChannel("sync", "openra.syncreport.txt", true, true);
|
||||
}
|
||||
|
||||
static void LoadUserSettings(Settings settings)
|
||||
@@ -638,5 +639,26 @@ namespace OpenRA
|
||||
Chrome.rootWidget.CloseWindow();
|
||||
Chrome.rootWidget.OpenWindow("MAINMENU_BG");
|
||||
}
|
||||
|
||||
internal static int GetGameId()
|
||||
{
|
||||
try
|
||||
{
|
||||
string s = File.ReadAllText(Log.LogPathPrefix + "openra.gameid");
|
||||
return int.Parse(s);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void SetGameId(int id)
|
||||
{
|
||||
var file = File.CreateText(Log.LogPathPrefix + "openra.gameid");
|
||||
file.Write(id);
|
||||
file.Flush();
|
||||
file.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,11 +38,11 @@ namespace OpenRA
|
||||
|
||||
public static void LoadRules(Manifest m, Map map)
|
||||
{
|
||||
Log.Write("Using rules files: ");
|
||||
Log.Write("debug", "Using rules files: ");
|
||||
foreach (var y in m.Rules)
|
||||
Log.Write(" -- {0}", y);
|
||||
Log.Write("debug", " -- {0}", y);
|
||||
|
||||
Log.Write("Using Map: {0}",map.Uid);
|
||||
Log.Write("debug", "Using Map: {0}",map.Uid);
|
||||
|
||||
Info = LoadYamlRules(m.Rules, map.Rules, (k, y) => new ActorInfo(k.Key.ToLowerInvariant(), k.Value, y));
|
||||
Weapons = LoadYamlRules(m.Weapons, map.Weapons, (k, _) => new WeaponInfo(k.Key.ToLowerInvariant(), k.Value));
|
||||
|
||||
@@ -564,7 +564,10 @@ namespace OpenRA.Server
|
||||
static void PingMasterServerResponse(object sender, DownloadDataCompletedEventArgs e)
|
||||
{
|
||||
string s = Encoding.UTF8.GetString(e.Result);
|
||||
int.TryParse(s.Trim(), out Game.MasterGameID);
|
||||
int gameId;
|
||||
if (int.TryParse(s.Trim(), out gameId))
|
||||
Game.SetGameId(gameId);
|
||||
Log.Write("debug", "Game ID: {0}", gameId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ namespace OpenRA
|
||||
Al.alGenSources(1, out source);
|
||||
if (0 != Al.alGetError())
|
||||
{
|
||||
Log.Write("Failed generating OpenAL source {0}", i);
|
||||
Log.Write("debug", "Failed generating OpenAL source {0}", i);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ namespace OpenRA
|
||||
// brutal hack
|
||||
Application.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
|
||||
if( Debugger.IsAttached )
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
Run( args );
|
||||
Run(args);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -48,38 +48,13 @@ namespace OpenRA
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
Log.Write( "{0}", e.ToString() );
|
||||
UploadLog();
|
||||
Log.AddChannel("exception", "openra.exception.txt", true, false);
|
||||
Log.Write("exception", "{0}", e.ToString());
|
||||
Log.Upload(Game.GetGameId());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
static void UploadLog()
|
||||
{
|
||||
Log.Close();
|
||||
var logfile = File.OpenRead(Log.Filename);
|
||||
byte[] fileContents = logfile.ReadAllBytes();
|
||||
var ms = new MemoryStream();
|
||||
|
||||
using (var gzip = new GZipStream(ms, CompressionMode.Compress, true))
|
||||
gzip.Write(fileContents, 0, fileContents.Length);
|
||||
|
||||
ms.Position = 0;
|
||||
byte[] buffer = ms.ReadAllBytes();
|
||||
|
||||
WebRequest request = WebRequest.Create("http://open-ra.org/logs/upload.php");
|
||||
request.ContentType = "application/x-gzip";
|
||||
request.ContentLength = buffer.Length;
|
||||
request.Method = "POST";
|
||||
request.Headers.Add("Game-ID", Game.MasterGameID.ToString());
|
||||
|
||||
using (var requestStream = request.GetRequestStream())
|
||||
requestStream.Write(buffer, 0, buffer.Length);
|
||||
|
||||
var response = (HttpWebResponse)request.GetResponse();
|
||||
MessageBox.Show("{0} {1}:{2}".F(Game.MasterGameID, Game.CurrentHost, Game.CurrentPort));
|
||||
}
|
||||
|
||||
static void Run( string[] args )
|
||||
{
|
||||
Game.Initialize( new Settings( args ) );
|
||||
|
||||
@@ -68,8 +68,8 @@ namespace OpenRA.Traits
|
||||
|
||||
int bib = Array.IndexOf(info.BibWidths,size);
|
||||
if (bib < 0)
|
||||
{
|
||||
Log.Write("Cannot bib {0}-wide building {1}",size,b.Info.Name);
|
||||
{
|
||||
Log.Write("debug", "Cannot bib {0}-wide building {1}", size, b.Info.Name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
return true;
|
||||
};
|
||||
r.GetWidget("CONNECTION_BUTTON_RETRY").OnMouseUp = mi => {
|
||||
Game.JoinServer(Game.MasterGameID, Game.CurrentHost, Game.CurrentPort);
|
||||
Game.JoinServer(Game.CurrentHost, Game.CurrentPort);
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
|
||||
r.GetWidget("CREATESERVER_BUTTON_START").OnMouseUp = mi => {
|
||||
r.OpenWindow("SERVER_LOBBY");
|
||||
Log.Write("Creating server");
|
||||
Log.Write("debug", "Creating server");
|
||||
|
||||
// TODO: Get this from a map chooser
|
||||
string map = Game.AvailableMaps.Keys.FirstOrDefault();
|
||||
@@ -57,8 +57,8 @@ namespace OpenRA.Widgets.Delegates
|
||||
gameName, Game.Settings.ListenPort,
|
||||
Game.Settings.ExternalPort, mods, map);
|
||||
|
||||
Log.Write("Joining server");
|
||||
Game.JoinServer(0, IPAddress.Loopback.ToString(), Game.Settings.ListenPort);
|
||||
Log.Write("debug", "Joining server");
|
||||
Game.JoinServer(IPAddress.Loopback.ToString(), Game.Settings.ListenPort);
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
@@ -76,7 +76,8 @@ namespace OpenRA.Widgets.Delegates
|
||||
OnMouseUp = nmi =>
|
||||
{
|
||||
r.GetWidget("JOINSERVER_BG").Visible = false;
|
||||
Game.JoinServer(g.Id, g.Address.Split(':')[0], int.Parse(g.Address.Split(':')[1]));
|
||||
Game.JoinServer(g.Address.Split(':')[0], int.Parse(g.Address.Split(':')[1]));
|
||||
Game.SetGameId(g.Id);
|
||||
return true;
|
||||
},
|
||||
};
|
||||
@@ -128,7 +129,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
r.GetWidget("JOINSERVER_BUTTON_DIRECTCONNECT").OnMouseUp = mi =>
|
||||
{ /* rude hack. kill this as soon as we can do a direct connect via the commandline */
|
||||
r.CloseWindow();
|
||||
Game.JoinServer(0, Game.Settings.NetworkHost, Game.Settings.NetworkPort);
|
||||
Game.JoinServer(Game.Settings.NetworkHost, Game.Settings.NetworkPort);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user