Ejemplo n.º 1
0
        private object GetEmbeddedAssetPropertyValue(EmbeddedAsset embedded)
        {
            if (embedded == null) return null;
            var assetPath = AssetDatabase.GetAssetPath(embedded.textAsset);
            if (String.IsNullOrEmpty(assetPath)) return null;

            var assetName = Path.GetFileName(assetPath);
            Dictionary<string, object> assetInfo = new Dictionary<string, object>();
            assetInfo.Add("type", embedded.GetType().FullName);
            assetInfo.Add("filename", assetName);
            assetInfo.Add("embedded", true);
            if (embedded.encoding == BabylonTextEncoding.RawBytes)
            {
                assetInfo.Add("base64", Convert.ToBase64String(embedded.textAsset.bytes));
            }
            else
            {
                assetInfo.Add("base64", Tools.FormatBase64(embedded.textAsset.text));
            }
            return assetInfo;
        }