public IEnumerator ConvertMultipleSongs(string folderPath)
        {
            string[] paths = Directory.GetDirectories(folderPath);
            core.uiManager.ProgressBarSetActive(true);
            core.uiManager.ProgressBarSetTitle("Importing songs");
            int i   = 0;
            int max = paths.Length;

            foreach (var path in paths)
            {
                try {
                    SongLoader.ConvertSong(path, core);
                }
                catch (Exception e) {
                    Console.WriteLine(e);
                }

                i++;
                core.uiManager.ProgressBarSetValue(1f / max * i);
                core.uiManager.ProgressBarSetTitle("Importing songs " + i + "/" + max);
                yield return(i);
            }
            core.uiManager.ProgressBarSetActive(false);
            reloadSongs = true;
        }
        static void Prefix(ref LevelPackLevelsTableView __instance, int row, ref HMUI.TableView ____tableView, ref bool ____showLevelPackHeader, ref IBeatmapLevelPack ____pack)
        {
            if (!SongLoader.AreSongsLoaded)
            {
                return;
            }

            if (____pack.beatmapLevelCollection.beatmapLevels.Length == 0)
            {
                return;
            }

            int num = ____showLevelPackHeader ? (row - 1) : row;

            num = Mathf.Clamp(num, 0, ____pack.beatmapLevelCollection.beatmapLevels.Length - 1);

            //     Console.WriteLine($"Num: {num}   Size: {____pack.beatmapLevelCollection.beatmapLevels.Length}");

            if (!(____pack.beatmapLevelCollection.beatmapLevels[num] is OverrideClasses.CustomLevel))
            {
                return;
            }

            OverrideClasses.CustomLevel customLevel = ____pack.beatmapLevelCollection.beatmapLevels[num] as OverrideClasses.CustomLevel;
            if (!customLevel)
            {
                return;
            }

            if (customLevel.coverImage == SongLoader.CustomSongsIcon)
            {
                SongLoader.LoadSprite(customLevel.customSongInfo.path + "/" + customLevel.customSongInfo.coverImagePath, customLevel);
            }
        }
    void Start()
    {
        string JSONSong = Application.dataPath + "\\Songs\\" + SongName + ".json";

        Song              = SongLoader.LoadSong(JSONSong);
        scoreDisplay      = GameObject.Find("ScoreDisplay").GetComponent <Text>();
        multiplierDisplay = GameObject.Find("MulitplierDisplay").GetComponent <Text>();


        //keep track of existing notes
        spawnedNotes = new List <GameObject>();

        //We will most likely be creating the spawn nodes in code rather than fetching them
        //Even more likely we will store raw positions in Vector3 rather than even needing GameObjects
        Transform spawnLocs = GameObject.Find("NoteSpawnLocs").transform;

        SpawnLocations = new GameObject[]
        {
            spawnLocs.GetChild(0).gameObject,
            spawnLocs.GetChild(1).gameObject,
            spawnLocs.GetChild(2).gameObject
        };

        //initialize spawn
        Debug.Log(Song.SpawnTime_SpawnLoc[0]);
        nextNote = Song.Spawn();
        //add method to event
        //spawnEvent.AddListener(Camera.main.gameObject.GetComponent<DebugText>().UpdateDebugText);
        spawnEvent.AddListener(SpawnNote);

        //hitbar set
        hitBar = GameObject.Find("HitBar");
    }
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            SongLoader.Loader = new StreamLoader();
            this.DataContext  = await SongLoader.Load();

            base.OnNavigatedTo(e);
        }
Exemple #5
0
    private IEnumerator SelectSong()
    {
        SongLoader.Instance.Load(ChartLocation, type, delegate(Song _song)
        {
            song = _song;
        });

        bool prepared = false;

        SongLoader.Instance.PrepareAudio(song, delegate()
        {
            prepared = true;
        });
        while (!prepared)
        {
            yield return(null);
        }

        AudioHelper.stopAllAudio();

        SongLoader.setSelected(gameObject);

        if (song.data.info.previewStart / 1000 > 15)
        {
            startTime = (float)song.data.info.previewStart / 1000;
        }

        AudioHelper.setAllAudioTime(startTime);
        AudioHelper.playAllAudio(0);
    }
Exemple #6
0
        public SongWindow(SongMeta meta)
        {
            _song = SongLoader.Load(meta);
            InitializeComponent();
            Text = $"Score: {meta.Artist} - {meta.Name} [{meta.Instrument}]";
            albumArtwork.Image = _song.GetCover();
            score1.SetSong(_song);

            _player = _song.GetSongPlayer();
            for (int x = 0; x < _player.Channels; x++)
            {
                AddFader(x);
            }


            seekBar1.Samples       = (long)(_player.Length.TotalSeconds * 44100.0 + 0.5);
            seekBar1.OnSliderDrop += i => _player.Position = TimeSpan.FromSeconds(i);
            _timer          = new Timer();
            _timer.Interval = 30;
            _timer.Tick    += TimerTick;
            _timer.Start();
            waveform1.WaveData       = _song.GetWaveform();
            waveform1.Sections       = _song.Sections;
            waveform1.Beats          = _song.Beats;
            waveform1.Looper.OnLoop += d => _player.Position = TimeSpan.FromSeconds(d);
        }
Exemple #7
0
 // Use this for initialization
 void Start()
 {
     songLoader     = gameManager.GetComponent <SongLoader>();
     soundConverter = gameManager.GetComponent <SoundConverter>();
     audioSource    = gameManager.GetComponent <AudioSource>();
     scoreScript    = gameManager.GetComponent <ScoreScript>();
 }
        public static void ShuffleAll(Context context)
        {
            var cursor    = SongLoader.CreateSongCursor(context, null, null);
            var trackList = SongLoader.GetSongListByCursor(cursor);
            var position  = 0;

            if (trackList.Length == 0 || Service == null)
            {
                return;
            }
            try
            {
                Service.SetShuffleMode(MusicService.SHUFFLE_NORMAL);
                var mCurrentId            = Service.GetAudioId();
                var mCurrentQueuePosition = GetQueuePosition();
                if (position != -1 && mCurrentQueuePosition == position &&
                    mCurrentId == trackList[position])
                {
                    var playlist = GetQueue();
                    if (Equals(trackList, playlist))
                    {
                        Service.Play();
                        return;
                    }
                }
                Service.Open(trackList, -1, -1, (int)MusicUtils.SourceTypeId.NA);
                Service.Play();
                cursor.Close();
                cursor = null;
            }
            catch { }
        }
Exemple #9
0
        private async Task ReloadAdapter()
        {
            await Task.Run(() =>
            {
                var list = SongLoader.GetAllSongs(Activity);
                _songListAdapter.UpdateData(list);
            });

            _songListAdapter.NotifyDataSetChanged();
        }
        public void LoadSongsSync(SongLoader loader)
        {
            NewLoad?.Invoke(this, EventArgs.Empty);
            var songs = loader.LoadSongs();

            LoadInitiated?.Invoke(this, songs.Count);
            UpdateLibrary(songs, false);
            library.InitialiseParts();
            LoadCompleted?.Invoke(this, EventArgs.Empty);
        }
 private void OpenBeatSaberSong()
 {
     StandaloneFileBrowser.OpenFolderPanelAsync("Open beatsaber Beatmap", "", true, delegate(string[] strings) {
         foreach (var path in strings)
         {
             SongLoader.ConvertSong(path, core);
         }
     });
     reloadSongs = true;
 }
Exemple #12
0
    /*
     * Create a new instance of SongLoader and attach it to the
     * provided game object.
     */
    public static SongLoader createSongLoader(GameObject gameObject)
    {
        SongLoader songLoaderObject = gameObject.AddComponent <SongLoader>();

        songLoaderObject.songDataTextFile = Resources.Load <TextAsset>("GhostFair");
        songLoaderObject.songFileAsString = songLoaderObject.songDataTextFile.text;

        songLoaderObject.songData =
            JsonUtility.FromJson <SongData>(songLoaderObject.songFileAsString);
        return(songLoaderObject);
    }
Exemple #13
0
 public void SongLoader_SongsLoadedEvent(SongLoader sender, List <CustomLevel> levels)
 {
     try
     {
         PlaylistsCollection.MatchSongsForAllPlaylists(true);
     }
     catch (Exception e)
     {
         Plugin.log.Critical("Unable to match songs for all playlists! Exception: " + e);
     }
 }
Exemple #14
0
 private void SongLoader_SongsLoadedEvent(SongLoader sender, List <CustomLevel> levels)
 {
     try
     {
         PlaylistsCollection.MatchSongsForAllPlaylists(true);
     }
     catch (Exception e)
     {
         Misc.Logger.Exception("Unable to match songs for all playlists! Exception: " + e);
     }
 }
Exemple #15
0
 /// <summary>
 /// Only gets called once during boot of BeatSaber.
 /// </summary>
 /// <param name="loader"></param>
 /// <param name="levels"></param>
 private void OnSongLoaderLoadedSongs(SongLoader loader, List <CustomLevel> levels)
 {
     Logger.Trace("OnSongLoaderLoadedSongs");
     try
     {
         _songBrowserUI.UpdateSongList();
     }
     catch (Exception e)
     {
         Logger.Exception("Exception during OnSongLoaderLoadedSongs: ", e);
     }
 }
Exemple #16
0
        public void SongsLoaded(SongLoader sender, List <CustomLevel> levels)
        {
            if (_multiplayerButton != null)
            {
                _multiplayerButton.interactable = true;
            }
            else
            {
                CreateUI();
            }

            SongInfo.GetOriginalLevelHashes();
        }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Debug.Log("Double songloader instance");
         Destroy(gameObject);
     }
     DontDestroyOnLoad(this.gameObject);
 }
Exemple #18
0
        private async Task LoadSong()
        {
            if (Activity is null)
            {
                return;
            }

            await Task.Run(() =>
            {
                _songListAdapter = new SongListAdapter((AppCompatActivity)Activity, SongLoader.GetAllSongs(Activity), false);
            });

            _recyclerView.AddItemDecoration(new DividerItemDecoration(Activity, DividerItemDecoration.Vertical));
        }
 /// <summary>
 /// Only gets called once during boot of BeatSaber.
 /// </summary>
 /// <param name="loader"></param>
 /// <param name="levels"></param>
 private void OnSongLoaderLoadedSongs(SongLoader loader, List <CustomLevel> levels)
 {
     Logger.Trace("OnSongLoaderLoadedSongs-SongBrowserApplication()");
     try
     {
         _songBrowserUI.UpdateLevelPackModel();
         _songBrowserUI.UpdateLevelDataModel();
         _songBrowserUI.RefreshSongList();
     }
     catch (Exception e)
     {
         Logger.Exception("Exception during OnSongLoaderLoadedSongs: ", e);
     }
 }
Exemple #20
0
        protected override void DidActivate()
        {
            log.Log("Activated!");

            ui          = BeatSaverUI._instance;
            _songLoader = FindObjectOfType <SongLoader>();

            UpdateAlreadyDownloadedSongs();

            if (_songListViewController == null)
            {
                _songListViewController = ui.CreateViewController <BeatSaverSongListViewController>();
                _songListViewController.rectTransform.anchorMin = new Vector2(0.3f, 0f);
                _songListViewController.rectTransform.anchorMax = new Vector2(0.7f, 1f);

                PushViewController(_songListViewController, true);
            }
            else
            {
                if (_viewControllers.IndexOf(_songListViewController) < 0)
                {
                    PushViewController(_songListViewController, true);
                }
            }
            _songListViewController.SelectTopButtons(TopButtonsState.Select);

            if (_backButton == null)
            {
                _backButton = ui.CreateBackButton(rectTransform);

                _backButton.onClick.AddListener(delegate()
                {
                    try
                    {
                        _songLoader.RefreshSongs();
                    }
                    catch (Exception e)
                    {
                        log.Exception("Can't refresh songs! EXCEPTION: " + e);
                    }
                    DismissModalViewController(null, false);
                });
            }

            GetPage(0);

            base.DidActivate();
        }
        private void OnSongsLoaded(SongLoader songLoader, List <CustomLevel> list)
        {
            SongLoader.SongsLoadedEvent -= OnSongsLoaded;
            _downloadButton.interactable = true;
            if (DoesSongExist(_queuedSong))
            {
                _ui.SetButtonText(ref _downloadButton, "Downloaded");
            }
            else
            {
                _ui.SetButtonText(ref _downloadButton, "Download");
            }

            _queuedSong = null;
            FindObjectOfType <LevelRequestFlowCoordinator>().CheckQueueAndUpdate(); //This kinda goes against the purpose of a flow controller, but I just want it to work.
        }
        public static long[] GetSongListByAlbum(Context context, long id)
        {
            var    projection = new [] { BaseColumns.Id };
            string selection  = $"{AudioColumns.AlbumId} = {id} AND {AudioColumns.IsMusic} = 1";
            var    cursor     = context.ContentResolver.Query(
                Media.ExternalContentUri, projection, selection, null,
                AudioColumns.Track + ", " + Media.DefaultSortOrder);

            if (cursor != null)
            {
                long[] mList = SongLoader.GetSongListByCursor(cursor);
                cursor.Close();
                cursor = null;
                return(mList);
            }
            return(new long[0]);
        }
 private void SongsLoaded(SongLoader sender, List <CustomLevel> levels)
 {
     if (BSMultiplayerClient._instance.ConnectToServer(selectedServerIP, selectedServerPort))
     {
         BSMultiplayerClient._instance.SendString(JsonUtility.ToJson(new ClientCommand(ClientCommandType.GetAvailableSongs)));
         BSMultiplayerClient._instance.SendString(JsonUtility.ToJson(new ClientCommand(ClientCommandType.GetServerState)));
         BSMultiplayerClient._instance.DataReceived += DataReceived;
         StartCoroutine(BSMultiplayerClient._instance.ReceiveFromServerCoroutine());
     }
     else
     {
         _loading = false;
         TextMeshProUGUI _errorText = ui.CreateText(rectTransform, String.Format("Can't connect to server!"), new Vector2(0f, -48f));
         _errorText.alignment = TextAlignmentOptions.Center;
         Destroy(_errorText.gameObject, 5f);
     }
 }
        public MainToolbarViewModel(SongLoader songLoader, CurrentSongService currentSongService, PrintService printService, ExportImageService saveService)
        {
            LoadState = new LoadState();
            this.printService = printService;
            this.saveService = saveService;
            this.currentSongService = currentSongService;

            SelectedGuitarPath = currentSongService.GuitarPath.Name;

            OpenFileCommand = new RelayCommand(songLoader.OpenFile);
            LoadDiskTracksCommand = new RelayCommand(songLoader.LoadDiskTracks);
            LoadDLCTracksCommand = new RelayCommand(songLoader.LoadDLCTracks);
            PrintCommand = new RelayCommand<TabControl>(PrintTab);
            SaveCommand = new RelayCommand<TabControl>(SaveTabImage);

            Messenger.Default.Register<SongChange>(this, (SongChange c) => { if (c == SongChange.Score) RaisePropertyChanged("IsATrackLoaded"); });
        }
        public static long[] GetSongListByArtist(Context context, long id)
        {
            var projection = new[] { BaseColumns.Id };
            var selection  = $"{AudioColumns.ArtistId} = {id} AND {AudioColumns.IsMusic} = 1";
            var cursor     = context.ContentResolver.Query(
                Media.ExternalContentUri, projection, selection, null,
                AudioColumns.AlbumKey + "," + AudioColumns.Track);

            if (cursor != null)
            {
                var list = SongLoader.GetSongListByCursor(cursor);
                cursor.Close();
                cursor = null;
                return(list);
            }
            return(new long[0]);
        }
        public MainViewModel(IDialogService dialogService, IErrorService errorService)
        {
            _dialogService = dialogService;
            _errorService  = errorService;
            songLoader     = new SongLoader(_dialogService, songManager);

            // Re-raise events for the view
            songManager.PropertyChanged += (sender, args) => this.OnPropertyChanged(args.PropertyName);
            songLoader.PropertyChanged  += (sender, args) => this.OnPropertyChanged(args.PropertyName);
            songLoader.PropertyChanged  += OnIsLoadingToggled;

            OpenFileCommand       = new RelayCommand(songLoader.OpenFile);
            LoadDiskTracksCommand = new RelayCommand(songLoader.LoadDiskTracks);
            LoadDLCTracksCommand  = new RelayCommand(songLoader.LoadDLCTracks);
            _showScoreInfoCommand = new RelayCommand(ShowScoreInfo, () => _score != null);

            SelectedGuitarPath = RockSmithTabExplorer.Properties.Settings.Default.GuitarPath;
        }
