public List <FormDescription> GetResourceUsage(string currentFormName, string currentViewName, string resourceFileName, string resourceKey) { var ret = new List <FormDescription>(); // if resource is splitted - it isn't used on another forms if (!string.IsNullOrEmpty(ResourceSplitter.Read(string.IsNullOrEmpty(currentViewName) ? currentFormName : currentViewName, resourceKey))) { return(ret); } var retStrings = new Dictionary <string, FormDescription>(); foreach (FormDescriptionLink fdl in this[resourceFileName, resourceKey].Forms) { if (fdl.Form != currentFormName && !retStrings.ContainsKey(fdl.Form)) { retStrings.Add(fdl.Form, m_Forms[fdl.Form]); } } foreach (FormDescription f in retStrings.Values) { ret.Add(f); } return(ret); }
public override string GetResourceNameForComponent(Component component, DesignElement designType) { var key = GetKeyForComponent(component, designType); if (!string.IsNullOrEmpty(ResourceSplitter.Read(GetViewNameForSplittedResources(), key))) { return(string.Empty); } BvMessages.Get(key); if (BvMessages.Instance.IsValueExists) { return("BvMessages"); } if (Messages != null) { Messages.GetString(key); if (Messages.IsValueExists) { return(Messages.GetType().Name); } } var parentView = ParentLayout.ParentBasePanel as ITranslationView; if (parentView != null) { return(parentView.GetResourceNameForComponent(component, designType)); } return(base.GetResourceNameForComponent(component, designType)); }
public override string GetResourceNameForComponent(Component component, DesignElement designType) { var key = GetKeyForComponent(component, designType); if (!string.IsNullOrEmpty(ResourceSplitter.Read(GetViewNameForSplittedResources(), key))) { return(string.Empty); } return(CommonResource.EidssFields.ToString()); }
public void TestResourceSplitterRead() { const string fileToRead = @"TestSplittedResources.{0}.xml"; const string viewName = "viewName2"; const string resourceKey = "resourceKey2"; const string resourceValue = "resourceValue2"; const string lang = "ru-Ru"; string path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(ResourceSplitter)).Location); ResourceSplitter.Split(viewName, "EidssMessages", resourceKey, resourceValue, lang); ResourceSplitter.Save(fileToRead, path, viewName, "EidssMessages", resourceKey, resourceValue, lang); // try string resourceValueRead = ResourceSplitter.Read(fileToRead, path, viewName, resourceKey, lang); // Check the result Assert.AreEqual(resourceValue, resourceValueRead); }