Packager.BuildFileIndex C# (CSharp) Method

BuildFileIndex() static private method

static private BuildFileIndex ( ) : void
return void
    static void BuildFileIndex() {
        string resPath = AppDataPath + "/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];
            string ext = Path.GetExtension(file);
            if (file.EndsWith(".meta") || file.Contains(".DS_Store")) continue;

            string md5 = QUtil.md5file(file);
            string value = file.Replace(resPath, string.Empty);
            sw.WriteLine(value + "|" + md5);
        }
        sw.Close(); fs.Close();
    }

Usage Example

Exemplo n.º 1
0
    public static void AssetBundles_Build()
    {
        UBuildScript.BuildAssetBundles();

        Packager.BuildFileIndex();
        Debug.Log("Alert:Build assetbundles over.");
    }
All Usage Examples Of Packager::BuildFileIndex