コード例 #1
0
        internal static DeviceCommand ParseCommandLine(string command, string argument)
        {
            if (command == null || argument == null || !command.StartsWith("device"))
            {
                return(null);
            }

            DeviceCommand d_command = null;

            switch (command)
            {
            case "device-activate-play":
                d_command = new DeviceCommand(DeviceCommandAction.Activate | DeviceCommandAction.Play);
                break;

            case "device-activate":
                d_command = new DeviceCommand(DeviceCommandAction.Activate);
                break;

            case "device-play":
                d_command = new DeviceCommand(DeviceCommandAction.Play);
                break;

            case "device":
                d_command = new DeviceCommand(DeviceCommandAction.None);
                break;

            default:
                return(null);
            }

            // FIXME: Should use GIO here to resolve UNIX device nodes or
            // HAL UDIs from the GIO URI that we were likely given by Nautilus

            try {
                Banshee.Base.SafeUri uri = new Banshee.Base.SafeUri(argument);
                d_command.device_id = uri.IsLocalPath ? uri.LocalPath : argument;
            } catch {
                d_command.device_id = argument;
            }

            Hyena.Log.InformationFormat("Received device command: action = {0}, device = {1}",
                                        d_command.Action, d_command.DeviceId);

            return(d_command);
        }
コード例 #2
0
ファイル: SafeUri.cs プロジェクト: SyaskiMasyaski/banshee
 public static string UriToFilename(SafeUri uri)
 {
     return(UriToFilename(uri.AbsoluteUri));
 }
コード例 #3
0
        private static string CreateUriId(SafeUri uri)
        {
            string digestible = uri.ToString();

            return(CreateId("unknown", digestible));
        }