Пример #1
0
        void t_Tick(object sender, EventArgs e)
        {
            if (serText == null)
            {
                return;
            }

            var sb = new StringBuilder(serText);

            sb.AppendLine();
            bool ok1, ok2, ok3, oks;

            ok1 = ok2 = ok3 = oks = false;
            try
            {
                LSSettings s = LSSettings.singleton;
                ok1 = s.devRec != null && (!(s.devRec is LSDevice)) || ((LSDevice)s.devRec).mm != null;
                ok2 = s.devMic != null && ((LSDevice)s.devMic).mm != null;
                ok3 = s.devOut != null && ((LSDevice)s.devOut).mm != null;
                sb.AppendLine("dev state indicated: " + ok1 + ", " + ok2 + ", " + ok3);
                LSSettings.singleton.init();
                s.runTests(null, true);
                ok1 = ok1 == (s.devRec != null && (!(s.devRec is LSDevice)) || ((LSDevice)s.devRec).mm != null);
                ok2 = ok2 == (s.devMic != null && ((LSDevice)s.devMic).mm != null);
                ok3 = ok3 == (s.devOut != null && ((LSDevice)s.devOut).mm != null);
                sb.AppendLine("dev state correct: " + ok1 + ", " + ok2 + ", " + ok3);
                oks = true;
            }
            catch { }
            serText = gi.ToString() + "\r\n" + sb.ToString();
            System.IO.File.WriteAllText(serPath + "2.txt", serText, Encoding.UTF8);
            System.IO.File.Delete(serPath + "1.txt");
            linkLabel1.Text = serPath + "2.txt";

            gDesc.Enabled = gIgnOnce.Enabled = gIgnAlways.Enabled = gRestart.Enabled = true;
            gDesc.Text    = defaultmsg;
            gRestart.Focus();

            if (oks && (!ok1 || !ok2 || !ok3))
            {
                if (DialogResult.Yes == MessageBox.Show(
                        "The  bad  news:   Loopstream just crashed :(\n" +
                        "The good news:   I think I know why!\n\n" +
                        "Did you disconnect or disable your speakers or microphone?\n" +
                        "'cause you need to restart Loopstream when you do that.\n\n" +
                        "Wanna go for a restart?", "Dirty devices detected",
                        MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation))
                {
                    Program.fixWorkingDirectory();
                }
            }
        }
