예제 #1
0
    public Script()
    {
        string     content     = "ctrl+w script-message my-message-1 my-argument-1";
        string     sectionName = Assembly.GetExecutingAssembly().GetName().Name;
        CorePlayer core        = Global.Core;

        core.commandv("define-section", sectionName, content, "force");
        core.commandv("enable-section", sectionName);
        core.ClientMessage += ClientMessage;
    }
예제 #2
0
    void ContextMenu_Opening(object sender, CancelEventArgs e)
    {
        // edit input.conf and add 'Edition' menu item there
        MenuItem menuItem = MainForm.FindMenuItem("Edition");

        if (menuItem == null)
        {
            return;
        }

        menuItem.DropDownItems.Clear();
        var editionTracks = Core.MediaTracks.Where(track => track.Type == "e");

        foreach (MediaTrack track in editionTracks)
        {
            MenuItem mi = new MenuItem(track.Text);
            mi.Action  = () => { Core.commandv("set", "edition", track.ID.ToString()); };
            mi.Checked = Core.Edition == track.ID;
            menuItem.DropDownItems.Add(mi);
        }
    }
예제 #3
0
    //handles keys defined in input.conf
    void ClientMessage(string[] args)
    {
        if (args[0] != "rate-file")
        {
            return;
        }

        int rating;

        if (int.TryParse(args[1], out rating))
        {
            string path = Core.get_property_string("path");

            if (!File.Exists(path))
            {
                return;
            }

            Dic[path] = rating;
            Core.commandv("show-text", "Rating: " + rating);
        }
    }
예제 #4
0
    void ClientMessage(string[] args)
    {
        if (args == null || args.Length != 2 || args[0] != "delete-current-file")
        {
            return;
        }

        if (args[1] == "ask")
        {
            FileToDelete = Core.get_property_string("path");
            DeleteTime   = DateTime.Now;
            Core.commandv("show-text", "Press 1 to delete file", "5000");
        }
        else if (args[1] == "confirm")
        {
            TimeSpan ts   = DateTime.Now - DeleteTime;
            string   path = Core.get_property_string("path");

            if (FileToDelete == path && ts.TotalSeconds < 5 && File.Exists(FileToDelete))
            {
                Core.command("playlist-remove current");
                int pos = Core.get_property_int("playlist-pos");

                if (pos == -1)
                {
                    int count = Core.get_property_int("playlist-count");

                    if (count > 0)
                    {
                        Core.set_property_int("playlist-pos", count - 1);
                    }
                }

                Thread.Sleep(2000);
                FileSystem.DeleteFile(FileToDelete, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
            }
        }
    }
 void FullscreenChange(bool value)
 {
     Core.commandv("show-text", "fullscreen: " + value);
 }