Example #1
0
		public Yield DeleteSource(DreamContext context, DreamMessage request, Result<DreamMessage> response)
		{
			Result<bool> result = new Result<bool>();
			yield return Context.Current.Instance.SourceController.Delete(context.GetParam("id"), context.GetParam("rev",null), result);

			response.Return(DreamMessage.Ok(MimeType.JSON, result.Value.ToString()));
		} 
 public Yield SubscribeToChange(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
     uint pageId = context.GetParam<uint>("pageid");
     string depth = context.GetParam("depth", "0");
     Result<UserInfo> userResult;
     yield return userResult = Coroutine.Invoke(GetUserInfo, true, request, new Result<UserInfo>()).Catch();
     if(userResult.HasException) {
         ReturnUserError(userResult.Exception, response);
         yield break;
     }
     UserInfo userInfo = userResult.Value;
     DreamMessage pageAuth = null;
     yield return _deki
         .At("pages", pageId.ToString(), "allowed")
         .With("permissions", "read,subscribe")
         .WithHeaders(request.Headers)
         .Post(new XDoc("users").Start("user").Attr("id", userInfo.Id).End(), new Result<DreamMessage>())
         .Set(x => pageAuth = x);
     if(!pageAuth.IsSuccessful || pageAuth.ToDocument()["user/@id"].AsText != userInfo.Id.ToString()) {
         throw new DreamForbiddenException("User not permitted to subscribe to page");
     }
     userInfo.AddResource(pageId, depth);
     userInfo.Save();
     response.Return(DreamMessage.Ok());
     yield break;
 }
 public Yield SubscribeToChange(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
     var wikiId = GetWikiIdFromRequest(request);
     var pageId = context.GetParam<uint>("pageid");
     var depth = context.GetParam("depth", "0") == "0" ? false : true;
     Result<PageSubscriptionUser> userResult;
     yield return userResult = Coroutine.Invoke(GetRequestUser, request, new Result<PageSubscriptionUser>()).Catch();
     if(userResult.HasException) {
         ReturnUserError(userResult.Exception, response);
         yield break;
     }
     var userInfo = userResult.Value;
     DreamMessage pageAuth = null;
     yield return _deki
         .At("pages", pageId.ToString(), "allowed")
         .With("permissions", "read,subscribe")
         .WithHeaders(request.Headers)
         .Post(new XDoc("users").Start("user").Attr("id", userInfo.Id).End(), new Result<DreamMessage>())
         .Set(x => pageAuth = x);
     if(!pageAuth.IsSuccessful || pageAuth.ToDocument()["user/@id"].AsText != userInfo.Id.ToString()) {
         throw new DreamForbiddenException("User not permitted to subscribe to page");
     }
     var dataSession = GetDataSession(wikiId);
     dataSession.Subscribe(userInfo.Id, pageId, depth);
     response.Return(DreamMessage.Ok());
     yield break;
 }
Example #4
0
		public Yield UpdateUser(DreamContext context, DreamMessage request, Result<DreamMessage> response)
		{

			Result<IUser> result = new Result<IUser>();
			yield return Context.Current.Instance.UserController.Update(context.GetParam("id"), context.GetParam("rev"), Context.Current.Instance.UserController.FromJson(request.ToText()), result);

			response.Return(DreamMessage.Ok(MimeType.JSON, Context.Current.Instance.UserController.ToJson(result.Value)));
		}
Example #5
0
		public Yield UpdateSource(DreamContext context, DreamMessage request, Result<DreamMessage> response)
		{
			ISource source = Context.Current.Instance.SourceController.FromJson(request.ToText());
			Result<ISource> result = new Result<ISource>();
			yield return Context.Current.Instance.SourceController.Update(context.GetParam("id"), context.GetParam("rev", null), source, result);

			response.Return(DreamMessage.Ok(MimeType.JSON, Context.Current.Instance.SourceController.ToJson(result.Value)));
		}
Example #6
0
		public Yield GetSources(DreamContext context, DreamMessage request, Result<DreamMessage> response)
		{
			Result<SearchResult<ISourceSearchResult>> result = new Result<SearchResult<ISourceSearchResult>>();
			int limit = context.GetParam("max", 20);
			int offset = context.GetParam("offset", 0);

			yield return Context.Current.Instance.IndexController.GetAllSources(limit, offset, result);

			response.Return(DreamMessage.Ok(MimeType.JSON, Context.Current.Instance.IndexController.ToJson(result.Value)));
		}
