Esempio n. 1
0
        private void OnTeleportCasted(bool _, LogLineEventArgs logInfo)
        {
            if (state != States.In2P)
            {
                return;
            }
            string log = logInfo.logLine;
            Match  m   = OnTeleport.Match(log);

            if (m.Success)
            {
                lock (lock2)
                {
                    uint id1 = Convert.ToUInt32(m.Groups[1].Value, 16);
                    uint id2 = Convert.ToUInt32(m.Groups[2].Value, 16);
                    if (list == null)
                    {
                        list = PlaceKupo.repository.GetCombatantList();
                    }
                    var cmb = list.FirstOrDefault(x => x.ID == id1);
                    if (cmb != null)
                    {
                        MarkExistence(cmb.PosX, cmb.PosY, 1);
                        PlaceKupo.Log(string.Format("已添加 {3}({4}): ({0},{1},{2})", cmb.PosX.ToString(), cmb.PosZ.ToString(), cmb.PosY.ToString(), cmb.Name, cmb.ID.ToString("X")));
                    }
                    cmb = list.FirstOrDefault(x => x.ID == id2);
                    if (cmb != null)
                    {
                        MarkExistence(cmb.PosX, cmb.PosY, -1);
                        PlaceKupo.Log(string.Format("已移除 {3}({4}): ({0},{1},{2})", cmb.PosX.ToString(), cmb.PosZ.ToString(), cmb.PosY.ToString(), cmb.Name, cmb.ID.ToString("X")));
                    }
                    teleport++;
                    if (teleport == 2)
                    {
                        int cnt = 0;
                        for (int i = 0; i < 4; i++)
                        {
                            if (Xnum[i] == 0)
                            {
                                for (int j = 0; j < 4; j++)
                                {
                                    if (Znum[j] == 0)
                                    {
                                        PlaceKupo.WriteWaymark(new Waymark(Xenum[i], -480F, Zenum[j], 0, true), cnt++);
                                        PlaceKupo.Log(string.Format("已标记安全点: ({0},-480,{1})。", Xenum[i], Zenum[j]));
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public bool SetAudioEndpoint(string dev, bool usedefault = false)
        {
            System.Collections.ObjectModel.ReadOnlyCollection <DirectSoundDevice> list = DirectSoundDeviceEnumerator.EnumerateDevices();

            DirectSoundDevice dsd = null;

            if (dev != null)                                               // active selection
            {
                dsd = list.FirstOrDefault(x => x.Description.Equals(dev)); // find
                if (dsd == null && !usedefault)                            // if not found, and don't use the default (used by constructor)
                {
                    return(false);
                }
            }

            DirectSoundOut dso = new DirectSoundOut(200);    // seems good quality at 200 ms latency

            if (dsd != null)
            {
                dso.Device = dsd.Guid;
            }

            if (aout != null)                   // clean up last
            {
                aout.Stopped -= Output_Stopped;
                aout.Stop();
                aout.Dispose();
            }

            aout          = dso;
            aout.Stopped += Output_Stopped;

            return(true);
        }
Esempio n. 3
0
        /// <summary>
        /// Iterate over command elements to extract local parameter values.
        ///
        /// Store these values by a key
        /// consisting of the suffix of the command + the parameter name.  There are some exceptions, e.g.
        /// credential, location, where the parameter name itself is the key.
        ///
        /// For example, New-AzResourceGroup -Name Hello -Location 'EastUS' will store into local parameters:
        ///   ResourceGroupName => Hello
        ///   Location => 'EastUS'
        /// </summary>
        /// <param name="command">The command ast elements</param>
        private void ExtractLocalParameters(System.Collections.ObjectModel.ReadOnlyCollection <CommandElementAst> command)
        {
            // Azure PowerShell command is in the form of {Verb}-Az{Noun}, e.g. New-AzResource.
            // We need to extract the noun to construct the parameter name.

            var commandName = command.FirstOrDefault()?.ToString();
            var commandNoun = ParameterValuePredictor.GetAzCommandNoun(commandName).ToLower();

            if (commandNoun == null)
            {
                return;
            }

            for (int i = 2; i < command.Count; i += 2)
            {
                if (command[i - 1] is CommandParameterAst parameterAst && command[i] is StringConstantExpressionAst)
                {
                    var parameterName = command[i - 1].ToString().ToLower().Trim('-');
                    if (_command_param_to_resource_map.ContainsKey(commandNoun))
                    {
                        if (_command_param_to_resource_map[commandNoun].ContainsKey(parameterName))
                        {
                            var key            = _command_param_to_resource_map[commandNoun][parameterName];
                            var parameterValue = command[i].ToString();
                            this._localParameterValues.AddOrUpdate(key, parameterValue, (k, v) => parameterValue);
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        private void StartSpeech(AssignedVoice vb, string outputfile)
        {
            WinAvailableVoice wv = (WinAvailableVoice)vb.root;

            // Find the best audio format to use for this voice.
            System.Collections.ObjectModel.ReadOnlyCollection <SpeechAudioFormatInfo> formats =
                wv.winVoice.VoiceInfo.SupportedAudioFormats;

            format = formats.FirstOrDefault();

            if (format == null)
            {
                // The voice did not tell us its parameters, so we pick some.
                format = new SpeechAudioFormatInfo(
                    16000,      // Samples per second
                    AudioBitsPerSample.Sixteen,
                    AudioChannel.Mono);
            }

            // First set up to synthesize the message into a WAV file.
            mstream = new FileStream(outputfile, FileMode.Create, FileAccess.Write);

            syn.SetOutputToWaveStream(mstream);

            pb        = new PromptBuilder();
            mainStyle = new PromptStyle();
            //            mainStyle.Volume = promptVol;
            syn.SelectVoice(wv.winVoice.VoiceInfo.Name);
            pb.StartStyle(mainStyle);
        }
Esempio n. 5
0
        public bool SetAudioEndpoint(string dev, bool usedefault = false)
        {
            System.Collections.ObjectModel.ReadOnlyCollection <DirectSoundDevice> list = DirectSoundDeviceEnumerator.EnumerateDevices();

            DirectSoundDevice dsd = null;

            if (dev != null)                                               // active selection
            {
                dsd = list.FirstOrDefault(x => x.Description.Equals(dev)); // find

                if (dsd == null && !usedefault)                            // if not found, and don't use the default (used by constructor)
                {
                    return(false);
                }
            }

            DirectSoundOut dso = new DirectSoundOut(200, System.Threading.ThreadPriority.Highest); // seems good quality at 200 ms latency

            if (dso == null)                                                                       // if no DSO, fail..
            {
                return(false);
            }

            if (dsd != null)
            {
                dso.Device = dsd.Guid;
            }
            else
            {
                DirectSoundDevice def = DirectSoundDevice.DefaultDevice;
                dso.Device = def.Guid;  // use default GUID
            }

            NullWaveSource nullw = new NullWaveSource(10);

            try
            {
                dso.Initialize(nullw);  // check it takes it.. may not if no sound devices there..
                dso.Stop();
                nullw.Dispose();
            }
            catch
            {
                nullw.Dispose();
                dso.Dispose();
                return(false);
            }

            if (aout != null)                 // clean up last
            {
                aout.Stopped -= Output_Stopped;
                aout.Stop();
                aout.Dispose();
            }

            aout          = dso;
            aout.Stopped += Output_Stopped;

            return(true);
        }
Esempio n. 6
0
        private MKPolygon GeoJsonPolygonToPolygon(Polygon geoJsonPolygon)
        {
            System.Collections.ObjectModel.ReadOnlyCollection <LineString> coords = geoJsonPolygon?.Coordinates;
            if (coords == null || coords.Count() == 0)
            {
                return(null);
            }

            LineString outer = coords.FirstOrDefault();
            IEnumerable <LineString> inner = coords.Count > 1 ? coords.Skip(1) : null;

            var outerCoordinates = new List <CLLocationCoordinate2D>();

            foreach (IPosition coordinate in outer.Coordinates)
            {
                outerCoordinates.Add(new CLLocationCoordinate2D(coordinate.Latitude, coordinate.Longitude));
            }

            var innerPolygons = new List <MKPolygon>();

            if (inner != null)
            {
                foreach (LineString linestring in inner)
                {
                    var innerCoordinates = new List <CLLocationCoordinate2D>();
                    foreach (IPosition coordinate in linestring.Coordinates)
                    {
                        innerCoordinates.Add(new CLLocationCoordinate2D(coordinate.Latitude, coordinate.Longitude));
                    }
                    innerPolygons.Add(MKPolygon.FromCoordinates(innerCoordinates.ToArray()));
                }
            }
            return(MKPolygon.FromCoordinates(outerCoordinates.ToArray(), innerPolygons.ToArray()));
        }
Esempio n. 7
0
        private PolygonOptions GeoJsonPolygonToPolygon(GPolygon geoJsonPolygon)
        {
            System.Collections.ObjectModel.ReadOnlyCollection <LineString> coords = geoJsonPolygon?.Coordinates;
            if (coords == null || coords.Count() == 0)
            {
                return(null);
            }

            PolygonOptions polygonOptions = GetPolygonOptions();

            LineString outer = coords.FirstOrDefault();
            IEnumerable <LineString> inner = coords.Count > 1 ? coords.Skip(1) : null;

            foreach (IPosition coordinate in outer.Coordinates)
            {
                polygonOptions.Add(new LatLng(coordinate.Latitude, coordinate.Longitude));
            }

            if (inner != null)
            {
                foreach (LineString linestring in inner)
                {
                    var holes = linestring.Coordinates.Select(coordinate => new LatLng(coordinate.Latitude, coordinate.Longitude)).ToList();
                    polygonOptions.Holes.Add(holes.ToJavaList());
                }
            }

            return(polygonOptions);
        }
 public SpeechSynthezier()
 {
     talker = new SpeechSynthesizer();
     // Load all installed voices
     System.Collections.ObjectModel.ReadOnlyCollection <InstalledVoice>
     voices = talker.GetInstalledVoices();
     talker.SelectVoice(voices.FirstOrDefault().VoiceInfo.Name);
 }
Esempio n. 9
0
        //If the product responds to a ping, set the ping data and also check its MQTT connection from the Trace.  Also re-enable the Trace if it has been lost due to disconnection/reboot/power loss
        void p_PingCompleted(object sender, PingCompletedEventArgs e)
        {
            string ip = (string)e.UserState;

            if (e.Reply != null)
            {
                lock (lockObj)
                {
                    //gets the list of appliances from WifiBasic
                    System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances;
                    //Selects the appliance based on IP address
                    ConnectedApplianceInfo cai = cio.FirstOrDefault(x => x.IPAddress == ip);
                    //If an appliance with the specified IP address is found in the list...
                    if (cai != null)
                    {
                        mqttresp = cai.IsTraceOn; //check if Trace is currently enabled
                        if (!cai.IsTraceOn)
                        {
                            //if it's not and Revelation is also not enabled, enable Revelation
                            if (!cai.IsRevelationConnected)
                            {
                                WifiLocal.ConnectTo(cai);
                            }
                            else
                            {
                                //If Revelation is enabled, enable Trace
                                WifiLocal.EnableTrace(cai, true);
                            }
                            mqttresp = false;
                        }
                        else
                        {
                            //If the Trace is enabled and Revelation is also connected, close the Revelation connection
                            if (cai.IsRevelationConnected)
                            {
                                WifiLocal.CloseRevelation(System.Net.IPAddress.Parse(cai.IPAddress));
                            }
                            mqttresp = true;
                        }
                    }
                    // Else if the IP address is not found in the WifiBasic list, connection has been lost
                    else
                    {
                        mqttresp = false;
                    }
                    if (e.Reply.Status == IPStatus.Success)
                    {
                        pingresp = ip + "\t" + e.Reply.RoundtripTime + "ms" + "\t" + mqttresp.ToString();
                    }
                    else
                    {
                        pingresp = ip + "\t" + e.Reply.Status.ToString() + "\t" + mqttresp.ToString();
                    }
                    responses.Add(pingresp);
                }
            }
        }
Esempio n. 10
0
        protected override void OnStartupNextInstance(StartupNextInstanceEventArgs eventArgs)
        {
            ProcessSquirrelStartup();
            // Subsequent launches
            base.OnStartupNextInstance(eventArgs);
            _commandLine = eventArgs.CommandLine;
            string code = _commandLine.FirstOrDefault();

            if (code != null && !code.StartsWith("-"))
            {
                _application?.Bootstrapper?.ProcessTokenUpdate(code);
            }
        }
Esempio n. 11
0
        private static List <string> GetGroupedNames(string text, bool allowAllCharacter)
        {
            // text should only be field names comma seperated
            List <string> fieldNames = new List <string>();

            if (string.IsNullOrEmpty(text))
            {
                return(fieldNames);
            }
            string[] fields      = text.Split(',');
            int      totalFields = fields.Length;

            for (int i = 0; i < totalFields; i++)
            {
                if (string.IsNullOrEmpty(fields[i]))
                {
                    throw new ArgumentException("The supplied query is invalid because there is an empty field name", "text");
                }
                fields[i] = fields[i].Trim();
                if (fields[i].Contains(' '))
                {
                    throw new ArgumentException("The supplied query is invalid because there is an invalid space inside a field name.", "text");
                }
                if (fields[i].StartsWith("[") && fields[i].EndsWith("]"))
                {
                    if (fields[i].Length == 2)
                    {
                        throw new ArgumentException("The supplied query is invalid because a there is a blank field name enclosed in brackets", "text");
                    }
                    fields[i] = fields[i].Substring(1, fields[i].Length - 2);
                }
                else
                {
                    if (Keywords.FirstOrDefault(x => x.Equals(fields[i], StringComparison.OrdinalIgnoreCase)) != null)
                    {
                        throw new ArgumentException("You must wrap any ambiguous column names with square brackets, or ensure that they are fully qualified.", "text");
                    }
                }
                fields[i] = fields[i].Trim();
                if (!allowAllCharacter && fields[i].Equals("*"))
                {
                    throw new ArgumentException("The '*' character is not allowed in this part of the query", "text");
                }
                fieldNames.Add(fields[i]);
            }
            if (fieldNames.Contains("*") && fieldNames.Count > 1)
            {
                throw new ArgumentException("The supplied query is invalid because all columns are marked to be selected as well as specific columns. Either select all columns or particular ones.", "text");
            }
            return(fieldNames);
        }
Esempio n. 12
0
        /// <summary>
        /// 添加管理员
        /// </summary>
        private IWebElement _addAdminUserInfo()
        {
            IWebElement addBtn = _driver.FindElement(By.CssSelector(".filter-item"));

            addBtn.Click();
            captureScreenShot();
            fillAdminUserInfoForm(out string userName);
            _driver.FindElementByCssSelector(".el-dialog .el-dialog__footer button.el-button--primary").Click();//保存按钮
            captureScreenShot();
            System.Collections.ObjectModel.ReadOnlyCollection <IWebElement> trs = _driver.FindElementsByCssSelector(".el-table__body tbody tr");
            IWebElement webElement = trs.FirstOrDefault(_ => userName.Equals(_.FindElement(By.CssSelector("td:nth-child(2) div.cell")).Text));

            Assert.IsNotNull(webElement, $"未找到 {userName} 的用户");
            return(webElement);
        }
Esempio n. 13
0
        //Not used right now, was used when pinging was done serially rather than asynchronously
        public bool PingHost(string nameOrAddress)
        {
            bool pingable = false;
            Ping pinger   = null;

            try
            {
                System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances;
                ConnectedApplianceInfo cai = cio.FirstOrDefault(x => x.IPAddress == nameOrAddress);
                if (cai != null)
                {
                    mqttresp = cai.IsMqttConnected;
                }
                else
                {
                    mqttresp = false;
                }
                pinger = new Ping();
                PingReply reply = pinger.Send(nameOrAddress, pingtimeout);
                pingable = reply.Status == IPStatus.Success;
                if (pingable)
                {
                    pingresp = reply.Address + "\t" + reply.RoundtripTime + "ms" + "\t" + mqttresp.ToString();
                }
                else
                {
                    pingresp = nameOrAddress + "\t" + reply.Status.ToString() + "\t" + mqttresp.ToString();
                }
            }
            catch (PingException)
            {
                // Discard PingExceptions and return false;
                mqttresp = false;
                pingresp = nameOrAddress + "\t" + "FAIL" + "\t" + mqttresp.ToString();
            }
            finally
            {
                if (pinger != null)
                {
                    pinger.Dispose();
                }
            }

            return(pingable);
        }
Esempio n. 14
0
        public void VerifyAdminModule()
        {
            _verifyLogin();                                                                                                                                           //登录
            System.Collections.ObjectModel.ReadOnlyCollection <IWebElement> firstNavs = _driver.FindElementsByCssSelector("ul.el-menu:nth-child(1) > li.el-submenu"); //一级导航
            IWebElement systemManager_li = firstNavs.FirstOrDefault(_ => "系统管理".Equals(_.FindElement(By.CssSelector("div.el-submenu__title span")).Text));

            systemManager_li.Click();                                                                                                                                 //点击系统管理
            captureScreenShot();
            System.Collections.ObjectModel.ReadOnlyCollection <IWebElement> subNavs_li = systemManager_li.FindElements(By.CssSelector("ul.el-menu li.el-menu-item")); //
            IWebElement adminUserInfoManager_li = subNavs_li.FirstOrDefault(_ => "管理员管理".Equals(_.FindElement(By.CssSelector("span")).Text));

            adminUserInfoManager_li.Click();
            captureScreenShot();
            Assert.AreEqual("管理员管理", _driver.Title, "管理员管理页面标题不符合 “管理员管理”");
            IWebElement userTr = _addAdminUserInfo();

            _setAdminRoel(userTr);
        }
        public static TimeZoneInfo GetSystemTimezone(String organiserTz, System.Collections.ObjectModel.ReadOnlyCollection <TimeZoneInfo> sysTZ)
        {
            TimeZoneInfo tzi = null;

            if (Settings.Instance.TimezoneMaps.ContainsKey(organiserTz))
            {
                tzi = sysTZ.FirstOrDefault(t => t.Id == Settings.Instance.TimezoneMaps[organiserTz]);
                if (tzi != null)
                {
                    log.Debug("Using custom timezone mapping ID '" + tzi.Id + "' for '" + organiserTz + "'");
                    return(tzi);
                }
                else
                {
                    log.Warn("Failed to convert custom timezone mapping to any available system timezone.");
                }
            }
            return(tzi);
        }
Esempio n. 16
0
        public bool SetAudioEndpoint(string dev, bool usedefault = false)
        {
#if true
            System.Collections.ObjectModel.ReadOnlyCollection <DirectSoundDevice> list = DirectSoundDeviceEnumerator.EnumerateDevices();

            DirectSoundDevice dsd = null;
            if (dev != null)                                               // active selection
            {
                dsd = list.FirstOrDefault(x => x.Description.Equals(dev)); // find
                if (dsd == null && !usedefault)                            // if not found, and don't use the default (used by constructor)
                {
                    return(false);
                }
            }

            DirectSoundOut dso = new DirectSoundOut(100, System.Threading.ThreadPriority.Highest);    // seems good quality at 200 ms latency

            if (dsd != null)
            {
                dso.Device = dsd.Guid;
            }
#else
            MMDevice  def = MMDeviceEnumerator.DefaultAudioEndpoint(DataFlow.Render, Role.Console);
            ISoundOut dso = new WasapiOut()
            {
                Latency = 100, Device = def
            };                                                                //BAD breakup
#endif

            if (aout != null)                 // clean up last
            {
                aout.Stopped -= Output_Stopped;
                aout.Stop();
                aout.Dispose();
            }

            aout          = dso;
            aout.Stopped += Output_Stopped;

            return(true);
        }
Esempio n. 17
0
 private void BTN_Add_Click(object sender, EventArgs e)
 {
     try
     {
         if (iplist.FirstOrDefault(x => x.IPAddress == TB_IP.Text) == null)
         {
             System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances;
             ConnectedApplianceInfo cai = cio.FirstOrDefault(x => x.IPAddress == TB_IP.Text);
             if (cai != null)
             {
                 LB_IPs.Items.Add(cai.IPAddress);
                 IPData newip = new IPData(cai.IPAddress, cai.MacAddress);
                 iplist.Add(newip);
                 DataRow dr = results.NewRow();
                 dr["IP Address"]  = newip.IPAddress;
                 dr["MAC Address"] = newip.MACAddress;
                 results.Rows.Add(dr);
             }
         }
     }
     catch
     {
     }
 }
Esempio n. 18
0
        private void BTN_Gen_Click(object sender, EventArgs e)
        {
            //  DialogResult dialogResult = MessageBox.Show("This will automatically create a new test plan run from the current IP. " +
            //  "This will then clear the current payload list and update the table accordingly. " +
            //  "Press Yes to Create or No to Cancel.", "Verify Full Clear and Auto Generation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            //if (dialogResult == DialogResult.Yes)
            // {

            System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances;
            ConnectedApplianceInfo cai = cio.FirstOrDefault(x => x.IPAddress == TB_IP.Text);

            if (cai == null)
            {
                MessageBox.Show("Target IP Address of " + TB_IP.Text + " is not currently listed within Wifibasic. " +
                                "Please verify the IP Address is connected and listed in Wifibasic, then retry generation.", "Error: WifiBasic IP Address Not Found",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            if (!CheckFill())
            {
                DialogResult checkresult = MessageBox.Show("You have NOT filled out all required text boxes and drop downs. " +
                                                           "Please check each text box and drop down and retry again.", "Error: Form Improperly Filled Out",
                                                           MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (parent.LB_IPs.Items.Count != 0)
            {
                parent.ResetForm(true);
            }

            string mqttpay = "";

            //Set MQTT payload to start standard bake 350 for whatever product or allow user to input one

            if (CB_Product.Text.Equals("NAR Cooking"))
            {
                mqttpay = "001BFF33330310000C02030D00010000005A0310000106E6030F000202"; // Standard bake 350 for upper oven for 1.5 minute;
            }
            else if (CB_Product.Text.Equals("EMEA Cooking"))
            {
                mqttpay = "001BFF33330B02001B0104090001028F04060001000000780408000202"; // Standard bake for Speed Oven (MWO bake instead of upper oven)
            }
            else if (CB_Product.Text.Equals("NAR Laundry"))
            {
                mqttpay = "0026FF333305050006010505001503050500180305050014000505000A010505000D000307000102"; // Standard wash cycle for Janus washer (wash cavity)
            }
            else
            {
                mqttpay = CB_Product.Text;
            }

            string allskip = "";

            //See if anything is skipped
            if (CB_NoCyc.Checked)
            {
                allskip       += "Remote cycle ";
                parent.skipcyc = true;
            }
            if (CB_NoTTF.Checked)
            {
                if (!String.IsNullOrEmpty(allskip))
                {
                    allskip += "and ";
                }
                allskip       += "Tests to Fail ";
                parent.skipttf = true;
            }
            if (CB_NoGen.Checked)
            {
                if (!String.IsNullOrEmpty(allskip))
                {
                    allskip += "and ";
                }
                allskip       += "Generic ";
                parent.skipgen = true;
            }

            if (!String.IsNullOrEmpty(allskip))
            {
                DialogResult dialogResult = MessageBox.Show("Please verify skipping " + allskip + "test case(s)." + '\n' +
                                                            "Press Yes to Confirm or No to Cancel.", "Verify Skip and Auto Generation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (dialogResult != DialogResult.Yes)
                {
                    return;
                }
            }
            try
            {
                //ClearAll();
                parent.glblip = TB_IP.Text;
                for (int i = 0; i < parent.TESTCASEMAX; i++)
                {
                    switch (i)
                    {
                    case 0:
                        BuildList(cai, "RQM 131835 OTA : Remote : User Starts Cycle from App in Download", mqttpay, i);
                        break;

                    case 1:
                        BuildList(cai, "RQM 131837 OTA : Remote : User Changes Settings from App in Download", mqttpay, i);
                        break;

                    case 2:
                        BuildList(cai, "RQM 131839 OTA : Remote : User Starts Cycle from App in IAP", mqttpay, i);
                        break;

                    case 3:
                        BuildList(cai, "RQM 131841 OTA : Remote : User Changes Settings from App in IAP", mqttpay, i);
                        break;

                    case 4:
                        BuildList(cai, "RQM 131812 OTA : Generic : Forced Update : Unit in Idle State", mqttpay, i);
                        break;

                    case 5:
                        BuildList(cai, "RQM 154635 OTA : Generic : Forced Update : Downgrade : Unit in Idle State", mqttpay, i);
                        break;

                    case 6:
                        BuildList(cai, "RQM 131844 OTA : Generic : Forced Update : Upgrade : Model/Serial Consistency Check", mqttpay, i);
                        break;

                    case 7:
                        BuildList(cai, "RQM 131845 OTA : Generic : Forced Update : Upgrade : Version Number Check", mqttpay, i);
                        break;

                    case 8:
                        BuildList(cai, "RQM 131846 OTA : Generic : Forced Update : Downgrade : Model/Serial Consistency Check", mqttpay, i);
                        break;

                    case 9:
                        BuildList(cai, "RQM 131847 OTA : Generic : Forced Update : Downgrade : Version Number Check", mqttpay, i);
                        break;

                    case 10:
                        BuildList(cai, "RQM 131849 OTA : Generic : Forced Update : Upgrade : CCURI Check", mqttpay, i);
                        break;

                    case 11:
                        BuildList(cai, "RQM 131850 OTA : Generic : Forced Update : Downgrade : CCURI Check", mqttpay, i);
                        break;

                    case 12:
                        BuildList(cai, "RQM 131851 OTA : Generic : Check Provision State", mqttpay, i);
                        break;

                    case 13:
                        BuildList(cai, "RQM 131852 OTA : Generic : Check Claimed Status", mqttpay, i);
                        break;

                    case 14:
                        BuildList(cai, "RQM 186300 OTA : Generic : Consumer is informed of the update status on app", mqttpay, i);
                        break;

                    case 15:
                        if (node == "HMI")
                        {
                            BuildList(cai, "RQM 131821 OTA : Generic : Forced Update : HMI Update", mqttpay, i);
                        }
                        if (node == "WiFi")
                        {
                            BuildList(cai, "RQM 132549 OTA : Generic : Forced Update : Wifi Radio", mqttpay, i);
                        }
                        if (node == "Expansion")
                        {
                            BuildList(cai, "RQM 132550 OTA : Generic : Forced Update : All Updatable Modules Updated", mqttpay, i);
                        }
                        if (node == "ACU")
                        {
                            BuildList(cai, "RQM 131822 OTA : Generic : Forced Update : ACU Update", mqttpay, i);
                        }
                        break;

                    case 16:
                        BuildList(cai, "RQM 131863 OTA : Generic : RSSI Strong Signal", mqttpay, i);
                        break;

                    case 17:
                        BuildList(cai, "RQM 186529 OTA : Generic : Post Condition : After OTA is successful OTAs are still possible (Appliances are able to receive and apply OTAs)", mqttpay, i);
                        break;

                    case 18:
                        BuildList(cai, "RQM 154667 OTA : Generic : Forced Update : ISPPartNumber check", mqttpay, i);
                        break;

                    case 19:
                        BuildList(cai, "RQM 132552 OTA : TTF : Download Times Out After 5 Attempts", mqttpay, i);
                        break;

                    case 20:
                        BuildList(cai, "RQM 131865 OTA : TTF : Invalid URL", mqttpay, i);
                        break;

                    case 21:
                        BuildList(cai, "RQM 131854 OTA : TTF : Incorrect CRC", mqttpay, i);
                        break;

                    case 22:
                        BuildList(cai, "RQM 131862 OTA : TTF : Forced OTA Payload Sent Multiple Times", mqttpay, i);
                        break;

                    default:
                        break;
                    }
                }
                parent.DGV_Data.Refresh();
                parent.autogen = true;
                parent.BTN_MakeList.Enabled = false;
                parent.BTN_Import.Enabled   = false;
                parent.SizeCol();
            }

            /*catch
             * {
             * }*/

            catch (Exception f)
            {
                /*MessageBox.Show("Catastrophic ProcessPayload error. source was " + source + " raw was "
                 + raw + " sb was " + sb + " and call was " + call, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);*/
                LogException("Venom BTN_Gen():  Message and Stacktrace were ");
                LogException(f, true);
                return;
            }
        }
Esempio n. 19
0
 protected override Expression VisitParameter(ParameterExpression node)
 {
     return(parameters?.FirstOrDefault(p => p.Name == node.Name) ??
            (node.Type == typeof(TSource) ? Expression.Parameter(typeof(TTarget), node.Name) : node));
 }
        private TimeZoneInfo getWindowsTimezoneFromDescription(String tzDescription)
        {
            try {
                System.Collections.ObjectModel.ReadOnlyCollection <TimeZoneInfo> sysTZ = TimeZoneInfo.GetSystemTimeZones();

                //First let's just search with what we've got
                TimeZoneInfo tzi = sysTZ.FirstOrDefault(t => t.DisplayName == tzDescription || t.StandardName == tzDescription || t.Id == tzDescription);
                if (tzi != null)
                {
                    return(tzi);
                }

                log.Warn("Could not find timezone ID based on given description. Attempting some fuzzy logic...");
                if (tzDescription.StartsWith("(GMT"))
                {
                    log.Fine("Replace GMT with UTC");
                    String modTzDescription = tzDescription.Replace("(GMT", "(UTC");
                    tzi = sysTZ.FirstOrDefault(t => t.DisplayName == modTzDescription || t.StandardName == modTzDescription || t.Id == modTzDescription);
                    if (tzi != null)
                    {
                        return(tzi);
                    }

                    log.Fine("Removing offset prefix");
                    modTzDescription = System.Text.RegularExpressions.Regex.Replace(modTzDescription, @"^\(UTC[+-]\d{1,2}:\d{0,2}\)\s+", "").Trim();
                    tzi = sysTZ.FirstOrDefault(t => t.StandardName == modTzDescription || t.Id == modTzDescription);
                    if (tzi != null)
                    {
                        return(tzi);
                    }
                }


                //Try searching just by timezone offset. This would at least get the right time for the appointment, eg if the tzDescription doesn't match
                //because they it is in a different language that the user's system data.
                Int16?offset = null;
                offset = TimezoneDB.GetTimezoneOffset(tzDescription);
                if (offset != null)
                {
                    List <TimeZoneInfo> tzis = sysTZ.Where(t => t.BaseUtcOffset.Hours == offset).ToList();
                    if (tzis.Count == 0)
                    {
                        log.Warn("No timezone ID exists for organiser's GMT offset timezone " + tzDescription);
                    }
                    else if (tzis.Count == 1)
                    {
                        return(tzis.First());
                    }
                    else
                    {
                        String tzCountry = tzDescription.Substring(tzDescription.LastIndexOf("/") + 1);
                        if (string.IsNullOrEmpty(tzCountry))
                        {
                            log.Warn("Could not determine country; and multiple timezones exist with same GMT offset of " + offset + ". Picking the first.");
                            return(tzis.FirstOrDefault());
                        }
                        else
                        {
                            List <TimeZoneInfo> countryTzis = tzis.Where(t => t.DisplayName.Contains(tzCountry)).ToList();
                            if (countryTzis.Count == 0)
                            {
                                log.Warn("Could not find timezone with GMT offset of " + offset + " for country " + tzCountry + ". Picking the first offset match regardless of country.");
                                return(tzis.FirstOrDefault());
                            }
                            else if (countryTzis.Count == 1)
                            {
                                return(countryTzis.First());
                            }
                            else
                            {
                                log.Warn("Could not find unique timezone with GMT offset of " + offset + " for country " + tzCountry + ". Picking the first.");
                                return(countryTzis.FirstOrDefault());
                            }
                        }
                    }
                }
                else
                {
                    //Check if it's already an IANA value
                    NodaTime.TimeZones.TzdbDateTimeZoneSource         tzDBsource = TimezoneDB.Instance.Source;
                    IEnumerable <NodaTime.TimeZones.TzdbZoneLocation> a          = tzDBsource.ZoneLocations.Where(l => l.ZoneId == tzDescription);
                    if (a.Count() >= 1)
                    {
                        log.Debug("It appears to be an IANA timezone already!");
                        Microsoft.Office.Interop.Outlook.TimeZone tz = WindowsTimeZone(tzDescription);
                        if (tz != null)
                        {
                            return(TimeZoneInfo.FindSystemTimeZoneById(tz.ID));
                        }
                    }
                }
            } catch (System.Exception ex) {
                log.Warn("Failed to get the organiser's timezone ID for " + tzDescription);
                OGCSexception.Analyse(ex);
            }
            return(null);
        }
Esempio n. 21
0
        private void BTN_Add_Click(object sender, EventArgs e)
        {
            string localpay     = TB_Payload.Text;
            string localdeliver = "MQTT"; // CHANGE IF ADDING REVELATION BACK

            System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances;
            ConnectedApplianceInfo cai = cio.FirstOrDefault(x => x.IPAddress == TB_IPDisplay.Text);

            if (cai != null)
            {
                //if (localdeliver.Equals("MQTT") && !cai.IsMqttConnected) // Add back if tracking MQTT or Revelation
                if (!cai.IsMqttConnected)
                {
                    DialogResult dialogResult = MessageBox.Show("You have selected the OTA delivery method as MQTT but the MQTT connection" +
                                                                " for the entered IP Address of " + TB_IPDisplay.Text + " is not currently connected." +
                                                                " If this is acceptable, click Yes to Continue. Otherwise, click No and setup the" +
                                                                " MQTT connection then try adding the IP Address again.",
                                                                "Error: MQTT Delivery but Device is not the MQTT Broker.",
                                                                MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                    if (dialogResult == DialogResult.No)
                    {
                        return;
                    }
                }

                try
                {
                    if (parent.iplist.FirstOrDefault(x => x.IPAddress == TB_IPDisplay.Text) == null)
                    {
                        parent.LB_IPs.Items.Add(cai.IPAddress);
                    }

                    IPData newip = new IPData(cai.IPAddress, localpay);
                    parent.iplist.Add(newip);
                    newip.MAC  = cai.MacAddress;
                    newip.Type = CB_Type.Text;
                    newip.Node = CB_Variant.Text;
                    newip.Name = "User Input";
                    // Update window for added IP
                    DataRow dr = parent.results.NewRow();

                    dr["IP Address"]      = newip.IPAddress;
                    dr["OTA Payload"]     = newip.Payload;
                    dr["Delivery Method"] = localdeliver;
                    dr["OTA Type"]        = newip.Type;
                    dr["Node"]            = newip.Node;
                    dr["Name"]            = newip.Name;
                    dr["OTA Result"]      = "PENDING";
                    parent.results.Rows.Add(dr);
                }
                catch
                {
                    MessageBox.Show("Catastrophic Add error.", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            else
            {
                // Else if the IP address is not found in the WifiBasic list
                MessageBox.Show("No IP Address was found in WifiBasic. Please choose a new IP Address or Retry.", "Error: WifiBasic IP Address Not Found",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 22
0
        private void BTN_Payload_Click(object sender, EventArgs e)
        {
            if (BTN_Payload.Text == "Set")
            {
                try
                {
                    DialogResult dialogurl;
                    if (!Valid())
                    {
                        DialogResult dialogResult = MessageBox.Show("No selection made. Please choose a selection from the check boxes.",
                                                                    "No Selection", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }

                    if (!CB_Suppress.Checked)
                    {
                        if (MessageBox.Show("Before continuing, please verify that IP Address of " + TB_IP.Text + " is currently" +
                                            " listed within WifiBasic. If not, press 'No' on this window and open WifiBasic then press 'Data Start'" +
                                            " and finally, press 'Scan Appliances' to populate the list in WifiBasic.", "Verify IP Address is Listed",
                                            MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
                        {
                            return;
                        }
                    }
                    string set    = "set";
                    bool   result = false;
                    BTN_Payload.Text    = "Running";
                    BTN_Payload.Enabled = false;
                    CB_EMEAP.Enabled    = false;
                    CB_NARS.Enabled     = false;
                    CB_NARP.Enabled     = false;
                    CB_Custom.Enabled   = false;
                    CB_MQTT.Enabled     = false;
                    CB_Org.Enabled      = false;
                    BTN_Reset.Enabled   = false;
                    TB_IP.Enabled       = false;
                    BTN_GET.Enabled     = false;
                    CB_Legacy.Enabled   = false;
                    //CycleWifi();
                    //Wait(2000);
                    System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances;
                    ConnectedApplianceInfo cai = cio.FirstOrDefault(x => x.IPAddress == TB_IP.Text);

                    byte[] paybytes = Encoding.ASCII.GetBytes(PaySelection());
                    byte[] orgbytes = Encoding.ASCII.GetBytes(OrgSelection());

                    if (cai != null)
                    {
                        if (RevelationConnect(set, cai))
                        {
                            result = SendRevelation(TB_IP.Text, paybytes, orgbytes);//, cai);
                            Wait(2000);
                        }
                        if (result)
                        {
                            dialogurl = MessageBox.Show("The MQTT URl for " + TB_IP.Text + " WAS CHANGED successfuly." +
                                                        " Request completed. Closing all open connections.", "Set MQTT URL",
                                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            dialogurl = MessageBox.Show("The MQTT URl for " + TB_IP.Text + " was NOT CHANGED successfuly." +
                                                        " Request completed. Closing all open connections.", "Set MQTT URL",
                                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        Reset(false);
                        BTN_Payload.Enabled = true;
                        TB_IP.Enabled       = true;
                        BTN_Reset.Enabled   = true;
                        BTN_GET.Enabled     = true;
                        WifiLocal.CloseAll(true);
                        return;
                    }
                    else
                    {
                        MessageBox.Show("Unable to connect. Verify IP Address of " + TB_IP.Text + " has been correctly typed" +
                                        " and that the IP Address is listed within WifiBasic.", "Error: Unable to connect.",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        Reset(false);
                        return;
                    }
                }

                catch
                {
                    Reset(false);
                    return;
                }
            }
            else
            {
                try
                {
                    Reset(false);
                    TB_IP.Enabled     = true;
                    BTN_Reset.Enabled = true;
                    return;
                }

                catch
                {
                    Reset(false);
                    return;
                }
            }
        }
        //http://stackoverflow.com/questions/17348807/how-to-translate-between-windows-and-iana-time-zones
        //https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
        //https://blogs.technet.microsoft.com/dst2007/ - MS timezone updates

        public Event IANAtimezone_set(Event ev, AppointmentItem ai)
        {
            String organiserTZname = null;
            String organiserTZid   = null;

            if (ai.Organizer != CurrentUserName())
            {
                log.Fine("Meeting organiser is someone else - checking their timezone.");
                try {
                    PropertyAccessor pa = null;
                    try {
                        pa = ai.PropertyAccessor;
                        organiserTZname = pa.GetProperty(PR_ORGANISER_TIMEZONE).ToString();
                    } finally {
                        pa = (PropertyAccessor)OutlookOgcs.Calendar.ReleaseObject(pa);
                    }
                    if (organiserTZname != ai.StartTimeZone.Name)
                    {
                        log.Fine("Appointment's timezone: " + ai.StartTimeZone.Name);
                        log.Fine("Organiser's timezone:   " + organiserTZname);
                        log.Debug("Retrieving the meeting organiser's timezone ID.");
                        System.Collections.ObjectModel.ReadOnlyCollection <TimeZoneInfo> sysTZ = TimeZoneInfo.GetSystemTimeZones();
                        try {
                            TimeZoneInfo tzi = sysTZ.FirstOrDefault(t => t.DisplayName == organiserTZname || t.StandardName == organiserTZname);
                            if (tzi == null)
                            {
                                throw new ArgumentNullException("No timezone ID exists for organiser's timezone " + organiserTZname);
                            }
                            else
                            {
                                organiserTZid = tzi.Id;
                            }
                        } catch (ArgumentNullException ex) {
                            throw ex as System.Exception;
                        } catch (System.Exception ex) {
                            throw new System.Exception("Failed to get the organiser's timezone ID for " + organiserTZname, ex);
                        }
                    }
                } catch (System.Exception ex) {
                    Forms.Main.Instance.Console.Update(OutlookOgcs.Calendar.GetEventSummary(ai) +
                                                       "<br/>Could not determine the organiser's timezone. Google Event will have incorrect time.", Console.Markup.warning);
                    OGCSexception.Analyse(ex);
                    organiserTZname = null;
                    organiserTZid   = null;
                }
            }

            try {
                try {
                    ev.Start.TimeZone = IANAtimezone(organiserTZid ?? ai.StartTimeZone.ID, organiserTZname ?? ai.StartTimeZone.Name);
                } catch (System.Exception ex) {
                    log.Debug(ex.Message);
                    throw new ApplicationException("Failed to set start timezone. [" + ai.StartTimeZone.ID + ", " + ai.StartTimeZone.Name + "]");
                }
                try {
                    ev.End.TimeZone = IANAtimezone(organiserTZid ?? ai.EndTimeZone.ID, organiserTZname ?? ai.EndTimeZone.Name);
                } catch (System.Exception ex) {
                    log.Debug(ex.Message);
                    throw new ApplicationException("Failed to set end timezone. [" + ai.EndTimeZone.ID + ", " + ai.EndTimeZone.Name + "]");
                }
            } catch (ApplicationException ex) {
                log.Warn(ex.Message);
            }
            return(ev);
        }
Esempio n. 24
0
        private void BTN_GET_Click(object sender, EventArgs e)
        {
            if (BTN_GET.Text == "Get")
            {
                try
                {
                    DialogResult dialogurl;
                    if (!CB_Suppress.Checked)
                    {
                        if (MessageBox.Show("Before continuing, please verify that IP Address of " + TB_IP.Text + " is currently" +
                                            " listed within WifiBasic and UITracer is NOT running. If not, press 'No' on this window and open WifiBasic then press 'Data Start'" +
                                            " and finally, press 'Scan Appliances' to populate the list in WifiBasic.", "Verify IP Address is Listed",
                                            MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
                        {
                            return;
                        }
                    }
                    string get = "get";
                    BTN_GET.Text        = "Running";
                    BTN_GET.Enabled     = false;
                    CB_EMEAP.Enabled    = false;
                    CB_NARS.Enabled     = false;
                    CB_NARP.Enabled     = false;
                    CB_Custom.Enabled   = false;
                    CB_Org.Enabled      = false;
                    CB_Org.Checked      = false;
                    CB_MQTT.Enabled     = false;
                    CB_MQTT.Checked     = false;
                    BTN_Reset.Enabled   = false;
                    TB_IP.Enabled       = false;
                    BTN_Payload.Enabled = false;
                    CB_Legacy.Enabled   = false;
                    //CycleWifi();
                    //Wait(2000);
                    System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances;
                    ConnectedApplianceInfo cai = cio.FirstOrDefault(x => x.IPAddress == TB_IP.Text);
                    byte[] orgbytes            = Encoding.ASCII.GetBytes(OrgSelection());
                    byte[] paybytes            = Encoding.ASCII.GetBytes(PaySelection());

                    if (cai != null)
                    {
                        if (RevelationConnect(get, cai))
                        {
                            if (SendRevelation(TB_IP.Text, paybytes, orgbytes))
                            {
                                for (int i = 0; i < ATTEMPTMAX; i++)
                                {
                                    if (mqtt_url.Contains("."))
                                    {
                                        break;
                                    }
                                    else
                                    {
                                        Wait(1000);
                                    }
                                }
                            }
                        }

                        if (mqtt_url != "")
                        {
                            if (mqtt_url == "0")
                            {
                                mqtt_url = "DEFAULT";
                            }
                            if (org_id == "0")
                            {
                                org_id = "DEFAULT";
                            }
                            dialogurl = MessageBox.Show("The MQTT URL for " + TB_IP.Text + " is currently " + mqtt_url + "."
                                                        + " The ORG ID for " + TB_IP.Text + " is currently " + org_id + "." +
                                                        " Request completed. Closing all open connections.", "Get MQTT URL and ORG ID",
                                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }


                        else
                        {
                            dialogurl = MessageBox.Show("The MQTT URl/Org ID for " + TB_IP.Text + " was NOT returned successfuly." +
                                                        " Request completed. Closing all open connections.", "Get MQTT URL and ORG ID",
                                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        Reset(false);
                        mqtt_url            = "";
                        TB_IP.Enabled       = true;
                        BTN_Reset.Enabled   = true;
                        BTN_Payload.Enabled = true;
                        WifiLocal.CloseAll(true);
                        return;
                    }
                    else
                    {
                        MessageBox.Show("Connection failed. Verify IP Address of " + TB_IP.Text + " has been correctly typed" +
                                        " and that the IP Address is listed within WifiBasic.", "Error: Unable to connect.",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        Reset(false);
                        return;
                    }
                }

                catch
                {
                    Reset(false);
                    mqtt_url            = "";
                    TB_IP.Enabled       = true;
                    BTN_Reset.Enabled   = true;
                    BTN_Payload.Enabled = true;
                    return;
                }
            }
            else
            {
                try
                {
                    Reset(false);
                    TB_IP.Enabled     = true;
                    BTN_Reset.Enabled = true;
                    return;
                }

                catch
                {
                    Reset(false);
                    return;
                }
            }
        }
Esempio n. 25
0
        public bool SendRevelation(string ips, byte[] paybytes, byte[] orgbytes)//, ConnectedApplianceInfo cai)
        {
            int  revattempt = 0;
            bool revconnect = false;

            // Check CAI and set IP address
            System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances;
            ConnectedApplianceInfo cai = cio.FirstOrDefault(x => x.IPAddress == ips);

            var myDestination = WifiLocal.ConnectedAppliances.FirstOrDefault(i => i.IPAddress.Equals(ips));

            // See if Revelation is Connected and attempt to connect until it is
            while (!revconnect && (revattempt < ATTEMPTMAX))
            {
                try
                {
                    revattempt++;

                    // Send Revelation message(s)
                    if (myDestination != null && cai.IsRevelationConnected)
                    {
                        if (CB_MQTT.Checked || BTN_GET.Text == "Running")
                        {
                            WifiLocal.SendRevelationMessage(myDestination, new RevelationPacket()
                            {
                                API     = 0xF0,
                                Opcode  = 00,
                                Payload = paybytes,
                            });
                            Wait(2000);
                        }
                        if (CB_Org.Checked || BTN_GET.Text == "Running")
                        {
                            WifiLocal.SendRevelationMessage(myDestination, new RevelationPacket()
                            {
                                API     = 0xF0,
                                Opcode  = 00,
                                Payload = orgbytes,
                            });
                            Wait(2000);
                        }
                        revconnect = true;
                    }

                    // Close revelation
                    if (revconnect)
                    {
                        WifiLocal.CloseRevelation(System.Net.IPAddress.Parse(cai.IPAddress));
                        Wait(2000);
                        return(true);
                    }
                }
                catch
                {
                    MessageBox.Show("Revelation connection failed. Verify IP Address of " + TB_IP.Text + " has been correctly typed" +
                                    " and that the IP Address is listed within WifiBasic.", "Error: Unable to connect.",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }
            }

            MessageBox.Show("Revelation connection failed. Verify IP Address of " + TB_IP.Text + " has been correctly typed" +
                            " and that the IP Address is listed within WifiBasic.", "Error: Unable to connect.",
                            MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            return(false);
        }