public static void HandleDiskFromAutoplay(char driveLetter, CDAction action) { CDAlbumCommand cdAlbumCommand = null; foreach (CDAlbumCommand cd in Instance.CDs) { if (cd != null && cd.CDDevice.DrivePath == driveLetter) { cdAlbumCommand = cd; break; } } if (cdAlbumCommand == null) { Instance._pendingAutoPlay = new AutoplayInfo(driveLetter, action); } else { cdAlbumCommand.Invoke(); if (action == CDAction.Rip && cdAlbumCommand.InsertedDuringSession && ZuneShell.DefaultInstance.Management.AutoCopyCD.Value || !cdAlbumCommand.CDDevice.IsDriveReady) { return; } cdAlbumCommand.AutoPlayAction = action; } }
// Use this for initialization void Start() { StreamReader sr = new StreamReader("F://a.txt"); CDAction c = new CDAction(); JsonUtility.FromJsonOverwrite(sr.ReadToEnd(), c); print(c.num); }
public static void HandleDiskFromAutoplay(string path, CDAction action) { int num = path.IndexOf(':'); if (num <= 0) { return; } char upperInvariant = char.ToUpperInvariant(path[num - 1]); if (upperInvariant < 'A' || upperInvariant > 'Z') { return; } HandleDiskFromAutoplay(upperInvariant, action); }