FindPackage() приватный Метод

private FindPackage ( [ packageFullName ) : Package
packageFullName [
Результат Windows.ApplicationModel.Package
Пример #1
0
    public string GetAppResourceStr(string resourcePath)
    {
        string resourceStr = null;

        AppResourceStrLock.EnterReadLock();
        AppResourceStrCache.TryGetValue(resourcePath, out resourceStr);
        AppResourceStrLock.ExitReadLock();
        if (resourceStr != null)
        {
            return(resourceStr);
        }

        var AppResource = TextHelpers.Split2(resourcePath.Substring(2, resourcePath.Length - 3), "?");

        Windows.ApplicationModel.Package package = packageManager.FindPackage(AppResource.Item1);
        if (package != null)
        {
            string pathToPri = Path.Combine(package.InstalledLocation.Path, "resources.pri");
            resourceStr = MiscFunc.GetResourceStr(pathToPri, AppResource.Item2);
        }

        if (resourceStr != null)
        {
            AppResourceStrLock.EnterWriteLock();
            if (!AppResourceStrCache.ContainsKey(resourcePath))
            {
                AppResourceStrCache.Add(resourcePath, resourceStr);
            }
            AppResourceStrLock.ExitWriteLock();
        }

        return(resourceStr == null ? resourcePath : resourceStr);
    }
Пример #2
0
    //////////////////////////////////////////////////////////////////////////////////////////////
    // App resource handling


    public string GetAppResourceStr(string resourcePath)
    {
        // Note: PackageManager requirers admin privilegs

        var AppResource = TextHelpers.Split2(resourcePath.Substring(2, resourcePath.Length - 3), "?");
        var package     = packageManager.FindPackage(AppResource.Item1);

        if (package != null)
        {
            string pathToPri = Path.Combine(package.InstalledLocation.Path, "resources.pri");
            return(MiscFunc.GetResourceStr(pathToPri, AppResource.Item2));
        }

        return(resourcePath);
    }