/// <summary> /// Returns the localized text for the specified result code. /// </summary> /// <param name="locale">The locale name in the format "[languagecode]-[country/regioncode]".</param> /// <param name="resultID">The result code identifier.</param> /// <returns>A message localized for the best match for the requested locale.</returns> public virtual string GetErrorText(string locale, ResultID resultID) { lock (this) { if (m_server == null) throw new NotConnectedException(); try { string currentLocale = GetLocale(); if (currentLocale != locale) { SetLocale(locale); } string errorText = null; ((IOPCCommon)m_server).GetErrorString(resultID.Code, out errorText); if (currentLocale != locale) { SetLocale(currentLocale); } return errorText; } catch (Exception e) { throw Interop.CreateException("IOPCServer.GetErrorString", e); } } }
/// <summary> /// Returns the localized text for the specified result code. /// </summary> /// <param name="locale">The locale name in the format "[languagecode]-[country/regioncode]".</param> /// <param name="resultID">The result code identifier.</param> /// <returns>A message localized for the best match for the requested locale.</returns> public string GetErrorText(string locale, ResultID resultID) { lock (this) { if (m_proxy == null) { throw new NotConnectedException(); } // fetch list of known locales. ArrayList knownLocales = new ArrayList(); knownLocales.AddRange(m_messageTables.Keys); // select best matching locale. string revisedLocale = Opc.Da.Server.FindBestLocale(locale, (string[])knownLocales.ToArray(typeof(string))); // find the message table for the locale. Hashtable messageTable = (Hashtable)m_messageTables[revisedLocale]; // lookup the error message. if (messageTable != null) { return((string)messageTable[resultID]); } // no matching message found. return(null); } }
// Token: 0x060000D3 RID: 211 RVA: 0x00009B0C File Offset: 0x00008B0C public virtual string GetErrorText(string locale, ResultID resultID) { string result; lock (this) { if (this.m_server == null) { throw new NotConnectedException(); } try { string locale2 = this.GetLocale(); if (locale2 != locale) { this.SetLocale(locale); } string text = null; ((IOPCCommon)this.m_server).GetErrorString(resultID.Code, out text); if (locale2 != locale) { this.SetLocale(locale2); } result = text; } catch (Exception e) { throw Interop.CreateException("IOPCServer.GetErrorString", e); } } return(result); }
public virtual string GetErrorText(string locale, ResultID resultID) { string str3; lock (this) { if (this.m_server == null) { throw new NotConnectedException(); } try { string str = this.GetLocale(); if (str != locale) { this.SetLocale(locale); } string ppString = null; ((IOPCCommon)this.m_server).GetErrorString(resultID.Code, out ppString); if (str != locale) { this.SetLocale(str); } str3 = ppString; } catch (Exception exception) { throw Interop.CreateException("IOPCServer.GetErrorString", exception); } } return(str3); }
/// <summary> /// Returns the localized text for the specified result code. /// </summary> /// <param name="locale">The locale name in the format "[languagecode]-[country/regioncode]".</param> /// <param name="resultID">The result code identifier.</param> /// <returns>A message localized for the best match for the requested locale.</returns> public override string GetErrorText(string locale, ResultID resultID) { lock (this) { if (m_server == null) { throw new NotConnectedException(); } try { string errorText = null; ((IOPCServer)m_server).GetErrorString( resultID.Code, OpcCom.Interop.GetLocale(locale), out errorText); return(errorText); } catch (Exception e) { throw OpcCom.Interop.CreateException("IOPCServer.GetErrorString", e); } } }
// Token: 0x06000807 RID: 2055 RVA: 0x00012E22 File Offset: 0x00011E22 public ItemPropertyCollection(ItemIdentifier itemID, ResultID resultID) { if (itemID != null) { this.m_itemName = itemID.ItemName; this.m_itemPath = itemID.ItemPath; } this.ResultID = resultID; }
/// <summary> /// Returns the localized text for the specified result code. /// </summary> /// <param name="locale">The locale name in the format "[languagecode]-[country/regioncode]".</param> /// <param name="resultID">The result code identifier.</param> /// <returns>A message localized for the best match for the requested locale.</returns> public string GetErrorText(string locale, ResultID resultID) { lock (this) { // determine the best supported locale. string revisedLocale = Opc.Da.Server.FindBestLocale(locale, m_cache.SupportedLocales); // lookup the string. return(m_cache.GetString(resultID.Name.Name, revisedLocale)); } }
public ResultID[] EnableConditionByArea(string[] areas) { lock (this) { if (m_server == null) { throw new NotConnectedException(); } if (areas == null || areas.Length == 0) { return(new ResultID[0]); } IntPtr ppErrors = IntPtr.Zero; int[] array = null; if (m_supportsAE11) { try { ((IOPCEventServer2)m_server).EnableConditionByArea2(areas.Length, areas, out ppErrors); } catch (Exception e) { throw OpcCom.Interop.CreateException("IOPCEventServer2.EnableConditionByArea2", e); } array = OpcCom.Interop.GetInt32s(ref ppErrors, areas.Length, deallocate: true); } else { try { ((IOPCEventServer)m_server).EnableConditionByArea(areas.Length, areas); } catch (Exception e2) { throw OpcCom.Interop.CreateException("IOPCEventServer.EnableConditionByArea", e2); } array = new int[areas.Length]; } ResultID[] array2 = new ResultID[array.Length]; for (int i = 0; i < array.Length; i++) { ref ResultID reference = ref array2[i]; reference = Interop.GetResultID(array[i]); } return(array2); }
internal static ResultID[] GetResultIDs(ref IntPtr pInput, int count, bool deallocate) { ResultID[] array = null; if (pInput != IntPtr.Zero && count > 0) { array = new ResultID[count]; int[] int32s = OpcCom.Interop.GetInt32s(ref pInput, count, deallocate); for (int i = 0; i < count; i++) { ref ResultID reference = ref array[i]; reference = OpcCom.Interop.GetResultID(int32s[i]); } }
internal static ResultID[] GetResultIDs(ref IntPtr pInput, int count, bool deallocate) { ResultID[] tidArray = null; if ((pInput != IntPtr.Zero) && (count > 0)) { tidArray = new ResultID[count]; int[] numArray = OpcCom.Interop.GetInt32s(ref pInput, count, deallocate); for (int i = 0; i < count; i++) { tidArray[i] = OpcCom.Interop.GetResultID(numArray[i]); } } return(tidArray); }
public ResultID[] EnableConditionBySource(string[] sources) { lock (this) { if (base.m_server == null) { throw new NotConnectedException(); } if ((sources == null) || (sources.Length == 0)) { return new ResultID[0]; } IntPtr zero = IntPtr.Zero; int[] numArray = null; if (this.m_supportsAE11) { try { ((IOPCEventServer2) base.m_server).EnableConditionBySource2(sources.Length, sources, out zero); } catch (Exception exception) { throw OpcCom.Interop.CreateException("IOPCEventServer2.EnableConditionBySource2", exception); } numArray = OpcCom.Interop.GetInt32s(ref zero, sources.Length, true); } else { try { ((IOPCEventServer) base.m_server).EnableConditionBySource(sources.Length, sources); } catch (Exception exception2) { throw OpcCom.Interop.CreateException("IOPCEventServer.EnableConditionBySource", exception2); } numArray = new int[sources.Length]; } ResultID[] tidArray = new ResultID[numArray.Length]; for (int i = 0; i < numArray.Length; i++) { tidArray[i] = OpcCom.Ae.Interop.GetResultID(numArray[i]); } return tidArray; } }
{ /// <summary> /// Converts an array of COM HRESULTs structures to .NET ResultID objects. /// </summary> internal static ResultID[] GetResultIDs(ref IntPtr pInput, int count, bool deallocate) { ResultID[] output = null; if (pInput != IntPtr.Zero && count > 0) { output = new ResultID[count]; int[] errors = OpcCom.Interop.GetInt32s(ref pInput, count, deallocate); for (int ii = 0; ii < count; ii++) { output[ii] = OpcCom.Interop.GetResultID(errors[ii]); } } return(output); }
private void GetValues(string itemID, ItemProperty[] properties) { try { int[] array = new int[properties.Length]; for (int i = 0; i < properties.Length; i++) { array[i] = properties[i].ID.Code; } IntPtr ppvData = IntPtr.Zero; IntPtr ppErrors = IntPtr.Zero; ((IOPCItemProperties)m_server).GetItemProperties(itemID, properties.Length, array, out ppvData, out ppErrors); object[] vARIANTs = Interop.GetVARIANTs(ref ppvData, properties.Length, deallocate: true); int[] int32s = Interop.GetInt32s(ref ppErrors, properties.Length, deallocate: true); for (int j = 0; j < properties.Length; j++) { properties[j].Value = null; if (properties[j].ResultID.Succeeded()) { properties[j].ResultID = Interop.GetResultID(int32s[j]); if (int32s[j] == -1073479674) { properties[j].ResultID = new ResultID(ResultID.Da.E_WRITEONLY, -1073479674L); } if (properties[j].ResultID.Succeeded()) { properties[j].Value = OpcCom.Da.Interop.UnmarshalPropertyValue(properties[j].ID, vARIANTs[j]); } } } } catch (Exception e) { ResultID resultID = new ResultID(Marshal.GetHRForException(e)); foreach (ItemProperty itemProperty in properties) { itemProperty.Value = null; itemProperty.ResultID = resultID; } } }
public ResultID[] AcknowledgeCondition(string acknowledgerID, string comment, EventAcknowledgement[] conditions) { lock (this) { if (base.m_server == null) { throw new NotConnectedException(); } if ((conditions == null) || (conditions.Length == 0)) { return new ResultID[0]; } int length = conditions.Length; string[] pszSource = new string[length]; string[] pszConditionName = new string[length]; OpcRcw.Ae.FILETIME[] pftActiveTime = new OpcRcw.Ae.FILETIME[length]; int[] pdwCookie = new int[length]; for (int i = 0; i < length; i++) { pszSource[i] = conditions[i].SourceName; pszConditionName[i] = conditions[i].ConditionName; pftActiveTime[i] = OpcCom.Ae.Interop.Convert(OpcCom.Interop.GetFILETIME(conditions[i].ActiveTime)); pdwCookie[i] = conditions[i].Cookie; } IntPtr zero = IntPtr.Zero; try { ((IOPCEventServer) base.m_server).AckCondition(conditions.Length, acknowledgerID, comment, pszSource, pszConditionName, pftActiveTime, pdwCookie, out zero); } catch (Exception exception) { throw OpcCom.Interop.CreateException("IOPCEventServer.AckCondition", exception); } int[] numArray2 = OpcCom.Interop.GetInt32s(ref zero, length, true); ResultID[] tidArray = new ResultID[length]; for (int j = 0; j < length; j++) { tidArray[j] = OpcCom.Ae.Interop.GetResultID(numArray2[j]); } return tidArray; } }
private void GetValues(string itemID, ItemProperty[] properties) { try { int[] pdwPropertyIDs = new int[properties.Length]; for (int i = 0; i < properties.Length; i++) { pdwPropertyIDs[i] = properties[i].ID.Code; } IntPtr zero = IntPtr.Zero; IntPtr ppErrors = IntPtr.Zero; ((IOPCItemProperties)base.m_server).GetItemProperties(itemID, properties.Length, pdwPropertyIDs, out zero, out ppErrors); object[] objArray = OpcCom.Interop.GetVARIANTs(ref zero, properties.Length, true); int[] numArray2 = OpcCom.Interop.GetInt32s(ref ppErrors, properties.Length, true); for (int j = 0; j < properties.Length; j++) { properties[j].Value = null; if (properties[j].ResultID.Succeeded()) { properties[j].ResultID = OpcCom.Interop.GetResultID(numArray2[j]); if (numArray2[j] == -1073479674) { properties[j].ResultID = new ResultID(ResultID.Da.E_WRITEONLY, -1073479674L); } if (properties[j].ResultID.Succeeded()) { properties[j].Value = OpcCom.Da.Interop.UnmarshalPropertyValue(properties[j].ID, objArray[j]); } } } } catch (Exception exception) { ResultID tid = new ResultID((long)Marshal.GetHRForException(exception)); foreach (ItemProperty property in properties) { property.Value = null; property.ResultID = tid; } } }
public override void Execute(IWorker worker) { var results = new List <TestResult>(); if (!ResultID.Equals(Guid.Empty)) { // get result by ID results.Add(worker.Results.GetResult(ResultID)); } else if (!string.IsNullOrEmpty(TestID)) { // get results by test ID results.AddRange(worker.Results.GetResults(TestID)); } else { // get all results results.AddRange(worker.Results.GetResults()); } Result = results; }
public override string GetErrorText(string locale, ResultID resultID) { string str2; lock (this) { if (base.m_server == null) { throw new NotConnectedException(); } try { string ppString = null; ((IOPCServer)base.m_server).GetErrorString(resultID.Code, OpcCom.Interop.GetLocale(locale), out ppString); str2 = ppString; } catch (Exception exception) { throw OpcCom.Interop.CreateException("IOPCServer.GetErrorString", exception); } } return(str2); }
public ResultID Update(RegisterUserViewModel user) { ResultID validity = IsValid(user); if (!string.IsNullOrEmpty(validity.Error)) { return(validity); } try { return(new ResultID { ID = repo.Update(user.ID, user.Name, user.Surname, user.Address, user.Country, HashPassword(user.Password), user.Username) }); } catch (Exception ex) { return(new ResultID { Error = "Failed to update user!" }); } }
// Token: 0x060004B8 RID: 1208 RVA: 0x0000E064 File Offset: 0x0000D064 public IdentifiedResult(ItemIdentifier item, ResultID resultID, string diagnosticInfo) : base(item) { this.ResultID = resultID; this.DiagnosticInfo = diagnosticInfo; }
// Token: 0x060004B7 RID: 1207 RVA: 0x0000E049 File Offset: 0x0000D049 public IdentifiedResult(ItemIdentifier item, ResultID resultID) : base(item) { this.ResultID = resultID; }
// Token: 0x060004B6 RID: 1206 RVA: 0x0000E027 File Offset: 0x0000D027 public IdentifiedResult(string itemName, ResultID resultID, string diagnosticInfo) : base(itemName) { this.ResultID = resultID; this.DiagnosticInfo = diagnosticInfo; }
// Token: 0x060004B5 RID: 1205 RVA: 0x0000E00C File Offset: 0x0000D00C public IdentifiedResult(string itemName, ResultID resultID) : base(itemName) { this.ResultID = resultID; }
/// <summary> /// Initializes the object with an qualified name and ResultID. /// </summary> public EnabledStateResult(string qualifiedName, ResultID resultID) { m_qualifiedName = qualifiedName; m_resultID = ResultID; }
// See ResultsLogger.cs for details public void AddResult(ResultID resultId) { s_ResultsIdsList.Add((int)resultId); }
/// <summary> /// Returns the localized text for the specified result code. /// </summary> /// <param name="locale">The locale name in the format "[languagecode]-[country/regioncode]".</param> /// <param name="resultID">The result code identifier.</param> /// <returns>A message localized for the best match for the requested locale.</returns> public string GetErrorText(string locale, ResultID resultID) { lock (this) { // determine the best supported locale. string revisedLocale = Opc.Da.Server.FindBestLocale(locale, m_cache.SupportedLocales); // lookup the string. return m_cache.GetString(resultID.Name.Name, revisedLocale); } }
/// <summary> /// Initializes the object with the specified ItemIdentifier, result code and diagnostic info. /// </summary> public ItemValueResult(ItemIdentifier item, ResultID resultID, string diagnosticInfo) : base(item) { ResultID = resultID; DiagnosticInfo = diagnosticInfo; }
/// <summary> /// Initialize object with the specified ItemIdentifier and result code. /// </summary> public ItemValueResult(ItemIdentifier item, ResultID resultID) : base(item) { ResultID = resultID; }
/// <summary> /// Initializes the object with the specified item name, result code and diagnostic info. /// </summary> public ItemValueResult(string itemName, ResultID resultID, string diagnosticInfo) : base(itemName) { ResultID = resultID; DiagnosticInfo = diagnosticInfo; }
/// <summary> /// Initializes the object with the specified item name and result code. /// </summary> public ItemValueResult(string itemName, ResultID resultID) : base(itemName) { ResultID = resultID; }
/// <summary> /// Initializes the object with an Item object and ResultID. /// </summary> public ItemResult(OpcItem item, ResultID resultID) : base(item) { ResultID = resultID; }
public static bool Log(ResultID resultId, params string[] extraParams) { if (!s_Results.ContainsKey(resultId)) { Debug.LogWarning($"[{CoverageSettings.PackageName}] ResultsLogger could not find result with id: {resultId}"); return(false); } ResultData result = s_Results[resultId]; string message = string.Concat( $"[{CoverageSettings.PackageName}] ", extraParams != null ? string.Format(result.message, extraParams) : result.message); switch (result.type) { case LogType.Log: if (VerbosityLevel <= LogVerbosityLevel.Info) { Debug.Log(message); } CoverageAnalytics.instance.AddResult(resultId); break; case LogType.Warning: if (VerbosityLevel <= LogVerbosityLevel.Warning) { Debug.LogWarning(message); } CoverageAnalytics.instance.AddResult(resultId); break; case LogType.Error: if (VerbosityLevel <= LogVerbosityLevel.Error) { Debug.LogError(message); } CoverageAnalytics.instance.AddResult(resultId); CoverageAnalytics.instance.SendCoverageEvent(false); break; case LogType.Assert: if (extraParams[0] != null && string.Equals(extraParams[0], "0")) { CoverageAnalytics.instance.AddResult(resultId); CoverageAnalytics.instance.SendCoverageEvent(false); Debug.Assert(false, message); } break; default: if (VerbosityLevel <= LogVerbosityLevel.Info) { Debug.Log(message); } CoverageAnalytics.instance.AddResult(resultId); break; } return(true); }