public static async Task <CamConfig> CheckConfiguration() { try { CamConfig newConfig; string result = defaultResult; Console.WriteLine("checking for cam"); result = await CustomScriptCommands.QuickQuery("queryconfig"); if (result == null || result == defaultResult || result.Length < 12 || !result.ToLower().Contains("6d")) { Console.WriteLine("checked null"); MainForm.m.WriteToResponses("Cam config received null", false); return(CamConfig.Null); } string type = result.Substring(13, 1); MainForm.m.WriteToResponses("Cam config received response: " + result + "(" + type + ")", false); switch (type) { case "0": newConfig = CamConfig.SSTraditional; break; case "1": newConfig = CamConfig.Strict; break; case "2": newConfig = CamConfig.RevTilt; break; case "3": newConfig = CamConfig.Legacy; break; default: newConfig = CamConfig.Null; break; } MainForm.m.WriteToResponses("Cam config type: " + newConfig.ToString(), false); Console.WriteLine("Cam config type: " + newConfig.ToString()); currentConfig = newConfig; return(newConfig); } catch (Exception e) { Console.WriteLine(e.ToString()); MessageBox.Show("CHECK CAM CONFIG\n" + e.ToString()); return(CamConfig.Null); } }
private void b_PD_Stop_Click(object sender, EventArgs e) //make it cancel current script { b_PD_Stop.Enabled = false; b_PD_Fire.Enabled = true; stop = true; CustomScriptCommands.stopScript = true; if (AsyncCamCom.sock.Connected) { CustomScriptCommands.QuickCommand("stop"); } }
public void DoCommand(int index) { try { if (index > buttonList.Count - 1 || MainForm.m.setPage.dgv_Custom_Buttons.Rows[index].Cells[1].Value == null) { return; } string val = MainForm.m.setPage.dgv_Custom_Buttons.Rows[index].Cells[1].Value.ToString(); if (val.ToLower().Trim().StartsWith("preset")) { string presetValue = ""; bool isDigitPresent = false; foreach (char c in val.ToArray()) { if (char.IsDigit(c)) { isDigitPresent = true; presetValue += c.ToString(); } else if (isDigitPresent) { break; } } if (isDigitPresent) { val = "gotopreset " + presetValue; } } CustomScriptCommands.QuickCommand(val, false); } catch (Exception e) { MessageBox.Show("DO COMMAND\n" + index.ToString() + "\n" + e.ToString()); } }
void Send() { string text = tB_Entry.Text; if (text.Length == 0) { return; } if (customCommand) { CustomScriptCommands.QuickCommand(text, false); } else if (int.TryParse(text, out int output)) { CustomScriptCommands.QuickCommand(command + " " + output.ToString(), false); } InfoPanel.i.UpdateNext(); tB_Entry.Text = ""; this.Close(); }
private void b_Presets_Admin_SetupMen_Click(object sender, EventArgs e) { CustomScriptCommands.SendAdminMenu(); }
private void b_Presets_Thermal_WhiteBlack_Click(object sender, EventArgs e) { CustomScriptCommands.DoPreset(2, 8); }
public async Task CheckLine(string line, int linePos, FireType type) { try { if (line != "" && !line.StartsWith("//")) { line = line.Replace(",", "").Trim(); line = line.ToLower().Replace("x", "0"); ScriptCommand sendCom = new ScriptCommand(null, new byte[] { 0, 0, 0, 0 }, null, 0); if (line.Length == 20) { sendCom = new ScriptCommand(new string[] { "" }, Tools.ConvertMsgToByte(line), "", 0); } else { uint adr = 0; Invoke((MethodInvoker) delegate { adr = Tools.MakeAdr(); }); sendCom = await CustomScriptCommands.CheckForCommands(line, adr, true).ConfigureAwait(false); if (sendCom.codeContent == noCommand) { sendCom = new ScriptCommand(new string[] { "" }, MakeCommand(line), "", 0); } } if (sendCom == null || sendCom.codeContent == null || sendCom.custom) { if ((sendCom == null || sendCom.codeContent == null) && !sendCom.custom) { MainForm.m.WriteToResponses(line + " is invalid!", true); } else if (sendCom.codeContent == loop) { int val = CustomScriptCommands.CheckForVal(line); if (val > 0) { loopPos = linePos; loopAmount = val; } } else if (sendCom.codeContent == loopStop) { if (loopPos != -1) { currentLoops++; } loopNow = true; } if (sendCom != null && !sendCom.custom) { Console.WriteLine("null command"); } return; } if (type == FireType.IP) { await IPSend(sendCom, line); } else { //SerialSend(send, line); } } } catch (Exception e) { MainForm.m.WriteToResponses("Failed to parse line! (" + line + ")\n" + e.ToString() , false); } }
private void b_Presets_SLG_FlashingRG_Click(object sender, EventArgs e) { CustomScriptCommands.DoPreset(1, 35); }
private void b_Presets_SLG_AllLightsOff_Click(object sender, EventArgs e) { CustomScriptCommands.DoPreset(1, 36); }
private void b_Presets_Daylight_Stabilizer_Click(object sender, EventArgs e) { CustomScriptCommands.DoPreset(1, 19); }
private void b_Presets_SLG_SteadyRed_Click(object sender, EventArgs e) { CustomScriptCommands.DoPreset(1, 32); }
private void b_Presets_ContrastNeg_Click(object sender, EventArgs e) { CustomScriptCommands.DoPreset(2, 178); }
private void b_Presets_Daylight_WDR_Click(object sender, EventArgs e) { CustomScriptCommands.DoPreset(1, 11); }
private void b_Presets_Thermal_DigiNeg_Click(object sender, EventArgs e) { CustomScriptCommands.DoPreset(2, 182); }
private void b_Presets_Thermal_BrightPos_Click(object sender, EventArgs e) { CustomScriptCommands.DoPreset(2, 177); }
private void b_Presets_Thermal_Stabi_Click(object sender, EventArgs e) { CustomScriptCommands.DoPreset(2, 19); }
private void b_Presets_Admin_MechMen_Click(object sender, EventArgs e) { CustomScriptCommands.SendMechanicalMenu(); }
private void b_Presets_Peak_StopZoom_Click(object sender, EventArgs e) { CustomScriptCommands.DoPreset(2, 184); }
private void b_Presets_Peak_LampOff_Click(object sender, EventArgs e) { CustomScriptCommands.DoPreset(2, 187); }
private void b_Presets_Peak_SteadyLamp_Click(object sender, EventArgs e) { CustomScriptCommands.DoPreset(2, 188); }
private void b_Presets_Admin_DefaultMen_Click(object sender, EventArgs e) { CustomScriptCommands.DoPreset(Convert.ToInt32(Tools.MakeAdr()), 2); }
private void b_Debug_Click(object sender, EventArgs e) { sc = CustomScriptCommands.CheckForCommands(tB_Debug.Text, 0, false).Result; Tools.ShowScriptCommandInfo(sc, true); }