void ISiteContext.SaveOptions(string path, IIo io) { try { var s = _siteOptions.Serialize(); io.WriteFile(path, s); } catch (Exception ex) { Debug.WriteLine(ex.Message); _logger.LogException(ex, "", path); } }
public override void SaveOptions(string path, IIo io) { try { var s = _siteOptions.Serialize(); io.WriteFile(path, s); } catch (Exception ex) { Debug.WriteLine(ex.Message); _logger.LogException(ex, "", $"path={path}"); } }
public bool Process(HttpServer server, HttpRequest request, HttpResponse response) { SystemLogger.Log(SystemLogger.Module.CORE, " ############## " + this.GetType() + " -> " + request.Url); if (request.Url.StartsWith(REMOTE_RESOURCE_URI)) { SystemLogger.Log(SystemLogger.Module.CORE, "Remote resource protocol."); try { string commandParams = request.Url.Substring(REMOTE_RESOURCE_URI.Length); string[] commandParamsArray = commandParams.Split(new char[] { '/' }); if (commandParamsArray.Length > 0) { string ioServiceName = commandParamsArray [0]; Object unityIOService = serviceLocator.GetService(UNITY_IO_SERVICE_NAME); if (unityIOService != null && ioServiceName != null) { IIo io = (IIo)unityIOService; string parameters = commandParams.Substring(ioServiceName.Length + 1); IORequest ioRequest = new IORequest(); ioRequest.Content = parameters; IOResponse ioResponse = io.InvokeService(ioRequest, ioServiceName); if (ioResponse != null) { response.ContentType = ioResponse.ContentType; response.RawContent = ioResponse.ContentBinary; } } } if (response.RawContent == null) { response.Content = "No content available."; SystemLogger.Log(SystemLogger.Module.CORE, "No content available for request [" + request.Url + "," + request.Method + "]. Continue to next handler..."); return(false); } return(true); } catch (Exception e) { SystemLogger.Log(SystemLogger.Module.CORE, "Exception when parsing request [" + request.Url + "]", e); response.Content = "Malformed request."; return(false); } } else { SystemLogger.Log(SystemLogger.Module.CORE, "Non remote resource protocol. Continue to next handler..."); return(false); } }
void ISiteContext.LoadOptions(string path, IIo io) { _siteOptions = new NicoSiteOptions(); try { var s = io.ReadFile(path); _siteOptions.Deserialize(s); } catch (Exception ex) { Debug.WriteLine(ex.Message); _logger.LogException(ex, "", path); } }
public override void LoadOptions(string path, IIo io) { _siteOptions = new ShowRoomSiteOptions(); try { var s = io.ReadFile(path); _siteOptions.Deserialize(s); } catch (Exception ex) { Debug.WriteLine(ex.Message); _logger.LogException(ex, "", $"path={path}"); } }
public static void Initialize(IIo io, int playerCount, XmlElement map) { VerifyStage(GameStage.NotInitialized); _Io = io; Map = new Map(map); Players = new Player[playerCount]; for (int i = 0; i < playerCount; i++) { Players[i] = new Player(i); } _CurrentPlayerId = 0; Day = 1; Stage = GameStage.Start; }
/// <summary> /// Initializes the appverse context exposing data to the WebView Javascript DOM. /// </summary> private void InitializeAppverseContext() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); try { #if DEBUG log("Before loading the main HTML, platform will expose some information directly to javascript..."); #endif IPhoneSystem systemService = (IPhoneSystem)IPhoneServiceLocator.GetInstance().GetService("system"); AbstractI18N i18nService = (AbstractI18N)IPhoneServiceLocator.GetInstance().GetService("i18n"); IIo ioService = (IIo)IPhoneServiceLocator.GetInstance().GetService("io"); // 1. Appverse Context (Appverse.is) UnityContext unityContext = systemService.GetUnityContext(); String unityContextJsonString = IPhoneUtils.GetInstance().JSONSerializeObjectData(unityContext); unityContextJsonString = "_AppverseContext = " + unityContextJsonString; this.EvaluateJavascript(unityContextJsonString); // 2. OS Info (Appverse.OSInfo) OSInfo osInfo = systemService.GetOSInfo(); String osInfoJsonString = IPhoneUtils.GetInstance().JSONSerializeObjectData(osInfo); osInfoJsonString = "_OSInfo = " + osInfoJsonString; this.EvaluateJavascript(osInfoJsonString); // 3. Hardware Info (Appverse.HardwareInfo) HardwareInfo hwInfo = systemService.GetOSHardwareInfo(); String hwInfoJsonString = IPhoneUtils.GetInstance().JSONSerializeObjectData(hwInfo); hwInfoJsonString = "_HwInfo = " + hwInfoJsonString; this.EvaluateJavascript(hwInfoJsonString); // 4. Get all configured localized keys (Appverse.i18n) Unity.Core.I18N.Locale[] supportedLocales = i18nService.GetLocaleSupported(); String localizedStrings = "_i18n = {}; _i18n['default'] = '" + i18nService.DefaultLocale + "'; "; String localeLiterals = ""; foreach (Unity.Core.I18N.Locale supportedLocale in supportedLocales) { ResourceLiteralDictionary literals = i18nService.GetResourceLiterals(supportedLocale); String literalsJsonString = IPhoneUtils.GetInstance().JSONSerializeObjectData(literals); localeLiterals = localeLiterals + " _i18n['" + supportedLocale.ToString() + "'] = " + literalsJsonString + "; "; } localizedStrings = localizedStrings + localeLiterals; this.EvaluateJavascript(localizedStrings); // 5. Current device locale Unity.Core.System.Locale currentLocale = systemService.GetLocaleCurrent(); String currentLocaleJsonString = IPhoneUtils.GetInstance().JSONSerializeObjectData(currentLocale); currentLocaleJsonString = "_CurrentDeviceLocale = " + currentLocaleJsonString; this.EvaluateJavascript(currentLocaleJsonString); // 6. Configured IO services endpoints IOService[] services = ioService.GetServices(); String servicesJsonString = "_IOServices = {}; "; foreach (IOService service in services) { String serviceJson = IPhoneUtils.GetInstance().JSONSerializeObjectData(service); servicesJsonString = servicesJsonString + " _IOServices['" + service.Name + "-" + IPhoneUtils.GetInstance().JSONSerializeObjectData(service.Type) + "'] = " + serviceJson + "; "; } this.EvaluateJavascript(servicesJsonString); IPhoneNet NetService = (IPhoneNet)IPhoneServiceLocator.GetInstance().GetService("net"); NetService.CheckConnectivity(); String netJsonString = "_NetworkStatus = " + NetService.getNetStatus(); this.EvaluateJavascript(netJsonString); } catch (Exception ex) { #if DEBUG log("Unable to load Appverse Context. Exception message: " + ex.Message); #endif } stopwatch.Stop(); #if DEBUG log("# Time elapsed initializing Appverse Context: " + stopwatch.Elapsed); #endif }
public Process(ProcessState state, string name, uint stop, uint step, IIo standardIn = null, IIo standardOut = null) : base(state, name, standardIn, standardOut) { Runner = new uint[] { step, stop }; Progress = 0; Listen(typeof(ProcessStartMessage), () => { State = ProcessState.Processing; }); AutoCallByState(ProcessState.Processing, () => Console.WriteLine($"[PROCESS INFO] {State}, Progress is {Progress}")); }
public PluginHost(MainViewModel vm, IOptions options, IIo io) { _vm = vm; _options = options; _io = io; }
public override IIo GetIOService() { if(_ioService == null) { _ioService = (IIo)IPhoneServiceLocator.GetInstance ().GetService ("io"); } return _ioService; }
public abstract void SaveOptions(string path, IIo io);
public abstract void LoadOptions(string path, IIo io);
public App(Io io) { this.io = io; }
public void SaveOptions(string path, IIo io) { }
public void LoadOptions(string path, IIo io) { }
/// <summary> /// Initialisiert eine neue Instanz der <see cref="T:System.Object"/>-Klasse. /// </summary> public App(IConsole console, IIo io, IEnvironment environment) { this.console = console; this.io = io; this.environment = environment; }
public GameEngine(IIo io) { _io = io; }