public virtual string GetDisplayName() { if (displayName == null) { displayName = ResourceBundles.GetCounterGroupName(GetName(), GetName()); } return(displayName); }
internal void LoadResourceBundles() { if (_rbloaded) { return; } _rbloaded = true; ResourceBundles.LoadZipFile(_zip, null); }
// Lock the object. Cannot simply use concurrent constructs on the counters // data-structure (like putIfAbsent) because of localization, limits etc. private T FindCounterImpl(string counterName, bool create) { lock (this) { T counter = counters[counterName]; if (counter == null && create) { string localized = ResourceBundles.GetCounterName(GetName(), counterName, counterName ); return(AddCounterImpl(counterName, localized, 0)); } return(counter); } }
public void ImportResourceBundle(string locale, string name, ResourceBundleContext context) { if (context == null) { context = new ResourceBundleContext(); } context.Locale = locale; ResourceBundles.CopyFlexLocale(locale); string key = locale + "$" + name; if (ContainsResourceBundle(key)) { return; } var rb = ResourceBundles.Get(locale, name); //NOTE: null in case of Dynamic Resource Modules!!! if (rb == null) { return; } var superType = ResourceBundleSuper; var instance = new AbcInstance(true) { ResourceBundleName = name, Locale = locale }; _rbcache[key] = instance; //NOTE: naming is strongly determined in Flex Resource Manager. string fullname = locale + '$' + name + "_properties"; instance.Name = DefineName(QName.Global(fullname)); instance.Flags = AbcClassFlags.Sealed | AbcClassFlags.ProtectedNamespace; instance.ProtectedNamespace = DefineProtectedNamespace(fullname); instance.BaseInstance = superType; instance.BaseTypeName = superType.Name; AddInstance(instance); instance.Initializer = DefineMethod( Sig.@void(), code => { code.PushThisScope(); code.LoadThis(); code.PushString(locale); code.PushString(name); code.ConstructSuper(2); code.ReturnVoid(); }); instance.Class.Initializer = DefineEmptyMethod(); var mn = DefineQName(instance.ProtectedNamespace, "getContent"); instance.DefineMethod( Sig.@override(mn, AvmTypeCode.Object), code => { int n = 0; var lines = rb.Content; for (int i = 0; i < lines.Length; ++i) { string line = lines[i]; context.Line = i + 1; context.ResourceBundle = rb; if (PushKeyValue(line, code, context)) { ++n; } } code.Add(InstructionCode.Newobject, n); code.ReturnValue(); } ); DefineScript(instance); }
protected internal virtual string LocalizeCounterName(string counterName) { return(ResourceBundles.GetCounterName(typeof(FileSystemCounter).FullName, counterName , counterName)); }
public override string GetDisplayName() { return(ResourceBundles.GetCounterName(groupName, GetName(), GetName())); }
/// <summary>Create a new counter group</summary> /// <param name="name">of the group</param> /// <param name="limits">the counters limits policy object</param> /// <returns>a new counter group</returns> public virtual G NewGroup(string name, Limits limits) { return(NewGroup(name, ResourceBundles.GetCounterGroupName(name, name), limits)); }