/// <summary> /// Collects info about data and injects it into track's assets list. /// </summary> public void RegisterAssets(Track track) { try { var filePaths = NTDFiles.Items; foreach (string file in filePaths) { // WEB ASSET if (Regex.IsMatch(file, WebAssetPattern)) { Match m = Regex.Match(file, WebAssetPattern); string url = m.Groups[1].Value; WebAsset webAsset = new WebAsset(url); track.Assets.Add(webAsset); continue; } // MODIFY if (_modifyMode) { Match m = Regex.Match(file, ModifyTrackPattern); if (m.Success) { int indexOfAsset = int.Parse(m.Groups[1].Value) - 1; track.Assets.Add(_track.Assets[indexOfAsset]); continue; } } // OTHER FILES FileInfo fi = new FileInfo(file); Type type = AssetConverter.GetAssetTypeByExtension(fi.Extension); var bytes = File.ReadAllBytes(file); var basset = new BinaryAsset(type, bytes); var asset = AssetConverter.ResolveBinaryAsset(basset); track.Assets.Add(asset); } } catch (Exception e) { throw new ForUserException( "A Problem occured during registering assets. Details: " + e.Message); } }