System.Resources.WindowsRuntimeResourceManager.FindPackageSimpleNameForFilename C# (CSharp) Méthode

FindPackageSimpleNameForFilename() private static méthode

private static FindPackageSimpleNameForFilename ( string libpath ) : string
libpath string
Résultat string
        private static string FindPackageSimpleNameForFilename(string libpath)
        {
            Debug.Assert(libpath != null);
            Debug.Assert(s_currentPackageInfo.Path != null); // Set in InitializeStatics()
            // s_currentPackageInfo.Name may be null (see note below)

            if (LibpathMatchesPackagepath(libpath, s_currentPackageInfo.Path))
                return s_currentPackageInfo.Name; // This may be null, in which case we failed to get the name (in InitializeStatics), but matched the path, so stop looking.
            else // Look at dependent packages
            {
                InitializeStaticsForDependentPackages();

                // s_dependentPackageInfoList is empty (but non-null) if there are no dependent packages.
                foreach (PackageInfo dependentPackageInfo in s_dependentPackageInfoList)
                {
                    if (LibpathMatchesPackagepath(libpath, dependentPackageInfo.Path))
                        return dependentPackageInfo.Name; // This may be null, in which case we failed to get the name (in InitializeStaticsForDependentPackages), but matched the path, so stop looking.
                }
            }

#if netstandard
            /* On phone libpath is usually ni path and not IL path as we do not touch the IL on phone.
               On Phone NI images are no longer under package root. Due to this above logic fails to
               find the package to which the library belongs. We assume that NI paths usually have
               package name as subfolder in its path. Based on this assumption we can find the package
               to which an NI belongs. Below code does that.
              */
            if (LibpathContainsPackagename(libpath, s_currentPackageInfo.FullName))
                return s_currentPackageInfo.Name;
            else // Look at dependent packages
            {
                // s_dependentPackageInfoList is empty (but non-null) if there are no dependent packages.
                foreach (PackageInfo dependentPackageInfo in s_dependentPackageInfoList)
                {
                    if (LibpathContainsPackagename(libpath, dependentPackageInfo.FullName))
                        return dependentPackageInfo.Name;
                }
            }
#endif
            return null;
        }