public static ExchangeResourceManager GetResourceManager(string baseName, Assembly assembly) { if (null == assembly) { throw new ArgumentNullException("assembly"); } string key = baseName + assembly.GetName().Name; ExchangeResourceManager result; lock (ExchangeResourceManager.resourceManagers) { ExchangeResourceManager exchangeResourceManager = null; if (!ExchangeResourceManager.resourceManagers.TryGetValue(key, out exchangeResourceManager)) { exchangeResourceManager = new ExchangeResourceManager(baseName, assembly); ExchangeResourceManager.resourceManagers.Add(key, exchangeResourceManager); } result = exchangeResourceManager; } return(result); }
public Concurrent(ExchangeResourceManager resourceManager) : base(resourceManager.BaseName, resourceManager.MainAssembly) { this.resourceManager = resourceManager; }
public LocalizedString(string id, string stringId, bool showStringIdIfError, bool showAssistanceInfoIfError, ExchangeResourceManager resourceManager, params object[] inserts) { if (id == null) { throw new ArgumentNullException("id"); } if (resourceManager == null) { throw new ArgumentNullException("resourceManager"); } this.Id = id; this.stringId = stringId; this.showStringIdInUIIfError = showStringIdIfError; this.showAssistanceInfoInUIIfError = showAssistanceInfoIfError; this.ResourceManager = resourceManager; this.DeserializedFallback = null; this.Inserts = ((inserts != null && inserts.Length > 0) ? inserts : null); this.formatParameters = ((this.Inserts != null) ? new ReadOnlyCollection <object>(this.Inserts) : null); }
private LocalizedString(SerializationInfo info, StreamingContext context) { this.Inserts = (object[])info.GetValue("inserts", typeof(object[])); this.formatParameters = ((this.Inserts != null) ? new ReadOnlyCollection <object>(this.Inserts) : null); this.ResourceManager = null; this.Id = null; this.stringId = null; this.showStringIdInUIIfError = false; this.showAssistanceInfoInUIIfError = false; this.DeserializedFallback = null; string text = null; try { string @string = info.GetString("baseName"); text = info.GetString("fallback"); if (!string.IsNullOrEmpty(@string)) { string string2 = info.GetString("assemblyName"); Assembly assembly = Assembly.Load(new AssemblyName(string2)); this.ResourceManager = ExchangeResourceManager.GetResourceManager(@string, assembly); this.Id = info.GetString("id"); if (this.ResourceManager.GetString(this.Id) == null) { this.ResourceManager = null; } else { this.DeserializedFallback = text; try { this.stringId = info.GetString("stringId"); this.showStringIdInUIIfError = info.GetBoolean("showStringIdInUIIfError"); this.showAssistanceInfoInUIIfError = info.GetBoolean("showAssistanceInfoInUIIfError"); } catch (SerializationException) { this.stringId = null; this.showStringIdInUIIfError = false; this.showAssistanceInfoInUIIfError = false; } } } } catch (SerializationException) { this.ResourceManager = null; } catch (FileNotFoundException) { this.ResourceManager = null; } catch (FileLoadException) { this.ResourceManager = null; } catch (MissingManifestResourceException) { this.ResourceManager = null; } if (this.ResourceManager == null) { this.Id = text; } }
public LocalizedString(string id, ExchangeResourceManager resourceManager, params object[] inserts) { this = new LocalizedString(id, null, false, false, resourceManager, inserts); }