Beispiel #1
0
    private static void RecordUpdateAB(string starget)
    {
        DirectoryInfo path          = new DirectoryInfo(Application.dataPath + "/../update/" + _version + "/" + starget);
        JsonData      assetNameJson = new JsonData();

        foreach (FileInfo file in path.GetFiles("*.*", SearchOption.AllDirectories))
        {
            string name = file.Name;
            ToolUtil.WriteFile(path + "/" + name, GetEncryptBytes(file.FullName));
            JsonData resJson = new JsonData();
            resJson["name"] = name;
            resJson["md5"]  = ToolUtil.GetMD5(path + "/" + name);
            resJson["size"] = ToolUtil.GetFileSize(path + "/" + name);
            assetNameJson.Add(resJson);
        }

        JsonData verJson = new JsonData();

        verJson["ver"]         = Convert.ToInt32(_version);
        verJson["target"]      = starget;
        verJson["down"]        = _updateurl + _version + "/" + starget + "/";
        verJson["entryres"]    = ToolUtil.EntryRes;
        verJson["entryscript"] = ToolUtil.EntryScript;
        verJson["list"]        = assetNameJson;
        ToolUtil.SaveAndEncryptFile(path + "/assets.dat", verJson.ToJson());

        ToolUtil.SaveFile(Application.dataPath + "/../update/" + starget + "/assets.json", verJson.ToJson());
        Debug.Log("versionupdate -------->" + verJson.ToJson());
    }
Beispiel #2
0
    static void RecordABList(BuildTarget target)
    {
        DirectoryInfo path          = new DirectoryInfo(Application.dataPath + "/StreamingAssets/data");
        JsonData      assetNameJson = new JsonData();

        foreach (FileInfo file in path.GetFiles("*.*", SearchOption.AllDirectories))
        {
            string name = file.Name;
            if (name.EndsWith(".meta") || name.EndsWith(".manifest"))
            {
                continue;
            }

            ToolUtil.WriteFile(path + "/" + name, GetEncryptBytes(file.FullName));
            JsonData resJson = new JsonData();
            resJson["name"] = name;
            resJson["md5"]  = ToolUtil.GetMD5(path + "/" + name);
            resJson["size"] = ToolUtil.GetFileSize(path + "/" + name);
            assetNameJson.Add(resJson);
        }

        JsonData verJson = new JsonData();

        verJson["ver"] = Convert.ToInt32(_version);
        if (target == BuildTarget.iOS)
        {
            verJson["target"] = "IOS";
            verJson["down"]   = _updateurl + _version + "/ios/";
        }
        else if (target == BuildTarget.Android)
        {
            verJson["target"] = "Android";
            verJson["down"]   = _updateurl + _version + "/android/";
        }
        verJson["entryres"]    = ToolUtil.EntryRes;
        verJson["entryscript"] = ToolUtil.EntryScript;
        verJson["list"]        = assetNameJson;
        ToolUtil.SaveAndEncryptFile(path + "/assets.dat", verJson.ToJson());

        ToolUtil.SaveFile(Application.dataPath + "/StreamingAssets/assetlist.txt", verJson.ToJson());
        Debug.Log("version -------->" + verJson.ToJson());
    }