Example #7
0
		public Yield GetPlaysFromSource(DreamContext context, DreamMessage request, Result<DreamMessage> response)
		{
			Result<SearchResult<IPlay>> result = new Result<SearchResult<IPlay>>();
			int limit = context.GetParam("max", 20);
			int offset = context.GetParam("offset", 0);
			string id = context.GetParam("id");

			yield return Context.Current.Instance.PlayController.GetPlaysFromSource(offset, limit, id, result);

			response.Return(DreamMessage.Ok(MimeType.JSON, Context.Current.Instance.PlayController.ToJson(result.Value)));
		}
 public Yield GetPageAllowedUsers(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
     List<uint> userids = new List<uint>();
     if(request.HasDocument) {
         foreach(XDoc userid in request.ToDocument()["user/@id"]) {
             uint? id = userid.AsUInt;
             if(id.HasValue) {
                 userids.Add(id.Value);
             } else {
                 throw new DreamBadRequestException(string.Format("'{0}' is not a valid userid", userid.AsText));
             }
         }
     }
     if(userids.Count == 0) {
         throw new DreamBadRequestException("must provide at least one userid");
     }
     string permissionsList = context.GetParam("permissions");
     bool filterDisabled = context.GetParam("filterdisabled", false);
     if(filterDisabled) {
         List<uint> activeUsers = new List<uint>();
         foreach(UserBE user in DbUtils.CurrentSession.Users_GetByIds(userids)) {
             if(user.UserActive) {
                 activeUsers.Add(user.ID);
             }
         }
         userids = activeUsers;
         if(userids.Count == 0) {
             response.Return(DreamMessage.Ok(new XDoc("users")));
             yield break;
         }
     }
     Permissions permissions = Permissions.READ;
     if(!string.IsNullOrEmpty(permissionsList)) {
         bool first = true;
         foreach(string perm in permissionsList.Split(',')) {
             Permissions p;
             if(!SysUtil.TryParseEnum(perm, out p)) {
                 throw new DreamBadRequestException(string.Format("'{0}' is not a valid permission value", perm));
             }
             if(first) {
                 permissions = p;
             } else {
                 permissions |= p;
             }
             first = false;
         }
     }
     uint[] filteredIds = PermissionsBL.FilterDisallowed(userids.ToArray(), context.GetParam<uint>("pageid"), false, permissions);
     XDoc msg = new XDoc("users");
     foreach(int userid in filteredIds) {
         msg.Start("user").Attr("id", userid).End();
     }
     response.Return(DreamMessage.Ok(msg));
     yield break;
 }
Example #9
0
		public Yield GetScores(DreamContext aContext, DreamMessage aRequest, Result<DreamMessage> aResponse)
		{
			theLogger.Info("GetScores");
			Result<SearchResult<IScoreSearchResult>> result = new Result<SearchResult<IScoreSearchResult>>();
			int limit = aContext.GetParam("max", 20);
			int offset = aContext.GetParam("offset", 0);

			yield return Context.Current.Instance.IndexController.GetAllScores(limit, offset, result);

			aResponse.Return(DreamMessage.Ok(MimeType.JSON, Context.Current.Instance.IndexController.ToJson(result.Value)));
		}
Example #10
0
		public Yield GetScoresFromSource(DreamContext aContext, DreamMessage aRequest, Result<DreamMessage> aResponse)
		{
			theLogger.Info("GetScoresFromSource");
			Result<SearchResult<IScore>> result = new Result<SearchResult<IScore>>();
			int limit = aContext.GetParam("max", 20);
			int offset = aContext.GetParam("offset", 0);
			string id = aContext.GetParam("id");

			yield return Context.Current.Instance.ScoreController.GetScoresFromSource(id, offset, limit, result);

			aResponse.Return(DreamMessage.Ok(MimeType.JSON, Context.Current.Instance.ScoreController.ToJson(result.Value)));
		}
