コード例 #1
0
    public static void BuildFileIndex()
    {
        string resPath = Application.dataPath.ToLower() + "/StreamingAssets/";
        ///----------------------创建文件列表-----------------------
        string newFilePath = resPath + "/files.txt";

        if (File.Exists(newFilePath))
        {
            File.Delete(newFilePath);
        }

        paths.Clear(); files.Clear();
        Recursive(resPath);

        FileStream   fs = new FileStream(newFilePath, FileMode.CreateNew);
        StreamWriter sw = new StreamWriter(fs);

        for (int i = 0; i < files.Count; i++)
        {
            string file = files[i];
            if (file.EndsWith(".meta") || file.Contains(".DS_Store"))
            {
                continue;
            }

            string md5   = AppConst.md5file(file);
            string value = file.Replace(resPath, string.Empty);
            sw.WriteLine(value + "|" + md5);
        }
        sw.Close(); fs.Close();
    }
コード例 #2
0
 static int md5file(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         string arg0 = ToLua.CheckString(L, 1);
         string o    = AppConst.md5file(arg0);
         LuaDLL.lua_pushstring(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }