示例#1
0
        static void Main(string[] args)
        {
            ExeFile   = System.Reflection.Assembly.GetEntryAssembly().Location;
            ExeFolder = Path.GetDirectoryName(ExeFile);
            Environment.CurrentDirectory = ExeFolder; // always run from exe folder to avoid problems with dlls

            ConfigFile = ExeFolder + $@"\{ConfigName}.xml";
            LogFile    = ExeFolder + $@"\CGLog.txt";

            CleanLegacyOpenVRFiles();
            WaveFilePool.MigrateWaveFiles();

            if (args.Count() > 0)
            {
                CmdArgsLCase = String.Concat(args).ToLower();
            }

            if (CmdArgsLCase.Contains("bulkcga"))
            {
                WaveFilePool.BulkCga();
                Environment.Exit(0);
            }

            try
            {
                ReadEarlyConfig();
            }
            catch (Exception)
            {
                // intentionally ignore
            }

            // Windows startup
            if (CmdArgsLCase.Contains(Arg_WinStartup))
            {
                IsWindowsStartup = true;
                System.Threading.Thread.Sleep(WindowsStartupWaitInSeconds * 1000); // wait for audio devices
            }

            // SteamVR startup
            if (CmdArgsLCase.Contains(Arg_SteamVRStartup))
            {
                IsSteamVRStartup = true;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormMain());
        }
示例#2
0
        void RefreshWaveCombo()
        {
            WaveFileInfo previouslySelected = (comboBoxWave.SelectedItem as WaveFileInfo);

            SkipFlaggedEventHandlers = true;
            Enabled = false;
            comboBoxWave.DataSource = null;
            comboBoxWave.DataSource = WaveFilePool.GetAvailableWaves();
            Enabled = true;

            object matchToPreviouslySelected = null;

            foreach (var item in comboBoxWave.Items)
            {
                if ((item as WaveFileInfo).ValueEquals(previouslySelected))
                {
                    matchToPreviouslySelected = item;
                }
            }

            object matchToCurrentWave = null;

            foreach (var item in comboBoxWave.Items)
            {
                if ((item as WaveFileInfo).ValueEquals(TheWave?.Wave))
                {
                    matchToCurrentWave = item;
                }
            }

            if (matchToPreviouslySelected != null)
            {
                comboBoxWave.SelectedItem = matchToPreviouslySelected;
            }
            else if (matchToCurrentWave != null)
            {
                comboBoxWave.SelectedItem = matchToCurrentWave;
            }
            else if (previouslySelected != null)
            {
                TheWave.SetWave(previouslySelected);
            }
            SkipFlaggedEventHandlers = false;

            CheckNoWaveState();
        }
示例#3
0
        public WaveEditor()
        {
            InitializeComponent();

            if (!FormMain.RunFromDesigner)
            {
                comboBoxWave.DataSource = WaveFilePool.GetAvailableWaves();
                TTip.SetToolTip(pictureBoxRefresh, $"Refresh available sounds." + Environment.NewLine +
                                $"Put your custom sound files ({WaveFilePool.WaveFileExtension}) in: \"{WaveFilePool.WaveFolder}\"");
                TTip.SetToolTip(pictureBoxAddWaves, $"Open Windows explorer to manage your custom sounds ({WaveFilePool.WaveFileExtension}).");
                TTip.SetToolTip(labelNoWaves, $"Please add sound files ({WaveFilePool.WaveFileExtension}) to \"{WaveFilePool.WaveFolder}\" and click the refresh button.");
                TTip.SetToolTip(comboBoxWave, $"Select the sound file to play. Due to audio implementation, only the first 5 seconds of the wave will be played.");
                TTip.SetToolTip(numericUpDownLoop, $"Loop count. How many times the sound is played in succession per single trigger. Max=9.");
                TTip.SetToolTip(trackBarPan, $"Mouse middle button = center");

                InitializeAppearance();
            }

            AddEventHandlers();
        }