Example #11
0
		public Yield UpdatePlay(DreamContext context, DreamMessage request, Result<DreamMessage> response)
		{
			string playId = context.GetParam("id");
			string playRev = context.GetParam("rev");

			IPlay play = Context.Current.Instance.PlayController.FromJson(request.ToText());

			Result<IPlay> result = new Result<IPlay>();

			yield return Context.Current.Instance.PlayController.Update(playId,playRev, play, result);

			response.Return(DreamMessage.Ok(MimeType.JSON, Context.Current.Instance.PlayController.ToJson(result.Value)));
		}
 public Yield thumb(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
     var slide = context.GetParam<int>("slide");
     var width = context.GetParam<int>("width");
     var height = context.GetParam<int>("height");
     var requestInfo = new RequestInfo { 
         slide=slide,
         width=width,
         height=height
     };
     var image = cache.ContainsKey(requestInfo) ?
         cache[requestInfo] : createImage(requestInfo);
     response.Return(DreamMessage.Ok(MimeType.JPEG, image));
     yield break;
 }
Example #13
0
 private static bool ShowXml(DreamContext context) {
     switch(context.GetParam("format", null) ?? context.GetParam("output", "cooked")) {
     case "raw":
     case "debug":
         return false;
     case "seared":
     case "xml":
         return true;
     case "cooked":
     case "html":
         return false;
     default:
         throw new OutputParameterInvalidArgumentException();
     }
 }
 private static bool ShowXml(DreamContext context) {
     switch(context.GetParam("format", null) ?? context.GetParam("output", "cooked")) {
     case "raw":
     case "debug":
         return false;
     case "seared":
     case "xml":
         return true;
     case "cooked":
     case "html":
         return false;
     default:
         throw new DreamBadRequestException(DekiResources.OUTPUT_PARAM_INVALID);
     }
 }
Example #15
0
        public static CommentBE PostNewComment(PageBE page, DreamMessage request, DreamContext context) {
            ValidateCommentText(request.ContentType, request.AsText());

            CommentBE comment = new CommentBE();
            comment.Title = context.GetParam("title", string.Empty);
            comment.PageId = page.ID;
            comment.Content = request.AsText();
            comment.ContentMimeType = request.ContentType.ToString();
            comment.PosterUserId = DekiContext.Current.User.ID;
            comment.CreateDate = DateTime.UtcNow;

            //Note (MaxM): Replytoid/replies not yet exposed
            //ulong replyToId = context.GetParam<ulong>("replyto", 0);
            //if (replyToId == 0)
            //    newComment.ReplyToId = null;
            //else
            //    newComment.ReplyToId = replyToId;

            ushort commentNumber;
            uint commentId = DbUtils.CurrentSession.Comments_Insert(comment, out commentNumber);
            if (commentId == 0) {
                return null;
            } else {
                comment.Id = commentId;
                comment.Number = commentNumber;
                PageBL.Touch(page, comment.CreateDate);
                RecentChangeBL.AddCommentCreateRecentChange(comment.CreateDate, page, DekiContext.Current.User, string.Format(DekiResources.COMMENT_ADDED, comment.Number.ToString()), comment);
                return comment;
            } 
        }
        public Yield GetServiceById(DreamContext context, DreamMessage request, Result<DreamMessage> response) {

            bool privateDetails = PermissionsBL.IsUserAllowed(DekiContext.Current.User, Permissions.ADMIN);

            //Private feature requires api-key
            var identifier = context.GetParam("id");
            uint serviceId = 0;
            if(identifier.StartsWith("=")) {
                var serviceInfo = DekiContext.Current.Instance.RunningServices[XUri.Decode(identifier.Substring(1))];
                if(serviceInfo != null) {
                    serviceId = serviceInfo.ServiceId;
                }
            } else {
                if(!uint.TryParse(identifier, out serviceId)) {
                    throw new DreamBadRequestException(string.Format("Invalid id '{0}'", identifier));
                }
            }
            ServiceBE service = ServiceBL.GetServiceById(serviceId);
            DreamMessage responseMsg = null;
            if(service == null) {
                responseMsg = DreamMessage.NotFound(string.Format(DekiResources.SERVICE_NOT_FOUND, identifier));
            } else {
                responseMsg = DreamMessage.Ok(ServiceBL.GetServiceXmlVerbose(DekiContext.Current.Instance, service, null, privateDetails));
            }
            response.Return(responseMsg);
            yield break;
        }
Example #17
0
        public Yield GetFileHandler(DreamContext context, DreamMessage request, Result<DreamMessage> response)
        {
            string suffixPath = string.Join("" + Path.DirectorySeparatorChar, context.GetSuffixes(UriPathFormat.Decoded));
            string filename = Path.Combine(_path, suffixPath);
            if(Directory.Exists(filename)) {
                XDoc ret = new XDoc("files");
                string pattern = context.GetParam("pattern", "");
                AddDirectories(new DirectoryInfo(filename), pattern, ret);
                AddFiles(new DirectoryInfo(filename), pattern, ret);
                response.Return(DreamMessage.Ok(ret));
                yield break;
            }

            DreamMessage message;
            try {
                message = DreamMessage.FromFile(filename, StringUtil.EqualsInvariant(context.Verb, "HEAD"));
            } catch(FileNotFoundException) {
                message = DreamMessage.NotFound("file not found");
            } catch(Exception) {
                message = DreamMessage.BadRequest("invalid path");
            }

            // open file and stream it to the requester
            response.Return(message);
        }
Example #18
0
        public Yield Register(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
            string servicePath = context.GetParam("service-path");
            string location = StringUtil.CreateAlphaNumericKey(8);

            // register the script
            XDoc config = new XDoc("config")
                .Elem("manifest", servicePath)
                .Elem("debug", true);

            //create the script service
            Result<Plug> res;
            yield return res = CreateService(location, "sid://mindtouch.com/2007/12/dekiscript", config, new Result<Plug>());
            Plug service = res.Value;

            // register script functions in environment
            XDoc manifest = service.Get().ToDocument();
            string ns = manifest["namespace"].AsText;
            foreach(XDoc function in manifest["function"]) {
                string name = function["name"].AsText;
                if(string.IsNullOrEmpty(ns)) {
                    _env.Vars.AddNativeValueAt(name, function["uri"].AsUri);
                } else {
                    _env.Vars.AddNativeValueAt(ns + "." + name, function["uri"].AsUri);
                }
            }
            response.Return(DreamMessage.Ok(MimeType.XML, manifest));
        }
        public Yield PostImport(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
            string uri = context.GetParam("uri", null);
            string reltopath = context.GetParam("reltopatch", "/");
            DreamMessage packageMessage = request;
            if(!string.IsNullOrEmpty(uri)) {
                Result<DreamMessage> packageResult;
                yield return packageResult = Plug.New(uri).InvokeEx("GET", DreamMessage.Ok(), new Result<DreamMessage>());
                packageMessage = packageResult.Value;
                if(!packageMessage.IsSuccessful) {
                    throw new DreamAbortException(DreamMessage.BadRequest(string.Format("Unable to retrieve package from Uri '{0}': {1}", uri, packageMessage.Status)));
                }
            }
            string tempFile = Path.GetTempFileName();
            Stream tempStream = File.Create(tempFile);
            Result<long> copyResult;

            // TODO (steveb): use WithCleanup() to dispose of resources in case of failure
            yield return copyResult = packageMessage.ToStream().CopyTo(tempStream, packageMessage.ContentLength, new Result<long>()).Catch();
            tempStream.Dispose();
            if(copyResult.HasException) {
                response.Throw(copyResult.Exception);
                yield break;
            }
            ArchivePackageReader archivePackageReader = new ArchivePackageReader(File.OpenRead(tempFile));
            Result<ImportManager> importerResult;
            Plug authorizedDekiApi = _dekiApi.WithHeaders(request.Headers);

            // TODO (steveb): use WithCleanup() to dispose of resources in case of failure
            yield return importerResult = ImportManager.CreateAsync(authorizedDekiApi, reltopath, archivePackageReader, new Result<ImportManager>()).Catch();
            if(importerResult.HasException) {
                archivePackageReader.Dispose();
                File.Delete(tempFile);
                response.Throw(importerResult.Exception);
                yield break;
            }
            ImportManager importManager = importerResult.Value;
            Result importResult;
            yield return importResult = importManager.ImportAsync(new Result()).Catch();
            archivePackageReader.Dispose();
            File.Delete(tempFile);
            if(importResult.HasException) {
                response.Throw(importResult.Exception);
                yield break;
            }
            response.Return(DreamMessage.Ok());
            yield break;
        }
