Пример #1
0
        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);
            }
        }
Пример #2
0
 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");
     }
 }
Пример #3
0
        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());
            }
        }
Пример #4
0
        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();
        }
Пример #5
0
 private void b_Presets_Admin_SetupMen_Click(object sender, EventArgs e)
 {
     CustomScriptCommands.SendAdminMenu();
 }
Пример #6
0
 private void b_Presets_Thermal_WhiteBlack_Click(object sender, EventArgs e)
 {
     CustomScriptCommands.DoPreset(2, 8);
 }
Пример #7
0
        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);
            }
        }
Пример #8
0
 private void b_Presets_SLG_FlashingRG_Click(object sender, EventArgs e)
 {
     CustomScriptCommands.DoPreset(1, 35);
 }
Пример #9
0
 private void b_Presets_SLG_AllLightsOff_Click(object sender, EventArgs e)
 {
     CustomScriptCommands.DoPreset(1, 36);
 }
Пример #10
0
 private void b_Presets_Daylight_Stabilizer_Click(object sender, EventArgs e)
 {
     CustomScriptCommands.DoPreset(1, 19);
 }
Пример #11
0
 private void b_Presets_SLG_SteadyRed_Click(object sender, EventArgs e)
 {
     CustomScriptCommands.DoPreset(1, 32);
 }
Пример #12
0
 private void b_Presets_ContrastNeg_Click(object sender, EventArgs e)
 {
     CustomScriptCommands.DoPreset(2, 178);
 }
Пример #13
0
 private void b_Presets_Daylight_WDR_Click(object sender, EventArgs e)
 {
     CustomScriptCommands.DoPreset(1, 11);
 }
Пример #14
0
 private void b_Presets_Thermal_DigiNeg_Click(object sender, EventArgs e)
 {
     CustomScriptCommands.DoPreset(2, 182);
 }
Пример #15
0
 private void b_Presets_Thermal_BrightPos_Click(object sender, EventArgs e)
 {
     CustomScriptCommands.DoPreset(2, 177);
 }
Пример #16
0
 private void b_Presets_Thermal_Stabi_Click(object sender, EventArgs e)
 {
     CustomScriptCommands.DoPreset(2, 19);
 }
Пример #17
0
 private void b_Presets_Admin_MechMen_Click(object sender, EventArgs e)
 {
     CustomScriptCommands.SendMechanicalMenu();
 }
Пример #18
0
 private void b_Presets_Peak_StopZoom_Click(object sender, EventArgs e)
 {
     CustomScriptCommands.DoPreset(2, 184);
 }
Пример #19
0
 private void b_Presets_Peak_LampOff_Click(object sender, EventArgs e)
 {
     CustomScriptCommands.DoPreset(2, 187);
 }
Пример #20
0
 private void b_Presets_Peak_SteadyLamp_Click(object sender, EventArgs e)
 {
     CustomScriptCommands.DoPreset(2, 188);
 }
Пример #21
0
 private void b_Presets_Admin_DefaultMen_Click(object sender, EventArgs e)
 {
     CustomScriptCommands.DoPreset(Convert.ToInt32(Tools.MakeAdr()), 2);
 }
Пример #22
0
 private void b_Debug_Click(object sender, EventArgs e)
 {
     sc = CustomScriptCommands.CheckForCommands(tB_Debug.Text, 0, false).Result;
     Tools.ShowScriptCommandInfo(sc, true);
 }