From 05665d9f7ce80942a19be2c418593d483e153529 Mon Sep 17 00:00:00 2001 From: Kevin Gadd Date: Tue, 10 Jul 2012 23:24:28 -0700 Subject: [PATCH] Throw FileNotFoundException instead of Exception when an asset is missing from the manifest so apps can respond to it. --- .gitignore | 4 +- Libraries/JSIL.Bootstrap.js | 20 +++++ Libraries/JSIL.Browser.js | 7 +- build_demos.bat | 3 +- jsil.org/demos/Soulcaster/Soulcaster.css | 24 +---- jsil.org/demos/Soulcaster/Soulcaster.html | 20 ++--- .../demos/Soulcaster/Soulcaster.jsilconfig | 2 +- jsil.org/demos/Soulcaster2/Soulcaster2.css | 72 +++++++++++++++ jsil.org/demos/Soulcaster2/Soulcaster2.html | 88 +++++++++++++++++++ .../demos/Soulcaster2/Soulcaster2.jsilconfig | 21 +++++ 10 files changed, 225 insertions(+), 36 deletions(-) create mode 100644 jsil.org/demos/Soulcaster2/Soulcaster2.css create mode 100644 jsil.org/demos/Soulcaster2/Soulcaster2.html create mode 100644 jsil.org/demos/Soulcaster2/Soulcaster2.jsilconfig diff --git a/.gitignore b/.gitignore index adcb93ec6..3346381d4 100644 --- a/.gitignore +++ b/.gitignore @@ -36,7 +36,9 @@ Tests/*Cases/*.js /jsil.org/demos/Sully/*.js /jsil.org/demos/Sully/Content /jsil.org/demos/Soulcaster/*.js -/jsil.org/demos/Soulcaster/Soulcaster2Content +/jsil.org/demos/Soulcaster/Soulcaster1Content +/jsil.org/demos/Soulcaster2/*.js +/jsil.org/demos/Soulcaster2/Soulcaster2Content /jsil.org/demos/RPG/Content /jsil.org/demos/GameType/*.js /jsil.org/demos/GameType/Content diff --git a/Libraries/JSIL.Bootstrap.js b/Libraries/JSIL.Bootstrap.js index 1e8224b05..ce24eb1aa 100644 --- a/Libraries/JSIL.Bootstrap.js +++ b/Libraries/JSIL.Bootstrap.js @@ -1073,6 +1073,25 @@ JSIL.ImplementExternals( } ); +JSIL.ImplementExternals( + "System.IO.FileNotFoundException", function ($) { + $.Method({Static:false, Public:true }, ".ctor", + new JSIL.MethodSignature(null, [$.String], []), + function (message) { + System.Exception.prototype._ctor.call(this, message); + } + ); + + $.Method({Static:false, Public:true }, ".ctor", + (new JSIL.MethodSignature(null, [$.String, $.String], [])), + function _ctor (message, fileName) { + System.Exception.prototype._ctor.call(this, message); + this._fileName = fileName; + } + ); + } +); + JSIL.MakeClass(Error, "System.Exception", true, [], function ($) { $.Property({Public: true , Static: false, Virtual: true }, "Message"); $.Property({Public: true , Static: false}, "InnerException"); @@ -1080,6 +1099,7 @@ JSIL.MakeClass(Error, "System.Exception", true, [], function ($) { JSIL.MakeClass("System.Exception", "System.InvalidCastException", true); JSIL.MakeClass("System.Exception", "System.InvalidOperationException", true); +JSIL.MakeClass("System.Exception", "System.IO.FileNotFoundException", true); JSIL.ImplementExternals("System.Console", function ($) { $.RawMethod(true, "WriteLine", function () { diff --git a/Libraries/JSIL.Browser.js b/Libraries/JSIL.Browser.js index e22bd85f2..170c55a87 100644 --- a/Libraries/JSIL.Browser.js +++ b/Libraries/JSIL.Browser.js @@ -92,14 +92,15 @@ JSIL.Host.getFile = function (filename) { } if (!JSIL.Host.doesFileExist(filename)) - throw new System.Exception(errorMessage); + throw new System.IO.FileNotFoundException(errorMessage, filename); return allFiles[JSIL.Host.translateFilename(filename)]; }; JSIL.Host.getImage = function (filename) { var key = getAssetName(filename, false); if (!allAssets.hasOwnProperty(key)) - throw new System.Exception("The image '" + key + "' is not in the asset manifest."); + throw new System.IO.FileNotFoundException("The image '" + key + "' is not in the asset manifest.", filename); + return allAssets[key].image; }; JSIL.Host.doesAssetExist = function (filename, stripRoot) { @@ -130,7 +131,7 @@ JSIL.Host.getAsset = function (filename, stripRoot) { var key = getAssetName(filename, false); if (!allAssets.hasOwnProperty(key)) - throw new System.Exception("The asset '" + key + "' is not in the asset manifest."); + throw new System.IO.FileNotFoundException("The asset '" + key + "' is not in the asset manifest.", filename); return allAssets[key]; }; diff --git a/build_demos.bat b/build_demos.bat index 2326f4d9a..205228824 100644 --- a/build_demos.bat +++ b/build_demos.bat @@ -1,8 +1,9 @@ pushd bin del /s/q ..\jsil.org\demos\*.js JSILc "C:\Users\Kevin\Documents\Projects\EscapeGoat\bastille\bastille.sln" "C:\Users\Kevin\Documents\Projects\EscapeGoat\bastille\Bastille\Bastille\bin\x86\DebugPC\EscapeGoat.XmlSerializers.dll" "C:\Users\Kevin\Documents\Projects\JSIL\jsil.org\demos\EscapeGoat\EscapeGoat.jsilconfig" --platform:x86 --configuration:DebugPC +JSILc "C:\Users\Kevin\Documents\Projects\Soulcaster\Soulcaster1HTML5.sln" "C:\Users\Kevin\Documents\Projects\Soulcaster\Soulcaster1\Soulcaster1\bin\x86\DebugPC\TarchonData.XmlSerializers.dll" "C:\Users\Kevin\Documents\Projects\JSIL\jsil.org\demos\Soulcaster\Soulcaster.jsilconfig" --platform:x86 --configuration:DebugPC +JSILc "C:\Users\Kevin\Documents\Projects\Soulcaster\Soulcaster2HTML5.sln" "C:\Users\Kevin\Documents\Projects\Soulcaster\Soulcaster2\Soulcaster2\bin\x86\DebugPC\TarchonData.XmlSerializers.dll" "C:\Users\Kevin\Documents\Projects\JSIL\jsil.org\demos\Soulcaster2\Soulcaster2.jsilconfig" --platform:x86 --configuration:DebugPC JSILc "C:\Game Design\Game Type\CodeNew\GameType\GameType.sln" "C:\Users\Kevin\Documents\Projects\JSIL\jsil.org\demos\GameType\GameType.jsilconfig" --platform:x86 --configuration:Debug -JSILc "C:\Users\Kevin\Documents\Projects\Soulcaster\SoulcasterHTML5.sln" "C:\Users\Kevin\Documents\Projects\Soulcaster\Soulcaster2\Soulcaster2\bin\x86\DebugPC\TarchonData.XmlSerializers.dll" "C:\Users\Kevin\Documents\Projects\JSIL\jsil.org\demos\Soulcaster\Soulcaster.jsilconfig" --platform:x86 --configuration:DebugPC JSILc "C:\Users\Kevin\Documents\Projects\XNAVERGE\Sully.sln" "C:\Users\Kevin\Documents\Projects\JSIL\jsil.org\demos\Sully\Sully.jsilconfig" --platform:x86 --configuration:Debug JSILc "C:\Users\Kevin\Documents\Projects\lumberjack\LumberjackPC.sln" "C:\Users\Kevin\Documents\Projects\lumberjack\Lumberjack\Lumberjack\bin\x86\Debug\Lumberjack.XmlSerializers.dll" "C:\Users\Kevin\Documents\Projects\JSIL\jsil.org\demos\Lumberjack\Lumberjack.jsilconfig" --platform:x86 --configuration:Debug JSILc "C:\Users\Kevin\Documents\Projects\JSIL\Examples\SimpleRaytracer.sln" diff --git a/jsil.org/demos/Soulcaster/Soulcaster.css b/jsil.org/demos/Soulcaster/Soulcaster.css index 368da3aa4..f59f15872 100644 --- a/jsil.org/demos/Soulcaster/Soulcaster.css +++ b/jsil.org/demos/Soulcaster/Soulcaster.css @@ -15,22 +15,6 @@ a, a:visited { left: 0px; top: 0px; cursor: none; - - /* - - -moz-transform: scale(2); - -webkit-transform: scale(2); - -o-transform: scale(2); - -ms-transform: scale(2); - transform: scale(2); - - -moz-transform-origin: top left; - -webkit-transform-origin: top left; - -o-transform-origin: top left; - -ms-transform-origin: top left; - transform-origin: top left; - - */ } #welcomeMessage { width: 620px; @@ -60,20 +44,20 @@ a, a:visited { height: 40px; } #log { - width: 704px; + width: 640px; height: 200px; left: 2px; - top: 544px; + top: 484px; overflow-x: hidden; overflow-y: scroll; } #fullscreenButton { - left: 708px; + left: 644px; top: 2px; height: 45px; } #stats { - left: 708px; + left: 644px; top: 50px; } .boxCaption { diff --git a/jsil.org/demos/Soulcaster/Soulcaster.html b/jsil.org/demos/Soulcaster/Soulcaster.html index 6eda9fcf4..7071b62f1 100644 --- a/jsil.org/demos/Soulcaster/Soulcaster.html +++ b/jsil.org/demos/Soulcaster/Soulcaster.html @@ -1,7 +1,7 @@ - Soulcaster 2 + Soulcaster 1 @@ -18,8 +18,8 @@ localStorage: true, manifests: [ - "Soulcaster2.exe", - "Soulcaster2Content.contentproj" + "Soulcaster.exe", + "Soulcaster1Content.contentproj" ], showProgressBar: true, @@ -29,8 +29,8 @@ - - + +
@@ -44,8 +44,8 @@ diff --git a/jsil.org/demos/Soulcaster/Soulcaster.jsilconfig b/jsil.org/demos/Soulcaster/Soulcaster.jsilconfig index d6da12c1c..bc2439469 100644 --- a/jsil.org/demos/Soulcaster/Soulcaster.jsilconfig +++ b/jsil.org/demos/Soulcaster/Soulcaster.jsilconfig @@ -13,7 +13,7 @@ }, "ProfileSettings": { "OverwriteExistingContent": true, - "ContentOutputDirectory": "%configpath%/Soulcaster2Content", + "ContentOutputDirectory": "%configpath%/Soulcaster1Content", "UsePNGQuant": true, "FileSettings": { } diff --git a/jsil.org/demos/Soulcaster2/Soulcaster2.css b/jsil.org/demos/Soulcaster2/Soulcaster2.css new file mode 100644 index 000000000..9473ba2c3 --- /dev/null +++ b/jsil.org/demos/Soulcaster2/Soulcaster2.css @@ -0,0 +1,72 @@ +html { + margin: 0px; + padding: 0px; +} +body { + background-color: black; + color: white; + margin: 0px; + padding: 0px; +} +a, a:visited { + color: silver; +} +#canvas { + left: 0px; + top: 0px; + cursor: none; +} +#welcomeMessage { + width: 620px; + height: 140px; + left: 42px; + top: 162px; +} +#loadButton { + width: 200px; + height: 40px; + left: 539px; + top: 320px; +} +#quitButton { + width: 32px; + height: 32px; + left: 1284px; + top: 2px; +} +#loadingProgress { + width: 600px; + height: 40px; + left: 52px; + top: 252px; +} +#progressBar { + height: 40px; +} +#log { + width: 704px; + height: 200px; + left: 2px; + top: 544px; + overflow-x: hidden; + overflow-y: scroll; +} +#fullscreenButton { + left: 708px; + top: 2px; + height: 45px; +} +#stats { + left: 708px; + top: 50px; +} +.boxCaption { + position: absolute; + font-size: 10pt; + font-family: Consolas, Courier New, Courier; + z-index: -999; + top: 0; + left: 0; + right: 0; + bottom: 0; +} \ No newline at end of file diff --git a/jsil.org/demos/Soulcaster2/Soulcaster2.html b/jsil.org/demos/Soulcaster2/Soulcaster2.html new file mode 100644 index 000000000..70ac3c382 --- /dev/null +++ b/jsil.org/demos/Soulcaster2/Soulcaster2.html @@ -0,0 +1,88 @@ + + + + Soulcaster 2 + + + + + + + + + + + + +
+ +
+

JSIL logo

+
+
+ Use mouse to move and interact with menus.
+ For best performance, play in Google Chrome.
+

+ + + + + diff --git a/jsil.org/demos/Soulcaster2/Soulcaster2.jsilconfig b/jsil.org/demos/Soulcaster2/Soulcaster2.jsilconfig new file mode 100644 index 000000000..d6da12c1c --- /dev/null +++ b/jsil.org/demos/Soulcaster2/Soulcaster2.jsilconfig @@ -0,0 +1,21 @@ +{ + "UseThreads": true, + "OutputDirectory": "%configpath%", + "Assemblies": { + "Proxies": [ + "C:/Users/Kevin/Documents/Projects/Soulcaster/Proxies/bin/Debug/Proxies.dll" + ], + "Ignored": [ + "System.Data.*", + "System.Deployment", + "Proxies" + ] + }, + "ProfileSettings": { + "OverwriteExistingContent": true, + "ContentOutputDirectory": "%configpath%/Soulcaster2Content", + "UsePNGQuant": true, + "FileSettings": { + } + } +} \ No newline at end of file