Exemplo n.º 1
0
    public static void GenerateVersionInfo(BuildTarget buildTarget, int versionCode = 0)
    {
        if (versionCode == 0)
        {
            versionCode = GameVersion.code;
        }

        GameConfig.VersionInfo version = new GameConfig.VersionInfo(versionCode);

        string mainifestPath = Path.Combine(XManifest.updateRenameResOutputPath, XManifest.name);

        if (File.Exists(mainifestPath))
        {
            version.ManifestChecksum = GHelper.ComputeFileChecksum(mainifestPath);
        }

        version.ResRoot        = "http://cdn-tf02.dev.tapenjoy.com/";
        version.ResRootPublish = "http://lf3-ma18cdn-cn.dailygn.com/obj/light-game-cn/ma18/tf02/";

        string content = LitJson.JsonMapper.ToJson(version);

        Debug.Log(string.Format("version content: {0}", content));

        string path = Path.Combine(Environment.CurrentDirectory, string.Format("build/ver/{0}", XManifest.GetPlatformFolder(EditorUserBuildSettings.activeBuildTarget)));

        if (Directory.Exists(path))
        {
            Directory.Delete(path, true);
        }
        Directory.CreateDirectory(path);

        string name = Path.Combine(path, "ver.txt");

        Debug.Log(String.Format("version file save at: {0}", name));

        try
        {
            FileStream fs = new FileStream(name, FileMode.Create);
            System.Text.UTF8Encoding utf8 = new System.Text.UTF8Encoding(false);
            StreamWriter             sw   = new StreamWriter(fs, utf8);
            sw.Write(content);
            sw.Close();
            fs.Close();
        }
        catch (IOException e)
        {
            Debug.Log(e.Message);
        }

        //GenerateShareConfigJson(version.GetVersionCode());
        GenerateInnerVersionInfo(buildTarget, versionCode);
    }
Exemplo n.º 2
0
    public static void GetFileInfo(string path, out uint checksum, out uint size)
    {
        FileInfo info = new FileInfo(path);

        if (info == null)
        {
            Debug.LogError("path not exsit:" + path);
            checksum = 0;
            size     = 0;
        }
        else
        {
            size     = (uint)info.Length;
            checksum = GHelper.ComputeFileChecksum(path);
        }
    }