Example #20
0
 internal IEnumerator<IYield> GetImportStatus(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
     var wikiId = context.GetParam("wikiid");
     _log.DebugFormat("checking status on instance '{0}'", wikiId);
     var instance = GetInstance(wikiId, false);
     var status = instance == null ? "none" : instance.Status.ToString().ToLower();
     response.Return(DreamMessage.Ok(new XDoc("package-updater").Attr("wikiid", wikiId).Attr("status", status)));
     yield break;
 }
 public new Yield GetFiles(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
     PermissionsBL.CheckUserAllowed(DekiContext.Current.User, Permissions.READ);
     uint skip = context.GetParam<uint>("skip", 0);
     uint numfiles = 100;
     string numfilesStr = context.GetParam("numfiles", numfiles.ToString());
     if (StringUtil.EqualsInvariantIgnoreCase(numfilesStr, "ALL")) {
         numfiles = uint.MaxValue;
     } else {
         if (!uint.TryParse(numfilesStr, out numfiles))
             throw new DreamBadRequestException(DekiResources.CANNOT_PARSE_NUMFILES);
     }
     
     IList<AttachmentBE> files = AttachmentBL.Instance.RetrieveAttachments(skip, numfiles);
     XDoc ret = AttachmentBL.Instance.GetFileXml(files, false, null, null, null);
     response.Return(DreamMessage.Ok(ret));
     yield break;
 }
 public Yield DeleteBan(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
     PermissionsBL.CheckUserAllowed(DekiContext.Current.User, Permissions.ADMIN);
     BanBE ban = GetBanFromRequest(context, context.GetParam<uint>("banid"));
     BanningBL.DeleteBan(ban);
     DekiContext.Current.Instance.EventSink.BanRemoved(context.StartTime, ban);
     response.Return(DreamMessage.Ok());
     yield break;
 }
Example #23
0
        //--- Class Methods ---
        private static PageBE PageBL_GetPageFromUrl(DreamContext context, bool mustExist) {

            // TODO (steveb): replace all PageBL_GetPageFromUrl() calls

            var pageid = context.GetParam(PARAM_PAGEID);
            var redirects = DreamContext.Current.GetParam(PARAM_REDIRECTS, int.MaxValue);
            return PageBL_GetPage(pageid, redirects, mustExist);
        }
Example #24
0
        public static IList<GroupBE> GetGroupsByQuery(DreamContext context, out uint totalCount, out uint queryCount) {
            uint limit, offset;
            SortDirection sortDir;
            string sortFieldString;
            Utils.GetOffsetAndCountFromRequest(context, 100, out limit, out offset, out sortDir, out sortFieldString);

            // Attempt to read the sort field.  If a parsing error occurs, default to undefined.
            GroupsSortField sortField = GroupsSortField.UNDEFINED;
            if(!String.IsNullOrEmpty(sortFieldString)) {
                try { sortField = SysUtil.ChangeType<GroupsSortField>(sortFieldString); } catch { }
            }
            string groupnamefilter = context.GetParam("groupnamefilter", null);
            uint? serviceid = context.GetParam<uint>("authprovider", 0);
            if((serviceid ?? 0) == 0) {
                serviceid = null;
            }
            return DbUtils.CurrentSession.Groups_GetByQuery(groupnamefilter, serviceid, sortDir, sortField, offset, limit, out totalCount, out queryCount);
        }
Example #25
0
		public Yield GetUser(DreamContext context, DreamMessage request, Result<DreamMessage> response)
		{
			string id = context.GetParam("id");
			Result<IUser> result = new Result<IUser>();
			yield return Context.Current.Instance.UserController.Retrieve(id, result);

			response.Return(result.Value == null
								? DreamMessage.NotFound("No User found for id " + id)
								: DreamMessage.Ok(MimeType.JSON, Context.Current.Instance.UserController.ToJson((result.Value))));
		}
