private void MediaItemPlay(MediaItem newMediaItem) { String filepath = newMediaItem.GetFilePath(); if (newMediaItem.CheckIsLocalCopyAvailable(filepath) == true) { filepath = newMediaItem.GetLocalCopyFilePath(); } newMediaItem.isFilePathValid = m_Globals.m_library.TestFilePathExistance(@filepath); if (!newMediaItem.isFilePathValid) { // If the filepath is not valid, then just return. return; } String escapedFilepath = "\"" + @filepath + "\""; // Must add escaped quotation marks because this will be turned into a string and concatenated into a command string. String MediaPlayerPath = ""; String playArguments = ""; String playTime = newMediaItem.GetPlayTime(); String fullScreenArgument = ""; String partialScreenArgument = ""; String zoomPlaceholder = ""; String fileExtension = newMediaItem.GetFileExtension(); String VLCCompatibilityList = vlcPlayer.GetMediaCompatible(); if (VLCCompatibilityList.Contains(fileExtension)) { MediaPlayerPath = vlcPlayer.GetExecutablePath(m_Globals); playArguments = vlcPlayer.GetPlayArguments(escapedFilepath); playTime = vlcPlayer.GetPlayTimeArgument(playTime) + " " + vlcPlayer.GetImageDurationArgument(playTime); fullScreenArgument = vlcPlayer.GetFullScreenArgument(); partialScreenArgument = vlcPlayer.GetPartialScreenArgument(); zoomPlaceholder = vlcPlayer.GetZoomPlaceholder(); } else { MediaPlayerPath = myMediaPlayer.GetExecutablePath(m_Globals); playArguments = myMediaPlayer.GetPlayArguments(escapedFilepath); playTime = myMediaPlayer.GetPlayTimeArgument(playTime); fullScreenArgument = myMediaPlayer.GetFullScreenArgument(); partialScreenArgument = myMediaPlayer.GetPartialScreenArgument(); zoomPlaceholder = myMediaPlayer.GetZoomPlaceholder(); } if (newMediaItem.isPlayTimeAssigned) { playArguments += " " + playTime; } if (m_Globals.m_usePartialScreenSize) { // 1. Assume a default scalar of 0.4. Because we have no easy way to determining video dimensions. double scalar = 0.4; if (newMediaItem.GetClassification() == MediaItem.Classification.image) { // 2. Here's the easy way to determining an image's dimensions. // http://stackoverflow.com/questions/6455979/how-to-get-the-image-dimension-from-the-file-name scalar = newMediaItem.CalculatePartialScreenScalar(); } String scalarString = scalar.ToString("N2"); if (String.IsNullOrEmpty(fullScreenArgument)) { playArguments += " " + partialScreenArgument; } else { playArguments = Regex.Replace(playArguments, fullScreenArgument, partialScreenArgument); } playArguments = Regex.Replace(playArguments, zoomPlaceholder, scalarString); } else { m_Globals.m_library.MoveMouseOffScreen(); } m_Globals.m_library.ExecuteCommand(MediaPlayerPath, playArguments); }