Exemplo n.º 1
0
        private long getImportedFileSize(string path)
        {
            if (!string.IsNullOrEmpty(path))
            {
                string guid = AssetDatabase.AssetPathToGUID(path);
                if (guid.Length < 2)
                {
                    //Debug.Log(assetPath + " has no guid? value is \"" + guid + "\"");
                    return(-1);
                }

                string assetImportedPath = System.IO.Path.GetFullPath(Application.dataPath + "../../Library/cache/" + guid.Substring(0, 2) + "/" + guid);

                if (File.Exists(assetImportedPath))
                {
                    return(AssetHunterHelper.GetActualFileSize(assetImportedPath));
                }
                else
                {
                    assetImportedPath = System.IO.Path.GetFullPath(Application.dataPath + "../../Library/metadata/" + guid.Substring(0, 2) + "/" + guid);
                    string addedResourcePath = System.IO.Path.GetFullPath(Application.dataPath + "../../Library/metadata/" + guid.Substring(0, 2) + "/" + guid + ".resource");

                    //The additional resource file (i.e. audioclips have a file + a resource file)
                    long resourceSize = File.Exists(assetImportedPath) ? AssetHunterHelper.GetActualFileSize(addedResourcePath) : 0;

                    if (File.Exists(assetImportedPath))
                    {
                        return(AssetHunterHelper.GetActualFileSize(assetImportedPath) + resourceSize);
                    }
                }
            }

            //Fallback return -1;
            return(-1);
        }
Exemplo n.º 2
0
 public AssemblyInfo(System.Reflection.Assembly assembly)
 {
     this.AssemblyName = assembly.ManifestModule.Name;
     this.size         = AssetHunterHelper.GetActualFileSize(assembly.Location);
     this.sizeString   = (this.size != -1) ? AssetHunterHelper.SizeSuffix(this.size, 1) : "NA";
 }