예제 #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);
 }