static bool Rename(ResourceDictionary rsrcDict, string ns, string name) { var resourceName = name + ".resources"; uint hash = GetResourceHash(resourceName); var resource = rsrcDict.GetAndRemove(hash, ns); if (resource == null) { return(false); } int index = resource.Name.String.LastIndexOf('.'); string resourceNamespace, newName; if (index < 0) { resourceNamespace = ""; newName = resourceName; } else { resourceNamespace = resource.Name.String.Substring(0, index); newName = resourceNamespace + "." + resourceName; } if (resourceNamespace != ns) { throw new ApplicationException("Invalid resource namespace"); } Logger.v("Restoring resource name: '{0}' => '{1}'", Utils.RemoveNewlines(resource.Name), Utils.RemoveNewlines(newName)); resource.Name = newName; return(true); }
static bool Rename(ResourceDictionary rsrcDict, string ns, string name) { var resourceName = name + ".resources"; uint hash = GetResourceHash(resourceName); var resource = rsrcDict.GetAndRemove(hash, ns); if (resource == null) return false; int index = resource.Name.String.LastIndexOf('.'); string resourceNamespace, newName; if (index < 0) { resourceNamespace = ""; newName = resourceName; } else { resourceNamespace = resource.Name.String.Substring(0, index); newName = resourceNamespace + "." + resourceName; } if (resourceNamespace != ns) throw new ApplicationException("Invalid resource namespace"); Logger.v("Restoring resource name: '{0}' => '{1}'", Utils.RemoveNewlines(resource.Name), Utils.RemoveNewlines(newName)); resource.Name = newName; return true; }