IsDirectoryExist() 공개 정적인 메소드

public static IsDirectoryExist ( string fullPath ) : bool
fullPath string
리턴 bool
예제 #1
0
        /// <summary>
        /// 保存md5文件 都更新成功后保存
        /// </summary>
        /// <param name="tabDictionary"></param>
        private void SaveMD5Table(Dictionary <string, FileInfo> tabDictionary)
        {
            string filename = Platform.Path + Platform.Md5FileName;

            if (FileManager.IsFileExist(filename))
            {
                FileManager.DeleteFile(filename);
            }
            string directory = Path.GetDirectoryName(filename);

            if (!string.IsNullOrEmpty(directory) && !FileManager.IsDirectoryExist(directory))
            {
                FileManager.CreateDirectory(directory);
            }
            try
            {
                using (var write = new StreamWriter(new FileStream(filename, FileMode.Create)))
                {
                    foreach (KeyValuePair <string, FileInfo> keyValuePair in tabDictionary)
                    {
                        write.WriteLine(keyValuePair.Key + "," + keyValuePair.Value.md5 + "," + keyValuePair.Value.size);
                    }
                }
            }
            catch (Exception e)
            {
                Debuger.LogError(e.Message);
            }
        }
예제 #2
0
    public static bool DeleteDirectory(string directory)
    {
        if (!FileManager.IsDirectoryExist(directory))
        {
            return(true);
        }
        int  num = 0;
        bool result;

        while (true)
        {
            try
            {
                //Directory.Delete(directory, true);
                result = true;
                break;
            }
            catch (Exception ex)
            {
                num++;
                if (num >= 3)
                {
                    Debug.Log("Delete Directory " + directory + " Error! Exception = " + ex.ToString());
                    FileManager.s_delegateOnOperateFileFail(directory, enFileOperation.DeleteDirectory);
                    result = false;
                    break;
                }
            }
        }
        return(result);
    }
 static void ClearTempFile()
 {
     if (FileManager.IsDirectoryExist(LuaConst.luaTempDir))
     {
         FileManager.DeleteDirectory(LuaConst.luaTempDir);
     }
     if (FileManager.IsDirectoryExist(ConfigConst.tempconfigDir))
     {
         FileManager.DeleteDirectory(ConfigConst.tempconfigDir);
     }
 }
예제 #4
0
 static public int IsDirectoryExist_s(IntPtr l)
 {
     try {
         System.String a1;
         checkType(l, 1, out a1);
         var ret = FileManager.IsDirectoryExist(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #5
0
        /// <summary>
        /// 处理资源拷贝的问题
        /// </summary>
        /// <returns></returns>
        IEnumerator Preprocess()
        {
            if (!FileManager.IsDirectoryExist(Platform.Path))
            {
                FileManager.ClearDirectory(Platform.Path);
            }
            if (oldmd5Table == null || oldmd5Table.Count == 0)
            {
                yield break;
            }
            foreach (KeyValuePair <string, FileInfo> keyValuePair in oldmd5Table)
            {
                FileInfo fileInfo = keyValuePair.Value;
                yield return(FileManager.StartCopyInitialFile(fileInfo.fullname));

                currentcopycount++;
            }
            isCopyDone = true;
            PlayerPrefsUtil.SetIntSimple(PlayerPrefsKey.IsCopyAssets, 1);
            GetCurrentVersion(true);
        }
예제 #6
0
        private void ClearResourceHasUpdate()
        {
            string filename = Platform.Path + Platform.HasUpdateFileName;

            if (FileManager.IsFileExist(filename))
            {
                FileManager.DeleteFile(filename);
            }
            string directory = Path.GetDirectoryName(filename);

            if (!string.IsNullOrEmpty(directory) && !FileManager.IsDirectoryExist(directory))
            {
                FileManager.CreateDirectory(directory);
            }
            try
            {
                File.Create(filename);
            }
            catch (Exception e)
            {
                Debuger.LogError(e.Message);
            }
        }