private string evalDefaultLanguageCountry() { bool isFound = false; string languageAndCountryId = string.Empty; if (this.FileExists(I18NConfigFile)) { try { XmlTextReader reader = this.getXmlTextReader(I18NConfigFile); try { while ((reader.Read() && !isFound)) { XmlNodeType nodeType = reader.NodeType; if ((nodeType == XmlNodeType.Element) && (reader.Name == DEFAULT_TAG)) { languageAndCountryId = readSingleAttribute(reader, ID_TAG); // we need the real language and country selected by deafult, if provided string defaultLanguage = readSingleAttribute(reader, LANGUAGE_ATTRIBUTE_NAME); string defaultCountry = readSingleAttribute(reader, COUNTRY_ATTRIBUTE_NAME); reader.Read(); // continue with next node if (defaultLanguage != null) { languageAndCountryId = (new Locale(defaultLanguage)).ToString(); if (defaultCountry != null) { languageAndCountryId = (new Locale(defaultLanguage + "-" + defaultCountry)).ToString(); } } isFound = true; } } } finally { reader.Close(); } } catch (UriFormatException e) { #if DEBUG SystemLogger.Log(SystemLogger.Module.CORE, "# loadSettings. Getting Content From XmlReader on file path: " + I18NConfigFile + ":" + e.Message); #endif } } return(languageAndCountryId); }
public void FireUnityJavascriptEvent(string method, object data) { string dataJSONString = Serialiser.Serialize(data); if (data is String) { dataJSONString = "'" + (data as String) + "'"; } string jsCallbackFunction = "if(" + method + "){" + method + "(" + dataJSONString + ");}"; SystemLogger.Log(SystemLogger.Module.PLATFORM, "NotifyJavascript (single object): " + method + ", dataJSONString: " + dataJSONString); IPhoneServiceLocator.CurrentDelegate.MainUIWebView().EvaluateJavascript(jsCallbackFunction); SystemLogger.Log(SystemLogger.Module.PLATFORM, "NotifyJavascript EVALUATED"); }
/// <summary> /// /// </summary> protected void LoadServicesConfig() { try { // FileStream to read the XML document. byte[] configFileRawData = GetConfigFileBinaryData(); if (configFileRawData != null) { XmlSerializer serializer = new XmlSerializer(typeof(IOServicesConfig)); servicesConfig = (IOServicesConfig)serializer.Deserialize(new MemoryStream(configFileRawData)); } } catch (Exception e) { SystemLogger.Log(SystemLogger.Module.CORE, "Error when loading services configuration", e); servicesConfig = new IOServicesConfig(); // reset services config mapping when the services could not be loaded for any reason } }
protected override string GetContentFromStreamReader(string filePath) { //return base.GetContentFromStreamReader(filePath); SystemLogger.Log(SystemLogger.Module.PLATFORM, "# IPhoneResourceHandler. Getting Content From StreamReader on file path: " + filePath); Stream sr = IPhoneUtils.GetInstance().GetResourceAsStream(filePath); System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); string content = enc.GetString(((MemoryStream)sr).GetBuffer()); sr.Close(); return(content); }
/// <summary> /// Add the mine pickup to the pickup array /// </summary> public void AddMinePickup() { template minePickup = (obj) => { if (obj.gameObject.GetComponent <Shooting>() != null) { PickupCache.Instance.Mine.GetComponent <Weapon>().ammo += 3; PopUpText.Instance.NewPopUp("Mine Ammo!"); } }; this.Type[3] = minePickup; SystemLogger.write("Mine Pickup Initialized"); }
public void TestICallDeprecatedAndHaveWarning() { SystemLogger.SetWriter(this); _messages.Clear(); host.RunTestString( @"К = Новый ТестовыйКласс; К.УстаревшийМетод(); К.ObsoleteMethod(); К.УстаревшийМетод();" ); Assert.AreEqual(1, _messages.Count, "Только ОДНО предупреждение"); Assert.IsTrue(_messages[0].IndexOf("УстаревшийМетод", StringComparison.InvariantCultureIgnoreCase) >= 0 || _messages[0].IndexOf("ObsoleteMethod", StringComparison.InvariantCultureIgnoreCase) >= 0); }
protected virtual void OnConfigurationAck(List <short> Message) { try { WheelSorterTelegram.SetConfigurationAck send = new WheelSorterTelegram.SetConfigurationAck(Message); SystemLogger.Log(Level.Info, String.Format("<SetConfiguration Ack OK> [ErrorChute1={0}][ErrorChute2={1}][Reason={2}]", send.ErrorChute1, send.ErrorChute2, send.Reason), systemLogNm); } catch (Exception ex) { SystemLogger.Log(Level.Exception, string.Format("[{0}]{1} : {2}", this.Name, ex.StackTrace, ex.Message)); } }
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); } }
public virtual bool UpdateBase(string strJson) { //Session验证 try { var ent = JsonConvert.DeserializeObject <T>(strJson); return(base.Update(ent)); } catch (Exception ex) { SystemLogger.getLogger().Error(ex.Message.ToString()); return(false); } }
static void sh_Closed(object sender, EventArgs e) { try { Counters.IncrementCounter(CountersConstants.ExceptionMessages); string[] cc = SystemConfigurations.GetAppSetting("SupportMailCC").Split(','); NotificationSender.Send(true, true, false, SystemConfigurations.GetAppSetting("SupportMailFrom"), SystemConfigurations.GetAppSetting("SupportMailTo"), cc, "Fix Orders Service Closed", "Fix Orders Service Closed", string.Format("Fix Orders Service has been closed on machine {0} at {1}", SystemConfigurations.GetMachineIP(), DateTime.Now.ToString()), null); } catch (Exception ex) { SystemLogger.WriteOnConsoleAsync(true, "Sending Mail Error: " + ex.Message, ConsoleColor.Red, ConsoleColor.Black, true); } }
public void CheckUndefinedIsNull20() { SystemLogger.SetWriter(this); _messages.Clear(); host.RunTestString( @"К = Новый ТестNullПреобразования; Арг = 3.5; К.ПIValue = Арг; ВЗ = К.КПIValue; Если Не ВЗ = Арг Тогда ВызватьИсключение ""Test IValue Prop <-> IValue: return value is not equal of argument""; КонецЕсли;"); }
public void Log_UsesStateFunctionName_IfNoCategory(string key) { var logState = new Dictionary <string, object> { [key] = "TestFunction2" }; var localLogger = new SystemLogger(_hostInstanceId, "Not.A.Function", _mockEventGenerator.Object, _environment, _debugStateProvider.Object, null, new LoggerExternalScopeProvider(), _appServiceOptions); _mockEventGenerator.Setup(p => p.LogFunctionTraceEvent(LogLevel.Debug, It.IsAny <string>(), It.IsAny <string>(), "TestFunction2", It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <DateTime>())); localLogger.Log(LogLevel.Debug, 0, logState, null, (s, e) => "TestMessage"); _mockEventGenerator.VerifyAll(); }
public MainController(IUnityContainer container) { try { lock (_Lock) { Container = container; ApplicationService = container.Resolve <ApplicationService>(); if (Setup == false) { Logger.Debug("MainController - Setup = false, performing setup"); var eventService = container.Resolve <EventService>(); // This is here to ensure EventService is initialize and it's constructor is called so that EventList is not empty var dataService = container.Resolve <DataService>(); using (var session = dataService.OpenSession()) { WebsiteUtils.DateFormat = "dd-MM-yyyy"; var appSettings = session.QueryOver <SystemSettings>().List <SystemSettings>().FirstOrDefault(); if (appSettings != null) { if (!String.IsNullOrWhiteSpace(WebsiteUtils.DateFormat)) { WebsiteUtils.DateFormat = appSettings.DateFormat; } } } ConstructorError = String.Empty; Setup = true; } JSON_SETTINGS = new JsonSerializerSettings { DateFormatString = WebsiteUtils.DateFormat }; } } catch (Exception error) { SystemLogger.LogError <MainController>("Error in main controller constructor", error); ConstructorError = ""; var err = error; while (err != null) { ConstructorError = String.Format("{0}{1}\n{2}\n|---|\n", ConstructorError, error.Message, error.StackTrace); err = error.InnerException; } } }
public void CheckUndefinedIsNull10() { SystemLogger.SetWriter(this); _messages.Clear(); host.RunTestString( @"К = Новый ТестNullПреобразования; Арг = 3; ВЗ = 5.7; ВЗ = К.ТестUInt(Арг); Если Не ВЗ = Арг Тогда ВызватьИсключение ""Test uint Func(uint) -> Func(uint): return value is not equal of argument""; КонецЕсли;"); }
/// <summary> /// Add the rocket pickup to the pickup array /// </summary> public void AddRocketPickup() { template pickupOne = (obj) => { if (obj.gameObject.GetComponent <Shooting>() != null) { PickupCache.Instance.Rocket.GetComponent <Weapon>().ammo += 5; PopUpText.Instance.NewPopUp("Rocket Ammo!"); } }; this.Type[0] = pickupOne; SystemLogger.write("Rocket Pickup Initialized"); }
/// <summary> /// Add the damage multiplier pickup to the pickup array /// </summary> public void AddDamageMultiplierPickup() { template dmgPickup = (obj) => { if (obj.gameObject.GetComponent <Shooting>() != null) { PowerUpManager.Instance.Activate("DamageUp"); PopUpText.Instance.NewPopUp("Double Damage!"); } }; this.Type[5] = dmgPickup; SystemLogger.write("Damage Multiplier Pickup Initialized"); }
/// <summary> /// Add the multishot pickup to the pickup array /// </summary> public void AddMultishotPickup() { template multiPickup = (obj) => { if (obj.gameObject.GetComponent <Shooting>() != null) { PowerUpManager.Instance.Activate("Multishot"); PopUpText.Instance.NewPopUp("Multi Shot!"); } }; this.Type[4] = multiPickup; SystemLogger.write("Multishot Pickup Initialized"); }
/// <summary> /// Checks the invoke timeout. /// </summary> /// <param name='requestObject'> /// Request object. /// </param> private void CheckInvokeTimeout(object requestObject) { Thread.Sleep(ABSOLUTE_INVOKE_TIMEOUT); SystemLogger.Log(SystemLogger.Module.CORE, "Absolute timeout checking completed."); HttpWebRequest req = requestObject as HttpWebRequest; if (req != null) { SystemLogger.Log(SystemLogger.Module.CORE, "Aborting request..."); req.Abort(); // this causes a WebException with the Status property set to RequestCanceled // for any subsequent call to the GetResponse, BeginGetResponse, EndGetResponse, GetRequestStream, BeginGetRequestStream, or EndGetRequestStream methods. } }
public String JSONSerializeObjectData(object data) { try { string dataJSONString = Serialiser.Serialize(data); if (data is String) { dataJSONString = "'" + (data as String) + "'"; } return(dataJSONString); } catch (Exception ex) { SystemLogger.Log(SystemLogger.Module.PLATFORM, "Error trying to serialize object to JSON. Message; " + ex.Message); } return(null); }
public IValue GetEnvironmentVariable(string varName) { SystemLogger.Write("WARNING! Deprecated method: 'SystemInfo.GetEnvironmentVariable' is deprecated, use 'GetEnvironmentVariable' from global context"); string value = System.Environment.GetEnvironmentVariable(varName); if (value == null) { return(ValueFactory.Create()); } else { return(ValueFactory.Create(value)); } }
public int addStore(Store store) { int storeId = -1; try { //SqlConnection connection = Connector.getInstance().getSQLConnection(); //connection.Open(); lock (connection) { connection.Open(); using (var transaction = connection.BeginTransaction()) { //////////////////////////////////////////////// string sql = "INSERT INTO [dbo].[Stores] (storeId, name,description,numOfOwners,active)" + " VALUES (@storeId, @name, @description,@numOfOwners,@active)"; storeId = store.getStoreID(); string name = store.getStoreName(); string description = store.getDescription(); int numOfOwners = store.getNumberOfOwners(); int active = 0; if (store.isActive() == true) { active = 1; } LinkedList <PurchasePolicy> policies = store.getStorePolicyList(); foreach (PurchasePolicy p in policies) { addPolicyToDB(p, storeId); } connection.Execute(sql, new { storeId, name, description, numOfOwners, active }, transaction); stores.AddFirst(store); transaction.Commit(); connection.Close(); ///////////////////////// return(store.getStoreID()); } } } catch (Exception) { connection.Close(); SystemLogger.getErrorLog().Error("Connection error in function Addstore in DB Store store id " + storeId); throw new ConnectionException(); } }
/// <summary> /// Starts the monitoring all regions. /// </summary> public void StartMonitoringAllRegions() { rangingBeacons.Clear(); if (adapter != null) { if (adapter.IsScanning) { this.StopMonitoringBeacons(); } adapter.StartScanningForDevices(Guid.Empty); SystemLogger.Log(SystemLogger.Module.PLATFORM, "adapter.StartScanningForDevices(all)"); } }
public override void PresentLocalNotificationNow(NotificationData notification) { UIApplication.SharedApplication.InvokeOnMainThread(delegate { if (notification != null) { UILocalNotification localNotification = this.PrepareLocalNotification(notification); UIApplication.SharedApplication.PresentLocalNotificationNow(localNotification); } else { SystemLogger.Log(SystemLogger.Module.PLATFORM, "No suitable data object received for presenting local notification"); } }); }
private string getResourceLiteralValue(string key, string fullPathFilePlist, NSDictionary resourcesLiteral) { string resourceLiteralValue = string.Empty; try { resourceLiteralValue = ((NSString)resourcesLiteral.ObjectForKey(new NSString(key))); } catch (Exception e) { #if DEBUG SystemLogger.Log(SystemLogger.Module.PLATFORM, "Key:" + key + " not correctly configured on " + fullPathFilePlist + "Exception message:" + e.Message); #endif } return(resourceLiteralValue); }
public ServiceResult GetBy(string uuid) { try { UserManager userManager = new UserManager(Globals.DBConnectionKey, this.GetAuthToken(Request)); return(userManager.GetUser(uuid, true)); } catch (Exception ex) { SystemLogger logger = new SystemLogger(Globals.DBConnectionKey); logger.InsertError(ex.Message, "UsersController", "GetBy"); } return(ServiceResponse.Error()); }
/// <summary> /// Invokes the given service method, by using a json object as the invocation params. /// </summary> /// <param name="service">Service bean.</param> /// <param name="methodName">Method to be invoeked.</param> /// <param name="jsonString">Invocation params (json string: {"param1":"xxx","param2":"xxx", ...})</param> /// <returns>Result in byte array.</returns> public override byte[] InvokeService(Object service, string methodName, string jsonString) { object[] invokeParams = null; List <object> paramList = new List <object> (); try { if (jsonString != null) { object jsonData = serialiser.DeserializeObject(jsonString); int index = 1; bool readingParams = true; while (readingParams) { try { object jsonObject = ((IDictionary)jsonData) ["param" + index]; if (jsonObject != null) { paramList.Add(jsonObject); index++; } else { if (index <= ((IDictionary)jsonData).Count) { // param exists but is null value. paramList.Add(null); index++; } else { // no more params expected. readingParams = false; } } } catch (Exception) { readingParams = false; } } if (paramList.Count > 0) { invokeParams = paramList.ToArray(); } } } catch (Exception e) { SystemLogger.Log(SystemLogger.Module.CORE, "Exception invoking method [" + methodName + "] when parsing invocation parameters.", e); } return(InvokeService(service, methodName, invokeParams)); }
/// <summary> /// Returns the value of the requested column as a short. /// </summary> /// <param name="columnName">Column name.</param> /// <returns>Short (zero is returned on error casting to short type).</returns> public short GetShort(string columnName) { short result = 0; if (CurrentRow != null) { try { result = short.Parse(CurrentRow [Columns [columnName]].ToString()); } catch (Exception e) { SystemLogger.Log(SystemLogger.Module.CORE, "Error getting int value for column name [" + columnName + "].", e); } } return(result); }
/// <summary> /// Returns the value of the requested column as a short. /// </summary> /// <param name="columnIndex">Column index.</param> /// <returns>Short (zero is returned on error casting to short type).</returns> public short GetShort(int columnIndex) { short result = 0; if (CurrentRow != null) { try { result = short.Parse(CurrentRow [Columns [columnIndex]].ToString()); } catch (Exception e) { SystemLogger.Log(SystemLogger.Module.CORE, "Error getting long value for column index [" + columnIndex + "].", e); } } return(result); }
private string[] getLocaleSupportedXml() { List <string> idsLocale = new List <string>(); if (this.FileExists(I18NConfigFile)) { try { XmlTextReader reader = this.getXmlTextReader(I18NConfigFile); try { while (reader.Read()) { XmlNodeType nodeType = reader.NodeType; if ((nodeType == XmlNodeType.Element) && (reader.Name == SUPPORTED_LANGUAGE_TAG)) { string languageAndCountryId = readSingleAttribute(reader, ID_TAG); // we need the real language and country selected by deafult, if provided string defaultLanguage = readSingleAttribute(reader, LANGUAGE_ATTRIBUTE_NAME); string defaultCountry = readSingleAttribute(reader, COUNTRY_ATTRIBUTE_NAME); reader.Read(); // continue with next node if (defaultLanguage != null) { languageAndCountryId = (new Locale(defaultLanguage)).ToString(); if (defaultCountry != null) { languageAndCountryId = (new Locale(defaultLanguage + "-" + defaultCountry)).ToString(); } } idsLocale.Add(languageAndCountryId); } } } finally { reader.Close(); } } catch (UriFormatException e) { #if DEBUG SystemLogger.Log(SystemLogger.Module.CORE, "# loadSettings. Getting Content From XmlReader on file path: " + I18NConfigFile + ":" + e.Message); #endif } } return(idsLocale.ToArray()); }
/// <summary> /// Deletes the modules. /// </summary> /// <param name="modules">Modules.</param> public override void DeleteModules(Module[] modules) { List <Module> successlist = new List <Module> (); List <Module> failedlist = new List <Module> (); this.GetNotificationService().StartNotifyLoading(this.GetLocalizedMessage(DEFAULT_LOADING_MESSAGE_DELETE_MODULES)); try { foreach (Module module in modules) { bool moduleDeleted = false; try { string location = this.GetModuleLocation(module, false); string directoryName = Path.Combine(this.GetFileSystemService().GetDirectoryRoot().FullName, location); SystemLogger.Log(SystemLogger.Module.PLATFORM, "Deleting module under: " + location); if (Directory.Exists(directoryName)) { Directory.Delete(directoryName, true); moduleDeleted = true; } else { SystemLogger.Log(SystemLogger.Module.PLATFORM, "Module does not exists on filesystem. It couldn't be deleted."); } } catch (Exception ex) { SystemLogger.Log(SystemLogger.Module.PLATFORM, "Exception when deleting module [" + (module != null?module.Id:"undefined") + "]: " + ex.Message); } if (moduleDeleted) { successlist.Add(module); } else { failedlist.Add(module); } } } catch (Exception ex) { SystemLogger.Log(SystemLogger.Module.PLATFORM, "Exception when deleting modules: " + ex.Message); } UIApplication.SharedApplication.InvokeOnMainThread(delegate { IPhoneUtils.GetInstance().FireUnityJavascriptEvent("Appverse.AppLoader.onDeleteModulesFinished", new object [] { successlist.ToArray(), failedlist.ToArray() }); }); this.GetNotificationService().StopNotifyLoading(); }