void manMachineInterfaceManager_manageWidgets(object sender, EventArgs e) { if (mixer != null && mixer.isLQ != null) { lqMessage = mixer.isLQ; mixer.isLQ = null; this.Height += 64; pMessage.Visible = true; } bool connected = assumeConnected && tag != null; long now = DateTime.UtcNow.Ticks / 10000; if (!connected) { foreach (LSSettings.LSTrigger ev in LSSettings.singleton.triggers) { ev.lastAudio = now; ev.lastMouse = now; } } else { Point mousepos = Cursor.Position; if (mousepos.X != lastMousePosition.X || mousepos.Y != lastMousePosition.Y) { lastMousePosition = mousepos; foreach (LSSettings.LSTrigger ev in LSSettings.singleton.triggers) { ev.lastMouse = now; } } if (gOut != null && gOut.giSlider != null && gOut.giSlider.src != null) { if (gOut.giSlider.src.vuAge < 16) { foreach (LSSettings.LSTrigger ev in LSSettings.singleton.triggers) { if (gOut.giSlider.src.VU >= ev.pAudio) { ev.lastAudio = now; } } } } } if (tag == null) return; if (settings.mp3.FIXME_kbps <= 1 && settings.ogg.FIXME_kbps <= 1) { if (daText == "Connect") { this.Text = wincap; if (popPoor != null && popPoor.sactive) popPoor.Dispose(); popPoor = null; if (popDrop != null && popDrop.sactive) popDrop.Dispose(); popDrop = null; if (popSign != null && popSign.sactive) popSign.Dispose(); popSign = null; if (popQuit != null && popQuit.sactive) popQuit.Dispose(); popQuit = null; } else { this.Text = "- C O N N E C T I N G -"; } } else { this.Text = string.Format("{0:0.00} // {1:0.00} // {2}", Math.Round(settings.mp3.FIXME_kbps, 2), Math.Round(settings.ogg.FIXME_kbps, 2), tag.tag.tag); } if (settings.tagAuto) { gTag.Text = tag.tag.tag; } gConnect.Text = daText; if (daText == "Connect") { gConnect.Enabled = true; } if (settings.mixer.xRec < gMus.boost) gMus.boost = settings.mixer.xRec; if (settings.mixer.xMic < gMic.boost) gMic.boost = settings.mixer.xMic; double f, f_mp3, f_ogg; f = f_mp3 = f_ogg = -1; if (settings.mp3.FIXME_kbps >= 0) { f_mp3 = settings.mp3.FIXME_kbps * 1.0 / settings.mp3.bitrate; } if (settings.ogg.FIXME_kbps >= 0) { f_ogg = settings.ogg.FIXME_kbps * 1.0 / 24; } // TODO: ogg f = f_mp3 >= 0 ? f_mp3 : f_ogg; lock (Logger.bitratem) { Logger.bitratem.Add(Math.Max(settings.mp3.FIXME_kbps, 0)); } lock (Logger.bitrateo) { Logger.bitrateo.Add(Math.Max(settings.ogg.FIXME_kbps, 0)); } if (connected && popFilt) { foreach (LSSettings.LSTrigger ev in LSSettings.singleton.triggers) { ev.lastNet = f; } LSSettings.LSTrigger.Until prev = new LSSettings.LSTrigger.Until(); prev.required = prev.msec = int.MaxValue; LSSettings.LSTrigger show = null; foreach (LSSettings.LSTrigger ev in LSSettings.singleton.triggers) { LSSettings.LSTrigger.Until until = ev.until(now); if (until.msec <= prev.msec || until.msec < until.required / 2) { show = ev; prev = until; } } if (popPoor != null && popPoor.sactive && (show == null || show.eType != LSSettings.LSTrigger.EventType.WARN_CONN_POOR || show.until(now).msec > 0)) { popPoor.Dispose(); popPoor = null; } if (popDrop != null && popDrop.sactive && (show == null || show.eType != LSSettings.LSTrigger.EventType.WARN_CONN_DROP || show.until(now).msec > 0)) { popDrop.Dispose(); popDrop = null; } if (popSign != null && popSign.sactive && (show == null || show.eType != LSSettings.LSTrigger.EventType.WARN_NO_AUDIO || show.until(now).msec > 100)) { popSign.Dispose(); popSign = null; } if (popQuit != null && popQuit.sactive) { if (show == null || show.eType != LSSettings.LSTrigger.EventType.DISCONNECT) { popQuit.Dispose(); popQuit = null; } else { LSSettings.LSTrigger.Until remain = show.until(now); if (remain.msec > remain.required / 2) { popQuit.Dispose(); popQuit = null; } } } if (show != null && show.until(now).msec <= 0) { if (show.eType == LSSettings.LSTrigger.EventType.WARN_CONN_POOR && (popPoor == null || !popPoor.sactive)) { popPoor = new UI_Msg("poor", ""); popPoor.Show(); } if (show.eType == LSSettings.LSTrigger.EventType.WARN_CONN_DROP && (popDrop == null || !popDrop.sactive)) { popDrop = new UI_Msg("drop", ""); popDrop.Show(); } if (show.eType == LSSettings.LSTrigger.EventType.WARN_NO_AUDIO && popSign == null) { popSign = new UI_Msg("audio", ""); popSign.Show(); } if (show.eType != LSSettings.LSTrigger.EventType.WARN_NO_AUDIO && popSign != null) { popSign.Dispose(); popSign = null; } if (show.eType == LSSettings.LSTrigger.EventType.DISCONNECT) { if (popQuit != null && popQuit.sactive) { popQuit.setMsg("0"); } disconnect(); } } else if (show != null && show.eType == LSSettings.LSTrigger.EventType.DISCONNECT) { LSSettings.LSTrigger.Until remain = show.until(now); if (remain.msec <= remain.required / 2) { string msg = Math.Ceiling(remain.msec / 1000.0).ToString(); if (popQuit == null || !popQuit.sactive) { popQuit = new UI_Msg("quit", msg); popQuit.Show(); } else { popQuit.setMsg(msg); } if (popSign != null && !popSign.sactive) { popSign.Dispose(); popSign = null; } } } } else { double max = 0; foreach (LSSettings.LSTrigger ev in LSSettings.singleton.triggers) { if (ev.eType == LSSettings.LSTrigger.EventType.WARN_CONN_POOR || ev.eType == LSSettings.LSTrigger.EventType.WARN_CONN_DROP) { max = Math.Max(max, ev.pUpload); } } if (f > max) popFilt = assumeConnected; } }
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(); }