Пример #1
0
 public void SendPhoto(SPhotoData photo)
 {
     if (_CheckRight(EUserRights.UploadPhotos))
     {
         CVocaluxeServer.DoTask(CVocaluxeServer.SendPhoto, photo);
     }
 }
Пример #2
0
        public void SendKeyStringEvent(string keyString, bool isShiftPressed = false, bool isAltPressed = false, bool isCtrlPressed = false)
        {
            if (!_CheckRight(EUserRights.UseKeyboard))
            {
                return;
            }

            CVocaluxeServer.DoTask(CVocaluxeServer.SendKeyStringEvent, keyString, isShiftPressed, isAltPressed, isCtrlPressed);
        }
Пример #3
0
        public Stream Index()
        {
            if (WebOperationContext.Current != null)
            {
                WebOperationContext.Current.OutgoingResponse.ContentType = "text/html";
            }

            return(new MemoryStream(CVocaluxeServer.DoTask(CVocaluxeServer.GetSiteFile, "index.html")));
        }
Пример #4
0
        public void SendKeyEvent(string key)
        {
            if (!_CheckRight(EUserRights.UseKeyboard))
            {
                return;
            }


            CVocaluxeServer.DoTask(CVocaluxeServer.SendKeyEvent, key);
        }
Пример #5
0
        public Stream GetMp3File(int songId)
        {
            if (WebOperationContext.Current != null)
            {
                WebOperationContext.Current.OutgoingResponse.LastModified = DateTime.UtcNow;
                WebOperationContext.Current.OutgoingResponse.Headers.Add(
                    HttpResponseHeader.Expires,
                    DateTime.UtcNow.AddYears(1).ToString("r"));
            }


            String path = CVocaluxeServer.DoTask(CVocaluxeServer.GetMp3Path, songId);

            path = path.Replace("..", "");


            if (!File.Exists(path) ||
                !(path.EndsWith(".mp3", StringComparison.InvariantCulture) ||
                  path.EndsWith(".ogg", StringComparison.InvariantCulture) ||
                  path.EndsWith(".wav", StringComparison.InvariantCulture) ||
                  path.EndsWith(".webm", StringComparison.InvariantCulture)))
            {
                if (WebOperationContext.Current != null)
                {
                    WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.NotFound;
                }
                return(null);
            }

            if (WebOperationContext.Current != null)
            {
                if (path.EndsWith(".mp3", StringComparison.InvariantCulture))
                {
                    WebOperationContext.Current.OutgoingResponse.ContentType = "audio/mpeg";
                }
                else if (path.EndsWith(".ogg", StringComparison.InvariantCulture))
                {
                    WebOperationContext.Current.OutgoingResponse.ContentType = "audio/ogg";
                }
                else if (path.EndsWith(".wav", StringComparison.InvariantCulture))
                {
                    WebOperationContext.Current.OutgoingResponse.ContentType = "audio/wav";
                }
                else if (path.EndsWith(".webm", StringComparison.InvariantCulture))
                {
                    WebOperationContext.Current.OutgoingResponse.ContentType = "audio/webm";
                }
            }

            return(File.OpenRead(path));
        }
Пример #6
0
        public SProfileData GetProfile(int profileId)
        {
            Guid sessionKey = _GetSession();

            if (CSessionControl.GetUserIdFromSession(sessionKey) == profileId || _CheckRight(EUserRights.ViewOtherProfiles))
            {
                bool isReadonly = (!CSessionControl.RequestRight(sessionKey, EUserRights.EditAllProfiles) &&
                                   CSessionControl.GetUserIdFromSession(sessionKey) != profileId);


                return(CVocaluxeServer.DoTask(CVocaluxeServer.GetProfileData, profileId, isReadonly));
            }
            return(new SProfileData());
        }
Пример #7
0
        public void SendProfile(SProfileData profile)
        {
            Guid sessionKey = _GetSession();

            if (profile.ProfileId != -1) //-1 is the id for a new profile
            {
                if (CSessionControl.GetUserIdFromSession(sessionKey) != profile.ProfileId &&
                    !(_CheckRight(EUserRights.EditAllProfiles)))
                {
                    return;
                }
            }

            CVocaluxeServer.DoTask(CVocaluxeServer.SendProfileData, profile);
        }
