Example #1
0
        public static string GetPath(string res)
        {
            if (IOPath.IsPathRooted(res))
            {
                return(res);
            }

            foreach (AppFW.ResourceManager.Category category in Enum.GetValues(typeof(AppFW.ResourceManager.Category)))
            {
                var path = AppFW.ResourceManager.TryGetPath(category, res);

                if (path != null)
                {
                    return(path);
                }
            }

            AppFW.Application app = AppFW.Application.Current;
            if (app != null)
            {
                string resPath = app.DirectoryInfo.Resource + res;
                if (File.Exists(resPath))
                {
                    return(resPath);
                }
            }

            return(res);
        }
        static string GetPath(string res)
        {
            if (Path.IsPathRooted(res))
            {
                return(res);
            }

            foreach (AppFW.ResourceManager.Category category in Enum.GetValues(typeof(AppFW.ResourceManager.Category)))
            {
                foreach (var file in new[] { res, res + ".jpg", res + ".png", res + ".gif" })
                {
                    var path = AppFW.ResourceManager.TryGetPath(category, file);

                    if (path != null)
                    {
                        return(path);
                    }
                }
            }

            AppFW.Application app = AppFW.Application.Current;
            if (app != null)
            {
                string resPath = app.DirectoryInfo.Resource + res;

                foreach (var file in new [] { resPath, resPath + ".jpg", resPath + ".png", resPath + ".gif" })
                {
                    if (File.Exists(file))
                    {
                        return(file);
                    }
                }
            }

            return(res);
        }