Exemple #27
0
        public MainToolbarViewModel(SongLoader songLoader, CurrentSongService currentSongService, PrintService printService, ExportImageService saveService)
        {
            LoadState               = new LoadState();
            this.printService       = printService;
            this.saveService        = saveService;
            this.currentSongService = currentSongService;

            SelectedGuitarPath = currentSongService.GuitarPath.Name;

            OpenFileCommand       = new RelayCommand(songLoader.OpenFile);
            LoadDiskTracksCommand = new RelayCommand(songLoader.LoadDiskTracks);
            LoadDLCTracksCommand  = new RelayCommand(songLoader.LoadDLCTracks);
            PrintCommand          = new RelayCommand <TabControl>(PrintTab);
            SaveCommand           = new RelayCommand <TabControl>(SaveTabImage);

            Messenger.Default.Register <SongChange>(this, (SongChange c) => { if (c == SongChange.Score)
                                                                              {
                                                                                  RaisePropertyChanged("IsATrackLoaded");
                                                                              }
                                                    });
        }
        public MainViewModel(IDialogService dialogService, IErrorService errorService, SongCollection songCollection)
        {
            _dialogService = dialogService;
            _errorService = errorService;
            this.songCollection = songCollection;
            songLoader = new SongLoader(_dialogService, songCollection);

            // Re-raise events for the view
            songCollection.PropertyChanged += (sender, args) => this.RaisePropertyChanged(args.PropertyName);
            songLoader.PropertyChanged += (sender, args) => this.RaisePropertyChanged(args.PropertyName);
            songLoader.PropertyChanged += OnIsLoadingToggled;

            OpenFileCommand = new RelayCommand(songLoader.OpenFile);
            LoadDiskTracksCommand = new RelayCommand(songLoader.LoadDiskTracks);
            LoadDLCTracksCommand = new RelayCommand(songLoader.LoadDLCTracks);

            SelectedGuitarPath = RockSmithTabExplorer.Properties.Settings.Default.GuitarPath;

            if (ViewModelBase.IsInDesignModeStatic)
                TrackToolBarVisible = true;
        }
Exemple #29
0
    /*
     * Create a new instance of LevelHelper and attach it to the
     * provided game object.
     */
    public static LevelHelper createLevelHelper(GameObject gameObject)
    {
        LevelHelper levelHelper = gameObject.AddComponent <LevelHelper>();

        levelHelper.songLoader = SongLoader.createSongLoader(gameObject);

        levelHelper.soundSections = levelHelper.songLoader.songData.sections;
        levelHelper.duration      = levelHelper.songLoader.songData.track.duration;
        levelHelper.fadeOut       = levelHelper.songLoader.songData.track.start_of_fade_out;
        levelHelper.levelLength   = Mathf.CeilToInt(
            levelHelper.secondsToUnitsConversion * levelHelper.duration
            );

        Camera camera = Camera.main;

        levelHelper.halfHeight       = camera.orthographicSize;
        levelHelper.halfWidth        = camera.aspect * levelHelper.halfHeight;
        levelHelper.startingPosition = -levelHelper.halfWidth;

        return(levelHelper);
    }
Exemple #30
0
        public MainViewModel(IDialogService dialogService, IErrorService errorService, SongCollection songCollection)
        {
            _dialogService      = dialogService;
            _errorService       = errorService;
            this.songCollection = songCollection;
            songLoader          = new SongLoader(_dialogService, songCollection);

            // Re-raise events for the view
            songCollection.PropertyChanged += (sender, args) => this.RaisePropertyChanged(args.PropertyName);
            songLoader.PropertyChanged     += (sender, args) => this.RaisePropertyChanged(args.PropertyName);
            songLoader.PropertyChanged     += OnIsLoadingToggled;

            OpenFileCommand       = new RelayCommand(songLoader.OpenFile);
            LoadDiskTracksCommand = new RelayCommand(songLoader.LoadDiskTracks);
            LoadDLCTracksCommand  = new RelayCommand(songLoader.LoadDLCTracks);

            SelectedGuitarPath = RockSmithTabExplorer.Properties.Settings.Default.GuitarPath;

            if (ViewModelBase.IsInDesignModeStatic)
            {
                TrackToolBarVisible = true;
            }
        }
