Exemple #1
0
        private void mnuOpenScript_Click(object sender, RoutedEventArgs e)
        {
            var formats = ScriptLoaderManager.GetFormats();

            OpenFileDialog dialog = new OpenFileDialog
            {
                Filter      = formats.BuildFilter(true),
                FilterIndex = _lastScriptFilterIndex
            };

            if (dialog.ShowDialog(this) != true)
            {
                return;
            }
            _lastScriptFilterIndex = dialog.FilterIndex;
            var format = formats.GetFormat(dialog.FilterIndex - 1, dialog.FileName);

            var loader  = ScriptLoaderManager.GetLoader(format);
            var actions = loader.Load(dialog.FileName);

            _scriptHandler.SetScript(actions);
            _openScript = dialog.FileName;

            TryFindMatchingVideo(dialog.FileName);

            UpdateHeatMap();
        }
        public MainViewModel()
        {
            ButtplugApiVersion  = ButtplugAdapter.GetButtplugApiVersion();
            Playlist            = new PlaylistViewModel();
            Playlist.PlayEntry += PlaylistOnPlayEntry;

            ConversionModes            = Enum.GetValues(typeof(ConversionMode)).Cast <ConversionMode>().ToList();
            _supportedScriptExtensions = ScriptLoaderManager.GetSupportedExtensions();

            InitializeCommands();
            InitializeTestPatterns();
            InitializeLaunchFinder();
            InitializeScriptHandler();
        }
Exemple #3
0
        private void TryFindMatchingScript(string filename)
        {
            if (VideoAndScriptNamesMatch())
            {
                return;
            }

            string scriptFile = FindFile(filename, ScriptLoaderManager.GetSupportedExtensions());

            if (!String.IsNullOrWhiteSpace(scriptFile))
            {
                string nameOnly = Path.GetFileName(scriptFile);
                if (MessageBox.Show(this, $"Do you want to also load '{nameOnly}'?", "Also load Script?", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    LoadScript(scriptFile, false);
                }
            }
        }
Exemple #4
0
        private void LoadScript(string fileToLoad, bool checkForVideo)
        {
            ScriptLoader loader = ScriptLoaderManager.GetLoader(fileToLoad);

            if (loader == null)
            {
                return;
            }

            var actions = loader.Load(fileToLoad);

            _scriptHandler.SetScript(actions);
            _openScript = fileToLoad;

            if (checkForVideo)
            {
                TryFindMatchingVideo(fileToLoad);
            }

            UpdateHeatMap();
        }
Exemple #5
0
        public MainWindow()
        {
            _supportedScriptExtensions = ScriptLoaderManager.GetSupportedExtensions();

            InitializeComponent();
        }