Пример #1
0
        // Handlers
        // Handlers :: OnResponse
        private void OnResponse(object o, ResponseArgs args)
        {
            if (args.ResponseId != ResponseType.Ok)
            {
                base.Destroy();
                return;
            }

            string fn = base.Uri;

            // make sure the extension is ".m3u"
            if (!FileUtils.IsPlaylist(fn))
            {
                fn += ".m3u";
            }

            if (FileUtils.Exists(fn))
            {
                OverwriteDialog d         = new OverwriteDialog(this, fn);
                bool            overwrite = d.GetAnswer();

                if (!overwrite)
                {
                    return;
                }
            }

            base.Destroy();

            Global.Playlist.SavePlaylist(fn, false, false);
        }
Пример #2
0
        // Methods :: Private
        // Methods :: Private :: ProcessCommandLine
        /// <summary>
        ///	Process command-line arguments.
        /// </summary>
        /// <remarks>
        ///	Files listed on the command-line may be playlists or
        ///	music files. They are all added, and the first song
        ///	begins playing.
        /// </remarks>
        /// <param name="args">
        ///	An array of <see cref="String">strings</see>,
        ///	representing command-line arguments.
        /// </param>
        /// <returns>
        ///	True, if a file was added to the playlist,
        ///	False otherwise.
        /// </returns>
        private static bool ProcessCommandLine(string [] args)
        {
            bool opened_file = false;

            foreach (string arg in args)
            {
                System.IO.FileInfo finfo = new System.IO.FileInfo(arg);

                if (!finfo.Exists)
                {
                    continue;
                }

                opened_file = true;

                // See the file is a Playlist
                if (FileUtils.IsPlaylist(arg))                    // load as playlist
                {
                    dbus_object.OpenPlaylist(finfo.FullName);
                    continue;
                }

                // Must be a music file

                // If it's the first song, start playing it.
                if (arg == args [0])
                {
                    dbus_object.PlayFile(finfo.FullName);
                }
                else                 // Else, queue.
                {
                    dbus_object.QueueFile(finfo.FullName);
                }
            }

            return(opened_file);
        }
Пример #3
0
        // Handlers
        // Handlers :: OnResponse
        private void OnResponse(object o, ResponseArgs args)
        {
            if (args.ResponseId != ResponseType.Ok)
            {
                base.Destroy();
                return;
            }

            string fn = base.Uri;

            base.Destroy();

            if (!FileUtils.IsPlaylist(fn))
            {
                return;
            }

            if (!FileUtils.Exists(fn))
            {
                return;
            }

            Global.Playlist.OpenPlaylist(fn);
        }