Beispiel #1
0
        public ActionResult AddSource(string partyKey, HttpPostedFileBase file)
        {
            string _path = null;

            try {
                if (file.ContentLength > 0)
                {
                    string _FileName   = Path.GetFileName(file.FileName);
                    string _FolderPath = Server.MapPath("~/UploadCache");
                    if (!Directory.Exists(_FolderPath))
                    {
                        Directory.CreateDirectory(_FolderPath);
                    }
                    _path = Path.Combine(_FolderPath, _FileName);
                    file.SaveAs(_path);
                }
                ViewBag.Message = "File Uploaded Successfully!!";
            } catch {
                ViewBag.Message = "File upload failed!!";
            }
            if (_path != null)
            {
                PartyTracker.GetByKey(partyKey)?.TrackedHost?.AddSource(_path);
            }
            return(RedirectToAction("Party", "Home", new { id = partyKey }));
        }
Beispiel #2
0
 public string PullFormat(string partyKey)
 {
     if (string.IsNullOrEmpty(partyKey))
     {
         return("{}");
     }
     return(JsonConvert.SerializeObject(PartyTracker.GetByKey(partyKey).WaveFormat));
 }
Beispiel #3
0
 public string PullChunk(string partyKey, int?samplesRequested, int?channelCount, int?readHead)
 {
     if (string.IsNullOrEmpty(partyKey) || !samplesRequested.HasValue || !channelCount.HasValue)
     {
         return(new BoomBox());
     }
     return(PartyTracker.GetByKey(partyKey).Pull(samplesRequested.Value, channelCount.Value, readHead));
 }
Beispiel #4
0
        public ActionResult Party(string id)
        {
            if (PartyTracker.GetByKey(id) == null)
            {
                return(View("Index"));
            }

            return(View("Party", PartyTracker.GetByKey(id)));
        }
Beispiel #5
0
 public ActionResult LogOff()
 {
     PartyTracker.DesposeOf(User.Identity.Name);
     AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
     return(RedirectToAction("Index", "Home"));
 }
Beispiel #6
0
 public ActionResult StopParty(string username)
 {
     PartyTracker.DesposeOf(username);
     return(View("Index"));
 }
Beispiel #7
0
        public ActionResult CreateParty()
        {
            PartyTracker.StartParty(User.Identity.Name);

            return(View("Party", PartyTracker.GetByKey(User.Identity.Name)));
        }