Ejemplo n.º 1
0
        private static void WriteFile(string wwiseFolder, string hashPath, WwiseAsset asset)
        {
            var path = Path.Combine(wwiseFolder, asset.GetFilename());

            File.WriteAllBytes(path, asset.RawData);
            File.WriteAllBytes(hashPath, asset.hash);
        }
Ejemplo n.º 2
0
        public static bool UpdateWwiseFileIfNecessary(string wwiseFolder, WwiseAsset asset)
        {
            var hashPath = Path.Combine(wwiseFolder, asset.GetFilename() + ".md5");

            if (File.Exists(hashPath))
            {
                var existingHash = File.ReadAllBytes(hashPath);

                if (!AreHashesEqual(existingHash, asset.hash))
                {
                    // Different hash means file content has changed and needs to be updated
                    WriteFile(wwiseFolder, hashPath, asset);
                    return(true);
                }
            }
            else
            {
                // No hash means we are downloading the file for the first time
                WriteFile(wwiseFolder, hashPath, asset);
                return(true);
            }
            return(false);
        }