Пример #1
0
        /// <summary>
        /// 获取文件Uri
        /// </summary>
        /// <param name="filePath">完整路径或相对路径</param>
        /// <param name="isFileFullPath">只是是否是完整路径</param>
        /// <returns></returns>
        public static string GetFileAbsoluteUri(string filePath, bool isFileFullPath = false)
        {
            UriBuilder uriBuilder = new UriBuilder();

            uriBuilder.Host   = String.Empty;
            uriBuilder.Scheme = Uri.UriSchemeFile;
            uriBuilder.Path   = ((isFileFullPath) ? filePath : PathHelper.GetFullPath(filePath));//Path.Combine(PathHelper.GetRootPath(),filePath);
            Uri fileUri = uriBuilder.Uri;

            return(fileUri.ToString());
        }
Пример #2
0
        public Resource(string relativePath, string resourceBaseName)
        {
            if (Thread.CurrentThread.CurrentCulture == null)
            {
                Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(Cultures.zhCN);
            }
            string currentCulture = Thread.CurrentThread.CurrentCulture.Name;

            if (relativePath != "")
            {
                rm = ResourceManager.CreateFileBasedResourceManager(resourceBaseName, PathHelper.GetFullPath(Path.Combine("/", relativePath, "/", currentCulture, "/")), null);
            }
            else
            {
                rm = ResourceManager.CreateFileBasedResourceManager(resourceBaseName, PathHelper.GetFullPath(Path.Combine("/", currentCulture, "/")), null);
            }
        }