예제 #1
0
 public static void SaveFile(String p_FilePath, ByteBuffe p_Buffe)
 {
     if (!String.IsNullOrEmpty(p_FilePath) && p_Buffe.Count > 0)
     {
         IsolatedStorageManager.CreateImageFile(p_FilePath, p_Buffe.ToArrary());
     }
 }
예제 #2
0
 /// <summary>
 /// 读取指定文件内容
 /// </summary>
 /// <param name="p_IsContent">是否在项目的内容管理器里</param>
 /// <param name="p_FileName">文件名</param>
 /// <returns></returns>
 public static Stream ReadFile(bool p_IsContent, String p_FileName)
 {
     if (p_IsContent)
     {
         return(ContentManager.ReadFile(p_FileName));
     }
     else
     {
         return(IsolatedStorageManager.ReadFile(p_FileName));
     }
 }
        /// <summary>
        /// 保存文件
        /// </summary>
        /// <param name="p_DirectoryName">文件夹名称</param>
        /// <param name="p_FileName">文件名称</param>
        /// <param name="p_bytes">文件内容</param>
        /// <returns></returns>
        public static bool CreateImageFile(String p_FilePath, byte[] p_bytes)
        {
            String path = Path.GetDirectoryName(p_FilePath);

            if (!IsolatedStorageManager.DirectoryExists(path))
            {
                IsolatedStorageManager.CreateDirectory(path);
            }

            if (!ValidFilePath(p_FilePath))
            {
                using (IsolatedStorageFileStream stream = StorageFileManage.OpenFile(p_FilePath, FileMode.Create))
                {
                    stream.Write(p_bytes, 0, p_bytes.Length);
                }
                return(true);
            }
            return(false);
        }
예제 #4
0
 /// <summary>
 /// 文件是否存在
 /// </summary>
 /// <param name="p_FilePath">文件路径</param>
 /// <returns></returns>
 public static bool IsolatedStorageFileExists(String p_FilePath)
 {
     return(IsolatedStorageManager.FileExists(p_FilePath));
 }
예제 #5
0
 /// <summary>
 /// 文件夹是否存在
 /// </summary>
 /// <param name="p_DirPath">文件夹路径</param>
 /// <returns></returns>
 public static bool IsolatedStorageDirectoryExists(String p_DirPath)
 {
     return(IsolatedStorageManager.DirectoryExists(p_DirPath));
 }
예제 #6
0
 /// <summary>
 /// 创建用户存储区目录
 /// </summary>
 /// <param name="p_Path">全路径</param>
 public static void CreateIsolatedStorageDirectory(String p_Path)
 {
     IsolatedStorageManager.CreateDirectory(p_Path);
 }
예제 #7
0
 /// <summary>
 /// 获取存储目录的文件夹
 /// </summary>
 /// <param name="p_SearchPattern">筛选条件</param>
 /// <returns></returns>
 public static String[] GetIsolatedStorageDirectory(String p_SearchPattern)
 {
     return(IsolatedStorageManager.GetDirectorys(p_SearchPattern));
 }