Example #26
0
 internal DreamMessage PostHostInstanceStopByWikiId(DreamContext context, DreamMessage request) {
     var wikiId = context.GetParam("wikiid", null);
     if(!string.IsNullOrEmpty(wikiId)) {
         if(Instancemanager.ShutdownInstance(wikiId)) {
             return DreamMessage.Ok(new XDoc("tenant").Attr("wikiid", wikiId).Attr("status", "stopped"));
         }
         return new DreamMessage(DreamStatus.ServiceUnavailable, null);
     }
     return DreamMessage.Ok(new XDoc("tenant").Attr("wikiid", wikiId).Attr("status", "notrunning"));
 }
Example #27
0
		public Yield GetSource(DreamContext context, DreamMessage request, Result<DreamMessage> response)
		{
			Result<ISource> result = new Result<ISource>();
			string id = context.GetParam<string>("id");

			yield return Context.Current.Instance.SourceController.Retrieve(id, result);

			response.Return(result.Value == null
								? DreamMessage.NotFound("No Source found for id " + id)
								: DreamMessage.Ok(MimeType.JSON, Context.Current.Instance.SourceController.ToJson(result.Value)));
		}
Example #28
0
 public Yield Execute(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
     string expression = context.GetParam("expression");
     DekiScriptExpression expr = DekiScriptParser.Parse(new Location("POST:execute"), expression);
     DekiScriptLiteral result = _runtime.Evaluate(expr, DekiScriptEvalMode.Evaluate, _env);
     if(result.ScriptType == DekiScriptType.XML) {
         response.Return(DreamMessage.Ok(MimeType.XML, (XDoc)result.NativeValue));
     } else {
         response.Return(DreamMessage.Ok(MimeType.TEXT, result.ToString()));
     }
     yield break;
 }
Example #29
0
 public Yield GetComment(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
     PageBE page = null;
     CommentBE comment = null;
     var commentId = context.GetParam<uint>("commentid", 0);
     if(commentId > 0) {
         comment = CommentBL.GetComment(commentId);
     } else {
         GetCommentFromRequest(context, Permissions.READ, out page, out comment);
     }
     response.Return(DreamMessage.Ok(CommentBL.GetCommentXml(comment, null)));
     yield break;
 }
Example #30
0
		public Yield GetScore(DreamContext aContext, DreamMessage aRequest, Result<DreamMessage> aResponse)
		{
			theLogger.Info("GetScore");
			string id = aContext.GetParam("id");
			string fileName = aContext.GetParam("fileName", ".json").ToLower();
			string fileType = Path.GetExtension(fileName);
			switch (fileType)
			{
				case ".json":
					Result<IScore> resultJson = new Result<IScore>();
					yield return Context.Current.Instance.ScoreController.Retrieve(id, resultJson);

					aResponse.Return(resultJson.Value == null
					                 	? DreamMessage.NotFound("No Score found for id " + id)
					                 	: DreamMessage.Ok(MimeType.JSON,
					                 	                  Context.Current.Instance.ScoreController.ToJson(resultJson.Value)));
					break;
				case ".pdf":
					Result<Stream> resultPdf = new Result<Stream>();
					yield return Context.Current.Instance.ScoreController.GetConvertedScore(MimeType.PDF, id, resultPdf);
					Stream streamPdf = resultPdf.Value;
					aResponse.Return(DreamMessage.Ok(MimeType.PDF, streamPdf.Length, streamPdf));
					break;
				case ".xml":
					Result<Stream> resultXml = new Result<Stream>();
					yield return Context.Current.Instance.ScoreController.GetAttachment(id, "$musicxml.xml", resultXml);
					Stream streamXml = resultXml.Value;
					aResponse.Return(DreamMessage.Ok(MimeType.XML, streamXml.Length, streamXml));
					break;
				case ".mid":
					Result<Stream> resultMidi = new Result<Stream>();
					yield return Context.Current.Instance.ScoreController.GetConvertedScore(Constants.Midi, id, resultMidi);
					Stream streamMidi = resultMidi.Value;
					aResponse.Return(DreamMessage.Ok(Constants.Midi, streamMidi.Length, streamMidi));
					break;
			}
			yield break;
		}