Exemple #31
0
        private async Task <AudioClip> GetAudioClipFromSong(string pathToAudio)
        {
            AudioType audioType = Path.GetExtension(pathToAudio) == ".wav" ? AudioType.WAV : AudioType.OGGVORBIS;

            if (pathToAudio != null)
            {
                AudioClip clip = await SongLoader.LoadAudioClipFromMusic(pathToAudio, audioType);

                if (clip != null)
                {
                    return(clip);
                }
                else
                {
                    FlashMessage("error getting audio data. try again");
                    return(null);
                }
            }
            else
            {
                FlashMessage("no song selected! try again");
                return(null);
            }
        }
        public T LoadFromFile <T>(string assetName)
        {
            string extension = FileManager.GetExtension(assetName);

            if (FileManager.IsRelative(assetName))
            {
                // get the absolute path using the current relative directory
                assetName = FileManager.RelativeDirectory + assetName;
            }



            string fullNameWithType = assetName + typeof(T).Name;


            // get the dictionary by the contentManagerName.  If it doesn't exist, GetDisposableDictionaryByName
            // will create it.

            if (mDisposableDictionary.ContainsKey(fullNameWithType))
            {
#if PROFILE
                mHistory.Add(new ContentLoadHistory(
                                 TimeManager.CurrentTime, typeof(T).Name, fullNameWithType, ContentLoadDetail.Cached));
#endif

                return((T)mDisposableDictionary[fullNameWithType]);
            }
            else if (mNonDisposableDictionary.ContainsKey(fullNameWithType))
            {
                return((T)mNonDisposableDictionary[fullNameWithType]);
            }
            else
            {
#if PROFILE
                mHistory.Add(new ContentLoadHistory(
                                 TimeManager.CurrentTime,
                                 typeof(T).Name,
                                 fullNameWithType,
                                 ContentLoadDetail.HddFromFile));
#endif
#if DEBUG
                // The ThrowExceptionIfFileDoesntExist
                // call used to be done before the checks
                // in the dictionaries.  But whatever is held
                // in there may not really be a file so let's check
                // if the file exists after we check the dictionaries.
                FileManager.ThrowExceptionIfFileDoesntExist(assetName);
#endif

                IDisposable loadedAsset = null;

                if (typeof(T) == typeof(Texture2D) || typeof(T) == typeof(Microsoft.Xna.Framework.Graphics.Texture2D))
                {
                    // for now we'll create it here, eventually have it in a dictionary:
                    loadedAsset = textureContentLoader.Load(assetName);
                }

                #region Scene

                else if (typeof(T) == typeof(FlatRedBall.Scene))
                {
                    FlatRedBall.Scene scene = FlatRedBall.Content.Scene.SceneSave.FromFile(assetName).ToScene(mName);

                    object sceneAsObject = scene;

                    lock (mNonDisposableDictionary)
                    {
                        if (!mNonDisposableDictionary.ContainsKey(fullNameWithType))
                        {
                            mNonDisposableDictionary.Add(fullNameWithType, scene);
                        }
                    }
                    return((T)sceneAsObject);
                }

                #endregion

                #region EmitterList

                else if (typeof(T) == typeof(EmitterList))
                {
                    EmitterList emitterList = EmitterSaveList.FromFile(assetName).ToEmitterList(mName);


                    mNonDisposableDictionary.Add(fullNameWithType, emitterList);


                    return((T)((object)emitterList));
                }

                #endregion

                #region Image
#if !MONOGAME
                else if (typeof(T) == typeof(Image))
                {
                    switch (extension.ToLowerInvariant())
                    {
                    case "gif":
                        Image image = Image.FromFile(assetName);
                        loadedAsset = image;
                        break;
                    }
                }
#endif
                #endregion

                #region BitmapList
#if !XBOX360 && !SILVERLIGHT && !WINDOWS_PHONE && !MONOGAME
                else if (typeof(T) == typeof(BitmapList))
                {
                    loadedAsset = BitmapList.FromFile(assetName);
                }
#endif

                #endregion

                #region NodeNetwork
                else if (typeof(T) == typeof(NodeNetwork))
                {
                    NodeNetwork nodeNetwork = NodeNetworkSave.FromFile(assetName).ToNodeNetwork();

                    mNonDisposableDictionary.Add(fullNameWithType, nodeNetwork);

                    return((T)((object)nodeNetwork));
                }
                #endregion

                #region ShapeCollection

                else if (typeof(T) == typeof(ShapeCollection))
                {
                    ShapeCollection shapeCollection =
                        ShapeCollectionSave.FromFile(assetName).ToShapeCollection();

                    mNonDisposableDictionary.Add(fullNameWithType, shapeCollection);

                    return((T)((object)shapeCollection));
                }
                #endregion

                #region PositionedObjectList<Polygon>

                else if (typeof(T) == typeof(PositionedObjectList <FlatRedBall.Math.Geometry.Polygon>))
                {
                    PositionedObjectList <FlatRedBall.Math.Geometry.Polygon> polygons =
                        PolygonSaveList.FromFile(assetName).ToPolygonList();
                    mNonDisposableDictionary.Add(fullNameWithType, polygons);
                    return((T)((object)polygons));
                }

                #endregion

                #region AnimationChainList

                else if (typeof(T) == typeof(AnimationChainList))
                {
                    if (assetName.EndsWith("gif"))
                    {
#if WINDOWS_8 || UWP || DESKTOP_GL
                        throw new NotImplementedException();
#else
                        AnimationChainList acl = new AnimationChainList();
                        acl.Add(FlatRedBall.Graphics.Animation.AnimationChain.FromGif(assetName, this.mName));
                        acl[0].ParentGifFileName = assetName;
                        loadedAsset = acl;
#endif
                    }
                    else
                    {
                        loadedAsset =
                            AnimationChainListSave.FromFile(assetName).ToAnimationChainList(mName);
                    }

                    mNonDisposableDictionary.Add(fullNameWithType, loadedAsset);
                }

                #endregion

                else if (typeof(T) == typeof(Song))
                {
                    var loader = new SongLoader();
                    return((T)(object)loader.Load(assetName));
                }
#if MONOGAME
                else if (typeof(T) == typeof(SoundEffect))
                {
                    T soundEffect;

                    if (assetName.StartsWith(@".\") || assetName.StartsWith(@"./"))
                    {
                        soundEffect = base.Load <T>(assetName.Substring(2));
                    }
                    else
                    {
                        soundEffect = base.Load <T>(assetName);
                    }

                    return(soundEffect);
                }
#endif

                #region RuntimeCsvRepresentation

#if !SILVERLIGHT
                else if (typeof(T) == typeof(RuntimeCsvRepresentation))
                {
#if XBOX360
                    throw new NotImplementedException("Can't load CSV from file.  Try instead to use the content pipeline.");
#else
                    return((T)((object)CsvFileManager.CsvDeserializeToRuntime(assetName)));
#endif
                }
#endif


                #endregion

                #region SplineList

                else if (typeof(T) == typeof(List <Spline>))
                {
                    List <Spline> splineList = SplineSaveList.FromFile(assetName).ToSplineList();
                    mNonDisposableDictionary.Add(fullNameWithType, splineList);
                    object asObject = splineList;

                    return((T)asObject);
                }

                else if (typeof(T) == typeof(SplineList))
                {
                    SplineList splineList = SplineSaveList.FromFile(assetName).ToSplineList();
                    mNonDisposableDictionary.Add(fullNameWithType, splineList);
                    object asObject = splineList;

                    return((T)asObject);
                }

                #endregion

                #region BitmapFont

                else if (typeof(T) == typeof(BitmapFont))
                {
                    // We used to assume the texture is named the same as the font file
                    // But now FRB understands the .fnt file and gets the PNG from the font file
                    //string pngFile = FileManager.RemoveExtension(assetName) + ".png";
                    string fntFile = FileManager.RemoveExtension(assetName) + ".fnt";

                    BitmapFont bitmapFont = new BitmapFont(fntFile, this.mName);

                    object bitmapFontAsObject = bitmapFont;

                    return((T)bitmapFontAsObject);
                }

                #endregion


                #region Text

                else if (typeof(T) == typeof(string))
                {
                    return((T)((object)FileManager.FromFileText(assetName)));
                }

                #endregion

                #region Catch mistakes

#if DEBUG
                else if (typeof(T) == typeof(Spline))
                {
                    throw new Exception("Cannot load Splines.  Try using the List<Spline> type instead.");
                }
                else if (typeof(T) == typeof(Emitter))
                {
                    throw new Exception("Cannot load Emitters.  Try using the EmitterList type instead.");
                }
#endif

                #endregion

                #region else, exception!

                else
                {
                    throw new NotImplementedException("Cannot load content of type " +
                                                      typeof(T).AssemblyQualifiedName + " from file.  If you are loading " +
                                                      "through the content pipeline be sure to remove the extension of the file " +
                                                      "name.");
                }

                #endregion

                if (loadedAsset != null)
                {
                    lock (mDisposableDictionary)
                    {
                        // Multiple threads could try to load this content simultaneously
                        if (!mDisposableDictionary.ContainsKey(fullNameWithType))
                        {
                            mDisposableDictionary.Add(fullNameWithType, loadedAsset);
                        }
                    }
                }

                return((T)loadedAsset);
            }
        }