コード例 #1
0
ファイル: MainForm.cs プロジェクト: maesse/HLSM
        // Start listening, moving files, etc.
        public void Enable()
        {
            // Disable UI
            LockChanged(false);

            if (!Directory.Exists(Properties.Settings.Default.HLPath))
            {
                Disable();
                MessageBox.Show(this, "Path to HL/Mod is invalid. Check your settings", "Invalid HLPath", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Gather up sounds
            sounds = new Sounds();
            sounds.SoundList = new List<Sound>();
            foreach (SoundItem item in flowLayoutPanel1.Controls)
            {
                sounds.SoundList.Add(item.sound);
            }

            // Init Keyboard
            InitKeyboard();

            // Start timer for checking keyboard binds
            if(timer == null)
                timer = new Timer();

            timer.Interval = Properties.Settings.Default.TickInterval;
            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: maesse/HLSM
        // Save to given path
        void SaveConfigAs(string file)
        {
            // Gather sounds
            List<Sound> sounds = new List<Sound>();
            foreach (SoundItem item in flowLayoutPanel1.Controls)
                sounds.Add(item.sound);

            //Sound[] soundArr = sounds.ToArray();
            Sounds s = new Sounds();
            s.SoundList = sounds;

            // Serialize
            XmlSerializer x = new XmlSerializer(typeof(Sounds));
            FileStream str = File.Create(file);
            StreamWriter w = new StreamWriter(str);
            x.Serialize(w, s);
            w.Dispose();
            str.Dispose();

            // Save config path
            currentConfig = file;
            GotChanges = false;
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: maesse/HLSM
 // stop listening, moving files, etc.
 public void Disable()
 {
     // Enable UI
     LockChanged(true);
     sounds = null;
     ActiveSound = null;
     if (timer != null)
         timer.Stop();
     CloseKeyboard();
 }