Пример #8
0
 public SPlaylistSongInfo[] GetPlaylistSongs(int playlistId)
 {
     try
     {
         return(CVocaluxeServer.DoTask(CVocaluxeServer.GetPlaylistSongs, playlistId));
     }
     catch (ArgumentException e)
     {
         if (WebOperationContext.Current != null)
         {
             WebOperationContext.Current.OutgoingResponse.StatusCode        = HttpStatusCode.Forbidden;
             WebOperationContext.Current.OutgoingResponse.StatusDescription = e.Message;
         }
         return(new SPlaylistSongInfo[0]);
     }
 }
Пример #9
0
        public bool PlaylistContainsSong(int songId, int playlistId)
        {
            try
            {
                return(CVocaluxeServer.DoTask(CVocaluxeServer.PlaylistContainsSong, songId, playlistId));
            }
            catch (ArgumentException e)
            {
                if (WebOperationContext.Current != null)
                {
                    WebOperationContext.Current.OutgoingResponse.StatusCode        = HttpStatusCode.Forbidden;
                    WebOperationContext.Current.OutgoingResponse.StatusDescription = e.Message;
                }

                return(false);
            }
        }
Пример #10
0
        public int AddPlaylist(string playlistName)
        {
            if (!_CheckRight(EUserRights.CreatePlaylists))
            {
                return(-1);
            }

            try
            {
                return(CVocaluxeServer.DoTask(CVocaluxeServer.AddPlaylist, playlistName));
            }
            catch (ArgumentException e)
            {
                if (WebOperationContext.Current != null)
                {
                    WebOperationContext.Current.OutgoingResponse.StatusCode        = HttpStatusCode.Forbidden;
                    WebOperationContext.Current.OutgoingResponse.StatusDescription = e.Message;
                }

                return(-1);
            }
        }
Пример #11
0
        public Stream GetImgFile(string filename)
        {
            if (WebOperationContext.Current != null)
            {
                WebOperationContext.Current.OutgoingResponse.ContentType  = "image/png";
                WebOperationContext.Current.OutgoingResponse.LastModified = DateTime.UtcNow;
                WebOperationContext.Current.OutgoingResponse.Headers.Add(
                    HttpResponseHeader.Expires,
                    DateTime.UtcNow.AddYears(1).ToString("r"));
            }

            byte[] data = CVocaluxeServer.DoTask(CVocaluxeServer.GetSiteFile, "img/" + filename);

            if (data != null)
            {
                return(new MemoryStream(data));
            }
            if (WebOperationContext.Current != null)
            {
                WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.NotFound;
            }
            return(null);
        }
Пример #12
0
 public SSongInfo[] GetAllSongs()
 {
     return(CVocaluxeServer.DoTask(CVocaluxeServer.GetAllSongs));
 }
Пример #13
0
 public int GetUserRole(int profileId)
 {
     return(CVocaluxeServer.DoTask(CVocaluxeServer.GetUserRole, profileId));
 }
Пример #14
0
 public CBase64Image GetDelayedImage(string id)
 {
     return(CVocaluxeServer.DoTask(CVocaluxeServer.GetDelayedImage, id));
 }
Пример #15
0
 public SPlaylistData[] GetPlaylists()
 {
     return(CVocaluxeServer.DoTask(CVocaluxeServer.GetPlaylists));
 }
Пример #16
0
 public string GetServerVersion()
 {
     return(CVocaluxeServer.DoTask(CVocaluxeServer.GetServerVersion));
 }
Пример #17
0
 public SProfileData[] GetProfileList()
 {
     return(CVocaluxeServer.DoTask(CVocaluxeServer.GetProfileList));
 }
Пример #18
0
 public int GetCurrentSongId()
 {
     return(CVocaluxeServer.DoTask(CVocaluxeServer.GetCurrentSongId));
 }
Пример #19
0
 public SSongInfo GetSong(int songId)
 {
     return(CVocaluxeServer.DoTask(CVocaluxeServer.GetSong, songId));
 }