예제 #1
0
파일: RhoFile.cs 프로젝트: nhinze/rhodes
        public static byte[] readResourceFile(String path)
        {
            byte[] content = new byte[0];
            path = CFilePath.removeFirstSlash(path);

            if (!CRhoFile.isResourceFileExist(path))
            {
                return(content);
            }

            var task = StorageFile.GetFileFromApplicationUriAsync(new Uri(path, UriKind.Relative)).AsTask();

            task.Wait();
            var sr         = task.Result;
            var streamTask = sr.OpenStreamForReadAsync();

            streamTask.Wait();

            using (System.IO.BinaryReader br = new BinaryReader(streamTask.Result))
            {
                content = br.ReadBytes((int)streamTask.Result.Length);
            }

            return(content);
        }
예제 #2
0
파일: RhoFile.cs 프로젝트: joelbm24/rhodes
        public static byte[] readResourceFile(String path)
        {
            byte[] content = new byte[0];
            path = CFilePath.removeFirstSlash(path);

            if (!CRhoFile.isResourceFileExist(path))
            {
                return(content);
            }

            StreamResourceInfo sr = Application.GetResourceStream(new Uri(path, UriKind.Relative));

            using (System.IO.BinaryReader br = new BinaryReader(sr.Stream))
            {
                content = br.ReadBytes((int)sr.Stream.Length);
            }

            return(content);
        }
예제 #3
0
파일: RhoFile.cs 프로젝트: joelbm24/rhodes
        public static String readStringFromResourceFile(String path)
        {
            string content = "";

            path = CFilePath.removeFirstSlash(path);

            if (!CRhoFile.isResourceFileExist(path))
            {
                return(content);
            }

            StreamResourceInfo sr = Application.GetResourceStream(new Uri(path, UriKind.Relative));

            using (System.IO.BinaryReader br = new BinaryReader(sr.Stream))
            {
                char[] str = br.ReadChars((int)sr.Stream.Length);
                content = new string(str);
            }

            return(content);
        }