Загрузка данных


Windows PowerShell 5.1
(C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.

PS C:\Users\str> $root = 'C:\Temp\pepper42-build\wgt-staging'
PS C:\Users\str> $js = Join-Path $root 'static\js'
PS C:\Users\str>
PS C:\Users\str> function Show-Lines($file, $start, $end) {
>>     Write-Host "`n===== $file : $start-$end ====="
>>     $lines = Get-Content (Join-Path $js $file)
>>     for ($i = $start - 1; $i -lt [Math]::Min($end, $lines.Length); $i++) {
>>         '{0,4}: {1}' -f ($i + 1), $lines[$i]
>>     }
>> }
PS C:\Users\str>
PS C:\Users\str> Show-Lines 'messages.js' 1 65

===== messages.js : 1-65 =====
   1: var callbacks = {}
   2: var callbacks_ids = 1;
   3:
   4: /**
   5:  * var sendMessage - Sends a message with arguments to the NaCl module
   6:  *
   7:  * @param  {String} method A named method
   8:  * @param  {(String|Array)} params An array of options or a signle string
   9:  * @return {void}        The NaCl module calls back trought the handleMessage method
  10:  */
  11: var sendMessage = function(method, params) {
  12:   return new Promise(function(resolve, reject) {
  13:     var id = callbacks_ids++;
  14:     callbacks[id] = {
  15:       'resolve': resolve,
  16:       'reject': reject
  17:     };
  18:
  19:     common.naclModule.postMessage({
  20:       'callbackId': id,
  21:       'method': method,
  22:       'params': params
  23:     });
  24:   });
  25: }
  26:
  27: /**
  28:  * handleMessage - Handles messages from the NaCl module
  29:  *
  30:  * @param  {Object} msg An object given by the NaCl module
  31:  * @return {void}
  32:  */
  33: function handleMessage(msg) {
  34:   if (msg.data.callbackId && callbacks[msg.data.callbackId]) { // if it's a callback, treat it as such
  35:     callbacks[msg.data.callbackId][msg.data.type](msg.data.ret);
  36:     delete callbacks[msg.data.callbackId]
  37:   } else { // else, it's just info, or an event
  38:     console.log('%c[messages.js, handleMessage]', 'color:gray;', 'Message data: ', msg.data)
  39:     if (msg.data.indexOf('streamTerminated: ') === 0) { // if it's a recognized event, notify the appropriate function
  40:       // Release our keep awake request
  41:       // if (runningOnChrome) {
  42:       //   chrome.power.releaseKeepAwake();
  43:       // }
  44:
  45:       // Show a termination snackbar message if the termination was unexpected
  46:       var errorCode = parseInt(msg.data.replace('streamTerminated: ', ''));
  47:       switch (errorCode) {
  48:         case 0: // ML_ERROR_GRACEFUL_TERMINATION
  49:           break;
  50:
  51:         case -100: // ML_ERROR_NO_VIDEO_TRAFFIC
  52:           snackbarLogLong("No video received from host. Check the host PC's firewall and port forwarding rules.");
  53:           break;
  54:
  55:         case -101: // ML_ERROR_NO_VIDEO_FRAME
  56:           snackbarLogLong("Your network connection isn't performing well. Reduce your video bitrate setting or try a faster connection.");
  57:           break;
  58:
  59:         default:
  60:           snackbarLogLong("Connection terminated");
  61:           break;
  62:       }
  63:
  64:       api.refreshServerInfo().then(function(ret) {
  65:         // Return to app list with new currentgame
PS C:\Users\str> Show-Lines 'utils.js' 1 45

===== utils.js : 1-45 =====
   1: function runningOnChrome() {
   2:   try {
   3:       if (chrome) {
   4:           return true;
   5:       }
   6:   } catch (e) {}
   7:
   8:   return false;
   9: }
  10:
  11: function guuid() {
  12:   return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
  13:     var r = Math.random() * 16 | 0,
  14:       v = c == 'x' ? r : (r & 0x3 | 0x8);
  15:     return v.toString(16);
  16:   });
  17: }
  18:
  19: function uniqueid() {
  20:   return 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function(c) {
  21:     var r = Math.random() * 16 | 0;
  22:     return r.toString(16);
  23:   });
  24: }
  25:
  26: function generateRemoteInputKey() {
  27:   var array = new Uint8Array(16);
  28:   window.crypto.getRandomValues(array);
  29:   return Array.from(array, function(byte) {
  30:     return ('0' + (byte & 0xFF).toString(16)).slice(-2);
  31:   }).join('');
  32: }
  33:
  34: function generateRemoteInputKeyId() {
  35:   // Value must be signed 32-bit int for correct behavior
  36:   var array = new Int32Array(1);
  37:   window.crypto.getRandomValues(array);
  38:   return array[0];
  39: }
  40:
  41: // Based on OpenBSD arc4random_uniform()
  42: function cryptoRand(upper_bound) {
  43:   var min = (Math.pow(2, 32) - upper_bound) % upper_bound;
  44:   var array = new Uint32Array(1);
  45:
PS C:\Users\str> Show-Lines 'utils.js' 305 350

===== utils.js : 305-350 =====
 305:
 306:     var externIP = $root.find('ExternalIP').text().trim();
 307:     if (externIP) {
 308:       // New versions of GFE don't have this field, so don't overwrite
 309:       // the one we found via STUN
 310:       this.externalIP = externIP;
 311:     }
 312:
 313:     try { //  these aren't critical for functionality, and don't necessarily exist in older GFE versions.
 314:       this.gfeVersion = $root.find('GfeVersion').text().trim();
 315:       this.gputype = $root.find('gputype').text().trim();
 316:       this.numofapps = $root.find('numofapps').text().trim();
 317:       // now for the hard part: parsing the supported streaming
 318:       $root.find('DisplayMode').each(function(index, value) { // for each resolution:FPS object
 319:         var yres = parseInt($(value).find('Height').text());
 320:         var xres = parseInt($(value).find('Width').text());
 321:         var fps = parseInt($(value).find('RefreshRate').text());
 322:         if (!this.supportedDisplayModes[yres + ':' + xres]) {
 323:           this.supportedDisplayModes[yres + ':' + xres] = [];
 324:         }
 325:         if (!this.supportedDisplayModes[yres + ':' + xres].includes(fps)) {
 326:           this.supportedDisplayModes[yres + ':' + xres].push(fps);
 327:         }
 328:       }.bind(this));
 329:     } catch (err) {
 330:       // we don't need this data, so no error handling necessary
 331:     }
 332:
 333:
 334:     // GFE 2.8 started keeping currentgame set to the last game played. As a result, it no longer
 335:     // has the semantics that its name would indicate. To contain the effects of this change as much
 336:     // as possible, we'll force the current game to zero if the server isn't in a streaming session.
 337:     if (!$root.find("state").text().trim().endsWith("_SERVER_BUSY")) {
 338:       this.currentGame = 0;
 339:     }
 340:
 341:     return true;
 342:   },
 343:
 344:   getAppById: function(appId) {
 345:     return this.getAppList().then(function(list) {
 346:       var retApp = null;
 347:
 348:       list.some(function(app) {
 349:         if (app.id == appId) {
 350:           retApp = app;
PS C:\Users\str> Show-Lines 'utils.js' 390 480

===== utils.js : 390-480 =====
 390:       var appElements = rootElement.getElementsByTagName("App");
 391:       var appList = [];
 392:
 393:       for (var i = 0, len = appElements.length; i < len; i++) {
 394:         appList.push({
 395:           title: appElements[i].getElementsByTagName("AppTitle")[0].innerHTML.trim(),
 396:           id: parseInt(appElements[i].getElementsByTagName("ID")[0].innerHTML.trim(), 10)
 397:         });
 398:       }
 399:
 400:       this._memCachedApplist = appList;
 401:
 402:       return appList;
 403:     }.bind(this));
 404:   },
 405:
 406:   getAppList: function() {
 407:     if (this._memCachedApplist) {
 408:       return new Promise(function(resolve, reject) {
 409:         console.log('%c[utils.js, utils.js]', 'color: gray;', 'Returning memory-cached apps list');
 410:         resolve(this._memCachedApplist);
 411:         return;
 412:       }.bind(this));
 413:     }
 414:
 415:     return this.getAppListWithCacheFlush();
 416:   },
 417:
 418:   // returns the box art of the given appID.
 419:   // three layers of response time are possible: memory cached (in javascript), storage cached (in chrome.storage.local), and streamed (host sends binary over the network)
 420:   getBoxArt: function (appId) {
 421:     // if (chrome.storage) {
 422:     //   // This may be bad practice to push/pull this much data through local storage?
 423:     //   return new Promise(function(resolve, reject) {
 424:     //     chrome.storage.local.get('boxart-' + appId, function(storageData) {
 425:     //       // if we already have it, load it.
 426:     //       if (storageData !== undefined && Object.keys(storageData).length !== 0 && storageData['boxart-' + appId].constructor !== Object) {
 427:     //         console.log('%c[utils.js, getBoxArt]', 'color: gray;', 'Returning storage-cached box art for app: ', appId);
 428:     //         resolve(storageData['boxart-' + appId]);
 429:     //         return;
 430:     //       }
 431:
 432:     //       // otherwise, put it in our cache, then return it
 433:     //       sendMessage('openUrl', [
 434:     //         this._baseUrlHttps +
 435:     //         '/appasset?' + this._buildUidStr() +
 436:     //         '&appid=' + appId +
 437:     //         '&AssetType=2&AssetIdx=0',
 438:     //         this.ppkstr,
 439:     //         true
 440:     //       ]).then(function(boxArtBuffer) {
 441:     //         var reader = new FileReader();
 442:     //         reader.onloadend = function() {
 443:     //           var obj = {};
 444:     //           obj['boxart-' + appId] = this.result;
 445:     //           chrome.storage.local.set(obj, function(onSuccess) {});
 446:     //           console.log('%c[utils.js, utils.js,  getBoxArt]', 'color: gray;', 'Returning network-fetched box art');
 447:     //           resolve(this.result);
 448:     //         }
 449:     //         reader.readAsDataURL(new Blob([boxArtBuffer], {
 450:     //           type: "image/png"
 451:     //         }));
 452:     //       }.bind(this), function(error) {
 453:     //         console.error('%c[utils.js, utils.js,  getBoxArt]', 'color: gray;', 'Box-art request failed!', error);
 454:     //         reject(error);
 455:     //         return;
 456:     //       }.bind(this));
 457:     //     }.bind(this));
 458:     //   }.bind(this));
 459:
 460:     // } else { // shouldn't run because we always have chrome.storage, but I'm not going to antagonize other browsers
 461:     console.warn('%c[utils.js, utils.js,  getBoxArt]', 'color: gray;', 'chrome.storage not detected! Box art will not be saved!');
 462:     return new Promise((resolve, reject) => {
 463:       sendMessage('openUrl', [
 464:         this._baseUrlHttps +
 465:         '/appasset?' + this._buildUidStr() +
 466:         '&appid=' + appId +
 467:         '&AssetType=2&AssetIdx=0',
 468:         this.ppkstr,
 469:         true
 470:       ]).then((boxArtBuffer) => {
 471:         var reader = new FileReader();
 472:         reader.onloadend = function () {
 473:           var obj = {};
 474:           obj['boxart-' + appId] = this.result;
 475:           console.log('%c[utils.js, utils.js,  getBoxArt]', 'color: gray;', 'Returning network-fetched box art');
 476:           resolve(this.result);
 477:         }
 478:         reader.readAsDataURL(new Blob([boxArtBuffer], {
 479:           type: "image/png"
 480:         }));
PS C:\Users\str> Show-Lines 'controllers.js' 1 95

===== controllers.js : 1-95 =====
   1: var Controller = (function() {
   2:   var pollingInterval = null;
   3:
   4:   var gamepads = {};
   5:
   6:   function Button(button) {
   7:     this.value = button.value;
   8:     this.pressed = button.pressed;
   9:   }
  10:
  11:   function Gamepad(gamepad) {
  12:     this.buttons = gamepad.buttons.map((button) => new Button(button));
  13:   }
  14:
  15:   Gamepad.prototype.analyzeButtons = function(newButtons) {
  16:     if (this.buttons.length !== newButtons.length) {
  17:       console.error('New buttons layout does not match saved one');
  18:       return;
  19:     }
  20:
  21:     for (var i = 0; i < newButtons.length; ++i) {
  22:       if (this.buttons[i].pressed !== newButtons[i].pressed) {
  23:         window.dispatchEvent(
  24:             new CustomEvent('gamepadbuttonpressed',
  25:                 {
  26:                   detail: {
  27:                     key: i,
  28:                     pressed: newButtons[i].pressed,
  29:                   },
  30:                 }));
  31:       }
  32:     }
  33:
  34:     this.buttons = newButtons.map((button) => new Button(button));
  35:   };
  36:
  37:   function gamepadConnected(gamepad) {
  38:     gamepads[gamepad.index] = new Gamepad(gamepad);
  39:   }
  40:
  41:   function gamepadDisconnected(gamepad) {
  42:     delete gamepad[gamepad.index];
  43:   }
  44:
  45:   function analyzeGamepad(gamepad) {
  46:     var index = gamepad.index;
  47:     var pGamepad = gamepads[index];
  48:
  49:     if (pGamepad) {
  50:       pGamepad.analyzeButtons(gamepad.buttons);
  51:     }
  52:   }
  53:
  54:   function pollGamepads() {
  55:     var gamepads =
  56:         navigator.getGamepads ?
  57:           navigator.getGamepads() :
  58:           (navigator.webkitGetGamepads ? navigator.webkitGetGamepads : []);
  59:
  60:     if (!gamepads) {
  61:       return;
  62:     }
  63:
  64:     for (var gamepad of gamepads) {
  65:       if (gamepad) {
  66:         analyzeGamepad(gamepad);
  67:       }
  68:     }
  69:   }
  70:
  71:   function startWatching() {
  72:     if (!pollingInterval) {
  73:       window.addEventListener('gamepadconnected', function(e) {
  74:         gamepadConnected(e.gamepad);
  75:       });
  76:       window.addEventListener('gamepaddisconnected', function(e) {
  77:         gamepadDisconnected(e.gamepad);
  78:       });
  79:       pollingInterval = setInterval(pollGamepads, 5);
  80:     }
  81:   }
  82:
  83:   function stopWatching() {
  84:     if (pollingInterval) {
  85:       clearInterval(pollingInterval);
  86:       pollingInterval = null;
  87:     }
  88:   }
  89:
  90:   return {startWatching, stopWatching};
  91: })();
  92:
  93: function remoteControllerHandler(e) {
  94:   var keyCode = e.keyCode;
  95:
PS C:\Users\str> Show-Lines 'common.js' 80 155

===== common.js : 80-155 =====
  80:     moduleEl.setAttribute('path', path);
  81:     moduleEl.setAttribute('src', path + '/' + name + '.nmf');
  82:
  83:     // Add any optional arguments
  84:     if (attrs) {
  85:       for (var key in attrs) {
  86:         moduleEl.setAttribute(key, attrs[key]);
  87:         console.log('After setting ' + key + ':', moduleEl);
  88:       }
  89:     }
  90:
  91:     var mimetype = mimeTypeForTool(tool);
  92:     moduleEl.setAttribute('type', mimetype);
  93:
  94:     console.log('%c[createNaClModule, common.js]', 'color: gray;', "moduleEl: " + moduleEl.outerHTML);
  95:
  96:     // The <EMBED> element is wrapped inside a <DIV>, which has both a 'load'
  97:     // and a 'message' event listener attached.  This wrapping method is used
  98:     // instead of attaching the event listeners directly to the <EMBED> element
  99:     // to ensure that the listeners are active before the NaCl module 'load'
 100:     // event fires.
 101:     var listenerDiv = document.getElementById('listener');
 102:     listenerDiv.appendChild(moduleEl);
 103:
 104:     // Request the offsetTop property to force a relayout. As of Apr 10, 2014
 105:     // this is needed if the module is being loaded on a Chrome App's
 106:     // background page (see crbug.com/350445).
 107:     moduleEl.offsetTop;
 108:
 109:     // Host plugins don't send a moduleDidLoad message. We'll fake it here.
 110:     var isHost = isHostToolchain(tool);
 111:     if (isHost) {
 112:       window.setTimeout(function() {
 113:         moduleEl.readyState = 1;
 114:         moduleEl.dispatchEvent(new CustomEvent('loadstart'));
 115:         moduleEl.readyState = 4;
 116:         moduleEl.dispatchEvent(new CustomEvent('load'));
 117:         moduleEl.dispatchEvent(new CustomEvent('loadend'));
 118:       }, 100); // 100 ms
 119:     }
 120:   }
 121:
 122:   /**
 123:    * Add the default "load" and "message" event listeners to the element with
 124:    * id "listener".
 125:    *
 126:    * The "load" event is sent when the module is successfully loaded. The
 127:    * "message" event is sent when the naclModule posts a message using
 128:    * PPB_Messaging.PostMessage() (in C) or pp::Instance().PostMessage() (in
 129:    * C++).
 130:    */
 131:   function attachDefaultListeners() {
 132:     var listenerDiv = document.getElementById('listener');
 133:     listenerDiv.addEventListener('load', moduleDidLoad, true);
 134:     listenerDiv.addEventListener('message', handleMessage, true);
 135:     listenerDiv.addEventListener('error', handleError, true);
 136:     listenerDiv.addEventListener('crash', handleCrash, true);
 137:     if (typeof window.attachListeners !== 'undefined') {
 138:       window.attachListeners();
 139:     }
 140:   }
 141:
 142:   /**
 143:    * Called when the NaCl module fails to load.
 144:    *
 145:    * This event listener is registered in createNaClModule above.
 146:    */
 147:   function handleError(event) {
 148:     // We can't use common.naclModule yet because the module has not been
 149:     // loaded.
 150:     console.log('%c[handleError, common.js]', 'color: red;', event);
 151:     var moduleEl = document.getElementById('nacl_module');
 152:     updateStatus('ERROR [' + moduleEl.lastError + ']');
 153:   }
 154:
 155:   /**
PS C:\Users\str>
PS C:\Users\str> Write-Host "`n===== ЦЕПОЧКА ЗАГРУЗКИ И ВОССТАНОВЛЕНИЯ UI ====="

===== ЦЕПОЧКА ЗАГРУЗКИ И ВОССТАНОВЛЕНИЯ UI =====
PS C:\Users\str> Get-ChildItem $js -Recurse -File -Filter '*.js' |
>>     Select-String -Pattern 'moduleDidLoad|loadHTTPCertsCb|restoreUiAfterNaClLoad|httpInit|moduleLoadError|moduleCrashed' -Context 4,9

  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:105:    // this is needed if the module is being loaded on a C
hrome App's
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:106:    // background page (see crbug.com/350445).
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:107:    moduleEl.offsetTop;
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:108:
> C:\Temp\pepper42-build\wgt-staging\static\js\common.js:109:    // Host plugins don't send a moduleDidLoad message. We
'll fake it here.
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:110:    var isHost = isHostToolchain(tool);
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:111:    if (isHost) {
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:112:      window.setTimeout(function() {
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:113:        moduleEl.readyState = 1;
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:114:        moduleEl.dispatchEvent(new CustomEvent('loadstart'
));
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:115:        moduleEl.readyState = 4;
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:116:        moduleEl.dispatchEvent(new CustomEvent('load'));
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:117:        moduleEl.dispatchEvent(new CustomEvent('loadend'))
;
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:118:      }, 100); // 100 ms
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:129:   * C++).
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:130:   */
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:131:  function attachDefaultListeners() {
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:132:    var listenerDiv = document.getElementById('listener');
> C:\Temp\pepper42-build\wgt-staging\static\js\common.js:133:    listenerDiv.addEventListener('load', moduleDidLoad, tr
ue);
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:134:    listenerDiv.addEventListener('message', handleMessage,
 true);
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:135:    listenerDiv.addEventListener('error', handleError, tru
e);
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:136:    listenerDiv.addEventListener('crash', handleCrash, tru
e);
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:137:    if (typeof window.attachListeners !== 'undefined') {
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:138:      window.attachListeners();
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:139:    }
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:140:  }
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:141:
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:142:  /**
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:173:   * Called when the NaCl module is loaded.
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:174:   *
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:175:   * This event listener is registered in attachDefaultLis
teners above.
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:176:   */
> C:\Temp\pepper42-build\wgt-staging\static\js\common.js:177:  function moduleDidLoad() {
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:178:    common.naclModule = document.getElementById('nacl_modu
le');
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:179:    updateStatus('RUNNING');
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:180:
> C:\Temp\pepper42-build\wgt-staging\static\js\common.js:181:    if (typeof window.moduleDidLoad !== 'undefined') {
> C:\Temp\pepper42-build\wgt-staging\static\js\common.js:182:      window.moduleDidLoad();
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:183:    }
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:184:  }
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:185:
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:186:  /**
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:187:   * Hide the NaCl module's embed element.
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:188:   *
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:189:   * We don't want to hide by default; if we do, it is har
der to determine that
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:190:   * a plugin failed to load. Instead, call this function
inside the example's
> C:\Temp\pepper42-build\wgt-staging\static\js\common.js:191:   * "moduleDidLoad" function.
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:192:   *
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:193:   */
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:194:  function hideModule() {
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:195:    // Setting common.naclModule.style.display = "None" do
esn't work; the
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:196:    // module will no longer be able to receive postMessag
es.
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:197:    common.naclModule.style.height = '0';
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:198:  }
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:199:
  C:\Temp\pepper42-build\wgt-staging\static\js\common.js:200:  /**
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:76:    stopBackgroundPollingOfHost(hosts[hostUID]);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:77:  }
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:78:}
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:79:
> C:\Temp\pepper42-build\wgt-staging\static\js\index.js:80:function restoreUiAfterNaClLoad() {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:81:  $('#main-navigation').children().not("#quitCurrentApp").sh
ow();
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:82:  $("#main-content").children().not("#listener, #naclSpinner
, #game-grid").show();
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:83:  $('#naclSpinner').hide();
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:84:  $('#loadingSpinner').css('display', 'none');
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:85:  Navigation.push(Views.Hosts);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:86:  showHostsAndSettingsMode();
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:87:
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:88:  findNvService(function (finder, opt_error) {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:89:    if (finder.byService_['_nvstream._tcp']) {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:184:  $('#bitrateField').html($('#bitrateSlider').val() + " Mbp
s");
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:185:  saveBitrate();
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:186:}
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:187:
> C:\Temp\pepper42-build\wgt-staging\static\js\index.js:188:function moduleDidLoad() {
> C:\Temp\pepper42-build\wgt-staging\static\js\index.js:189:  openIndexDB(loadHTTPCertsCb);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:190:}
> C:\Temp\pepper42-build\wgt-staging\static\js\index.js:191:function loadHTTPCertsCb() {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:192:  console.log('load the HTTP cert and unique ID if we have
one.');
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:193:  getData('cert', function (savedCert) {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:194:    if (savedCert.cert != null) { // we have a saved cert
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:195:      pairingCert = savedCert.cert;
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:196:    }
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:197:
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:198:    getData('uniqueid', function (savedUniqueid) {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:199:      // See comment on myUniqueid
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:200:      /*if (savedUniqueid.uniqueid != null) { // we have a
saved uniqueid
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:204:        storeData('uniqueid', myUniqueid, null);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:205:      }*/
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:206:
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:207:      if (!pairingCert) { // we couldn't load a cert. Make
one.
> C:\Temp\pepper42-build\wgt-staging\static\js\index.js:208:        console.warn('%c[index.js, moduleDidLoad]', 'color:
 green;', 'Failed to load local cert. Generating new one');
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:209:        sendMessage('makeCert', []).then(function (cert) {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:210:          storeData('cert', cert, null);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:211:          pairingCert = cert;
> C:\Temp\pepper42-build\wgt-staging\static\js\index.js:212:          console.info('%c[index.js, moduleDidLoad]', 'colo
r: green;', 'Generated new cert:', cert);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:213:        }, function (failedCert) {
> C:\Temp\pepper42-build\wgt-staging\static\js\index.js:214:          console.error('%c[index.js, moduleDidLoad]', 'col
or: green;', 'Failed to generate new cert! Returned error was: \n', failedCert);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:215:        }).then(function (ret) {
> C:\Temp\pepper42-build\wgt-staging\static\js\index.js:216:          sendMessage('httpInit', [pairingCert.cert, pairin
gCert.privateKey, myUniqueid]).then(function (ret) {
> C:\Temp\pepper42-build\wgt-staging\static\js\index.js:217:            restoreUiAfterNaClLoad();
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:218:          }, function (failedInit) {
> C:\Temp\pepper42-build\wgt-staging\static\js\index.js:219:            console.error('%c[index.js, moduleDidLoad]', 'c
olor: green;', 'Failed httpInit! Returned error was: ', failedInit);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:220:          });
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:221:        });
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:222:      } else {
> C:\Temp\pepper42-build\wgt-staging\static\js\index.js:223:        sendMessage('httpInit', [pairingCert.cert, pairingC
ert.privateKey, myUniqueid]).then(function (ret) {
> C:\Temp\pepper42-build\wgt-staging\static\js\index.js:224:          restoreUiAfterNaClLoad();
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:225:        }, function (failedInit) {
> C:\Temp\pepper42-build\wgt-staging\static\js\index.js:226:          console.error('%c[index.js, moduleDidLoad]', 'col
or: green;', 'Failed httpInit! Returned error was: ', failedInit);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:227:        });
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:228:      }
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:229:
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:230:      // load previously connected hosts, which have been k
illed into an object, and revive them back into a class
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:231:      getData('hosts', function (previousValue) {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:232:        hosts = previousValue.hosts != null ? previousValue
.hosts : {};
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:233:        for (var hostUID in hosts) { // programmatically ad
d each new host.
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:234:          var revivedHost = new NvHTTP(hosts[hostUID].addre
ss, myUniqueid, hosts[hostUID].userEnteredAddress);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:235:          revivedHost.serverUid = hosts[hostUID].serverUid;


PS C:\Users\str>
PS C:\Users\str> Write-Host "`n===== ВЫЗОВЫ restoreUiAfterNaClLoad ====="

===== ВЫЗОВЫ restoreUiAfterNaClLoad =====
PS C:\Users\str> Select-String -Path "$js\*.js" -Pattern 'restoreUiAfterNaClLoad' -Context 8,12

  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:72:}
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:73:
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:74:function stopPollingHosts() {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:75:  for (var hostUID in hosts) {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:76:    stopBackgroundPollingOfHost(hosts[hostUID]);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:77:  }
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:78:}
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:79:
> C:\Temp\pepper42-build\wgt-staging\static\js\index.js:80:function restoreUiAfterNaClLoad() {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:81:  $('#main-navigation').children().not("#quitCurrentApp").sh
ow();
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:82:  $("#main-content").children().not("#listener, #naclSpinner
, #game-grid").show();
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:83:  $('#naclSpinner').hide();
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:84:  $('#loadingSpinner').css('display', 'none');
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:85:  Navigation.push(Views.Hosts);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:86:  showHostsAndSettingsMode();
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:87:
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:88:  findNvService(function (finder, opt_error) {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:89:    if (finder.byService_['_nvstream._tcp']) {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:90:      var ips = Object.keys(finder.byService_['_nvstream._tc
p']);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:91:      for (var i in ips) {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:92:        var ip = ips[i];
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:209:        sendMessage('makeCert', []).then(function (cert) {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:210:          storeData('cert', cert, null);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:211:          pairingCert = cert;
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:212:          console.info('%c[index.js, moduleDidLoad]', 'colo
r: green;', 'Generated new cert:', cert);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:213:        }, function (failedCert) {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:214:          console.error('%c[index.js, moduleDidLoad]', 'col
or: green;', 'Failed to generate new cert! Returned error was: \n', failedCert);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:215:        }).then(function (ret) {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:216:          sendMessage('httpInit', [pairingCert.cert, pairin
gCert.privateKey, myUniqueid]).then(function (ret) {
> C:\Temp\pepper42-build\wgt-staging\static\js\index.js:217:            restoreUiAfterNaClLoad();
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:218:          }, function (failedInit) {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:219:            console.error('%c[index.js, moduleDidLoad]', 'c
olor: green;', 'Failed httpInit! Returned error was: ', failedInit);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:220:          });
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:221:        });
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:222:      } else {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:223:        sendMessage('httpInit', [pairingCert.cert, pairingC
ert.privateKey, myUniqueid]).then(function (ret) {
> C:\Temp\pepper42-build\wgt-staging\static\js\index.js:224:          restoreUiAfterNaClLoad();
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:225:        }, function (failedInit) {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:226:          console.error('%c[index.js, moduleDidLoad]', 'col
or: green;', 'Failed httpInit! Returned error was: ', failedInit);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:227:        });
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:228:      }
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:229:
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:230:      // load previously connected hosts, which have been k
illed into an object, and revive them back into a class
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:231:      getData('hosts', function (previousValue) {
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:232:        hosts = previousValue.hosts != null ? previousValue
.hosts : {};
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:233:        for (var hostUID in hosts) { // programmatically ad
d each new host.
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:234:          var revivedHost = new NvHTTP(hosts[hostUID].addre
ss, myUniqueid, hosts[hostUID].userEnteredAddress);
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:235:          revivedHost.serverUid = hosts[hostUID].serverUid;
  C:\Temp\pepper42-build\wgt-staging\static\js\index.js:236:          revivedHost.externalIP = hosts[hostUID].externalI
P;


PS C:\Users\str>
PS C:\Users\str> Write-Host "`n===== ПАРАМЕТРЫ ЭКРАНА И VIEWPORT ====="

===== ПАРАМЕТРЫ ЭКРАНА И VIEWPORT =====
PS C:\Users\str> Select-String -Path "$root\index.html","$root\config.xml" `
>>     -Pattern 'viewport|resolution|screen-size|content|<tizen:|<feature' -Context 1,2

  C:\Temp\pepper42-build\wgt-staging\index.html:3:<head>
> C:\Temp\pepper42-build\wgt-staging\index.html:4:  <meta http-equiv="Pragma" content="no-cache">
> C:\Temp\pepper42-build\wgt-staging\index.html:5:  <meta http-equiv="Expires" content="-1">
> C:\Temp\pepper42-build\wgt-staging\index.html:6:  <meta name="viewport" content="width=device-width, initial-scale=1.
0">
  C:\Temp\pepper42-build\wgt-staging\index.html:7:  <title>Moonlight</title>
  C:\Temp\pepper42-build\wgt-staging\index.html:8:  <link rel="stylesheet" href="static/css/roboto.css">
  C:\Temp\pepper42-build\wgt-staging\index.html:26:          <div class="nav-menu-parent">
> C:\Temp\pepper42-build\wgt-staging\index.html:27:            <div id="resolutionMenu">
> C:\Temp\pepper42-build\wgt-staging\index.html:28:              <button id="selectResolution" data-value="1280:720" cl
ass="mdl-button mdl-js-button">
  C:\Temp\pepper42-build\wgt-staging\index.html:29:                                720p
  C:\Temp\pepper42-build\wgt-staging\index.html:30:                            </button>
  C:\Temp\pepper42-build\wgt-staging\index.html:32:
> C:\Temp\pepper42-build\wgt-staging\index.html:33:            <ul class="resolutionMenu mdl-menu mdl-menu--bottom-righ
t mdl-js-menu mdl-js-ripple-effect" for="selectResolution">
  C:\Temp\pepper42-build\wgt-staging\index.html:34:              <li class="mdl-menu__item" data-value="858:480">480p</
li>
  C:\Temp\pepper42-build\wgt-staging\index.html:35:              <li class="mdl-menu__item" data-value="1280:720">720p<
/li>
  C:\Temp\pepper42-build\wgt-staging\index.html:40:
> C:\Temp\pepper42-build\wgt-staging\index.html:41:            <div id="resolutionTooltip" class="mdl-tooltip" for="res
olutionMenu">
> C:\Temp\pepper42-build\wgt-staging\index.html:42:              Resolution
  C:\Temp\pepper42-build\wgt-staging\index.html:43:            </div>
  C:\Temp\pepper42-build\wgt-staging\index.html:44:          </div>
  C:\Temp\pepper42-build\wgt-staging\index.html:112:    </header>
> C:\Temp\pepper42-build\wgt-staging\index.html:113:    <main id="main-content" class="mdl-layout__content">
  C:\Temp\pepper42-build\wgt-staging\index.html:114:      <div id="host-grid">
  C:\Temp\pepper42-build\wgt-staging\index.html:115:        <div class="add-host-card mdl-card mdl-shadow--4dp" id="add
HostCell">
  C:\Temp\pepper42-build\wgt-staging\index.html:143:    <h3 class="mdl-dialog__title">Pairing</h3>
> C:\Temp\pepper42-build\wgt-staging\index.html:144:    <div class="mdl-dialog__content">
  C:\Temp\pepper42-build\wgt-staging\index.html:145:      <p id="pairingDialogText">
  C:\Temp\pepper42-build\wgt-staging\index.html:146:        Please enter the number XXXX on the GFE dialog on the compu
ter. This dialog will be dismissed once complete
  C:\Temp\pepper42-build\wgt-staging\index.html:154:    <h3 class="mdl-dialog__title">Quit Running App?</h3>
> C:\Temp\pepper42-build\wgt-staging\index.html:155:    <div class="mdl-dialog__content">
  C:\Temp\pepper42-build\wgt-staging\index.html:156:      <p id="quitAppDialogText">
  C:\Temp\pepper42-build\wgt-staging\index.html:157:        Y is already running. Would you like to quit Y?
  C:\Temp\pepper42-build\wgt-staging\index.html:166:    <h3 class="mdl-dialog__title">Delete PC</h3>
> C:\Temp\pepper42-build\wgt-staging\index.html:167:    <div class="mdl-dialog__content">
  C:\Temp\pepper42-build\wgt-staging\index.html:168:      <p id="deleteHostDialogText">
  C:\Temp\pepper42-build\wgt-staging\index.html:169:        Are you sure you want to delete this host?
  C:\Temp\pepper42-build\wgt-staging\index.html:178:    <h3 class="mdl-dialog__title">Add Host Manually</h3>
> C:\Temp\pepper42-build\wgt-staging\index.html:179:    <div class="mdl-dialog__content">
  C:\Temp\pepper42-build\wgt-staging\index.html:180:      <div class="mdl-textfield mdl-js-textfield mdl-textfield--flo
ating-label">
  C:\Temp\pepper42-build\wgt-staging\index.html:181:        <input class="mdl-textfield__input" type="text" id="dialogI
nputHost" />
  C:\Temp\pepper42-build\wgt-staging\config.xml:4:  </access>
> C:\Temp\pepper42-build\wgt-staging\config.xml:5:  <tizen:application id="ChqHQExU28.MoonlightNaCl" package="ChqHQExU2
8" required_version="2.4" />
> C:\Temp\pepper42-build\wgt-staging\config.xml:6:  <content src="index.html" />
> C:\Temp\pepper42-build\wgt-staging\config.xml:7:  <feature name="http://tizen.org/feature/screen.size.all" />
> C:\Temp\pepper42-build\wgt-staging\config.xml:8:  <feature name="http://www.samsungdforum.com/feature/Keyboard" />
> C:\Temp\pepper42-build\wgt-staging\config.xml:9:  <feature name="http://www.samsungdforum.com/feature/Mouse" />
> C:\Temp\pepper42-build\wgt-staging\config.xml:10:  <feature name="http://www.samsungdforum.com/feature/External_Devic
e" />
  C:\Temp\pepper42-build\wgt-staging\config.xml:11:  <icon src="icon.png" />
> C:\Temp\pepper42-build\wgt-staging\config.xml:12:  <tizen:metadata key="http://samsung.com/tv/metadata/prelaunch.supp
ort" value="true" />
> C:\Temp\pepper42-build\wgt-staging\config.xml:13:  <tizen:metadata key="http://samsung.com/tv/metadata/voice.support"
 value="false" />
> C:\Temp\pepper42-build\wgt-staging\config.xml:14:  <tizen:metadata key="http://samsung.com/tv/metadata/multiscreen.su
pport" value="true" />
> C:\Temp\pepper42-build\wgt-staging\config.xml:15:  <tizen:metadata key="http://samsung.com/tv/metadata/multitasking.s
upport" value="true" />
  C:\Temp\pepper42-build\wgt-staging\config.xml:16:  <name>MoonlightNaCl</name>
> C:\Temp\pepper42-build\wgt-staging\config.xml:17:  <tizen:privilege name="http://developer.samsung.com/privilege/netw
ork.public" />
> C:\Temp\pepper42-build\wgt-staging\config.xml:18:  <tizen:privilege name="http://tizen.org/privilege/application.laun
ch" />
> C:\Temp\pepper42-build\wgt-staging\config.xml:19:  <tizen:privilege name="http://tizen.org/privilege/tv.inputdevice"
/>
> C:\Temp\pepper42-build\wgt-staging\config.xml:20:  <tizen:profile name="tv-samsung" />
> C:\Temp\pepper42-build\wgt-staging\config.xml:21:  <tizen:setting screen-orientation="landscape" context-menu="enable
" background-support="disable" encryption="disable" install-location="auto" hwkey-event="enable" />
  C:\Temp\pepper42-build\wgt-staging\config.xml:22:</widget>


PS C:\Users\str>