Пример #2
0
        void t_Tick(object sender, EventArgs e)
        {
            ((Timer)sender).Stop();
            wincap = this.Text + " v" + Application.ProductVersion;
            this.Text = wincap;
            z("set window title");

            DFC.coreTest();
            z("dfc core ok");
            string toolsBase = @"..\..\tools\";
            string[] requiredFiles = {
                "oggenc2.exe",
                "lame.exe",
                "lame_enc.dll"
            };
            if (Directory.Exists(toolsBase) &&
                File.Exists(toolsBase + Program.toolsVer))
            {
                if (DialogResult.Yes == MessageBox.Show(
                    "make .dfc (decent file container) ?\r\n\r\nhint: rename the tools folder\r\n         if you don't wanna see this",
                    "new embedded archive",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question))
                {
                    splash.vis();
                    z("dfc maker");
                    foreach (string filename in requiredFiles)
                    {
                        if (!File.Exists(toolsBase + filename))
                        {
                            DialogResult reply = MessageBox.Show(
                                "The following file is required in order to build a\r\n" +
                                "working DFC. Would you like to browse for it?\r\n\r\n" + filename,
                                "Missing dependency", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

                            if (reply == System.Windows.Forms.DialogResult.Cancel)
                                Program.kill();

                            if (reply == System.Windows.Forms.DialogResult.No)
                                continue;

                            string ext = filename.Substring(filename.LastIndexOf(".") + 1);

                            OpenFileDialog ofd = new OpenFileDialog();
                            ofd.CheckFileExists = true;
                            ofd.Title = "I am hungry for " + filename;
                            ofd.Filter = ext + " files|*." + ext;
                            ofd.FileName =
                                filename.Contains("lame") ? "*lame*" :
                                filename.Contains("ogg") ? "*ogg*" : "";

                            if (DialogResult.OK == ofd.ShowDialog())
                                File.Copy(ofd.FileName, toolsBase + toolsBase);

                            else
                                Program.kill();
                        }
                    }
                    new DFC().make(splash.progress);
                    Program.kill();
                }
            }

            string deleteReason = "";

            if (Directory.Exists(Program.tools))
            {
                if (!File.Exists(Program.tools + Program.toolsVer))
                    deleteReason = "outdated.\r\n\r\nIf you'd like to keep something in there (for example your SFX folder) then create a backup now :)";

                foreach (string filename in requiredFiles)
                    if (!File.Exists(Program.tools + filename))
                        deleteReason =
                            "missing the following required file:\r\n\r\n" +
                            Program.tools + filename + "\r\n\r\n" +
                            "Whoever made your Loopstream.exe probably messed up.";
            }

            if (!string.IsNullOrWhiteSpace(deleteReason))
            {
                z("deleting cause its " + deleteReason);
                if (DialogResult.OK != MessageBox.Show(
                    "I'm about to delete your " + Program.tools.Trim('\\') + " directory since it's " + deleteReason,
                    "Housekeeping", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning))
                    Program.kill();

                for (int a = 0; a < 3; a++)
                {
                    try
                    {
                        Directory.Delete(Program.tools, true);
                        break;
                    }
                    catch (Exception ex)
                    {
                        z("thank you microsoft");
                        System.Threading.Thread.Sleep(100);
                    }
                }
                while (Directory.Exists(Program.tools))
                    Application.DoEvents();
            }

            if (!Directory.Exists(Program.tools))
            {
                splash.vis();
                z("extracting tools");
                new DFC().extract(splash.progress);
            }
            z("extract sequence done");

            foreach (string filename in requiredFiles)
                if (!File.Exists(Program.tools + filename))
                {
                    MessageBox.Show(
                        "The following required file was not found:\r\n\r\n" +
                        Program.tools + filename + "\r\n\r\n" +
                        "Whoever made your copy of Loopstream.exe f****d up.",
                        "pokker", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Program.kill();
                }

            plowTheFields(); z("traktor test ok");
            splash.unvis(); z("splash hidden");

            if (++loads > 1)
            {
                MessageBox.Show("Critical semantical error, load sequencye fucskdjflks");
                return;
            }
            z("Settings #1 - LOAD"); settings = LSSettings.load();
            z("Settings #2 - TEST"); settings.runTests(splash.progress, false);
            z("Settings #3 - DONE"); isPresetLoad = true;

            z("Binding sliders");
            gMus.valueChanged += gSlider_valueChanged;
            gMic.valueChanged += gSlider_valueChanged;
            gSpd.valueChanged += gSlider_valueChanged;
            gOut.valueChanged += gSlider_valueChanged;
            mixerPresetChanged(sender, e);

            z("Creating ni");
            Program.ni = new NotifyIcon();
            NotifyIcon ni = Program.ni;
            ni.Icon = this.Icon;
            ni.Visible = true;
            ni.DoubleClick += ni_DoubleClick;
            MenuItem[] items = {
                new MenuItem("Hide", ni_DoubleClick),
                new MenuItem("Connect", gConnect_Click),
                new MenuItem("---"),
                new MenuItem("A (1st preset)", gPreset_Click),
                new MenuItem("B (2nd preset)", gPreset_Click),
                new MenuItem("C (3nd impact)", gPreset_Click),
                new MenuItem("D (4th preset)", gPreset_Click),
                new MenuItem("---"),
                new MenuItem("Exit", gExit_Click)
            };
            ni.ContextMenu = new ContextMenu(items);

            z("Binding ni");
            gA.preset = settings.presets[0];
            gB.preset = settings.presets[1];
            gC.preset = settings.presets[2];
            gD.preset = settings.presets[3];

            popPoor = popDrop = popSign = popQuit = null;
            assumeConnected = popFilt = false;

            z("Layout gManualTags");
            gManualTags.Font = new System.Drawing.Font(gManualTags.Font.FontFamily, gManualTags.Font.SizeInPoints * 0.8f);
            gManualTags.Text = gManualTags.Text.ToUpper().Replace(" ", "  ");
            gManualTags.Location = new Point(
                (int)(pictureBox1.Left + (pictureBox1.Width - gManualTags.Width) / 1.85),
                (int)(pictureBox1.Top + (pictureBox1.Height - gManualTags.Height) / 1.9));

            // sfx
            psfx_MouseClick(null, null);

            z("Position form");
            this.Bounds = myBounds;

            splash.Focus();
            //splash.BringToFront();
            splash.fx = settings.splash;
            splash.gtfo();

            if (settings.autohide)
            {
                z("Autohide was true");
                this.Visible = false;
            }
            if (settings.autoconn)
            {
                z("Autoconn was true");
                connect();
            }

            // please don't look
            invals = new Control[] {
                box_top_graden,
                box_bottom_graden,
                gMus.giSlider,
                gMus.graden1,
                gMus.graden2,
                gMic.giSlider,
                gMic.graden1,
                gMic.graden2,
                gSpd.giSlider,
                gSpd.graden1,
                gSpd.graden2,
                gOut.giSlider,
                gOut.graden1,
                gOut.graden2,
            };
            invalOnNext = false;
            lqMessage = null;

            iKonami = 0;
            tKonami = new Timer();
            cKonami = new Keys[] { Keys.Up, Keys.Up, Keys.Down, Keys.Down, Keys.Left, Keys.Right, Keys.Left, Keys.Right, Keys.B, Keys.A, Keys.Enter };
            tKonami.Tick += new EventHandler(tKonami_Tick);
            tKonami.Interval = 10;
            //tKonami.Start();

            Timer manMachineInterfaceManager = new Timer();
            manMachineInterfaceManager.Tick += manMachineInterfaceManager_manageWidgets;
            manMachineInterfaceManager.Interval = 200;
            manMachineInterfaceManager.Start();

            z("showhide"); showhide();
            z("skinner"); hookskinner(this.Controls);
            //Program.popception();
        }