Exemplo n.º 1
0
 public void Save()
 {
     if (m_fileStore != null)
     {
         // Backed by store
         m_fileStore.CreateDirectory(AssetPath.GetDirectoryName(m_savePath));
         using (var stream = new StringWriter())
         {
             Save(stream);
             m_fileStore.SaveTextFile(m_savePath, stream.ToString());
         }
     }
     else
     {
         // Backed by filesystem
         Directory.CreateDirectory(Path.GetDirectoryName(m_savePath));
         using (var stream = new StreamWriter(m_savePath))
         {
             Save(stream);
         }
     }
     Modified = false;
 }
Exemplo n.º 2
0
        private static void LoadAsset(string path, bool reloadIfSourceUnchanged)
        {
            var extension = AssetPath.GetExtension(path);
            var type      = LookupType(extension);

            if (type != null)
            {
                if (type.Compound)
                {
                    var sources = new List <IAssetSource>();
                    for (int i = 0; i < s_assetSources.Count; ++i)
                    {
                        var source = s_assetSources[i];
                        if (source.CanLoad(path))
                        {
                            sources.Add(source);
                        }
                    }
                    if (sources.Count > 0)
                    {
                        LoadCompoundAsset(path, sources, reloadIfSourceUnchanged);
                    }
                }
                else
                {
                    for (int i = s_assetSources.Count - 1; i >= 0; --i)
                    {
                        var source = s_assetSources[i];
                        if (source.CanLoad(path))
                        {
                            LoadBasicAsset(path, source, reloadIfSourceUnchanged);
                            return;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
 public Language(string path)
 {
     m_path         = path;
     m_code         = AssetPath.GetFileNameWithoutExtension(path);
     m_translations = new Dictionary <string, string>();
 }
Exemplo n.º 4
0
 private string Resolve(string path)
 {
     return(AssetPath.Combine(m_rootPath, path));
 }
Exemplo n.º 5
0
 public bool CanLoad(string path)
 {
     return
         (Assets.GetType(AssetPath.GetExtension(path)) != null &&
          m_fileStore.FileExists(path));
 }