1,326 changes: 650 additions & 676 deletions client/submodules/live/GlassLiveConnection.cs

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions client/submodules/live/GlassLiveUser.cs
Expand Up @@ -7,9 +7,6 @@
return GlassLiveUsers.user[%blid];
}

//echo("[" @ GlassLiveUsers.user[%blid] @ "] exists: " @ isObject(GlassLiveUsers.user[%blid]));
//echo("creating glu: [" @ %username @ "] [" @ %blid @ "]");

%user = new ScriptObject() {
class = "GlassLiveUser";
username = getASCIIString(%username);
Expand Down
2 changes: 1 addition & 1 deletion client/submodules/modmanager/colorsetsPage.cs
Expand Up @@ -390,7 +390,7 @@ class = "GlassModManager_Colorset";
%so.aid = ($JSON::Value).id;
$JSON::Value.delete();
} else {
echo("error reading glass.json: " @ $JSON::Error);
GlassLog::error("Error reading glass.json for " @ %name @ ": " @ $JSON::Error);
}
}

Expand Down
2 changes: 1 addition & 1 deletion client/submodules/modmanager/myAddonsPage.cs
Expand Up @@ -372,7 +372,7 @@
}

function GMM_MyAddonsPage::defaults() {
// echo("Loading defaults");
GlassLog::debug("Setting add-ons to default");
for(%i = 0; %i < GMM_MyAddonsPage_List.getCount(); %i++) {
%guiObj = GMM_MyAddonsPage_List.getObject(%i);

Expand Down
10 changes: 5 additions & 5 deletions client/submodules/modmanager/rtbImport.cs
Expand Up @@ -74,7 +74,7 @@
%fo.close();

if(!%id) {
echo("\c3Found rtbInfo.txt but no id for " @ %name);
GlassLog::error("\c3Found rtbInfo.txt but no id for " @ %name);
continue;
}

Expand Down Expand Up @@ -280,9 +280,9 @@
%originalPath = "Add-Ons/" @ %this.importName[%this.downloadIndex] @ ".zip";
if(%tcp.savePath !$= %originalPath) {
fileDelete(%originalPath);
echo("\c1Deleting original file \c0" @ %originalPath);
GlassLog::log("\c1Deleting original file \c0" @ %originalPath);
} else {
echo("\c1Replaced \c0" @ %originalPath);
GlassLog::log("\c1Replaced \c0" @ %originalPath);
}

discoverFile(%tcp.savePath);
Expand All @@ -300,7 +300,7 @@
}

function GMM_ImportPage_downloadFailed(%dl, %error) {
echo("ERROR");
GlassLog::error("Import download failed for " @ %this.importName[%this.downloadIndex]);
%this = GMM_ImportPage;
%swatch = %this.importSwatch[%this.downloadIndex];
%swatch.progresstext.setValue("<shadow:1:1><just:center><font:verdana:12><color:ed7669>FAILED");
Expand All @@ -309,7 +309,7 @@
}

function GMM_ImportPage_downloadUnwritable(%dl) {
echo("UNWRITABLE");
GlassLog::error("Path unwritable for " @ %this.importName[%this.downloadIndex]);
%this = GMM_ImportPage;
%swatch = %this.importSwatch[%this.downloadIndex];
%swatch.progresstext.setValue("<shadow:1:1><just:center><font:verdana:12><ed7669:54d98c>PATH UNWRITABLE");
Expand Down
6 changes: 3 additions & 3 deletions common/GlassApi.cs
Expand Up @@ -134,7 +134,7 @@
// the call is authorized, so we need to make sure there was no
// unauthorization issues
if(%obj._authorized && %object.status $= "unauthorized") {
echo("Glass API: Unauthorized!");
GlassLog::error("Glass API: Unauthorized!");

GlassApi.unauthorizedCt++; // keep track of how many times we have retried this

Expand All @@ -156,10 +156,10 @@

} else {
if(%this._isJSON) {
echo("Glass API: Invalid response for \c1" @ %obj._api @ "\c0!");
GlassLog::error("Glass API: Invalid response for \c1" @ %obj._api @ "\c0!");

for(%i = 0; %i < getLineCount(%this.buffer); %i++) {
echo(getLine(%this.buffer, %i));
GlassLog::debug(getLine(%this.buffer, %i));
}
// TODO log?
}
Expand Down
1 change: 0 additions & 1 deletion common/GlassDownloadManager.cs
Expand Up @@ -61,7 +61,6 @@ class = "GlassDownload";
}

function GlassDownloadTCP::onLine(%this, %line) {
//echo(%line);
%head = getWord(%line, 0);
if(%head $= "Content-Disposition:") {
%filename = getSubStr(%line, strPos(%line, "filename="), strlen(%line));
Expand Down
49 changes: 32 additions & 17 deletions common/GlassLog.cs
@@ -1,7 +1,10 @@
function GlassLog::init() {
if(!isObject(GlassLog))
new ScriptObject(GlassLog) {
folder = "config/log/";
folder = "config/log/";

echoLevel = 1;
echoFormatting = true;
};

%time = strreplace(getDateTime(), ":", "_");
Expand Down Expand Up @@ -52,23 +55,16 @@
if(%baseLevel $= "")
%baseLevel = %level;

switch(%level+0) {
case 0:
//extremely verbose output containing everything
%levelText = "debug";

case 1:
//standard output with errors
%levelText = "log";

case 2:
//errors only
%levelText = "error";
%levelText[0] = "debug";
%levelText[1] = "log";
%levelText[2] = "error";

default:
error("[Glass Log] Invalid logging level!");
return;
%levelText = %levelText[%level+0];
%baseLevelText = %levelText[%baseLevel+0];

if(%levelText $= "" || %baseLevelText $= "") {
echo("[Glass Log] Invalid logging level \"" @ %level @ "\"");
return; //??
}

%path = GlassLog.folder @ "glass/";
Expand All @@ -82,10 +78,29 @@
GlassLogFO.openForAppend(%path);
for(%i = 0; %i < getLineCount(%str); %i++) {
%line = getLine(%str, %i);
GlassLogFO.writeLine("[" @ %time @ "]\t[" @ %levelText @ "]\t" @ expandEscape(%line));
GlassLogFO.writeLine("[" @ %time @ "]\t[" @ %baseLevelText @ "]\t" @ expandEscape(%line));
}
GlassLogFO.close();

if(%level > 0)
GlassLog::log(%str, %level-1, %baseLevel);

if(%level == %baseLevel) {
if(GlassLog.echoLevel <= %level) {
if(GlassLog.echoFormatting) {
echo("\c4[Glass " @ strCap(%levelText) @ "] \c0" @ %str);
} else {
echo(%str);
}
}
}
}

function GlassLog::error(%str) {
GlassLog::log(%str, 2);
}


function GlassLog::debug(%str) {
GlassLog::log(%str, 0);
}
15 changes: 5 additions & 10 deletions common/GlassResourceManager.cs
Expand Up @@ -8,16 +8,13 @@
//if there's a zip, check for a version.json
//if it's just a folder, we're going to assume they know what they're doing
if(getFileLength("Add-Ons/" @ %resource @ ".zip") > 0 && isFile("Add-Ons/" @ %resource @ ".zip") && (isFile("Add-Ons/" @ %resource @ "/version.json") || isFile("Add-Ons/" @ %resource @ "/version.txt"))) {
echo("Local version of " @ %resource @ " found, proceeding as normal");
GlassLog::log("Local version of " @ %resource @ " found, proceeding as normal");
} else if(getFileCount("Add-Ons/" @ %resource @ "/*.cs") > 0) {
echo("Local zip of " @ %resource @ " is missing, but a folder is present");
GlassLog::log("Local zip of " @ %resource @ " is missing, but a folder is present");
} else {
echo("\n\c4Loading local resource " @ %resource @ "...");
GlassLog::log("\n\c4Loading local resource " @ %resource @ "...");
if(isFile("Add-Ons/System_BlocklandGlass/resources/" @ %resource @ "/" @ %context @ ".cs"))
exec("Add-Ons/System_BlocklandGlass/resources/" @ %resource @ "/" @ %context @ ".cs");
else
echo("Missing context");
echo("\n");

GlassResourceManager::createFakeFile(%resource);

Expand Down Expand Up @@ -45,11 +42,9 @@
folderDeleteAll("Add-Ons/Support_Preferences/");

%resource = "Support_Preferences";
echo("\n\c4Loading local resource " @ %resource @ "...");
GlassLog::log("\n\c4Loading local resource " @ %resource @ "...");
if(isFile("Add-Ons/System_BlocklandGlass/resources/" @ %resource @ "/" @ %context @ ".cs"))
exec("Add-Ons/System_BlocklandGlass/resources/" @ %resource @ "/" @ %context @ ".cs");

echo("\n");
}

function folderDeleteAll(%folder) {
Expand Down Expand Up @@ -79,7 +74,7 @@

for(%i = 0; %i < GlassResourceManager.fakes; %i++) {
%resource = GlassResourceManager.fake[%i];
echo("\c5> GLASS FAKE: " @ %resource);
GlassLog::debug("\c5> GLASS FAKE: " @ %resource);

//for debug purposes
Glass.fakedResource[%resource] = true;
Expand Down
4 changes: 1 addition & 3 deletions common/GlassStatistics.cs
Expand Up @@ -21,7 +21,6 @@
}
new ScriptGroup(GlassAddons);
%pattern = "Add-ons/*/glass.json";
//echo("\c1Looking for Glass Add-Ons");
while((%file $= "" ? (%file = findFirstFile(%pattern)) : (%file = findNextFile(%pattern))) !$= "") {
%name = getsubstr(%file, 8, strlen(%file)-19);
if(strPos(%name, "/") > -1) continue;
Expand Down Expand Up @@ -74,8 +73,7 @@
}

GlassAddons.add(%go);

//echo(" \c1+ Found \c4\"" @ %name @ "\" \c1(" @ %go.id @ ")");

}
}

Expand Down
4 changes: 1 addition & 3 deletions core.cs
Expand Up @@ -41,9 +41,7 @@
}

function Glass::debug(%text) {
if(Glass.dev) {
echo(%text);
}
GlassLog::debug(%text);
}

function JettisonObject::get(%this, %key) {
Expand Down
6 changes: 3 additions & 3 deletions runonce/settingConversion.cs
@@ -1,5 +1,5 @@
if(isFile("config/BLG/client/mm.cs")) {
echo("Pre-1.1 settings found. Converting.");
GlassLog::log("Pre-1.1 settings found. Converting.");

exec("config/BLG/client/mm.cs");
GlassSettings.update("Live::Keybind", $BLG::Live::Keybind);
Expand All @@ -15,13 +15,13 @@
%reset = GlassSettings.cacheFetch("SettingsReset");

if(semanticVersionCompare(%reset, "3.2.0") == 2) {
warn("Resetting settings!");
GlassLog::log("Resetting settings!");
GlassSettings.resetToDefaults("client");
GlassSettings.cachePut("SettingsReset", "3.2.0");
}

if(semanticVersionCompare(%reset, "4.0.1") == 2) {
warn("Setting Live::ViewLocation to Anyone");
GlassLog::log("Setting Live::ViewLocation to Anyone");
GlassSettings.cachePut("SettingsReset", "4.0.1");
GlassSettings.update("Live::ViewLocation", "Anyone");
}
Expand Down
2 changes: 0 additions & 2 deletions server/GlassServerGraphs.cs
Expand Up @@ -170,8 +170,6 @@ class = "GlassCollection";

commandToClient(%client, 'GlassGraphClearData');

echo("Sending data from " @ %col.name);

for(%i = %col.dataCt-%ct; %i < %col.dataCt; %i++) {
if(%i < 0) {
%i = 0;
Expand Down