/// <summary> /// This method returns an arraylist of GUIListItems for the specified folder /// If the folder is protected by a pincode then the user is asked to enter the pincode /// and the folder contents are only returned when the pincode is correct /// </summary> /// <param name="strDir">The path to load items from</param> /// <param name="loadHidden">The path to load items from even hidden one</param> /// <returns>A list of GUIListItems for the specified folder</returns> public List<GUIListItem> GetDirectoryExt(string strDir, bool loadHidden) { if (String.IsNullOrEmpty(strDir)) { m_strPreviousDir = ""; CurrentShare = ""; return GetRootExt(); } //if we have a folder like D:\ then remove the \ if (strDir.EndsWith(@"\")) { strDir = strDir.Substring(0, strDir.Length - 1); } List<GUIListItem> items = new List<GUIListItem>(); if (strDir.Length > 254) { Log.Warn("VirtualDirectory: GetDirectoryExt received a path which contains too many chars"); return items; } //get the parent folder string strParent = ""; if (IsRemote(strDir)) { int ipos = strDir.LastIndexOf(@"/"); if (ipos > 0) { strParent = strDir.Substring(0, ipos); } } else { int ipos = strDir.LastIndexOf(@"\"); if (ipos > 0) { strParent = strDir.Substring(0, ipos); } } //is this directory protected string iPincodeCorrect; if (IsProtectedShare(strDir, out iPincodeCorrect)) { #region Pin protected bool retry = true; { while (retry) { //no, then ask user to enter the pincode GUIMessage msgGetPassword = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GET_PASSWORD, 0, 0, 0, 0, 0, 0); GUIWindowManager.SendMessage(msgGetPassword); if (msgGetPassword.Label != iPincodeCorrect) { GUIMessage msgWrongPassword = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WRONG_PASSWORD, 0, 0, 0, 0, 0, 0); GUIWindowManager.SendMessage(msgWrongPassword); if (!(bool)msgWrongPassword.Object) { GUIListItem itemTmp = new GUIListItem(); itemTmp.IsFolder = true; itemTmp.Label = ".."; itemTmp.Label2 = ""; itemTmp.Path = m_strPreviousDir; Utils.SetDefaultIcons(itemTmp); items.Add(itemTmp); return items; } } else retry = false; } } #endregion } //Setting current share; SetCurrentShare(strDir); //check if this is an image file like .iso, .nrg,... //ifso then ask daemontools to automount it bool VirtualShare = false; if (!IsRemote(strDir)) { if (DaemonTools.IsEnabled) { #region DaemonTools string extension = Path.GetExtension(strDir); if (IsImageFile(extension)) { if (!DaemonTools.IsMounted(strDir)) { string virtualPath; if (DaemonTools.Mount(strDir, out virtualPath)) { strDir = virtualPath; VirtualShare = true; } } else { strDir = DaemonTools.GetVirtualDrive(); VirtualShare = true; } } #endregion } } GUIListItem item; if (!IsRootShare(strDir) || VirtualShare) { item = new GUIListItem(); item.IsFolder = true; item.Label = ".."; item.Label2 = ""; Utils.SetDefaultIcons(item); item.Path = strParent == strDir ? "" : strParent; items.Add(item); } else { item = new GUIListItem(); item.IsFolder = true; item.Label = ".."; item.Label2 = ""; item.Path = ""; Utils.SetDefaultIcons(item); items.Add(item); } if (IsRemote(strDir)) { #region Remote files FTPClient ftp = GetFtpClient(strDir); if (ftp == null) return items; string folder = strDir.Substring("remote:".Length); string[] subitems = folder.Split(new char[] {'?'}); if (subitems[4] == string.Empty) subitems[4] = "/"; FTPFile[] files; try { ftp.ChDir(subitems[4]); files = ftp.DirDetails(); //subitems[4]); } catch (Exception) { //maybe this socket has timed out, remove it and get a new one FtpConnectionCache.Remove(ftp); ftp = GetFtpClient(strDir); if (ftp == null) return items; try { ftp.ChDir(subitems[4]); } catch (Exception ex) { Log.Info("VirtualDirectory:unable to chdir to remote folder:{0} reason:{1} {2}", subitems[4], ex.Message, ex.StackTrace); return items; } try { files = ftp.DirDetails(); //subitems[4]); } catch (Exception ex) { Log.Info("VirtualDirectory:unable to get remote folder:{0} reason:{1} {2}", subitems[4], ex.Message, ex.StackTrace); return items; } } for (int i = 0; i < files.Length; ++i) { FTPFile file = files[i]; //Log.Info("VirtualDirectory: {0} {1}",file.Name,file.Dir); if (file.Dir) { if (file.Name != "." && file.Name != "..") { item = new GUIListItem(); item.IsFolder = true; item.Label = file.Name; item.Label2 = ""; item.Path = String.Format("{0}/{1}", strDir, file.Name); item.IsRemote = true; item.FileInfo = null; Utils.SetDefaultIcons(item); string pin; if (!IsProtectedShare(item.Path, out pin)) { Utils.SetThumbnails(ref item); } items.Add(item); } } else { if (IsValidExtension(file.Name)) { item = new GUIListItem(); item.IsFolder = false; item.Label = Utils.GetFilename(file.Name); item.Label2 = ""; item.Path = String.Format("{0}/{1}", strDir, file.Name); item.IsRemote = true; if (IsRemoteFileDownloaded(item.Path, file.Size)) { item.Path = GetLocalFilename(item.Path); item.IsRemote = false; } else if (FtpConnectionCache.IsDownloading(item.Path)) { item.IsDownloading = true; } item.FileInfo = new FileInformation(); DateTime modified = file.LastModified; item.FileInfo.CreationTime = modified; item.FileInfo.Length = file.Size; Utils.SetDefaultIcons(item); Utils.SetThumbnails(ref item); items.Add(item); } } } #endregion } else { #region CDDA comment /* Here is the trick to play Enhanced CD and not only CD-DA: * we force the creation of GUIListItem of Red Book tracks. * Track names are made up on-the-fly, using naming conventions * (Track%%.cda) and are not really retrieved from the drive * directory, as opposed to the old method. * If the data session happens to be the first to be recorded * then the old method can't read the Red Book structure. * Current audio tracks number is found using Windows API * (dependances on the Ripper package). * These are not really limitations (because it was already * the way CD-DA playing was handled before) but worth noting: * -The drive structure is browsed twice, once in Autoplay and * the other one here. * -CD-DA and Enhanced CD share the same methods. * -A CD Audio must be a Windows drive letter followed by a * semi-colon (mounted images should work, Windows shared * drives seem not to). * Works with Windows Media Player * Seems to work with Winamp (didn't make more than one experiment) * Wasn't tested with other players */ #endregion bool doesContainRedBookData = false; if (item.IsFolder && strDir.Length == 2 && strDir[1] == ':') { try { CDDrive m_Drive = new CDDrive(); if (m_Drive.IsOpened) m_Drive.Close(); if (m_Drive.Open(strDir[0]) && m_Drive.IsCDReady() && m_Drive.Refresh()) { int totalNumberOfTracks = m_Drive.GetNumTracks(); //int totalNumberOfRedBookTracks = 0; for (int i = 1; i <= totalNumberOfTracks; i++) if (m_Drive.IsAudioTrack(i)) { doesContainRedBookData = true; //totalNumberOfRedBookTracks++; } } m_Drive.Close(); } catch (Exception) {} } HandleLocalFilesInDir(strDir, ref items, doesContainRedBookData, loadHidden); // CUE Filter items = (List<GUIListItem>)CueUtil.CUEFileListFilter<GUIListItem>(items, CueUtil.CUE_TRACK_FILE_GUI_LIST_ITEM_BUILDER); } m_strPreviousDir = strDir; return items; }
private void DisplayUpdate() { uint segments = 0; bool flag = false; DiskIcon icon = new DiskIcon(); if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Starting Display Update Thread"); } CDDrive drive = new CDDrive(); bool flag2 = false; int num2 = 0; if (this.DisplaySettings.BlankDisplayWithVideo & this.DisplaySettings.EnableDisplayAction) { GUIWindowManager.OnNewAction += new OnActionHandler(this.OnExternalAction); } char[] cDDriveLetters = CDDrive.GetCDDriveLetters(); if (this.DoDebug) { object[] arg = new object[] {cDDriveLetters.Length.ToString()}; Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Found {0} CD/DVD Drives.", arg); } //if (cDDriveLetters.Length > 0) //{ // drive.Open(cDDriveLetters[0]); //} icon.Reset(); while (true) { lock (this.StopMutex) { if (this.stopDisplayUpdateThread) { if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Display Update Thread terminating"); } if (this.DisplaySettings.BlankDisplayWithVideo & this.DisplaySettings.EnableDisplayAction) { GUIWindowManager.OnNewAction -= new OnActionHandler(this.OnExternalAction); } return; } } MiniDisplayHelper.GetSystemStatus(ref this.MPStatus); flag = !flag; int num3 = num2; int num4 = 0; uint num5 = 0; icon.Off(); icon.Animate(); if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Collecting status..."); } if (MiniDisplayHelper.MPStatus.Media_IsRecording) { num5 |= 0x2000; num4 = 5; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting REC icon"); } } if (this.MPStatus.MediaPlayer_Playing) { string property; string[] strArray; if ((this.MPStatus.Media_IsTV || this.MPStatus.Media_IsTVRecording) & (!this.MPStatus.Media_IsDVD && !this.MPStatus.Media_IsCD)) { if (this.MPStatus.MediaPlayer_Playing) { if (this.DisplaySettings.BlankDisplayWithVideo) { this.DisplayOff(); } } else { this.RestoreDisplayFromVideoOrIdle(); } num5 |= 1; num4 = 1; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting ICON_TV"); } } if (this.MPStatus.Media_IsDVD || this.MPStatus.Media_IsCD) { if (this.MPStatus.Media_IsDVD & this.MPStatus.Media_IsVideo) { if (this.DisplaySettings.BlankDisplayWithVideo) { this.DisplayOff(); } num5 |= 8; num5 |= 2; num4 = 2; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting ICON_DVD & ICON_MOVIE"); } } else if (this.MPStatus.Media_IsCD & !this.MPStatus.Media_IsVideo) { num5 |= 0x10; num5 |= 4; num4 = 3; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting ICON_MUSIC & ICON_CD"); } } icon.On(); icon.InvertOff(); if (this.MPStatus.MediaPlayer_Playing) { if (this.MPStatus.Media_Speed > 0) { icon.RotateCW(); } else if (this.MPStatus.Media_Speed < 0) { icon.RotateCCW(); } icon.FlashOff(); } else { this.RestoreDisplayFromVideoOrIdle(); icon.FlashOn(); num4 = 6; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting PAUSED icon"); } } } if (this.MPStatus.Media_IsMusic) { if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting ICON_MUSIC"); } num5 |= 0x10; num4 = 3; icon.On(); icon.InvertOn(); if (this.MPStatus.MediaPlayer_Playing) { if (this.MPStatus.Media_Speed > 0) { icon.RotateCW(); } else if (this.MPStatus.Media_Speed < 0) { icon.RotateCCW(); } icon.FlashOff(); } else { icon.FlashOn(); num4 = 6; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting PAUSED icon"); } } if (!_useDiskIconForAllMedia) { icon.Off(); } property = GUIPropertyManager.GetProperty("#Play.Current.File"); if (property.Length > 0) { string str2; strArray = property.Split(new char[] {'.'}); if ((strArray.Length > 1) && ((str2 = strArray[1]) != null)) { if (!(str2 == "mp3")) { if (str2 == "ogg") { num5 |= 0x80; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting ICON_OGG"); } } else if (str2 == "wma") { num5 |= 0x200; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting ICON_WMA"); } } else if (str2 == "wav") { num5 |= 0x4000; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting ICON_WAV"); } } } else { num5 |= 0x100; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting ICON_MP3"); } } } } } if (this.MPStatus.Media_IsVideo & !this.MPStatus.Media_IsDVD) { num5 |= 8; num5 |= 0x10; num4 = 4; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting ICON_MOVIE"); } icon.On(); icon.InvertOn(); if (this.MPStatus.MediaPlayer_Playing) { if (this.DisplaySettings.BlankDisplayWithVideo) { this.DisplayOff(); } if (this.MPStatus.Media_Speed > 0) { icon.RotateCW(); } else if (this.MPStatus.Media_Speed < 0) { icon.RotateCCW(); } icon.FlashOff(); } else { this.RestoreDisplayFromVideoOrIdle(); icon.FlashOn(); num4 = 6; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting PAUSED icon"); } } if (!_useDiskIconForAllMedia) { icon.Off(); } property = GUIPropertyManager.GetProperty("#Play.Current.File"); Log.Debug("current file: {0}", new object[] {property}); if (property.Length > 0) { string str3; num5 |= 0x10; strArray = property.Split(new char[] {'.'}); if ((strArray.Length > 1) && ((str3 = strArray[1].ToLowerInvariant()) != null)) { if ((!(str3 == "ifo") && !(str3 == "vob")) && !(str3 == "mpg")) { if (str3 == "wmv") { num5 |= 0x400; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting ICON_WMV"); } } else if (str3 == "divx") { num5 |= 0x20; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting ICON_DIVX"); } } else if (str3 == "xvid") { num5 |= 0x800; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting ICON_XVID"); } } } else { num5 |= 0x40; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting ICON_MPG"); } } } } } } if (!this.MPStatus.MediaPlayer_Playing || !_useDiskIconForAllMedia) { if (!this.MPStatus.MediaPlayer_Playing) { this.RestoreDisplayFromVideoOrIdle(); } segments = 0; if (drive.IsOpened) { if (drive.IsCDReady()) { if (!flag2) { flag2 = drive.Refresh(); } if (drive.GetNumAudioTracks() > 0) { segments = this.ICON_CDIn; } else { segments = this.ICON_DVDIn; } } else { flag2 = false; } } } if (!this.MPStatus.MediaPlayer_Active) { this.RestoreDisplayFromVideoOrIdle(); if (_mpIsIdle) { num5 |= 0x1000; num4 = 0; if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Setting ICON_IDLE"); } } } if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Status collected..."); } if (num4 != num3) { num2 = num4; } this.GetEQ(); this.DisplayEQ(); lock (this.DWriteMutex) { if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Building display image"); } if ((_useProgressDisplay || _useVolumeDisplay) || _useIcons) { this.ClearIconArea(); } if (_useProgressDisplay || _useVolumeDisplay) { this.DrawProgressBars(); } if (_useIcons) { if (!this.MPStatus.MediaPlayer_Playing || !_useDiskIconForAllMedia) { this.DrawDiskIcon(segments); } else { this.DrawDiskIcon(icon.Mask); } this.DrawIcons(num5); this.DrawLargeIcons(); } if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() image built - sending to display"); } this.GX_Session.SendAsyncFrame(this.GX_Surface); } if (!this.EQSettings._EqDataAvailable) { if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Sleeping..."); } Thread.Sleep(250); if (this.DoDebug) { Log.Info("MatrixGX.MOGXDisplay.DisplayUpdate() Waking..."); } } } }
private void UpdateIcons() { ulong optionBitmask = 0L; ulong num2; bool flag = false; var icon = new DiskIcon(); Log.Debug("iMONLCDg.UpdateIcons(): Starting Icon Update Thread"); var mask = new BuiltinIconMask(); var drive = new CDDrive(); if (DisplaySettings.BlankDisplayWithVideo & DisplaySettings.EnableDisplayAction) { GUIWindowManager.OnNewAction += OnExternalAction; } for (int i = 0; i < 0x1b; i++) { Inserted_Media[i] = 0; } if (DisplayOptions.DiskIcon & DisplayOptions.DiskMonitor) { char[] cDDriveLetters = CDDrive.GetCDDriveLetters(); var arg = cDDriveLetters.Length; Log.Debug("iMONLCDg.UpdateIcons(): Found {0} CD/DVD Drives.", arg); for (int j = 0; j < cDDriveLetters.Length; j++) { if (drive.Open(cDDriveLetters[j])) { Log.Debug("iMONLCDg.UpdateIcons(): Checking media in Drive {0}.", cDDriveLetters[j]); bool flag2 = false; for (int k = 0; k < 10; k++) { if (drive.IsCDReady()) { flag2 = true; } else { Thread.Sleep(50); } } if (flag2) { Log.Debug("iMONLCDg.UpdateIcons(): Waiting for Drive {0} to refresh.", cDDriveLetters[j]); drive.Refresh(); if (drive.GetNumAudioTracks() > 0) { Inserted_Media[cDDriveLetters[j] - 'A'] = 1; Log.Debug("iMONLCDg.UpdateIcons(): Found Audio CD in Drive {0}.", cDDriveLetters[j]); } else if (File.Exists(cDDriveLetters[j] + @"\VIDEO_TS")) { Inserted_Media[cDDriveLetters[j] - 'A'] = 2; Log.Debug("iMONLCDg.UpdateIcons(): Found DVD in Drive {0}.", cDDriveLetters[j]); } else { Inserted_Media[cDDriveLetters[j] - 'A'] = 4; Log.Debug("iMONLCDg.UpdateIcons(): Unknown media found in Drive {0}.", cDDriveLetters[j]); } } else { Inserted_Media[cDDriveLetters[j] - 'A'] = 0; Log.Debug("iMONLCDg.UpdateIcons(): No media found in Drive {0}.", cDDriveLetters[j]); } } drive.Close(); } } if (DisplayOptions.DiskIcon & DisplayOptions.DiskMonitor) { ActivateDVM(); } icon.Reset(); while (true) { do { lock (ThreadMutex) { if (DoDebug) { Log.Info("iMONLCDg.UpdateIcons(): Checking for Thread termination request"); } if (_stopUpdateIconThread) { Log.Info("iMONLCDg.UpdateIcons(): Icon Update Thread terminating"); _stopUpdateIconThread = false; if (DisplaySettings.BlankDisplayWithVideo & DisplaySettings.EnableDisplayAction) { GUIWindowManager.OnNewAction -= OnExternalAction; } if (DVM != null) { DVM.Dispose(); DVM = null; } return; } if ((!DVMactive & DisplayOptions.DiskIcon) & DisplayOptions.DiskMonitor) { ActivateDVM(); } num2 = optionBitmask; flag = !flag; int num7 = _CurrentLargeIcon; LastVolLevel = volLevel; LastProgLevel = progLevel; int num8 = 0; icon.Off(); icon.Animate(); if (DoDebug) { Log.Info("iMONLCDg.UpdateIcons(): Checking TV Card status: IsAnyCardRecording = {0}, IsViewing = {1}", MiniDisplayHelper.IsCaptureCardRecording().ToString(), MiniDisplayHelper.IsCaptureCardViewing().ToString()); } MiniDisplayHelper.GetSystemStatus(ref MPStatus); Check_Idle_State(); if (DoDebug) { Log.Info("iMONLCDg.UpdateIcons(): System Status: Plugin Status = {0}, IsIdle = {1}", MPStatus.CurrentPluginStatus.ToString(), MPStatus.MP_Is_Idle); } optionBitmask = ConvertPluginIconsToDriverIcons(MPStatus.CurrentIconMask); if ((optionBitmask & (0x400000000L)) > 0L) { num8 = 5; } else if ((optionBitmask & (8L)) > 0L) { num8 = 1; } if (MiniDisplayHelper.IsCaptureCardViewing() && !MPStatus.Media_IsTimeshifting) { icon.On(); icon.InvertOn(); icon.RotateCW(); } if (_mpIsIdle) { num8 = 0; } if (MPStatus.MediaPlayer_Playing) { icon.On(); if ((MPStatus.CurrentIconMask & (0x10L)) > 0L) { icon.InvertOff(); } else { icon.InvertOn(); } if ((MPStatus.CurrentIconMask & (0x10000000000L)) > 0L) { icon.RotateCCW(); } else { icon.RotateCW(); } icon.FlashOff(); if (((((((MPStatus.CurrentIconMask & (0x40L)) > 0L) | ((MPStatus.CurrentIconMask & (8L)) > 0L)) | (MPStatus.CurrentPluginStatus == Status.PlayingDVD)) | (MPStatus.CurrentPluginStatus == Status.PlayingTV)) | (MPStatus.CurrentPluginStatus == Status.PlayingVideo)) | (MPStatus.CurrentPluginStatus == Status.Timeshifting)) { if ((MPStatus.CurrentPluginStatus == Status.PlayingTV) | ((MPStatus.CurrentIconMask & (8L)) > 0L)) { num8 = 1; } else { num8 = 2; } if (DisplaySettings.BlankDisplayWithVideo) { DisplayOff(); } } else { num8 = 3; } GetEQ(); } else if (MPStatus.MediaPlayer_Paused) { icon.On(); lock (DWriteMutex) { EQSettings._EqDataAvailable = false; _iconThread.Priority = ThreadPriority.BelowNormal; } RestoreDisplayFromVideoOrIdle(); icon.FlashOn(); num8 = 6; } else { icon.Off(); RestoreDisplayFromVideoOrIdle(); lock (DWriteMutex) { EQSettings._EqDataAvailable = false; _iconThread.Priority = ThreadPriority.BelowNormal; } } if ((!MiniDisplayHelper.Player_Playing() & !MiniDisplayHelper.IsCaptureCardViewing()) || (DisplayOptions.DiskIcon & !DisplayOptions.DiskMediaStatus)) { int num9 = 0; if (DisplayOptions.DiskIcon) { for (int m = 0; m < 0x1b; m++) { num9 |= Inserted_Media[m]; } switch (num9) { case 1: optionBitmask |= mask.ICON_CDIn; goto Label_06B0; case 2: optionBitmask |= mask.ICON_DVDIn; goto Label_06B0; } if (num9 > 0) { optionBitmask |= mask.ICON_DiskOn; } } } Label_06B0: if (DisplayOptions.DiskIcon & DisplayOptions.DiskMediaStatus) { optionBitmask |= icon.Mask; } if (DoDebug) { Log.Info("iMONLCDg.UpdateIcons(): last = {0}, new = {1}, disk mask = {2}", num2.ToString("X0000000000000000"), optionBitmask.ToString("X0000000000000000"), icon.Mask.ToString("X0000000000000000")); } if (optionBitmask != num2) { lock (DWriteMutex) { SendData(iMonCommand.General.SetIcons, optionBitmask); } } DisplayEQ(); if (DisplayOptions.VolumeDisplay || DisplayOptions.ProgressDisplay) { lock (DWriteMutex) { ShowProgressBars(); } } if (num8 != num7) { _CurrentLargeIcon = num8; } } } while (EQSettings._EqDataAvailable && !MPStatus.MediaPlayer_Paused); Thread.Sleep(200); } }
private static void VolumeInserted(int bitMask) { string str = DVM.MaskToLogicalPaths(bitMask); if (Settings.Instance.ExtensiveLogging) { Log.Info("iMONLCDg.UpdateDisplay.VolumeInserted(): volume inserted in drive {0}", str); } var drive = new CDDrive(); if (drive.IsOpened) { drive.Close(); } drive.Open(str[0]); while (!drive.IsCDReady()) { Thread.Sleep(100); } drive.Refresh(); if (drive.GetNumAudioTracks() > 0) { Inserted_Media[str[0] - 'A'] = 1; if (Settings.Instance.ExtensiveLogging) { Log.Info("iMONLCDg.UpdateDisplay.VolumeInserted(): Audio CD inserted in drive {0}", str); } drive.Close(); } else { drive.Close(); if (Directory.Exists(str + @"\VIDEO_TS")) { Inserted_Media[str[0] - 'A'] = 2; if (Settings.Instance.ExtensiveLogging) { Log.Info("iMONLCDg.UpdateDisplay.VolumeInserted(): DVD inserted in drive {0}", str); } } else { Inserted_Media[str[0] - 'A'] = 4; if (Settings.Instance.ExtensiveLogging) { Log.Info("iMONLCDg.UpdateDisplay.VolumeInserted(): Unknown Media inserted in drive {0}", str); } } } }
private static void ThreadEncodeTrack() { m_Ripping = true; try { CreateTempFolder(); if (mp3Background) { GUIWaitCursor.Show(); } else if (dlgProgress != null) { dlgProgress.Reset(); dlgProgress.SetPercentage(0); dlgProgress.StartModal(GetID); dlgProgress.Progress(); dlgProgress.ShowProgressBar(true); } while (importQueue.Count > 0) { TrackInfo trackInfo = (TrackInfo) importQueue.Dequeue(); if ((dlgProgress != null) && !mp3Background) { if (importQueue.Count > 0) { dlgProgress.SetHeading( string.Format(GUILocalizeStrings.Get(1105) + " ({0} " + GUILocalizeStrings.Get(1104) + ")", importQueue.Count + 1)); } else { dlgProgress.SetHeading(GUILocalizeStrings.Get(1103)); } dlgProgress.SetLine(2, string.Format("{0:00}. {1} - {2}", trackInfo.MusicTag.Track, trackInfo.MusicTag.Artist, trackInfo.MusicTag.Title)); //dlgProgress.SetLine(2, trackInfo.TempFileName); if (dlgProgress.IsCanceled) { m_CancelRipping = true; } } if (!m_CancelRipping) { m_Drive = new CDDrive(); SaveTrack(trackInfo); if (File.Exists(trackInfo.TempFileName) && !m_CancelRipping) { #region Tagging try { Tags tags = Tags.FromFile(trackInfo.TempFileName); tags["TRCK"] = trackInfo.MusicTag.Track.ToString() + "/" + trackInfo.TrackCount.ToString(); tags["TALB"] = trackInfo.MusicTag.Album; tags["TPE1"] = trackInfo.MusicTag.Artist; tags["TIT2"] = trackInfo.MusicTag.Title; tags["TCON"] = trackInfo.MusicTag.Genre; if (trackInfo.MusicTag.Year > 0) { tags["TYER"] = trackInfo.MusicTag.Year.ToString(); } tags["TENC"] = "MediaPortal / Lame"; tags.Save(trackInfo.TempFileName); } catch { } #endregion #region Database try { if (!Directory.Exists(trackInfo.TargetDir)) { Directory.CreateDirectory(trackInfo.TargetDir); } if (File.Exists(trackInfo.TargetFileName)) { if (mp3ReplaceExisting) { File.Delete(trackInfo.TargetFileName); } } if (!File.Exists(trackInfo.TargetFileName)) { File.Move(trackInfo.TempFileName, trackInfo.TargetFileName); } if (File.Exists(trackInfo.TargetFileName) && mp3Database) { if (importUnknown || (trackInfo.MusicTag.Artist != "Unknown Artist") || (trackInfo.MusicTag.Album != "Unknown Album")) { MusicDatabase dbs = MusicDatabase.Instance; dbs.AddSong(trackInfo.TargetFileName); } } } catch { Log.Info("CDIMP: Error moving encoded file {0} to new location {1}", trackInfo.TempFileName, trackInfo.TargetFileName); } #endregion } } } if (mp3Background) { GUIWaitCursor.Hide(); } else { dlgProgress.Close(); } } finally { CleanupTempFolder(); } m_CancelRipping = false; m_Ripping = false; }