GetString() public static method

public static GetString ( string identifier ) : string
identifier string
return string
示例#1
0
 private void RenderResources()
 {
     Text = LocRm.GetString("settings");
     btnBrowseVideo.Text        = LocRm.GetString("chars_3014702301470230147");
     btnColorArea.Text          = LocRm.GetString("AreaHighlight");
     btnColorBack.Text          = LocRm.GetString("ObjectBack");
     btnColorMain.Text          = LocRm.GetString("MainPanel");
     btnColorTracking.Text      = LocRm.GetString("Tracking");
     btnBorderHighlight.Text    = LocRm.GetString("BorderHighlight");
     btnColorVolume.Text        = LocRm.GetString("Level");
     btnDetectColor.Text        = LocRm.GetString("Activity");
     btnNoDetectColor.Text      = LocRm.GetString("NoActivity");
     btnTimestampColor.Text     = LocRm.GetString("TimeStamp");
     button1.Text               = LocRm.GetString("Ok");
     button2.Text               = LocRm.GetString("Cancel");
     chkBalloon.Text            = LocRm.GetString("ShowBalloonTips");
     chkCheckForUpdates.Text    = LocRm.GetString("AutomaticallyCheckForUpda");
     chkErrorReporting.Text     = LocRm.GetString("AnonymousErrorReporting");
     chkPasswordProtect.Text    = LocRm.GetString("PasswordProtectWhenMinimi");
     chkShowGettingStarted.Text = LocRm.GetString("ShowGettingStarted");
     chkStartup.Text            = LocRm.GetString("RunOnStartupthisUserOnly");
     chkStorage.Text            = LocRm.GetString("EnableStorageManagementwa");
     chkAutoSchedule.Text       = LocRm.GetString("AutoApplySchedule");
     gbStorage.Text             = LocRm.GetString("StorageManagement");
     label1.Text           = LocRm.GetString("Password");
     label10.Text          = LocRm.GetString("MaxMediaFolderSize");
     label11.Text          = LocRm.GetString("WhenOver70FullDeleteFiles");
     label12.Text          = LocRm.GetString("DaysOld0ForNoDeletions");
     label14.Text          = LocRm.GetString("IspyServerName");
     label16.Text          = LocRm.GetString("ispyOpacitymayNotW");
     label19.Text          = LocRm.GetString("ispyCanAutomaticallyUploa");
     label2.Text           = LocRm.GetString("ServerReceiveTimeout");
     label20.Text          = LocRm.GetString("additionalControlsForYout");
     label21.Text          = LocRm.GetString("TrayIconText");
     label3.Text           = LocRm.GetString("MediaDirectory");
     label4.Text           = LocRm.GetString("ms");
     label5.Text           = LocRm.GetString("YoutubeUsername");
     label6.Text           = LocRm.GetString("YoutubePassword");
     label7.Text           = LocRm.GetString("ms");
     label8.Text           = LocRm.GetString("MjpegReceiveTimeout");
     label9.Text           = LocRm.GetString("Mb");
     label18.Text          = LocRm.GetString("MaxRecordingThreads");
     label13.Text          = LocRm.GetString("PlaybackMode");
     tabPage1.Text         = LocRm.GetString("Colors");
     tabPage2.Text         = LocRm.GetString("Storage");
     tabPage3.Text         = LocRm.GetString("Youtube");
     tabPage4.Text         = LocRm.GetString("Timeouts");
     tabPage6.Text         = LocRm.GetString("options");
     tabPage7.Text         = LocRm.GetString("IPAccess");
     linkLabel1.Text       = LocRm.GetString("GetLatestList");
     Text                  = LocRm.GetString("settings");
     linkLabel2.Text       = LocRm.GetString("HelpTranslateISpy");
     chkAlertWindows.Text  = LocRm.GetString("CreateAlertWindow");
     chkOverlay.Text       = LocRm.GetString("ShowOverlayControls");
     lblPriority.Text      = LocRm.GetString("Priority");
     btnLogin.Text         = LocRm.GetString("Test");
     chkInterrupt.Text     = LocRm.GetString("InterruptScreensaverOnAlert");
     label23.Text          = LocRm.GetString("JPEGQuality");
     llblHelp.Text         = LocRm.GetString("help");
     label17.Text          = LocRm.GetString("IPAccessExplainer");
     chkStopRecording.Text = LocRm.GetString("StopRecordingOnLimit");
     label24.Text          = LocRm.GetString("MediaPanelItems");
     //chkRecycle.Text = LocRm.GetString("DeleteToRecycleBin");
 }
示例#2
0
        private void Button1Click(object sender, EventArgs e)
        {
            bool   bIPv6 = tcIPMode.SelectedIndex == 1;
            int    port, localPort;
            string error;

            if (!SetupNetwork(out port, out localPort, out error))
            {
                MessageBox.Show(error + Environment.NewLine + LocRm.GetString("TryDifferentPort"));
                return;
            }

            if (!String.IsNullOrWhiteSpace(txtUsername.Text.Trim()))
            {
                try
                {
                    var fw = new FireWall();
                    var r  = fw.Initialize();
                    if (r == FireWall.FwErrorCode.FwNoerror)
                    {
                        bool bOn;
                        r = fw.IsWindowsFirewallOn(out bOn);
                        if (r == FireWall.FwErrorCode.FwNoerror)
                        {
                            if (bOn)
                            {
                                string strApplication = Application.StartupPath + "\\iSpy.exe";
                                bool   bEnabled       = false;
                                r = fw.IsAppEnabled(strApplication, ref bEnabled);
                                if (r == FireWall.FwErrorCode.FwNoerror)
                                {
                                    if (!bEnabled)
                                    {
                                        fw.AddApplication(strApplication, "iSpy");
                                    }
                                }
                            }
                        }
                    }
                    if (r != FireWall.FwErrorCode.FwNoerror)
                    {
                        throw new Exception(r.ToString());
                    }
                }
                catch (Exception ex)
                {
                    Logger.LogExceptionToFile(ex);
                    MessageBox.Show(this,
                                    LocRm.GetString("ErrorFromFirewall") + Environment.NewLine + ex.Message + Environment.NewLine +
                                    LocRm.GetString("AddFirewallExceptionManually"));
                }

                Next.Enabled = false;
                Next.Text    = "...";
                Application.DoEvents();

                MainForm.Conf.DHCPReroute = chkReroute.Checked;
                MainForm.Conf.SpecificIP  = chkBindSpecific.Checked;

                bool failed = false;


                var result = WsWrapper.TestConnection(MainForm.Conf.WSUsername, MainForm.Conf.WSPassword, true);
                if (result[0] != "OK")
                {
                    MessageBox.Show(result[0], LocRm.GetString("Error"));
                    failed = true;
                }

                if (!failed)
                {
                    if (result.Length > 0 && result[0] == "OK")
                    {
                        EmailAddress                  = result[2];
                        MobileNumber                  = result[4];
                        MainForm.Conf.Reseller        = result[5];
                        MainForm.Conf.ServicesEnabled = true;
                        MainForm.Conf.Subscribed      = Convert.ToBoolean(result[1]);
                        if (result[3] != "")
                        {
                            if (!bIPv6)
                            {
                                //try setting port automatically
                                if (chkuPNP.Checked)
                                {
                                    if (!NATControl.SetPorts(port, localPort))
                                    {
                                        MessageBox.Show(LocRm.GetString("ErrorPortMapping"), LocRm.GetString("Error"));
                                        chkuPNP.Checked = false;
                                    }
                                    else
                                    {
                                        result = WsWrapper.TestConnection(MainForm.Conf.WSUsername, MainForm.Conf.WSPassword, true);
                                    }
                                }
                            }

                            if (result[3] != "")
                            {
                                MainForm.Conf.Loopback = false;
                                Next.Enabled           = true;
                                Next.Text         = LocRm.GetString("Finish");
                                MainForm.LoopBack = false;
                                if (!bIPv6)
                                {
                                    switch (
                                        MessageBox.Show(
                                            LocRm.GetString("ErrorLoopback").Replace("[PORT]", port.ToString(CultureInfo.InvariantCulture)),
                                            LocRm.GetString("Error"), MessageBoxButtons.YesNoCancel))
                                    {
                                    case DialogResult.Yes:
                                        ShowTroubleShooter();
                                        return;

                                    case DialogResult.No:
                                        MainForm.Conf.Loopback = false;
                                        MainForm.LoopBack      = false;
                                        DialogResult           = DialogResult.Yes;
                                        Close();
                                        return;

                                    case DialogResult.Cancel:
                                        return;
                                    }
                                }
                                else
                                {
                                    switch (
                                        MessageBox.Show(
                                            LocRm.GetString("ErrorLoopbackIPv6").Replace("[PORT]", localPort.ToString(CultureInfo.InvariantCulture)),
                                            LocRm.GetString("Error"), MessageBoxButtons.YesNoCancel))
                                    {
                                    case DialogResult.Yes:
                                        ShowTroubleShooter();
                                        return;

                                    case DialogResult.No:
                                        MainForm.Conf.Loopback = false;
                                        MainForm.LoopBack      = false;
                                        DialogResult           = DialogResult.Yes;
                                        Close();
                                        return;

                                    case DialogResult.Cancel:
                                        return;
                                    }
                                }
                            }
                        }
                        if (result[3] == "")
                        {
                            MainForm.Conf.Loopback = true;
                            MainForm.LoopBack      = true;

                            DialogResult = DialogResult.Yes;
                            Close();
                            return;
                        }
                        Next.Enabled = true;
                        Next.Text    = LocRm.GetString("Finish");
                    }
                    else
                    {
                        if (result.Length > 0 && result[0].ToLower().IndexOf("login", StringComparison.Ordinal) == -1)
                        {
                            MessageBox.Show(result[0], LocRm.GetString("Error"));
                        }
                        else
                        {
                            MessageBox.Show(LocRm.GetString("NoResponse"), LocRm.GetString("ConnectFailed"));
                        }
                    }
                }
            }
            else
            {
                Next.Enabled = true;
                Next.Text    = LocRm.GetString("Finish");
                if (
                    MessageBox.Show(LocRm.GetString("WarningLogin"), LocRm.GetString("Note"), MessageBoxButtons.OKCancel) ==
                    DialogResult.Cancel)
                {
                    return;
                }
                MainForm.Conf.ServicesEnabled = false;
                MainForm.Conf.Subscribed      = false;
                MainForm.Conf.WSUsername      = "";
                MainForm.Conf.WSPassword      = "";
                DialogResult = DialogResult.OK;
                Close();
            }
            Next.Enabled = true;
            Next.Text    = LocRm.GetString("Finish");
        }
示例#3
0
        private void Troubleshooter()
        {
            //causes a reset of detected ip addresses
            MainForm.AddressIPv4 = MainForm.Conf.IPv4Address;
            MainForm.AddressIPv6 = MainForm.Conf.IPv6Address;

            UISync.Execute(() => rtbOutput.Clear());

            try
            {
                MainForm.StopAndStartServer();
            }
            catch (Exception ex)
            {
                Logger.LogExceptionToFile(ex);
            }

            bool portMapOk = false;
            bool bIPv6     = MainForm.Conf.IPMode == "IPv6";

            UISync.Execute(() => button2.Enabled = false);



            string localserver = (MainForm.Conf.SSLEnabled?"https":"http") + "://" + MainForm.IPAddress + ":" + MainForm.Conf.LANPort;

            UISync.Execute(() => rtbOutput.Text = $"Local iSpy Server: {localserver}{NL}");
            if (webports.IndexOf("," + MainForm.Conf.LANPort + ",", StringComparison.Ordinal) == -1)
            {
                UISync.Execute(() => rtbOutput.Text +=
                                   $"Warning: Running a local server on a non-standard port ({MainForm.Conf.LANPort}) may cause web-browser security errors. Click the link above to test in your web browser.{NL}");
            }
            if (MainForm.IPAddress.StartsWith("169.254"))
            {
                UISync.Execute(() => rtbOutput.Text += NL + "Warning: Your network adaptor has assigned itself a link-local address (169.254.x.x). This means your PC is setup for DHCP but can't find a DHCP server and iSpy will be unavailable over your LAN. Try resetting your router." + NL);
            }
            if (MainForm.Conf.SSLEnabled)
            {
                UISync.Execute(() => rtbOutput.Text += "Warning: Using SSL - disable SSL in settings if you are having problems with connecting." + NL);
            }
            if (MainForm.Conf.SpecificIP)
            {
                UISync.Execute(
                    () =>
                    rtbOutput.Text +=
                        "Warning: You are binding to a specific IP address. This can cause issues on systems with multiple NICs. Try unchecking the Bind To IP Address option in settings/ web server if you have problems." +
                        NL);
            }

            UISync.Execute(() => rtbOutput.Text += "Checking local server... ");
            Application.DoEvents();
            string res = "";

            if (!loadurl(localserver, out res))
            {
                string res1 = res;
                UISync.Execute(() => rtbOutput.Text += $"Failed: {res1}{NL}");
                if (MainForm.MWS.Running)
                {
                    UISync.Execute(() => rtbOutput.Text += "Server reports it IS running" + NL);
                }
                else
                {
                    UISync.Execute(() => rtbOutput.Text += "Server reports it IS NOT running - check the log file for errors (View-> Log File)" + NL);
                }

                UISync.Execute(() => rtbOutput.Text += "Do you have a third party firewall or antivirus running (AVG/ zonealarm etc)?" + NL);
            }
            else
            {
                res = res.ToLower();
                if (res == "ok" || res.IndexOf("ispy", StringComparison.Ordinal) != -1)
                {
                    UISync.Execute(() => rtbOutput.Text += "OK");
                }
                else
                {
                    string res1 = res;
                    UISync.Execute(() => rtbOutput.Text += $"Unexpected output: {res1}");
                }
            }
            UISync.Execute(() => rtbOutput.Text += NL);
            UISync.Execute(() => rtbOutput.Text += "Checking WebServer... ");
            Application.DoEvents();
            if (!loadurl(MainForm.Webserver + "/webservices/ispyapi.asmx", out res))
            {
                UISync.Execute(() => rtbOutput.Text += "Webservices not responding.");
            }
            else
            {
                if (res.IndexOf("error occurred while", StringComparison.Ordinal) != -1)
                {
                    UISync.Execute(() => rtbOutput.Text += "Error with webservices. Please try again later (check your internet connection).");
                }
                else
                {
                    UISync.Execute(() => rtbOutput.Text += "OK");
                }
            }
            UISync.Execute(() => rtbOutput.Text += NL);
            UISync.Execute(() => rtbOutput.Text += "Checking your firewall... ");
            Application.DoEvents();
            var fw = new FireWall();

            fw.Initialize();

            bool bOn;
            var  r = fw.IsWindowsFirewallOn(out bOn);

            if (r == FireWall.FwErrorCode.FwNoerror)
            {
                if (bOn)
                {
                    string strApplication = Application.StartupPath + "\\iSpy.exe";
                    bool   bEnabled       = false;
                    fw.IsAppEnabled(strApplication, ref bEnabled);
                    if (!bEnabled)
                    {
                        UISync.Execute(() => rtbOutput.Text += "iSpy is *NOT ENABLED* - add ispy.exe to the windows firewall allowed list");
                    }
                    else
                    {
                        UISync.Execute(() => rtbOutput.Text += "iSpy is enabled");
                    }
                }
                else
                {
                    UISync.Execute(() => rtbOutput.Text += "Firewall is off");
                }
            }
            else
            {
                UISync.Execute(() => rtbOutput.Text += "Firewall error: " + r);
            }
            UISync.Execute(() => rtbOutput.Text += NL);


            UISync.Execute(() => rtbOutput.Text += "Checking your account... ");

            var result = WsWrapper.TestConnection(MainForm.Conf.WSUsername, MainForm.Conf.WSPassword, false);

            if (result[0] != "OK")
            {
                UISync.Execute(() => rtbOutput.Text += result[0]);
            }
            else
            {
                string[] result1 = result;
                UISync.Execute(() => rtbOutput.Text += "Found: " + result1[2]);
                if (Convert.ToBoolean(result[1]))
                {
                    UISync.Execute(() => rtbOutput.Text += NL + "Your subscription is valid." + NL);
                    if (MainForm.Conf.IPMode == "IPv4")
                    {
                        UISync.Execute(() => rtbOutput.Text += "IPv4: Checking port mappings... " + NL);
                        try
                        {
                            if (NATControl.Mappings == null)
                            {
                                UISync.Execute(
                                    () =>
                                    rtbOutput.Text +=
                                        "IPv4 Port mappings are unavailable - set up port mapping manually, instructions here: http://portforward.com/english/routers/port_forwarding/routerindex.htm" +
                                        NL);
                            }
                            else
                            {
                                int j = 2;
                                while (!portMapOk && j > 0)
                                {
                                    int maps = 0;
                                    try
                                    {
                                        var enumerator = NATControl.Mappings.GetEnumerator();
                                        while (enumerator.MoveNext())
                                        {
                                            var map = (NATUPNPLib.IStaticPortMapping)enumerator.Current;
                                            UISync.Execute(
                                                () =>
                                                rtbOutput.Text +=
                                                    map.ExternalPort + " -> " + map.InternalPort + " on " +
                                                    map.InternalClient +
                                                    " (" +
                                                    map.Protocol + ")" + NL);
                                            if (map.ExternalPort == MainForm.Conf.ServerPort)
                                            {
                                                if (map.InternalPort != MainForm.Conf.LANPort)
                                                {
                                                    UISync.Execute(
                                                        () =>
                                                        rtbOutput.Text +=
                                                            "*** External port is routing to " + map.InternalPort +
                                                            " instead of " +
                                                            MainForm.Conf.LANPort + NL);
                                                }
                                                else
                                                {
                                                    if (map.InternalClient != MainForm.AddressIPv4)
                                                    {
                                                        UISync.Execute(
                                                            () =>
                                                            rtbOutput.Text +=
                                                                "*** Port is mapping to IP Address " + map.InternalClient +
                                                                " - should be " +
                                                                MainForm.AddressIPv4 +
                                                                ". Set a static IP address for your computer and then update the port mapping." +
                                                                NL);
                                                    }
                                                    else
                                                    {
                                                        portMapOk = true;
                                                    }
                                                }
                                            }
                                            maps++;
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        UISync.Execute(
                                            () => rtbOutput.Text += "Port mapping lookup failed (" + ex.Message.Trim() + "). If the connection fails try resetting your router or manually configure port forwarding. " + NL);
                                        if (maps == 0)
                                        {
                                            throw;
                                        }
                                    }
                                    if (!portMapOk)
                                    {
                                        //add port mapping
                                        UISync.Execute(() => rtbOutput.Text += "IPv4: Fixing port mapping... " + NL);
                                        if (!NATControl.SetPorts(MainForm.Conf.ServerPort, MainForm.Conf.LANPort))
                                        {
                                            UISync.Execute(
                                                () => rtbOutput.Text += LocRm.GetString("ErrorPortMapping") + NL);
                                        }

                                        j--;
                                        if (j > 0)
                                        {
                                            UISync.Execute(
                                                () => rtbOutput.Text += "IPv4: Checking port mappings... " + NL);
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Logger.LogExceptionToFile(ex);
                        }
                    }


                    UISync.Execute(() => rtbOutput.Text += "Checking external access... " + NL);

                    result = WsWrapper.TestConnection(MainForm.Conf.WSUsername, MainForm.Conf.WSPassword, true);

                    if (result.Length > 3 && result[3] != "")
                    {
                        MainForm.Conf.Loopback = MainForm.LoopBack = false;
                        UISync.Execute(() => rtbOutput.Text += "iSpyConnect is trying to contact your server at: " + result[6] + NL);
                        UISync.Execute(() => rtbOutput.Text += "Failed: " + result[3] + NL);
                        if (!bIPv6)
                        {
                            UISync.Execute(
                                () =>
                                rtbOutput.Text +=
                                    "Your router should be configured to forward TCP traffic from WAN (external) port " +
                                    MainForm.Conf.ServerPort + " to internal (LAN) port " +
                                    MainForm.Conf.LANPort + " on IP address " + MainForm.AddressIPv4 +
                                    NL);
                            if (portMapOk)
                            {
                                UISync.Execute(
                                    () =>
                                    rtbOutput.Text +=
                                        NL +
                                        "Your port mapping seems to be OK - try turning your router off and on again. Failing that we recommend checking with your ISP to see if they are blocking port " +
                                        MainForm.Conf.ServerPort +
                                        " or check if your antivirus protection (eset, zonealarm etc) is blocking iSpy. ");
                            }
                        }

                        if (MainForm.AddressListIPv4.Length > 1)
                        {
                            UISync.Execute(() => rtbOutput.Text += NL + "Warning: There are multiple network adaptors in your PC. Try selecting a different IP address to listen on in iSpy web settings or disable unused network adaptors and restart iSpy: " + NL);
                            foreach (var ip in MainForm.AddressListIPv4)
                            {
                                string ip1 = ip.ToString();
                                if (ip1 != MainForm.IPAddress)
                                {
                                    UISync.Execute(() => rtbOutput.Text += "\t" + ip1 + NL);
                                }
                            }
                        }
                        UISync.Execute(() => rtbOutput.Text += NL + NL + "Please see the troubleshooting section here: http://www.ispyconnect.com/userguide-remote-access-troubleshooting.aspx");
                    }
                    else
                    {
                        if (result.Length == 1)
                        {
                            UISync.Execute(() => rtbOutput.Text +=
                                               "Failed: Communication with webserver failed." + NL + NL);
                        }
                        else
                        {
                            UISync.Execute(() => rtbOutput.Text +=
                                               "Success!" + NL + NL + "If you cannot access content locally please ensure 'Use LAN IP when available' is checked on " + MainForm.Webserver + "/account.aspx and also ensure you're using an up to date web browser (we recommend google Chrome)");

                            MainForm.Conf.Loopback = MainForm.LoopBack = true;
                        }
                    }
                }
                else
                {
                    UISync.Execute(() => rtbOutput.Text += NL +
                                                           "Not subscribed - local access only. http://www.ispyconnect.com/subscribe.aspx");
                }
            }
            UISync.Execute(() => rtbOutput.Text += NL);
            Application.DoEvents();
            UISync.Execute(() => button2.Enabled = true);
        }
示例#4
0
        public static string AlertSummary(objectsActionsEntry e)
        {
            string t = "Unknown";
            bool   b;

            switch (e.type.ToUpperInvariant())
            {
            case "EXE":
                t = LocRm.GetString("ExecuteFile") + ": " + e.param1;
                break;

            case "URL":
                t = LocRm.GetString("CallURL") + ": " + e.param1;
                Boolean.TryParse(e.param2, out b);
                if (b)
                {
                    t += " (POST grab)";
                }
                break;

            case "NM":
                t = e.param1 + " " + e.param2 + ":" + e.param3 + " (" + e.param4 + ")";
                break;

            case "S":
                t = LocRm.GetString("PlaySound") + ": " + e.param1;
                break;

            case "ATC":
                t = LocRm.GetString("SoundThroughCamera") + ": " + e.param1;
                break;

            case "SW":
                t = LocRm.GetString("ShowWindow");
                break;

            case "B":
                t = LocRm.GetString("Beep");
                break;

            case "M":
                t = LocRm.GetString("Maximise");
                break;

            case "MO":
                t = LocRm.GetString("SwitchMonitorOn");
                break;

            case "TA":
            {
                string[] op = e.param1.Split(',');
                string   n  = "[removed]";
                int      id = Convert.ToInt32(op[1]);
                switch (op[0])
                {
                case "1":
                    objectsMicrophone om = MainForm.Microphones.FirstOrDefault(p => p.id == id);
                    if (om != null)
                    {
                        n = om.name;
                    }
                    break;

                case "2":
                    objectsCamera oc = MainForm.Cameras.FirstOrDefault(p => p.id == id);
                    if (oc != null)
                    {
                        n = oc.name;
                    }
                    break;
                }
                t = LocRm.GetString("TriggerAlertOn") + " " + n;
            }
            break;

            case "SOO":
            {
                string[] op = e.param1.Split(',');
                string   n  = "[removed]";
                int      id = Convert.ToInt32(op[1]);
                switch (op[0])
                {
                case "1":
                    objectsMicrophone om = MainForm.Microphones.FirstOrDefault(p => p.id == id);
                    if (om != null)
                    {
                        n = om.name;
                    }
                    break;

                case "2":
                    objectsCamera oc = MainForm.Cameras.FirstOrDefault(p => p.id == id);
                    if (oc != null)
                    {
                        n = oc.name;
                    }
                    break;
                }
                t = LocRm.GetString("SwitchObjectOn") + " " + n;
            }
            break;

            case "SOF":
            {
                string[] op = e.param1.Split(',');
                string   n  = "[removed]";
                int      id;
                int.TryParse(op[1], out id);
                switch (op[0])
                {
                case "1":
                    objectsMicrophone om = MainForm.Microphones.FirstOrDefault(p => p.id == id);
                    if (om != null)
                    {
                        n = om.name;
                    }
                    break;

                case "2":
                    objectsCamera oc = MainForm.Cameras.FirstOrDefault(p => p.id == id);
                    if (oc != null)
                    {
                        n = oc.name;
                    }
                    break;
                }
                t = LocRm.GetString("SwitchObjectOff") + " " + n;
            }
            break;

            case "E":
                t = LocRm.GetString("SendEmail") + ": " + e.param1;
                if (e.param2 != "")
                {
                    bool.TryParse(e.param2, out b);
                    if (b)
                    {
                        t += " (include grab)";
                    }
                }

                break;

            case "SMS":
                t = LocRm.GetString("SendSMS") + ": " + e.param1;
                break;

            case "TM":
                t = LocRm.GetString("SendTwitterMessage");
                break;
            }

            return(t);
        }
示例#5
0
        private void WebservicesLoad(object sender, EventArgs e)
        {
            txtWANPort.Value        = MainForm.Conf.ServerPort;
            txtUsername.Text        = MainForm.Conf.WSUsername;
            txtPassword.Text        = MainForm.Conf.WSPassword;
            txtLANPort.Text         = MainForm.Conf.LANPort.ToString(CultureInfo.InvariantCulture);
            txtPort.Text            = MainForm.Conf.LANPort.ToString(CultureInfo.InvariantCulture);
            chkReroute.Checked      = MainForm.Conf.DHCPReroute;
            chkEnableIPv6.Checked   = !MainForm.Conf.IPv6Disabled;
            chkBindSpecific.Checked = MainForm.Conf.SpecificIP;

            chkuPNP.Checked = MainForm.Conf.UseUPNP;
            if (!chkuPNP.Checked)
            {
                chkReroute.Checked = chkReroute.Enabled = false;
            }

            bool success;

            lblIPAddresses.Text = LocRm.GetString("PublicIPAddress").Replace("[IP]", MainForm.IPAddressExternal(out success));
            int i2 = 0;

            foreach (IPAddress ipadd in MainForm.AddressListIPv4)
            {
                lbIPv4Address.Items.Add(ipadd.ToString());
                if (ipadd.ToString() == MainForm.AddressIPv4)
                {
                    lbIPv4Address.SelectedIndex = i2;
                }
                i2++;
            }
            if (lbIPv4Address.Items.Count > 0 && lbIPv4Address.SelectedIndex == -1)
            {
                lbIPv4Address.SelectedIndex = 0;
            }

            int i = 0;

            foreach (IPAddress ipadd in MainForm.AddressListIPv6)
            {
                lbIPv6Address.Items.Add(ipadd.ToString());
                if (ipadd.ToString() == MainForm.AddressIPv6)
                {
                    lbIPv6Address.SelectedIndex = i;
                }

                i++;
            }

            if (i == 0)
            {
                tcIPMode.TabPages.RemoveAt(1);
            }


            if (tcIPMode.TabPages.Count == 2)
            {
                switch (MainForm.Conf.IPMode)
                {
                case "IPv4":
                    tcIPMode.SelectedIndex = 0;
                    break;

                case "IPv6":
                    tcIPMode.SelectedIndex = 1;
                    break;
                }
            }
            else
            {
                tcIPMode.SelectedIndex = 0;
                MainForm.Conf.IPMode   = "IPv4";
            }
            EnableNext();
            _loaded = true;
        }
示例#6
0
 private void downloader_Load(object sender, EventArgs e)
 {
     UISync.Init(this);
     backgroundWorker1.RunWorkerAsync();
     Text = LocRm.GetString("Updating");
 }
示例#7
0
        private bool Save()
        {
            if (!CheckStep1())
            {
                return(false);
            }

            string err = "";

            if (!int.TryParse(txtNoSound.Text, out int nosoundinterval))
            {
                err += LocRm.GetString("Validate_Microphone_NoSound") + Environment.NewLine;
            }
            if (!int.TryParse(txtSound.Text, out int soundinterval))
            {
                err += LocRm.GetString("Validate_Microphone_Sound") + Environment.NewLine;
            }


            if (txtBuffer.Text.Length < 1 || txtInactiveRecord.Text.Length < 1 ||
                txtMaxRecordTime.Text.Length < 1)
            {
                err += LocRm.GetString("Validate_Camera_RecordingSettings") + Environment.NewLine;
            }

            if (err != "")
            {
                MessageBox.Show(err, LocRm.GetString("Error"));
                return(false);
            }


            VolumeLevel.Micobject.settings.buffer         = Convert.ToInt32(txtBuffer.Value);
            VolumeLevel.Micobject.recorder.inactiverecord = Convert.ToInt32(txtInactiveRecord.Value);
            VolumeLevel.Micobject.recorder.maxrecordtime  = Convert.ToInt32(txtMaxRecordTime.Value);

            VolumeLevel.Micobject.name = txtMicrophoneName.Text.Trim();

            VolumeLevel.Micobject.alerts.active = chkSound.Checked;

            VolumeLevel.Micobject.alerts.mode = "sound";
            if (rdoNoMovement.Checked)
            {
                VolumeLevel.Micobject.alerts.mode = "nosound";
            }
            VolumeLevel.Micobject.detector.nosoundinterval = nosoundinterval;
            VolumeLevel.Micobject.detector.soundinterval   = soundinterval;

            VolumeLevel.Micobject.schedule.active = chkSchedule.Checked;
            VolumeLevel.Micobject.width           = VolumeLevel.Width;
            VolumeLevel.Micobject.height          = VolumeLevel.Height;

            VolumeLevel.Micobject.settings.active         = chkActive.Checked;
            VolumeLevel.Micobject.detector.recordondetect = rdoRecordDetect.Checked;
            VolumeLevel.Micobject.detector.recordonalert  = rdoRecordAlert.Checked;
            VolumeLevel.Micobject.recorder.minrecordtime  = (int)numMinRecord.Value;

            VolumeLevel.Micobject.settings.accessgroups = txtAccessGroups.Text;
            VolumeLevel.Micobject.settings.messaging    = chkMessaging.Checked;


            if (txtDirectory.Text.Trim()?.Length == 0)
            {
                txtDirectory.Text = MainForm.RandomString(5);
            }

            var md     = (ListItem)ddlMediaDirectory.SelectedItem;
            var newind = Convert.ToInt32(md.Value);

            string olddir = Helper.GetMediaDirectory(1, VolumeLevel.Micobject.id) + "video\\" + VolumeLevel.Micobject.directory + "\\";

            bool needsFileRefresh = (VolumeLevel.Micobject.directory != txtDirectory.Text || VolumeLevel.Micobject.settings.directoryIndex != newind);

            int tempidx = VolumeLevel.Micobject.settings.directoryIndex;

            VolumeLevel.Micobject.settings.directoryIndex = newind;

            string newdir = Helper.GetMediaDirectory(1, VolumeLevel.Micobject.id) + "video\\" + txtDirectory.Text + "\\";

            if (IsNew)
            {
                try
                {
                    if (!Directory.Exists(newdir))
                    {
                        Directory.CreateDirectory(newdir);
                    }
                    else
                    {
                        switch (
                            MessageBox.Show(this,
                                            LocRm.GetString("Validate_Directory_Exists"),
                                            LocRm.GetString("Confirm"), MessageBoxButtons.YesNoCancel))
                        {
                        case DialogResult.Yes:
                            Directory.Delete(newdir, true);
                            Directory.CreateDirectory(newdir);
                            break;

                        case DialogResult.Cancel:
                            VolumeLevel.Micobject.settings.directoryIndex = tempidx;
                            return(false);

                        case DialogResult.No:
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, LocRm.GetString("Validate_Directory_String") + Environment.NewLine + ex.Message);
                    VolumeLevel.Micobject.settings.directoryIndex = tempidx;
                    return(false);
                }
            }
            else
            {
                if (newdir != olddir)
                {
                    try
                    {
                        if (!Directory.Exists(newdir))
                        {
                            if (Directory.Exists(olddir))
                            {
                                if (MessageBox.Show(this, "Copy Files?", LocRm.GetString("Confirm"), MessageBoxButtons.YesNo) == DialogResult.Yes)
                                {
                                    Helper.CopyFolder(olddir, newdir);
                                }
                            }
                            else
                            {
                                Directory.CreateDirectory(newdir);
                            }
                        }
                        else
                        {
                            switch (
                                MessageBox.Show(this,
                                                LocRm.GetString("Validate_Directory_Exists"),
                                                LocRm.GetString("Confirm"), MessageBoxButtons.YesNoCancel))
                            {
                            case DialogResult.Yes:
                                if (Directory.Exists(olddir))
                                {
                                    if (MessageBox.Show(this, "Copy Files?", LocRm.GetString("Confirm"), MessageBoxButtons.YesNo) == DialogResult.Yes)
                                    {
                                        Helper.CopyFolder(olddir, newdir);
                                    }
                                }
                                else
                                {
                                    Directory.Delete(newdir, true);
                                    Directory.CreateDirectory(newdir);
                                }
                                break;

                            case DialogResult.Cancel:
                                VolumeLevel.Micobject.settings.directoryIndex = tempidx;
                                return(false);

                            case DialogResult.No:
                                break;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(this, LocRm.GetString("Validate_Directory_String") + Environment.NewLine + ex.Message);
                        VolumeLevel.Micobject.settings.directoryIndex = tempidx;
                        return(false);
                    }
                }
            }


            VolumeLevel.Micobject.directory        = txtDirectory.Text;
            VolumeLevel.Micobject.recorder.trigger = ((ListItem)ddlTriggerRecording.SelectedItem).Value;

            SetStorageManagement();

            MainForm.NeedsSync = true;

            if (needsFileRefresh)
            {
                VolumeLevel.GenerateFileList();
                MainForm.NeedsMediaRebuild = true;
                MainForm.NeedsMediaRefresh = Helper.Now;
            }
            return(true);
        }
示例#8
0
        private void MicrophoneSourceLoad(object sender, EventArgs e)
        {
            UISync.Init(this);
            tableLayoutPanel2.Enabled = VlcHelper.VLCAvailable;
            linkLabel3.Visible        = lblInstallVLC.Visible = !tableLayoutPanel2.Enabled;
            cmbVLCURL.Text            = MainForm.Conf.VLCURL;
            cmbVLCURL.Items.AddRange(ObjectList(MainForm.Conf.RecentVLCList));
            cmbFFMPEGURL.Items.AddRange(ObjectList(MainForm.Conf.RecentVLCList));
            ddlSampleRate.Items.AddRange(SampleRates);
            try
            {
                int selind = -1;

                for (int n = 0; n < WaveIn.DeviceCount; n++)
                {
                    ddlDevice.Items.Add(WaveIn.GetCapabilities(n).ProductName);
                    if (WaveIn.GetCapabilities(n).ProductName == Mic.settings.sourcename)
                    {
                        selind = n;
                    }
                }


                ddlDevice.Enabled = true;

                if (selind > -1)
                {
                    ddlDevice.SelectedIndex = selind;
                }
                else
                {
                    if (ddlDevice.Items.Count == 0)
                    {
                        ddlDevice.Items.Add(_noDevices);
                        ddlDevice.Enabled = false;
                    }
                    else
                    {
                        ddlDevice.SelectedIndex = 0;
                    }
                }
            }
            catch (ApplicationException ex)
            {
                Logger.LogException(ex);
                ddlDevice.Items.Add(_noDevices);
                ddlDevice.Enabled = false;
            }
            ddlSampleRate.SelectedIndex = 0;
            foreach (var mic in MainForm.Microphones)
            {
                if (mic.id != Mic.id && mic.settings.typeindex != 5) //dont allow a clone of a clone as the events get too complicated (and also it's pointless)
                {
                    ddlCloneMicrophone.Items.Add(new MainForm.ListItem(mic.name, mic.id));
                }
            }

            SetSourceIndex(Mic.settings.typeindex);
            numSamples.Value  = Mic.settings.samples;
            numChannels.Value = Mic.settings.channels;

            switch (Mic.settings.typeindex)
            {
            case 0:
                if (ddlDevice.Items.Count > 0)
                {
                    tcAudioSource.SelectedIndex = 0;
                    int j = 0;
                    foreach (int s in ddlSampleRate.Items)
                    {
                        if (s == Mic.settings.samples)
                        {
                            ddlSampleRate.SelectedIndex = j;
                        }
                        j++;
                    }
                }
                break;

            case 1:
                txtNetwork.Text = Mic.settings.sourcename;
                break;

            case 2:
                cmbVLCURL.Text = Mic.settings.sourcename;
                break;

            case 3:
                cmbFFMPEGURL.Text = Mic.settings.sourcename;
                break;

            case 4:
                int i;
                Int32.TryParse(Mic.settings.sourcename, out i);
                var c = MainForm.Cameras.SingleOrDefault(p => p.id == i);
                lblCamera.Text = c == null?LocRm.GetString("Removed") : c.name;

                break;

            case 5:
                int id;
                if (Int32.TryParse(Mic.settings.sourcename, out id))
                {
                    foreach (MainForm.ListItem li in ddlCloneMicrophone.Items)
                    {
                        if ((int)li.Value == id)
                        {
                            ddlCloneMicrophone.SelectedItem = li;
                            break;
                        }
                    }
                }
                break;

            case 6:
                txtWavStreamURL.Text = Mic.settings.sourcename;
                break;
            }


            txtVLCArgs.Text = Mic.settings.vlcargs.Replace("\r\n", "\n").Replace("\n\n", "\n").Replace("\n", Environment.NewLine);

            numAnalyseDuration.Value = Mic.settings.analyzeduration;
        }
示例#9
0
        private void Finish()
        {
            int sourceIndex = GetSourceIndex();

            switch (sourceIndex)
            {
            case 0:
                if (!ddlDevice.Enabled)
                {
                    Close();
                    return;
                }
                Mic.settings.sourcename = ddlDevice.SelectedItem.ToString();

                int i = 0, selind = -1;
                for (int n = 0; n < WaveIn.DeviceCount; n++)
                {
                    ddlDevice.Items.Add(WaveIn.GetCapabilities(n).ProductName);
                    if (WaveIn.GetCapabilities(n).ProductName == Mic.settings.sourcename)
                    {
                        selind = i;
                    }
                    i++;
                }

                int channels = WaveIn.GetCapabilities(selind).Channels;

                Mic.settings.channels = channels;
                Mic.settings.samples  = Convert.ToInt32(ddlSampleRate.SelectedItem);
                Mic.settings.bits     = 16;

                break;

            case 1:
                try
                {
                    var url = new Uri(txtNetwork.Text);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
                Mic.settings.sourcename = txtNetwork.Text;

                //set format
                Mic.settings.channels = 1;
                Mic.settings.samples  = 22050;
                Mic.settings.bits     = 16;
                break;

            case 2:
            {
                string t = cmbVLCURL.Text.Trim();
                if (t == String.Empty)
                {
                    MessageBox.Show(LocRm.GetString("Validate_Microphone_SelectSource"), LocRm.GetString("Error"));
                    return;
                }
                Mic.settings.sourcename = t;
            }
            break;

            case 3:
                try
                {
                    var url = new Uri(cmbFFMPEGURL.Text);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
                Mic.settings.sourcename = cmbFFMPEGURL.Text;
                break;

            case 5:
                if (ddlCloneMicrophone.SelectedIndex > -1)
                {
                    int micid = (int)((MainForm.ListItem)ddlCloneMicrophone.SelectedItem).Value;
                    Mic.settings.sourcename = micid.ToString(CultureInfo.InvariantCulture);
                    var mic = MainForm.Microphones.First(p => p.id == micid);
                    Mic.name = "Clone: " + mic.name;
                }
                else
                {
                    MessageBox.Show(this, LocRm.GetString("SelectMicrophoneToClone"));
                    return;
                }
                break;

            case 6:
                try
                {
                    var url = new Uri(txtWavStreamURL.Text);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
                Mic.settings.sourcename = txtWavStreamURL.Text;

                //set default format
                Mic.settings.channels = (int)numChannels.Value;
                Mic.settings.samples  = (int)numSamples.Value;
                Mic.settings.bits     = 16;
                break;
            }

            MainForm.Conf.VLCURL = cmbVLCURL.Text.Trim();
            if (!MainForm.Conf.RecentVLCList.Contains(MainForm.Conf.VLCURL) &&
                MainForm.Conf.VLCURL != "")
            {
                MainForm.Conf.RecentVLCList =
                    (MainForm.Conf.RecentVLCList + "|" + MainForm.Conf.VLCURL).Trim('|');
            }

            Mic.settings.typeindex  = sourceIndex;
            Mic.settings.decompress = true; // chkDecompress.Checked;
            Mic.settings.vlcargs    = txtVLCArgs.Text.Trim();

            Mic.settings.analyzeduration = (int)numAnalyseDuration.Value;

            DialogResult = DialogResult.OK;
            Close();
        }
示例#10
0
        private void AddMicrophoneLoad(object sender, EventArgs e)
        {
            if (VolumeLevel.Micobject.id == -1)
            {
                if (!SelectSource())
                {
                    Close();
                    return;
                }
            }
            VolumeLevel.IsEdit = true;
            if (VolumeLevel.CameraControl != null)
            {
                VolumeLevel.CameraControl.IsEdit = true;
            }

            btnBack.Enabled        = false;
            gpbSubscriber.Enabled  = MainForm.Conf.Subscribed;
            txtMicrophoneName.Text = VolumeLevel.Micobject.name;
            tbSensitivity.Value    = VolumeLevel.Micobject.detector.sensitivity;
            //tbGain.Value = (int)(VolumeLevel.Micobject.settings.gain * 100);

            chkSound.Checked        = VolumeLevel.Micobject.alerts.active;
            rdoRecordDetect.Checked = VolumeLevel.Micobject.detector.recordondetect;
            rdoRecordAlert.Checked  = VolumeLevel.Micobject.detector.recordonalert;
            rdoNoRecord.Checked     = !rdoRecordDetect.Checked && !rdoRecordAlert.Checked;
            txtExecuteAudio.Text    = VolumeLevel.Micobject.alerts.executefile;

            if (VolumeLevel.Micobject.alerts.mode == "sound")
            {
                rdoMovement.Checked = true;
            }
            else
            {
                rdoNoMovement.Checked = true;
            }

            chkSendEmailSound.Checked  = VolumeLevel.Micobject.notifications.sendemail;
            chkSendSMSMovement.Checked = VolumeLevel.Micobject.notifications.sendsms;


            txtEmailAlert.Text  = VolumeLevel.Micobject.settings.emailaddress;
            txtSMSNumber.Text   = VolumeLevel.Micobject.settings.smsnumber;
            chkSchedule.Checked = VolumeLevel.Micobject.schedule.active;
            chkActive.Checked   = VolumeLevel.Micobject.settings.active;

            chkActive.Enabled = VolumeLevel.Micobject.settings.sourcename != "";

            if (VolumeLevel.Micobject.settings.sourcename != "")
            {
                lblAudioSource.Text = "";
                if (VolumeLevel.Micobject.settings.typeindex == 4)
                {
                    int icam;
                    if (Int32.TryParse(VolumeLevel.Micobject.settings.sourcename, out icam))
                    {
                        var c = MainForm.Cameras.SingleOrDefault(p => p.id == icam);
                        if (c != null)
                        {
                            lblAudioSource.Text = c.name;
                        }
                    }
                }
                if (lblAudioSource.Text == "")
                {
                    lblAudioSource.Text = VolumeLevel.Micobject.settings.sourcename;
                }
            }
            else
            {
                lblAudioSource.Text = LocRm.GetString("NoSource");
                chkActive.Checked   = false;
            }


            string[] alertOptions = VolumeLevel.Micobject.alerts.alertoptions.Split(','); //beep,restore
            chkBeep.Checked    = Convert.ToBoolean(alertOptions[0]);
            chkRestore.Checked = Convert.ToBoolean(alertOptions[1]);
            Text = LocRm.GetString("EditMicrophone");
            if (VolumeLevel.Micobject.id > -1)
            {
                Text += " (ID: " + VolumeLevel.Micobject.id + ", DIR: " + VolumeLevel.Micobject.directory + ")";
            }

            txtNoSound.Text      = VolumeLevel.Micobject.detector.nosoundinterval.ToString();
            txtSound.Text        = VolumeLevel.Micobject.detector.soundinterval.ToString();
            pnlSound.Enabled     = chkSound.Checked;
            pnlScheduler.Enabled = chkSchedule.Checked;

            txtBuffer.Text          = VolumeLevel.Micobject.settings.buffer.ToString();
            txtInactiveRecord.Text  = VolumeLevel.Micobject.recorder.inactiverecord.ToString();
            txtMinimumInterval.Text = VolumeLevel.Micobject.alerts.minimuminterval.ToString();
            txtMaxRecordTime.Text   = VolumeLevel.Micobject.recorder.maxrecordtime.ToString();

            ddlHourStart.SelectedIndex   =
                ddlHourEnd.SelectedIndex = ddlMinuteStart.SelectedIndex = ddlMinuteEnd.SelectedIndex = 0;
            linkLabel5.Visible           = !(MainForm.Conf.Subscribed);
            ShowSchedule(-1);
            chkEmailOnDisconnect.Checked = VolumeLevel.Micobject.settings.notifyondisconnect;
            txtArguments.Text            = VolumeLevel.Micobject.alerts.arguments;

            txtAccessGroups.Text = VolumeLevel.Micobject.settings.accessgroups;
            txtDirectory.Text    = VolumeLevel.Micobject.directory;

            chkTwitter.Checked = VolumeLevel.Micobject.notifications.sendtwitter;

            ddlCopyFrom.Items.Clear();
            ddlCopyFrom.Items.Add(new ListItem(LocRm.GetString("CopyFrom"), "-1"));
            foreach (objectsMicrophone c in MainForm.Microphones)
            {
                if (c.id != VolumeLevel.Micobject.id)
                {
                    ddlCopyFrom.Items.Add(new ListItem(c.name, c.id.ToString()));
                }
            }
            ddlCopyFrom.SelectedIndex = 0;


            int i = 0, j = 0;

            foreach (var dev in DirectSoundOut.Devices)
            {
                ddlPlayback.Items.Add(new ListItem(dev.Description, dev.Guid.ToString()));
                if (dev.Guid.ToString() == VolumeLevel.Micobject.settings.deviceout)
                {
                    i = j;
                }
                j++;
            }
            if (ddlPlayback.Items.Count > 0)
            {
                ddlPlayback.SelectedIndex = i;
            }
            else
            {
                ddlPlayback.Items.Add(LocRm.GetString("NoAudioDevices"));
                ddlPlayback.Enabled = false;
            }

            tmrUpdateSourceDetails.Start();



            string t  = VolumeLevel.Micobject.alerts.trigger ?? "";
            string t2 = VolumeLevel.Micobject.recorder.trigger ?? "";

            ddlTrigger.Items.Add(new ListItem("None", ""));
            ddlTriggerRecording.Items.Add(new ListItem("None", ""));

            foreach (var c in MainForm.Cameras.Where(p => p.settings.micpair != VolumeLevel.Micobject.id))
            {
                ddlTrigger.Items.Add(new ListItem(c.name, "2," + c.id));
                ddlTriggerRecording.Items.Add(new ListItem(c.name, "2," + c.id));
            }
            foreach (var c in MainForm.Microphones.Where(p => p.id != VolumeLevel.Micobject.id))
            {
                ddlTrigger.Items.Add(new ListItem(c.name, "1," + c.id));
                ddlTriggerRecording.Items.Add(new ListItem(c.name, "1," + c.id));
            }
            foreach (ListItem li in ddlTrigger.Items)
            {
                if (li.Value == t)
                {
                    ddlTrigger.SelectedItem = li;
                }
                if (li.Value == t2)
                {
                    ddlTriggerRecording.SelectedItem = li;
                }
            }
            if (ddlTrigger.SelectedIndex == -1)
            {
                ddlTrigger.SelectedIndex = 0;
            }
            if (ddlTriggerRecording.SelectedIndex == -1)
            {
                ddlTriggerRecording.SelectedIndex = 0;
            }

            if (VolumeLevel.CameraControl != null)
            {
                txtBuffer.Enabled = false;
                toolTip1.SetToolTip(txtBuffer, "Change the buffer on the paired camera to update");
            }
            _loaded = true;
        }
示例#11
0
 private void RenderResources()
 {
     Text         = LocRm.GetString("ApplicationHasBeenLocked");
     button1.Text = LocRm.GetString("Unlock");
     label1.Text  = LocRm.GetString("UnlockPassword");
 }
示例#12
0
        private void BtnFinishClick(object sender, EventArgs e)
        {
            //validate page 0
            if (CheckStep1())
            {
                string err = "";
                if (chkSendSMSMovement.Checked && MainForm.Conf.ServicesEnabled &&
                    txtSMSNumber.Text.Trim() == "")
                {
                    err += LocRm.GetString("Validate_Camera_MobileNumber") + Environment.NewLine;
                }

                int nosoundinterval;
                if (!int.TryParse(txtNoSound.Text, out nosoundinterval))
                {
                    err += LocRm.GetString("Validate_Microphone_NoSound") + Environment.NewLine;
                }
                int soundinterval;
                if (!int.TryParse(txtSound.Text, out soundinterval))
                {
                    err += LocRm.GetString("Validate_Microphone_Sound") + Environment.NewLine;
                }


                string sms = txtSMSNumber.Text.Trim().Replace(" ", "");
                if (sms.StartsWith("00"))
                {
                    sms = sms.Substring(2);
                }
                if (sms.StartsWith("+"))
                {
                    sms = sms.Substring(1);
                }
                if (sms != "")
                {
                    if (!IsNumeric(sms))
                    {
                        err += LocRm.GetString("Validate_Camera_SMSNumbers") + Environment.NewLine;
                    }
                }
                string email = txtEmailAlert.Text.Replace(" ", "");
                if (email != "" && !email.IsValidEmail())
                {
                    err += LocRm.GetString("Validate_Camera_EmailAlerts") + Environment.NewLine;
                }

                if (email == "")
                {
                    chkSendEmailSound.Checked    = false;
                    chkEmailOnDisconnect.Checked = false;
                }
                if (sms == "")
                {
                    chkSendSMSMovement.Checked = false;
                }

                if (txtBuffer.Text.Length < 1 || txtInactiveRecord.Text.Length < 1 || txtMinimumInterval.Text.Length < 1 ||
                    txtMaxRecordTime.Text.Length < 1)
                {
                    err += LocRm.GetString("Validate_Camera_RecordingSettings") + Environment.NewLine;
                }

                if (err != "")
                {
                    MessageBox.Show(err, LocRm.GetString("Error"));
                    return;
                }


                VolumeLevel.Micobject.settings.buffer         = Convert.ToInt32(txtBuffer.Value);
                VolumeLevel.Micobject.recorder.inactiverecord = Convert.ToInt32(txtInactiveRecord.Value);
                VolumeLevel.Micobject.alerts.minimuminterval  = Convert.ToInt32(txtMinimumInterval.Value);
                VolumeLevel.Micobject.recorder.maxrecordtime  = Convert.ToInt32(txtMaxRecordTime.Value);

                VolumeLevel.Micobject.name = txtMicrophoneName.Text.Trim();
                VolumeLevel.Micobject.detector.sensitivity = tbSensitivity.Value;
                VolumeLevel.Micobject.alerts.active        = chkSound.Checked;
                VolumeLevel.Micobject.alerts.executefile   = txtExecuteAudio.Text;
                VolumeLevel.Micobject.alerts.alertoptions  = chkBeep.Checked + "," + chkRestore.Checked;
                VolumeLevel.Micobject.alerts.mode          = "sound";
                if (rdoNoMovement.Checked)
                {
                    VolumeLevel.Micobject.alerts.mode = "nosound";
                }
                VolumeLevel.Micobject.detector.nosoundinterval = nosoundinterval;
                VolumeLevel.Micobject.detector.soundinterval   = soundinterval;
                VolumeLevel.Micobject.notifications.sendemail  = chkSendEmailSound.Checked;
                VolumeLevel.Micobject.notifications.sendsms    = chkSendSMSMovement.Checked;
                VolumeLevel.Micobject.settings.smsnumber       = sms;
                VolumeLevel.Micobject.settings.emailaddress    = email;

                VolumeLevel.Micobject.schedule.active = chkSchedule.Checked;
                VolumeLevel.Micobject.width           = VolumeLevel.Width;
                VolumeLevel.Micobject.height          = VolumeLevel.Height;

                VolumeLevel.Micobject.settings.active             = chkActive.Checked;
                VolumeLevel.Micobject.detector.recordondetect     = rdoRecordDetect.Checked;
                VolumeLevel.Micobject.detector.recordonalert      = rdoRecordAlert.Checked;
                VolumeLevel.Micobject.notifications.sendtwitter   = chkTwitter.Checked;
                VolumeLevel.Micobject.settings.notifyondisconnect = chkEmailOnDisconnect.Checked;

                VolumeLevel.Micobject.alerts.arguments = txtArguments.Text;

                VolumeLevel.Micobject.settings.accessgroups = txtAccessGroups.Text;

                if (txtDirectory.Text.Trim() == "")
                {
                    txtDirectory.Text = MainForm.RandomString(5);
                }

                if (VolumeLevel.Micobject.directory != txtDirectory.Text)
                {
                    string path = MainForm.Conf.MediaDirectory + "audio\\" + txtDirectory.Text + "\\";
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                }

                VolumeLevel.Micobject.directory = txtDirectory.Text;

                VolumeLevel.Micobject.alerts.trigger   = ((ListItem)ddlTrigger.SelectedItem).Value;
                VolumeLevel.Micobject.recorder.trigger = ((ListItem)ddlTriggerRecording.SelectedItem).Value;

                DialogResult       = DialogResult.OK;
                MainForm.NeedsSync = true;
                Close();
            }
        }
示例#13
0
        private void RenderResources()
        {
            btnBack.Text              = LocRm.GetString("Back");
            btnDelete.Text            = LocRm.GetString("Delete");
            btnDetectSound.Text       = LocRm.GetString("chars_3014702301470230147");
            btnFinish.Text            = LocRm.GetString("Finish");
            btnNext.Text              = LocRm.GetString("Next");
            btnSelectSource.Text      = LocRm.GetString("chars_3014702301470230147");
            btnUpdate.Text            = LocRm.GetString("Update");
            button2.Text              = LocRm.GetString("Add");
            chkActive.Text            = LocRm.GetString("MicrophoneActive");
            chkBeep.Text              = LocRm.GetString("Beep");
            chkEmailOnDisconnect.Text = LocRm.GetString("SendEmailOnDisconnect");
            chkFri.Text                    = LocRm.GetString("Fri");
            chkMon.Text                    = LocRm.GetString("Mon");
            groupBox1.Text                 = LocRm.GetString("RecordingSettings");
            groupBox6.Text                 = LocRm.GetString("RecordingSettings");
            groupBox6.Text                 = LocRm.GetString("RecordingMode");
            rdoRecordDetect.Text           = LocRm.GetString("RecordOnSoundDetection");
            rdoRecordAlert.Text            = LocRm.GetString("RecordOnAlert");
            rdoNoRecord.Text               = LocRm.GetString("NoRecord");
            chkRecordSchedule.Text         = LocRm.GetString("RecordOnScheduleStart");
            chkRestore.Text                = LocRm.GetString("ShowIspyWindow");
            chkSat.Text                    = LocRm.GetString("Sat");
            chkSchedule.Text               = LocRm.GetString("ScheduleMicrophone");
            chkScheduleActive.Text         = LocRm.GetString("ScheduleActive");
            chkScheduleAlerts.Text         = LocRm.GetString("AlertsEnabled");
            chkScheduleRecordOnDetect.Text = LocRm.GetString("RecordOnDetect");
            chkRecordAlertSchedule.Text    = LocRm.GetString("RecordOnAlert");
            chkSendEmailSound.Text         = LocRm.GetString("SendEmailOnAlert");
            chkSendSMSMovement.Text        = LocRm.GetString("SendSmsOnAlert");
            chkSound.Text                  = LocRm.GetString("AlertsEnabled");
            chkSun.Text                    = LocRm.GetString("Sun");
            chkThu.Text                    = LocRm.GetString("Thu");
            chkTue.Text                    = LocRm.GetString("Tue");
            chkWed.Text                    = LocRm.GetString("Wed");
            gpbSubscriber.Text             = LocRm.GetString("WebServiceOptions");
            label1.Text                    = LocRm.GetString("Name");
            label10.Text                   = label18.Text = LocRm.GetString("chars_3801146");
            label11.Text                   = LocRm.GetString("SmsNumber");
            label12.Text                   = LocRm.GetString("MaxRecordTime");
            label13.Text                   = LocRm.GetString("Seconds");
            label14.Text                   = LocRm.GetString("Seconds");
            label15.Text                   = LocRm.GetString("DistinctAlertInterval");
            label16.Text                   = LocRm.GetString("Seconds");
            label17.Text                   = LocRm.GetString("Seconds");
            label19.Text                   = LocRm.GetString("InactivityRecord");
            label2.Text                    = LocRm.GetString("Source");
            label20.Text                   = LocRm.GetString("BufferAudio");
            label21.Text                   = LocRm.GetString("ExitThisToEnableAlertsAnd");
            label3.Text                    = LocRm.GetString("Sensitivity");
            label4.Text                    = LocRm.GetString("WhenSound");
            label45.Text                   = LocRm.GetString("EmailAddress");
            label48.Text                   = LocRm.GetString("Seconds");
            label49.Text                   = LocRm.GetString("Days");
            label5.Text                    = LocRm.GetString("Seconds");
            label50.Text                   = LocRm.GetString("ImportantMakeSureYourSche");
            label6.Text                    = LocRm.GetString("ExecuteFile");
            label8.Text                    = LocRm.GetString("Start");

            label9.Text  = LocRm.GetString("chars_3801146");
            label7.Text  = LocRm.GetString("TipToCreateAScheduleOvern");
            label10.Text = LocRm.GetString("Stop");

            lblAudioSource.Text = LocRm.GetString("Audiosource");
            linkLabel1.Text     = LocRm.GetString("HowToEnterYourNumber");
            linkLabel5.Text     = LocRm.GetString("YouNeedAnActiveSubscripti");
            rdoMovement.Text    = LocRm.GetString("IsDetectedFor");
            rdoNoMovement.Text  = LocRm.GetString("IsNotDetectedFor");
            tabPage1.Text       = LocRm.GetString("Microphone");
            tabPage2.Text       = LocRm.GetString("Alerts");
            tabPage3.Text       = LocRm.GetString("Scheduling");
            tabPage4.Text       = LocRm.GetString("Recording");
            Text = LocRm.GetString("Addmicrophone");

            toolTip1.SetToolTip(txtMicrophoneName, LocRm.GetString("ToolTip_MicrophoneName"));
            toolTip1.SetToolTip(txtMinimumInterval, LocRm.GetString("ToolTip_AlertInterval"));
            toolTip1.SetToolTip(txtInactiveRecord, LocRm.GetString("ToolTip_InactiveRecordAudio"));
            toolTip1.SetToolTip(txtBuffer, LocRm.GetString("ToolTip_BufferAudio"));
            toolTip1.SetToolTip(lbSchedule, LocRm.GetString("ToolTip_PressDelete"));
            llblHelp.Text        = LocRm.GetString("help");
            label72.Text         = LocRm.GetString("arguments");
            lblAccessGroups.Text = LocRm.GetString("AccessGroups");
            label74.Text         = LocRm.GetString("Directory");
        }
示例#14
0
        private void Button1Click(object sender, EventArgs e)
        {
            string password = txtPassword.Text;

            if (chkPasswordProtect.Checked)
            {
                if (password.Length < 3)
                {
                    MessageBox.Show(LocRm.GetString("Validate_Password"), LocRm.GetString("Note"));
                    return;
                }
            }
            string err = "";

            if (!Directory.Exists(txtMediaDirectory.Text))
            {
                err += LocRm.GetString("Validate_MediaDirectory") + "\n";
            }

            if (err != "")
            {
                MessageBox.Show(err, LocRm.GetString("Error"));
                return;
            }

            if (numJPEGQuality.Value != MainForm.Conf.JPEGQuality)
            {
                MainForm.EncoderParams.Param[0] = new EncoderParameter(Encoder.Quality, (int)numJPEGQuality.Value);
            }
            MainForm.Conf.Enable_Error_Reporting    = chkErrorReporting.Checked;
            MainForm.Conf.Enable_Update_Check       = chkCheckForUpdates.Checked;
            MainForm.Conf.Enable_Password_Protect   = chkPasswordProtect.Checked;
            MainForm.Conf.Password_Protect_Password = password;

            string dir = txtMediaDirectory.Text.Trim();

            if (!dir.EndsWith("\\"))
            {
                dir += "\\";
            }


            if (MainForm.Conf.MediaDirectory != dir)
            {
                MainForm.Conf.MediaDirectory = dir;
                Directory.CreateDirectory(dir + "audio");
                Directory.CreateDirectory(dir + "video");
                foreach (objectsCamera cam in MainForm.Cameras)
                {
                    Directory.CreateDirectory(dir + "video\\" + cam.directory);
                    Directory.CreateDirectory(dir + "video\\" + cam.directory + "\\thumbs");
                }
                foreach (objectsMicrophone mic in MainForm.Microphones)
                {
                    Directory.CreateDirectory(dir + "audio\\" + mic.directory);
                }
            }

            MainForm.Conf.NoActivityColor      = btnNoDetectColor.BackColor.ToRGBString();
            MainForm.Conf.TimestampColor       = btnTimestampColor.BackColor.ToRGBString();
            MainForm.Conf.ActivityColor        = btnDetectColor.BackColor.ToRGBString();
            MainForm.Conf.TrackingColor        = btnColorTracking.BackColor.ToRGBString();
            MainForm.Conf.VolumeLevelColor     = btnColorVolume.BackColor.ToRGBString();
            MainForm.Conf.MainColor            = btnColorMain.BackColor.ToRGBString();
            MainForm.Conf.AreaColor            = btnColorArea.BackColor.ToRGBString();
            MainForm.Conf.BackColor            = btnColorBack.BackColor.ToRGBString();
            MainForm.Conf.BorderHighlightColor = btnBorderHighlight.BackColor.ToRGBString();
            MainForm.Conf.BorderDefaultColor   = btnBorderDefault.BackColor.ToRGBString();

            MainForm.Conf.Enabled_ShowGettingStarted = chkShowGettingStarted.Checked;
            MainForm.Conf.MaxMediaFolderSizeMB       = Convert.ToInt32(txtMaxMediaSize.Value);
            MainForm.Conf.DeleteFilesOlderThanDays   = Convert.ToInt32(txtDaysDelete.Value);
            MainForm.Conf.Opacity = tbOpacity.Value;
            MainForm.Conf.Enable_Storage_Management = chkStorage.Checked;
            MainForm.Conf.YouTubePassword           = txtYouTubePassword.Text;
            MainForm.Conf.YouTubeUsername           = txtYouTubeUsername.Text;
            MainForm.Conf.BalloonTips          = chkBalloon.Checked;
            MainForm.Conf.TrayIconText         = txtTrayIcon.Text;
            MainForm.Conf.IPCameraTimeout      = Convert.ToInt32(txtIPCameraTimeout.Value);
            MainForm.Conf.ServerReceiveTimeout = Convert.ToInt32(txtServerReceiveTimeout.Value);
            MainForm.Conf.ServerName           = txtServerName.Text;
            MainForm.Conf.AutoSchedule         = chkAutoSchedule.Checked;
            MainForm.Conf.CPUMax = Convert.ToInt32(numMaxCPU.Value);
            MainForm.Conf.MaxRecordingThreads = (int)numMaxRecordingThreads.Value;
            MainForm.Conf.CreateAlertWindows  = chkAlertWindows.Checked;
            MainForm.Conf.MaxRedrawRate       = (int)numRedraw.Value;
            MainForm.Conf.Priority            = ddlPriority.SelectedIndex + 1;
            MainForm.Conf.Monitor             = chkMonitor.Checked;
            MainForm.Conf.ScreensaverWakeup   = chkInterrupt.Checked;
            MainForm.Conf.PlaybackMode        = ddlPlayback.SelectedIndex;
            MainForm.Conf.PreviewItems        = (int)numMediaPanelItems.Value;
            MainForm.Conf.BigButtons          = chkBigButtons.Checked;
            MainForm.Conf.DeleteToRecycleBin  = chkRecycle.Checked;
            MainForm.Conf.SpeechRecognition   = chkSpeechRecognition.Checked;

            MainForm.Iconfont = new Font(FontFamily.GenericSansSerif, MainForm.Conf.BigButtons ? 22 : 15, FontStyle.Bold, GraphicsUnit.Pixel);
            if (ddlTalkMic.Items.Count == 0)
            {
                MainForm.Conf.TalkMic = "";
            }
            else
            {
                MainForm.Conf.TalkMic = ddlTalkMic.Enabled  ? ddlTalkMic.SelectedItem.ToString() : "";
            }
            MainForm.Conf.MinimiseOnClose = chkMinimise.Checked;
            MainForm.Conf.JPEGQuality     = (int)numJPEGQuality.Value;
            MainForm.Conf.IPv6Disabled    = !chkEnableIPv6.Checked;

            MainForm.SetPriority();

            var ips = rtbAccessList.Text.Trim().Split(',');
            var t   = ips.Select(ip => ip.Trim()).Where(ip2 => ip2 != "").Aggregate("", (current, ip2) => current + (ip2 + ","));

            MainForm.Conf.AllowedIPList       = t.Trim(',');
            LocalServer.AllowedIPs            = null;
            MainForm.Conf.ShowOverlayControls = chkOverlay.Checked;

            string lang = ((ListItem)ddlLanguage.SelectedItem).Value[0];

            if (lang != MainForm.Conf.Language)
            {
                ReloadResources  = true;
                LocRm.CurrentSet = null;
            }
            MainForm.Conf.Language = lang;

            if (chkStartup.Checked)
            {
                try
                {
                    _rkApp = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
                    if (_rkApp != null)
                    {
                        _rkApp.SetValue("iSpy", "\"" + Application.ExecutablePath + "\" -silent", RegistryValueKind.String);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    Log.Error("", ex);//MainForm.LogExceptionToFile(ex);
                }
            }
            else
            {
                try
                {
                    _rkApp = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
                    if (_rkApp != null)
                    {
                        _rkApp.DeleteValue("iSpy", false);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    Log.Error("", ex);//MainForm.LogExceptionToFile(ex);
                }
            }

            MainForm.Conf.StopSavingOnStorageLimit = chkStopRecording.Checked;

            if (!MainForm.Conf.StopSavingOnStorageLimit)
            {
                MainForm.StopRecordingFlag = false;
            }

            MainForm.ReloadColors();

            DialogResult = DialogResult.OK;
            Close();
        }
示例#15
0
文件: Settings.cs 项目: vrosnet/iSpy
        private void Button1Click(object sender, EventArgs e)
        {
            string err = "";

            foreach (var s in mediaDirectoryEditor1.Directories)
            {
                if (!Directory.Exists(s.Entry))
                {
                    err += LocRm.GetString("Validate_MediaDirectory") + " (" + s.Entry + ")\n";
                    break;
                }
            }

            if (err != "")
            {
                MessageBox.Show(err, LocRm.GetString("Error"));
                return;
            }

            if (numJPEGQuality.Value != MainForm.Conf.JPEGQuality)
            {
                MainForm.EncoderParams.Param[0] = new EncoderParameter(Encoder.Quality, (int)numJPEGQuality.Value);
            }
            MainForm.Conf.Enable_Error_Reporting  = chkErrorReporting.Checked;
            MainForm.Conf.Enable_Update_Check     = chkCheckForUpdates.Checked;
            MainForm.Conf.Enable_Password_Protect = chkPasswordProtect.Checked;

            MainForm.Conf.NoActivityColor      = btnNoDetectColor.BackColor.ToRGBString();
            MainForm.Conf.ActivityColor        = btnDetectColor.BackColor.ToRGBString();
            MainForm.Conf.TrackingColor        = btnColorTracking.BackColor.ToRGBString();
            MainForm.Conf.VolumeLevelColor     = btnColorVolume.BackColor.ToRGBString();
            MainForm.Conf.MainColor            = btnColorMain.BackColor.ToRGBString();
            MainForm.Conf.AreaColor            = btnColorArea.BackColor.ToRGBString();
            MainForm.Conf.BackColor            = btnColorBack.BackColor.ToRGBString();
            MainForm.Conf.BorderHighlightColor = btnBorderHighlight.BackColor.ToRGBString();
            MainForm.Conf.BorderDefaultColor   = btnBorderDefault.BackColor.ToRGBString();

            MainForm.Conf.Enabled_ShowGettingStarted = chkShowGettingStarted.Checked;
            MainForm.Conf.Opacity              = tbOpacity.Value;
            MainForm.Conf.OpenGrabs            = chkOpenGrabs.Checked;
            MainForm.Conf.BalloonTips          = chkBalloon.Checked;
            MainForm.Conf.TrayIconText         = txtTrayIcon.Text;
            MainForm.Conf.IPCameraTimeout      = Convert.ToInt32(txtIPCameraTimeout.Value);
            MainForm.Conf.ServerReceiveTimeout = Convert.ToInt32(txtServerReceiveTimeout.Value);
            MainForm.Conf.ServerName           = txtServerName.Text;
            MainForm.Conf.AutoSchedule         = chkAutoSchedule.Checked;
            MainForm.Conf.CPUMax = Convert.ToInt32(numMaxCPU.Value);
            MainForm.Conf.MaxRecordingThreads         = (int)numMaxRecordingThreads.Value;
            MainForm.Conf.CreateAlertWindows          = chkAlertWindows.Checked;
            MainForm.Conf.MaxRedrawRate               = (int)numRedraw.Value;
            MainForm.Conf.Priority                    = ddlPriority.SelectedIndex + 1;
            MainForm.Conf.Monitor                     = chkMonitor.Checked;
            MainForm.Conf.ScreensaverWakeup           = chkInterrupt.Checked;
            MainForm.Conf.PlaybackMode                = ddlPlayback.SelectedIndex;
            MainForm.Conf.PreviewItems                = (int)numMediaPanelItems.Value;
            MainForm.Conf.BigButtons                  = chkBigButtons.Checked;
            MainForm.Conf.DeleteToRecycleBin          = chkRecycle.Checked;
            MainForm.Conf.SpeechRecognition           = chkSpeechRecognition.Checked;
            MainForm.Conf.AppendLinkText              = txtAppendLinkText.Text;
            MainForm.Conf.StartupForm                 = ddlStartUpForm.SelectedItem.ToString();
            MainForm.Conf.TrayOnMinimise              = chkMinimiseToTray.Checked;
            MainForm.Conf.MJPEGStreamInterval         = (int)numMJPEGStreamInterval.Value;
            MainForm.Conf.AlertOnDisconnect           = txtAlertOnDisconnect.Text;
            MainForm.Conf.AlertOnReconnect            = txtAlertOnReconnect.Text;
            MainForm.Conf.StartupMode                 = ddlStartupMode.SelectedIndex;
            MainForm.Conf.EnableGZip                  = chkGZip.Checked;
            MainForm.Conf.DisconnectNotificationDelay = (int)numDisconnectNotification.Value;
            var l = mediaDirectoryEditor1.Directories.ToList();

            MainForm.Conf.MediaDirectories = l.ToArray();
            var l2 = ftpEditor1.Servers.ToList();

            MainForm.Conf.FTPServers               = l2.ToArray();
            MainForm.Conf.MailAlertSubject         = txtAlertSubject.Text;
            MainForm.Conf.MailAlertBody            = txtAlertBody.Text;
            MainForm.Conf.SMSAlert                 = txtSMSBody.Text;
            MainForm.Conf.VLCFileCache             = (int)numFileCache.Value;
            MainForm.Conf.Password_Protect_Startup = chkPasswordProtectOnStart.Checked;
            SaveSMTPSettings();

            MainForm.Conf.Archive = txtArchive.Text.Trim();
            if (!string.IsNullOrEmpty(MainForm.Conf.Archive))
            {
                if (!MainForm.Conf.Archive.EndsWith(@"\"))
                {
                    MainForm.Conf.Archive += @"\";
                }
                if (!Directory.Exists(MainForm.Conf.Archive))
                {
                    MainForm.Conf.Archive = "";
                    Logger.LogErrorToFile("Archive directory ignored - couldn't be found on disk");
                }
            }

            MainForm.Iconfont = new Font(FontFamily.GenericSansSerif, MainForm.Conf.BigButtons ? 22 : 15, FontStyle.Bold, GraphicsUnit.Pixel);

            MainForm.Conf.TalkMic = "";
            if (ddlTalkMic.Enabled)
            {
                if (ddlTalkMic.SelectedIndex > 0)
                {
                    MainForm.Conf.TalkMic = ddlTalkMic.SelectedItem.ToString();
                }
            }

            MainForm.Conf.MinimiseOnClose = chkMinimise.Checked;
            MainForm.Conf.JPEGQuality     = (int)numJPEGQuality.Value;
            MainForm.Conf.IPv6Disabled    = !chkEnableIPv6.Checked;

            MainForm.SetPriority();

            var ips = rtbAccessList.Text.Trim().Split(',');
            var t   = ips.Select(ip => ip.Trim()).Where(ip2 => ip2 != "").Aggregate("", (current, ip2) => current + (ip2 + ","));

            MainForm.Conf.AllowedIPList = t.Trim(',');
            LocalServer.ReloadAllowedIPs();

            var refs = rtbReferrers.Text.Trim().Split(',');
            var t2   = refs.Select(ip => ip.Trim()).Where(ip2 => ip2 != "").Aggregate("", (current, ip2) => current + (ip2 + ","));

            MainForm.Conf.Referers = t2.Trim(',');
            LocalServer.ReloadAllowedReferrers();


            MainForm.Conf.ShowOverlayControls = chkOverlay.Checked;

            string lang = ((ListItem)ddlLanguage.SelectedItem).Value[0];

            if (lang != MainForm.Conf.Language)
            {
                ReloadResources = true;
                LocRm.Reset();
            }
            MainForm.Conf.Language = lang;
            if (chkStartup.Checked)
            {
                try
                {
                    _rkApp = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
                    _rkApp?.SetValue("iSpy", "\"" + Application.ExecutablePath + "\" -silent", RegistryValueKind.String);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    Logger.LogExceptionToFile(ex);
                }
            }
            else
            {
                try
                {
                    _rkApp = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
                    _rkApp?.DeleteValue("iSpy", false);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    Logger.LogExceptionToFile(ex);
                }
            }

            //SetStorageOptions();

            MainForm.ReloadColors();

            if (ddlJoystick.SelectedIndex > 0)
            {
                string nameid = _sticks[ddlJoystick.SelectedIndex - 1];
                MainForm.Conf.Joystick.id = nameid.Split('|')[1];

                MainForm.Conf.Joystick.XAxis = jaxis1.ID;

                MainForm.Conf.Joystick.InvertXAxis = jaxis1.Invert;

                MainForm.Conf.Joystick.YAxis       = jaxis2.ID;
                MainForm.Conf.Joystick.InvertYAxis = jaxis2.Invert;

                MainForm.Conf.Joystick.ZAxis       = jaxis3.ID;
                MainForm.Conf.Joystick.InvertZAxis = jaxis3.Invert;

                MainForm.Conf.Joystick.Record   = jbutton1.ID;
                MainForm.Conf.Joystick.Snapshot = jbutton2.ID;
                MainForm.Conf.Joystick.Talk     = jbutton3.ID;
                MainForm.Conf.Joystick.Listen   = jbutton4.ID;
                MainForm.Conf.Joystick.Play     = jbutton5.ID;
                MainForm.Conf.Joystick.Next     = jbutton6.ID;
                MainForm.Conf.Joystick.Previous = jbutton7.ID;
                MainForm.Conf.Joystick.Stop     = jbutton8.ID;
                MainForm.Conf.Joystick.MaxMin   = jbutton9.ID;
            }
            else
            {
                MainForm.Conf.Joystick.id = "";
            }

            MainForm.Conf.Logging.Enabled  = chkEnableLogging.Checked;
            MainForm.Conf.Logging.FileSize = (int)numMaxLogSize.Value;
            MainForm.Conf.Logging.KeepDays = (int)numKeepLogs.Value;

            DialogResult = DialogResult.OK;
            Close();
        }
示例#16
0
 private void RenderResources()
 {
     btnPlayPause.Text = LocRm.GetString("Pause");
     btnStop.Text      = LocRm.GetString("StopPlayer");
     linkLabel1.Text   = LocRm.GetString("OpenLocalFolder");
 }
示例#17
0
文件: Settings.cs 项目: vrosnet/iSpy
        private void RenderResources()
        {
            Text = LocRm.GetString("settings");
            btnColorArea.Text              = LocRm.GetString("AreaHighlight");
            btnColorBack.Text              = LocRm.GetString("ObjectBack");
            btnColorMain.Text              = LocRm.GetString("MainPanel");
            btnColorTracking.Text          = LocRm.GetString("Tracking");
            btnBorderHighlight.Text        = LocRm.GetString("BorderHighlight");
            btnColorVolume.Text            = LocRm.GetString("Level");
            btnDetectColor.Text            = LocRm.GetString("Activity");
            btnNoDetectColor.Text          = LocRm.GetString("NoActivity");
            button1.Text                   = LocRm.GetString("Ok");
            button2.Text                   = LocRm.GetString("Cancel");
            chkBalloon.Text                = LocRm.GetString("ShowBalloonTips");
            chkCheckForUpdates.Text        = LocRm.GetString("AutomaticallyCheckForUpda");
            chkErrorReporting.Text         = LocRm.GetString("AnonymousErrorReporting");
            chkPasswordProtect.Text        = LocRm.GetString("PasswordProtectWhenMinimi");
            chkShowGettingStarted.Text     = LocRm.GetString("ShowGettingStarted");
            chkStartup.Text                = LocRm.GetString("RunOnStartupthisUserOnly");
            chkAutoSchedule.Text           = LocRm.GetString("AutoApplySchedule");
            chkPasswordProtectOnStart.Text = LocRm.GetString("PasswordProtectOnStart");

            label14.Text = LocRm.GetString("IspyServerName");
            label16.Text = LocRm.GetString("ispyOpacitymayNotW");
            label2.Text  = LocRm.GetString("ServerReceiveTimeout");
            label21.Text = LocRm.GetString("TrayIconText");
            label3.Text  = LocRm.GetString("MediaDirectory");
            label4.Text  = "ms";
            label7.Text  = "ms";
            label8.Text  = LocRm.GetString("MjpegReceiveTimeout");

            label18.Text         = LocRm.GetString("MaxRecordingThreads");
            label13.Text         = LocRm.GetString("PlaybackMode");
            tabPage1.Text        = LocRm.GetString("Colors");
            tabPage2.Text        = LocRm.GetString("Storage");
            tabPage4.Text        = LocRm.GetString("Timeouts");
            tabPage6.Text        = LocRm.GetString("options");
            tabPage7.Text        = LocRm.GetString("IPAccess");
            linkLabel1.Text      = LocRm.GetString("GetLatestList");
            Text                 = LocRm.GetString("settings");
            linkLabel2.Text      = LocRm.GetString("HelpTranslateISpy");
            chkAlertWindows.Text = LocRm.GetString("CreateAlertWindow");
            chkOverlay.Text      = LocRm.GetString("ShowOverlayControls");
            lblPriority.Text     = LocRm.GetString("Priority");
            chkInterrupt.Text    = LocRm.GetString("InterruptScreensaverOnAlert");
            label23.Text         = LocRm.GetString("JPEGQuality");
            llblHelp.Text        = LocRm.GetString("help");
            label17.Text         = LocRm.GetString("IPAccessExplainer");
            chkMonitor.Text      = LocRm.GetString("RestartIfCrashed");
            chkGZip.Text         = LocRm.GetString("Enable GZip");
            label40.Text         = LocRm.GetString("Permissions");
            label24.Text         = LocRm.GetString("MediaPanelItems");
            label11.Text         = LocRm.GetString("ArchiveDirectory");
            label48.Text         = LocRm.GetString("DisconnectionNotificationDelay");
            label41.Text         = LocRm.GetString("MJPEGFrameInterval");
            label20.Text         = LocRm.GetString("VLCFileCache");
            label64.Text         = LocRm.GetString("HTTPReferrersAllowed");

            LocRm.SetString(lblMicrophone, "Microphone");
            LocRm.SetString(chkBigButtons, "BigButtons");
            LocRm.SetString(chkMinimise, "MinimiseOnClose");
            LocRm.SetString(chkRecycle, "DeleteToRecycle");
            LocRm.SetString(chkEnableIPv6, "EnableIPv6");
            LocRm.SetString(label15, "MaxCPUTarget");
            LocRm.SetString(label22, "MaxRedrawRate");
            LocRm.SetString(btnBorderDefault, "BorderDefault");
            LocRm.SetString(label25, "YouCanUseRegularExpressions");
            LocRm.SetString(tabPage5, "Talk");
            LocRm.SetString(tabPage8, "Joystick");
            LocRm.SetString(label26, "Joystick");
            LocRm.SetString(tabPage9, "Messaging");
            LocRm.SetString(label19, "AppendLinkText");

            LocRm.SetString(label28, "PanAxis");
            LocRm.SetString(label30, "TiltAxis");
            LocRm.SetString(label32, "ZoomAxis");
            LocRm.SetString(btnCenterAxes, "CenterAxes");


            LocRm.SetString(label34, "Record");
            LocRm.SetString(label29, "Snapshot");
            LocRm.SetString(label27, "Talk");
            LocRm.SetString(label31, "Listen");
            LocRm.SetString(label33, "Play");
            LocRm.SetString(label37, "Stop");
            LocRm.SetString(label35, "Next");
            LocRm.SetString(label36, "Previous");
            LocRm.SetString(label38, "JoystickNote");
            LocRm.SetString(label39, "StartupForm");
            LocRm.SetString(chkMinimiseToTray, "MinimiseToTray");

            LocRm.SetString(label56, "EmailNotifications");
            LocRm.SetString(label50, "EmailSubject");
            LocRm.SetString(label51, "EmailBody");
            LocRm.SetString(label19, "AppendLinkText");
            LocRm.SetString(label57, "SMSNotifications");
            LocRm.SetString(label54, "Message");
            LocRm.SetString(linkLabel5, "Reset");

            chkUseiSpy.Text = LocRm.GetString("UseISpyServers");
            label52.Text    = LocRm.GetString("FromAddress");
            label58.Text    = LocRm.GetString("Username");

            LocRm.SetString(label59, "Password");
            LocRm.SetString(label53, "Server");
            LocRm.SetString(label61, "Port");
            LocRm.SetString(chkSMTPUseSSL, "UseSSL");
            LocRm.SetString(btnTestSMTP, "Test");
            LocRm.SetString(label43, "WhenDisconnectedFromWebServices");
            LocRm.SetString(label45, "Execute");
            LocRm.SetString(label46, "Execute");
            LocRm.SetString(label44, "WhenReconnectedToWebServices");
            LocRm.SetString(label10, "Plugins");
            LocRm.SetString(linkLabel3, "DownloadPlugins");
            LocRm.SetString(linkLabel4, "RefreshList");
            tabPage10.Text = LocRm.GetString("ConnectionAlerts");
            tabPage11.Text = LocRm.GetString("Plugins");
            tabPage14.Text = LocRm.GetString("Logging");
            label9.Text    = LocRm.GetString("MaximseAndRestore");
            label60.Text   = LocRm.GetString("SSLCertificate");
            //future
            chkSpeechRecognition.Visible = false;
            label63.Text          = LocRm.GetString("Servers");
            chkOpenGrabs.Text     = LocRm.GetString("OpenImagesAfterSaving");
            chkEnableLogging.Text = LocRm.GetString("Enable");
            numKeepLogs.Text      = LocRm.GetString("KeepLogsForDays");
            numMaxLogSize.Text    = LocRm.GetString("MaxFileSizeKB");
            llblHelp.Visible      = linkLabel1.Visible = linkLabel2.Visible = Helper.HasFeature(Enums.Features.View_Ispy_Links);
        }
 private void RenderResources()
 {
     label4.Text = LocRm.GetString("Seconds");
     label3.Text = LocRm.GetString("ReconnectEvery");
 }
示例#19
0
        private void RenderResources()
        {
            btnBack.Text         = LocRm.GetString("Back");
            btnFinish.Text       = LocRm.GetString("Finish");
            btnNext.Text         = LocRm.GetString("Next");
            btnSelectSource.Text = "...";
            chkActive.Text       = LocRm.GetString("MicrophoneActive");
            groupBox1.Text       = LocRm.GetString("RecordingSettings");
            groupBox6.Text       = LocRm.GetString("RecordingSettings");
            groupBox6.Text       = LocRm.GetString("RecordingMode");
            rdoRecordDetect.Text = LocRm.GetString("RecordOnSoundDetection");
            rdoRecordAlert.Text  = LocRm.GetString("RecordOnAlert");
            rdoNoRecord.Text     = LocRm.GetString("NoRecord");
            chkSchedule.Text     = LocRm.GetString("ScheduleMicrophone");
            chkSound.Text        = LocRm.GetString("AlertsEnabled");
            label1.Text          = LocRm.GetString("Name");
            label12.Text         = LocRm.GetString("MaxRecordTime");
            label6.Text          = LocRm.GetString("MinRecordTime");
            label13.Text         = LocRm.GetString("Seconds");
            label14.Text         = LocRm.GetString("Seconds");
            label15.Text         = LocRm.GetString("DistinctAlertInterval");
            label16.Text         = LocRm.GetString("Seconds");
            label17.Text         = LocRm.GetString("Seconds");
            label19.Text         = LocRm.GetString("InactivityRecord");
            label2.Text          = LocRm.GetString("Source");
            label20.Text         = LocRm.GetString("BufferAudio");
            label21.Text         = LocRm.GetString("ExitThisToEnableAlertsAnd");
            label3.Text          = LocRm.GetString("Sensitivity");
            label4.Text          = LocRm.GetString("WhenSound");
            label48.Text         = LocRm.GetString("Seconds");
            label5.Text          = LocRm.GetString("Seconds");
            label15.Text         = LocRm.GetString("Intervals");

            lblAudioSource.Text = LocRm.GetString("Audiosource");
            rdoMovement.Text    = LocRm.GetString("IsDetectedFor");
            rdoNoMovement.Text  = LocRm.GetString("IsNotDetectedFor");
            tabPage1.Text       = LocRm.GetString("Microphone");
            tabPage2.Text       = LocRm.GetString("Alerts");
            tabPage3.Text       = LocRm.GetString("Scheduling");
            tabPage4.Text       = LocRm.GetString("Recording");
            Text = LocRm.GetString("Addmicrophone");

            toolTip1.SetToolTip(txtMicrophoneName, LocRm.GetString("ToolTip_MicrophoneName"));
            toolTip1.SetToolTip(txtInactiveRecord, LocRm.GetString("ToolTip_InactiveRecordAudio"));
            toolTip1.SetToolTip(txtBuffer, LocRm.GetString("ToolTip_BufferAudio"));
            llblHelp.Text        = LocRm.GetString("help");
            lblAccessGroups.Text = LocRm.GetString("AccessGroups");
            toolTip1.SetToolTip(ranger1, LocRm.GetString("ToolTip_MotionSensitivity"));
            label74.Text = LocRm.GetString("Directory");

            LocRm.SetString(label23, "Listen");
            LocRm.SetString(label22, "TriggerRecording");

            label11.Text = LocRm.GetString("MediaLocation");
            label74.Text = LocRm.GetString("Directory");
            chkStorageManagement.Text = LocRm.GetString("EnableStorageManagement");
            label85.Text    = LocRm.GetString("MaxFolderSizeMb");
            label94.Text    = LocRm.GetString("MaxAgeHours");
            chkArchive.Text = LocRm.GetString("ArchiveInsteadOfDelete");
            btnRunNow.Text  = LocRm.GetString("RunNow");

            HideTab(tabPage2, Helper.HasFeature(Enums.Features.Alerts));
            HideTab(tabPage4, Helper.HasFeature(Enums.Features.Recording));
            HideTab(tabPage3, Helper.HasFeature(Enums.Features.Scheduling));
            HideTab(tabPage5, Helper.HasFeature(Enums.Features.Storage));
            LocRm.SetString(linkLabel4, "CopyTo");
        }
示例#20
0
        private bool ConfigureSchedule(objectsMicrophoneScheduleEntry sched)
        {
            if (ddlHourStart.SelectedItem.ToString() == "-" || ddlMinuteStart.SelectedItem.ToString() == "-")
            {
                sched.start = "-:-";
            }
            else
            {
                sched.start = ddlHourStart.SelectedItem + ":" + ddlMinuteStart.SelectedItem;
            }
            if (ddlHourEnd.SelectedItem.ToString() == "-" || ddlMinuteEnd.SelectedItem.ToString() == "-")
            {
                sched.stop = "-:-";
            }
            else
            {
                sched.stop = ddlHourEnd.SelectedItem + ":" + ddlMinuteEnd.SelectedItem;
            }

            sched.daysofweek = "";
            if (chkMon.Checked)
            {
                sched.daysofweek += "1,";
            }
            if (chkTue.Checked)
            {
                sched.daysofweek += "2,";
            }
            if (chkWed.Checked)
            {
                sched.daysofweek += "3,";
            }
            if (chkThu.Checked)
            {
                sched.daysofweek += "4,";
            }
            if (chkFri.Checked)
            {
                sched.daysofweek += "5,";
            }
            if (chkSat.Checked)
            {
                sched.daysofweek += "6,";
            }
            if (chkSun.Checked)
            {
                sched.daysofweek += "0,";
            }
            sched.daysofweek = sched.daysofweek.Trim(',');
            if (sched.daysofweek == "")
            {
                MessageBox.Show(LocRm.GetString("Validate_Camera_SelectOneDay")); //"Please select at least one day");
                return(false);
            }

            sched.recordonstart  = chkRecordSchedule.Checked;
            sched.active         = chkScheduleActive.Checked;
            sched.recordondetect = chkScheduleRecordOnDetect.Checked;
            sched.alerts         = chkScheduleAlerts.Checked;
            sched.messaging      = chkScheduleMessaging.Checked;
            return(true);
        }
示例#21
0
        private void AddMicrophoneLoad(object sender, EventArgs e)
        {
            if (VolumeLevel.Micobject.id == -1 && !SelectSource())
            {
                Close();
                return;
            }
            if (VolumeLevel.Micobject.id == -1)
            {
                VolumeLevel.Micobject.id = MainForm.NextMicrophoneId;
            }
            VolumeLevel.IsEdit = true;
            if (VolumeLevel.CameraControl != null)
            {
                VolumeLevel.CameraControl.IsEdit = true;
            }

            btnBack.Enabled        = false;
            txtMicrophoneName.Text = VolumeLevel.Micobject.name;
            //tbGain.Value = (int)(VolumeLevel.Micobject.settings.gain * 100);

            chkSound.Checked        = VolumeLevel.Micobject.alerts.active;
            rdoRecordDetect.Checked = VolumeLevel.Micobject.detector.recordondetect;
            rdoRecordAlert.Checked  = VolumeLevel.Micobject.detector.recordonalert;
            rdoNoRecord.Checked     = !rdoRecordDetect.Checked && !rdoRecordAlert.Checked;

            if (VolumeLevel.Micobject.alerts.mode == "sound")
            {
                rdoMovement.Checked = true;
            }
            else
            {
                rdoNoMovement.Checked = true;
            }

            chkSchedule.Checked = VolumeLevel.Micobject.schedule.active;
            chkActive.Checked   = VolumeLevel.Micobject.settings.active;

            chkActive.Enabled = VolumeLevel.Micobject.settings.sourcename != "";

            if (VolumeLevel.Micobject.settings.sourcename != "")
            {
                lblAudioSource.Text = "";
                if (VolumeLevel.Micobject.settings.typeindex == 4 && Int32.TryParse(VolumeLevel.Micobject.settings.sourcename, out int icam))
                {
                    var c = MainForm.Cameras.SingleOrDefault(p => p.id == icam);
                    if (c != null)
                    {
                        lblAudioSource.Text = c.name;
                    }
                }
                if (lblAudioSource.Text?.Length == 0)
                {
                    lblAudioSource.Text = VolumeLevel.Micobject.settings.sourcename;
                }
            }
            else
            {
                lblAudioSource.Text = LocRm.GetString("NoSource");
                chkActive.Checked   = false;
            }



            Text = LocRm.GetString("EditMicrophone");
            if (VolumeLevel.Micobject.id > -1)
            {
                Text += string.Format(" (ID: {0}, DIR: {1})", VolumeLevel.Micobject.id, VolumeLevel.Micobject.directory);
            }

            txtNoSound.Text  = VolumeLevel.Micobject.detector.nosoundinterval.ToString(CultureInfo.InvariantCulture);
            txtSound.Text    = VolumeLevel.Micobject.detector.soundinterval.ToString(CultureInfo.InvariantCulture);
            pnlSound.Enabled = chkSound.Checked;

            txtBuffer.Text         = VolumeLevel.Micobject.settings.buffer.ToString(CultureInfo.InvariantCulture);
            txtInactiveRecord.Text = VolumeLevel.Micobject.recorder.inactiverecord.ToString(CultureInfo.InvariantCulture);
            txtMaxRecordTime.Text  = VolumeLevel.Micobject.recorder.maxrecordtime.ToString(CultureInfo.InvariantCulture);

            scheduleEditor1.Io = VolumeLevel;

            txtAccessGroups.Text = VolumeLevel.Micobject.settings.accessgroups;
            txtDirectory.Text    = VolumeLevel.Micobject.directory;


            tblStorage.Enabled     = chkStorageManagement.Checked = VolumeLevel.Micobject.settings.storagemanagement.enabled;
            numMaxAge.Value        = VolumeLevel.Micobject.settings.storagemanagement.maxage;
            numMaxFolderSize.Value = VolumeLevel.Micobject.settings.storagemanagement.maxsize;
            numMinRecord.Value     = VolumeLevel.Micobject.recorder.minrecordtime;

            ddlCopyFrom.Items.Clear();
            ddlCopyFrom.Items.Add(new ListItem(LocRm.GetString("CopyFrom"), "-1"));
            foreach (objectsMicrophone c in MainForm.Microphones)
            {
                if (c.id != VolumeLevel.Micobject.id)
                {
                    ddlCopyFrom.Items.Add(new ListItem(c.name, c.id.ToString(CultureInfo.InvariantCulture)));
                }
            }
            ddlCopyFrom.SelectedIndex = 0;


            int i = 0, j = 0;

            foreach (var dev in DirectSoundOut.Devices)
            {
                ddlPlayback.Items.Add(new ListItem(dev.Description, dev.Guid.ToString()));
                if (dev.Guid.ToString() == VolumeLevel.Micobject.settings.deviceout)
                {
                    i = j;
                }
                j++;
            }
            if (ddlPlayback.Items.Count > 0)
            {
                ddlPlayback.SelectedIndex = i;
            }
            else
            {
                ddlPlayback.Items.Add(LocRm.GetString("NoAudioDevices"));
                ddlPlayback.Enabled = false;
            }

            tmrUpdateSourceDetails.Start();

            foreach (string dt in _actiontypes)
            {
                ddlActionType.Items.Add(LocRm.GetString(dt));
            }
            ddlActionType.SelectedIndex = 0;

            string t2 = VolumeLevel.Micobject.recorder.trigger ?? "";


            ddlTriggerRecording.Items.Add(new ListItem("None", ""));

            foreach (var c in MainForm.Cameras.Where(p => p.settings.micpair != VolumeLevel.Micobject.id))
            {
                ddlTriggerRecording.Items.Add(new ListItem(c.name, "2," + c.id));
            }
            foreach (var c in MainForm.Microphones.Where(p => p.id != VolumeLevel.Micobject.id))
            {
                ddlTriggerRecording.Items.Add(new ListItem(c.name, "1," + c.id));
            }
            foreach (ListItem li in ddlTriggerRecording.Items)
            {
                if (li.Value == t2)
                {
                    ddlTriggerRecording.SelectedItem = li;
                }
            }

            if (ddlTriggerRecording.SelectedIndex == -1)
            {
                ddlTriggerRecording.SelectedIndex = 0;
            }

            if (VolumeLevel.CameraControl != null)
            {
                txtBuffer.Enabled = false;
                toolTip1.SetToolTip(txtBuffer, "Change the buffer on the paired camera to update");
            }

            actionEditor1.LoginRequested += ActionEditor1LoginRequested;
            chkArchive.Checked            = VolumeLevel.Micobject.settings.storagemanagement.archive;

            LoadMediaDirectories();

            ranger1.Maximum          = 100;
            ranger1.Minimum          = 0.001;
            ranger1.ValueMin         = VolumeLevel.Micobject.detector.minsensitivity;
            ranger1.ValueMax         = VolumeLevel.Micobject.detector.maxsensitivity;
            ranger1.Gain             = VolumeLevel.Micobject.detector.gain;
            ranger1.ValueMinChanged += Ranger1ValueMinChanged;
            ranger1.ValueMaxChanged += Ranger1ValueMaxChanged;
            ranger1.GainChanged     += Ranger1GainChanged;
            ranger1.SetText();

            intervalConfig1.Init(VolumeLevel);

            chkMessaging.Checked = VolumeLevel.Micobject.settings.messaging;
            _loaded = true;
        }
示例#22
0
        void FfmpegMergeProcessExited(object sender, EventArgs e)
        {
            if (_ffmpegProcess.ExitCode == 0)
            {
                if (_pbMerge.Count > 0)
                {
                    var ma = 0d;
                    var fi = new FileInfo(_dir + _outfile);


                    var alertData       = new StringBuilder();
                    int durationSeconds = 0;
                    foreach (var m in _pbMerge)
                    {
                        if (m.AlertData != "")
                        {
                            alertData.Append(m.AlertData);
                            alertData.Append(",");
                        }
                        durationSeconds += m.DurationSeconds;

                        if (m.MaxAlarm > ma)
                        {
                            ma = m.MaxAlarm;
                        }
                    }

                    var ff = new FilesFile
                    {
                        CreatedDateTicks     = DateTime.Now.Ticks,
                        DurationSeconds      = durationSeconds,
                        IsTimelapse          = false,
                        TriggerLevel         = _pbMerge.First().TriggerLevel,
                        TriggerLevelMax      = _pbMerge.First().TriggerLevelMax,
                        Filename             = _outfile,
                        AlertData            = Helper.GetMotionDataPoints(alertData),
                        MaxAlarm             = ma,
                        SizeBytes            = fi.Length,
                        IsMergeFile          = true,
                        IsMergeFileSpecified = true
                    };

                    string name;
                    if (_currentObject.Ot == 1)
                    {
                        var vl = MainClass.GetVolumeLevel(_currentObject.ID);
                        vl.AddFile(ff);
                        name = vl.Micobject.name;
                    }
                    else
                    {
                        var cw = MainClass.GetCameraWindow(_currentObject.ID);
                        cw.AddFile(ff);
                        name = cw.Camobject.name;

                        var fpv = _pbMerge.First();
                        //get preview image
                        string imgname = fpv.Filename.Substring(0,
                                                                fpv.Filename.LastIndexOf(".", StringComparison.Ordinal));
                        var imgpath = _dir + "thumbs/" + imgname + "_large.jpg";

                        if (File.Exists(imgpath))
                        {
                            Image bmpPreview = Image.FromFile(imgpath);

                            string jpgname = _dir + "thumbs\\" + ff.Filename.Substring(0,
                                                                                       ff.Filename.LastIndexOf(".", StringComparison.Ordinal));

                            bmpPreview.Save(jpgname + "_large.jpg", MainForm.Encoder,
                                            MainForm.EncoderParams);

                            Image.GetThumbnailImageAbort myCallback = ThumbnailCallback;
                            Image myThumbnail = bmpPreview.GetThumbnailImage(96, 72, myCallback, IntPtr.Zero);

                            myThumbnail.Save(jpgname + ".jpg", MainForm.Encoder,
                                             MainForm.EncoderParams);

                            myThumbnail.Dispose();
                            bmpPreview.Dispose();
                        }
                    }

                    var fp = new FilePreview(_outfile, durationSeconds, name, ff.CreatedDateTicks, _currentObject.Ot, _currentObject.ID, ma, false, true);
                    MainForm.MasterFileAdd(fp);
                    MainForm.NeedsMediaRefresh = Helper.Now;
                }
                _pbMerge.Clear();
            }
            else
            {
                MainForm.LogErrorToFile("FFMPEG process exited with code " + _ffmpegProcess.ExitCode);
                MessageBox.Show(this, LocRm.GetString("ErrorCheckLogFile"));
            }
            DoClose();
        }
示例#23
0
        private void Finish()
        {
            var iReconnect = (int)txtReconnect.Value;

            if (iReconnect < 30 && iReconnect != 0)
            {
                MessageBox.Show(LocRm.GetString("Validate_ReconnectInterval"), LocRm.GetString("Note"));
                return;
            }

            switch (tcAudioSource.SelectedIndex)
            {
            case 0:
                if (!ddlDevice.Enabled)
                {
                    Close();
                    return;
                }
                Mic.settings.sourcename = ddlDevice.SelectedItem.ToString();

                int i = 0, selind = -1;
                for (int n = 0; n < WaveIn.DeviceCount; n++)
                {
                    ddlDevice.Items.Add(WaveIn.GetCapabilities(n).ProductName);
                    if (WaveIn.GetCapabilities(n).ProductName == Mic.settings.sourcename)
                    {
                        selind = i;
                    }
                    i++;
                }

                int channels = WaveIn.GetCapabilities(selind).Channels;

                Mic.settings.channels = channels;
                Mic.settings.samples  = Convert.ToInt32(ddlSampleRate.SelectedItem);
                Mic.settings.bits     = 16;

                break;

            case 1:
                try
                {
                    var url = new Uri(txtNetwork.Text);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
                Mic.settings.sourcename = txtNetwork.Text;

                //set format
                Mic.settings.channels = 1;
                Mic.settings.samples  = 22050;
                Mic.settings.bits     = 16;
                break;

            case 2:
                string t = cmbVLCURL.Text.Trim();
                if (t == String.Empty)
                {
                    MessageBox.Show(LocRm.GetString("Validate_Microphone_SelectSource"), LocRm.GetString("Error"));
                    return;
                }
                Mic.settings.sourcename = t;
                break;

            case 3:
                try
                {
                    var url = new Uri(cmbFFMPEGURL.Text);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
                Mic.settings.sourcename = cmbFFMPEGURL.Text;
                break;
            }

            MainForm.Conf.VLCURL = cmbVLCURL.Text.Trim();
            if (!MainForm.Conf.RecentVLCList.Contains(MainForm.Conf.VLCURL) &&
                MainForm.Conf.VLCURL != "")
            {
                MainForm.Conf.RecentVLCList =
                    (MainForm.Conf.RecentVLCList + "|" + MainForm.Conf.VLCURL).Trim('|');
            }

            Mic.settings.typeindex  = tcAudioSource.SelectedIndex;
            Mic.settings.decompress = true; // chkDecompress.Checked;
            Mic.settings.vlcargs    = txtVLCArgs.Text.Trim();

            Mic.settings.reconnectinterval = (int)txtReconnect.Value;
            //int samplerate;
            //if (Int32.TryParse(txtSampleRate.Text, out samplerate))
            //    Mic.settings.samples = samplerate;

            //int bits;
            //if (Int32.TryParse(txtBits.Text, out bits))
            //    Mic.settings.bits = bits;

            //int channels;
            //if (Int32.TryParse(txtChannels.Text, out channels))
            //    Mic.settings.channels = channels;

            // Mic.settings.username = txtUsername.Text;
            // Mic.settings.password = txtPassword.Text;

            DialogResult = DialogResult.OK;
            Close();
        }
示例#24
0
        private void Next()
        {
            if (pnlConfig.Visible)
            {
                MainForm.IPLISTED = tbl1.Enabled;
                MainForm.IPRTSP   = chkRTSP.Checked;
                MainForm.IPHTTP   = chkHTTP.Checked;
                if (MainForm.IPLISTED)
                {
                    if (ddlMake.SelectedIndex == -1)
                    {
                        MessageBox.Show(this, LocRm.GetString("ChooseMake"));
                        return;
                    }
                }
                else
                {
                    if (!MainForm.IPRTSP && !MainForm.IPHTTP)
                    {
                        MessageBox.Show(this, LocRm.GetString("ChooseOption"));
                        return;
                    }
                }
                ShowPanel(pnlLogin);
                return;
            }
            if (pnlLogin.Visible)
            {
                ShowPanel(pnlFindNetwork);
                return;
            }
            if (pnlFindNetwork.Visible)
            {
                string addr = txtIPAddress.Text.Trim();
                if (String.IsNullOrEmpty(addr))
                {
                    MessageBox.Show(this, LocRm.GetString("EnterIPAddress"));
                    return;
                }
                Uri nUrl = null;
                if (!Uri.TryCreate("http://" + addr, UriKind.Absolute, out nUrl))
                {
                    MessageBox.Show(this, LocRm.GetString("EnterIPDNSOnly"));
                    return;
                }

                AddConnections();
                return;
            }
            if (pnlConnect.Visible)
            {
                if (MainForm.IPLISTED && ddlMake.SelectedIndex == 0)
                {
                    ShowPanel(pnlConfig);
                    return;
                }

                string make  = txtMake.Text;
                string model = txtModel.Text;

                if (MainForm.IPLISTED)
                {
                    make = ddlMake.SelectedItem.ToString();
                    if (ddlModel.SelectedIndex > 0)
                    {
                        model = ddlModel.SelectedItem.ToString().ToUpper();
                    }
                }


                ManufacturersManufacturerUrl s = null;
                for (int j = 0; j < pnlOptions.Controls.Count; j++)
                {
                    if (pnlOptions.Controls[j] is RadioButton)
                    {
                        if (((RadioButton)pnlOptions.Controls[j]).Checked)
                        {
                            s = (ManufacturersManufacturerUrl)(pnlOptions.Controls[j]).Tag;
                            break;
                        }
                    }
                }
                if (s == null)
                {
                    MessageBox.Show(this, LocRm.GetString("SelectURL"));
                    return;
                }

                FinalUrl = GetAddr(s);

                string source = s.Source;
                if (source == "VLC" && !_vlc)
                {
                    source = "FFMPEG";
                }

                switch (source)
                {
                case "JPEG":
                    VideoSourceType = 0;
                    break;

                case "MJPEG":
                    VideoSourceType = 1;
                    break;

                case "FFMPEG":
                    VideoSourceType = 2;
                    break;

                case "VLC":
                    VideoSourceType = 5;
                    break;
                }
                AudioSourceType = -1;
                if (!String.IsNullOrEmpty(s.AudioSource))
                {
                    switch (s.AudioSource.ToUpper())
                    {
                    case "FFMPEG":
                        AudioSourceType = 3;
                        break;

                    case "VLC":
                        AudioSourceType = 2;
                        if (!_vlc)
                        {
                            AudioSourceType = 3;
                        }
                        break;

                    case "WAVSTREAM":
                        AudioSourceType = 6;
                        break;
                    }
                    AudioUrl = GetAddr(s, true);
                }

                Ptzid = -1;

                if (!s.@fixed)
                {
                    string modellc = model.ToLower();
                    string n       = make.ToLower();
                    bool   quit    = false;
                    foreach (var ptz in MainForm.PTZs)
                    {
                        int j = 0;
                        foreach (var m in ptz.Makes)
                        {
                            if (m.Name.ToLower() == n)
                            {
                                Ptzid      = ptz.id;
                                Ptzentryid = j;
                                string mdl = m.Model.ToLower();
                                if (mdl == modellc || s.version.ToLower() == mdl)
                                {
                                    Ptzid      = ptz.id;
                                    Ptzentryid = j;
                                    quit       = true;
                                    break;
                                }
                            }
                            j++;
                        }
                        if (quit)
                        {
                            break;
                        }
                    }
                }

                MainForm.IPUN      = txtUsername.Text;
                MainForm.IPPASS    = txtPassword.Text;
                MainForm.IPTYPE    = make;
                MainForm.IPMODEL   = model;
                MainForm.IPADDR    = txtIPAddress.Text;
                MainForm.IPPORTS   = txtPorts.Text;
                MainForm.IPPORT    = (int)numPort.Value;
                MainForm.IPCHANNEL = txtChannel.Text.Trim();

                AudioModel = s.AudioModel;

                LastConfig.PromptSave = !MainForm.IPLISTED && MainForm.IPMODEL.Trim() != "";

                LastConfig.Iptype  = MainForm.IPTYPE;
                LastConfig.Ipmodel = MainForm.IPMODEL;
                LastConfig.Prefix  = s.prefix;
                LastConfig.Source  = s.Source;
                LastConfig.URL     = s.url;
                LastConfig.Cookies = s.cookies;
                LastConfig.Flags   = s.flags;
                if (!String.IsNullOrEmpty(s.port))
                {
                    LastConfig.Port = Convert.ToInt32(s.port);
                }

                if (_dt != null)
                {
                    MainForm.IPTABLE = _dt.Copy();
                }
                DialogResult = DialogResult.OK;
                Close();
            }
        }
示例#25
0
 private void chkEnableIPv6_CheckedChanged(object sender, EventArgs e)
 {
     if (_loaded)
     {
         if (chkEnableIPv6.Checked)
         {
             MessageBox.Show(this,
                             LocRm.GetString("IPv6Issues") + Environment.NewLine + LocRm.GetString("IPv6Warning"), LocRm.GetString("Warning"));
         }
         MainForm.Conf.IPv6Disabled = !chkEnableIPv6.Checked;
     }
 }
示例#26
0
        private void PortScannerManager(string host)
        {
            var ports = new List <int>();

            foreach (string s in txtPorts.Text.Split(','))
            {
                int p;
                if (int.TryParse(s, out p))
                {
                    if (p < 65535 && p > 0)
                    {
                        ports.Add(p);
                    }
                }
            }
            UISync.Execute(() => pbScanner.Value = 0);

            var manualEvents = new ManualResetEvent[MaxThreads];
            int j;

            for (int k = 0; k < MaxThreads; k++)
            {
                manualEvents[k] = new ManualResetEvent(true);
            }

            var ipranges = new List <string>();

            if (host == LocRm.GetString("AllAdaptors"))
            {
                ipranges.AddRange(from string s in ddlHost.Items where s != LocRm.GetString("AllAdaptors") select s);
            }
            else
            {
                ipranges.Add(host);
            }

            UISync.Execute(() => pbScanner.Maximum = ipranges.Count * 254);
            MainForm.LogMessageToFile("Scanning LAN");
            j = 0;
            foreach (string IP in DnsEntries)
            {
                string ip      = IP;
                int    k       = j;
                var    scanner = new Thread(p => PortScanner(ports, ip, manualEvents[k]));
                scanner.Start();

                j = WaitHandle.WaitAny(manualEvents);
                UISync.Execute(() => pbScanner.PerformStep());
                if (_exiting)
                {
                    break;
                }
            }

            if (!_exiting)
            {
                j = 0;
                foreach (string shost in ipranges)
                {
                    for (int i = 0; i < 255; i++)
                    {
                        string ip = shost.Replace("x", i.ToString(CultureInfo.InvariantCulture));
                        if (!DnsEntries.Contains(ip))
                        {
                            int k = j;
                            manualEvents[k].Reset();
                            var scanner = new Thread(p => PortScanner(ports, ip, manualEvents[k]));
                            scanner.Start();

                            j = WaitHandle.WaitAny(manualEvents);
                            UISync.Execute(() => pbScanner.PerformStep());
                        }
                        if (_exiting)
                        {
                            break;
                        }
                    }
                    if (_exiting)
                    {
                        break;
                    }
                }
            }

            if (j > 0)
            {
                WaitHandle.WaitAll(manualEvents);
            }


            //populate MAC addresses
            try
            {
                var arpStream = ExecuteCommandLine("arp", "-a");
                // Consume first three lines
                for (int i = 0; i < 3; i++)
                {
                    arpStream.ReadLine();
                }
                // Read entries
                while (!arpStream.EndOfStream)
                {
                    var line = arpStream.ReadLine();
                    if (line != null)
                    {
                        line = line.Trim();
                        while (line.Contains("  "))
                        {
                            line = line.Replace("  ", " ");
                        }
                        var parts = line.Trim().Split(' ');

                        if (parts.Length == 3)
                        {
                            for (int i = 0; i < _dt.Rows.Count; i++)
                            {
                                DataRow dr = _dt.Rows[i];
                                string  ip = parts[0];
                                if (ip == dr["IP Address"].ToString().Split(':')[0])
                                {
                                    dr["MAC Address"] = parts[1];
                                }
                            }
                        }
                    }
                }
                _dt.AcceptChanges();
            }
            catch (Exception ex)
            {
                MainForm.LogExceptionToFile(ex);
            }

            UISync.Execute(ResetControls);
        }
示例#27
0
 private void PTZTool_Load(object sender, EventArgs e)
 {
     Text = LocRm.GetString("PTZTool");
 }
示例#28
0
文件: Settings.cs 项目: vrosnet/iSpy
        private void SettingsLoad(object sender, EventArgs e)
        {
            if (!Helper.HasFeature(Enums.Features.Settings))
            {
                using (var cp = new CheckPassword())
                {
                    cp.ShowDialog(this);
                }
            }

            if (!Helper.HasFeature(Enums.Features.Settings))
            {
                MessageBox.Show(this, LocRm.GetString("AccessDenied"));
                Close();
                return;
            }

            UISync.Init(this);
            tcTabs.SelectedIndex       = InitialTab;
            chkErrorReporting.Checked  = MainForm.Conf.Enable_Error_Reporting;
            chkCheckForUpdates.Checked = MainForm.Conf.Enable_Update_Check;

            chkShowGettingStarted.Checked = MainForm.Conf.Enabled_ShowGettingStarted;
            _rkApp             = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", false);
            chkStartup.Checked = (_rkApp != null && _rkApp.GetValue("iSpy") != null);

            mediaDirectoryEditor1.Init(MainForm.Conf.MediaDirectories);

            btnDetectColor.BackColor     = MainForm.Conf.ActivityColor.ToColor();
            btnNoDetectColor.BackColor   = MainForm.Conf.NoActivityColor.ToColor();
            btnColorTracking.BackColor   = MainForm.Conf.TrackingColor.ToColor();
            btnColorVolume.BackColor     = MainForm.Conf.VolumeLevelColor.ToColor();
            btnColorMain.BackColor       = MainForm.Conf.MainColor.ToColor();
            btnColorArea.BackColor       = MainForm.Conf.AreaColor.ToColor();
            btnColorBack.BackColor       = MainForm.Conf.BackColor.ToColor();
            btnBorderHighlight.BackColor = MainForm.Conf.BorderHighlightColor.ToColor();
            btnBorderDefault.BackColor   = MainForm.Conf.BorderDefaultColor.ToColor();
            chkAutoSchedule.Checked      = MainForm.Conf.AutoSchedule;
            numMaxCPU.Value = MainForm.Conf.CPUMax;
            numMaxRecordingThreads.Value = MainForm.Conf.MaxRecordingThreads;
            numRedraw.Value              = MainForm.Conf.MaxRedrawRate;
            numMediaPanelItems.Value     = MainForm.Conf.PreviewItems;
            txtTrayIcon.Text             = MainForm.Conf.TrayIconText;
            chkMinimise.Checked          = MainForm.Conf.MinimiseOnClose;
            chkSpeechRecognition.Checked = MainForm.Conf.SpeechRecognition;
            chkMinimiseToTray.Checked    = MainForm.Conf.TrayOnMinimise;

            if (chkMonitor.Checked && !MainForm.Conf.Monitor)
            {
                Process.Start(Program.AppPath + "iSpyMonitor.exe");
            }
            chkMonitor.Checked = MainForm.Conf.Monitor;

            tbOpacity.Value = MainForm.Conf.Opacity;
            SetColors();

            chkBalloon.Checked = MainForm.Conf.BalloonTips;

            txtIPCameraTimeout.Value      = MainForm.Conf.IPCameraTimeout;
            txtServerReceiveTimeout.Value = MainForm.Conf.ServerReceiveTimeout;
            txtServerName.Text            = MainForm.Conf.ServerName;
            rtbAccessList.Text            = MainForm.Conf.AllowedIPList;

            int i = 0, selind = 0;

            foreach (TranslationsTranslationSet set in LocRm.TranslationSets.OrderBy(p => p.Name))
            {
                ddlLanguage.Items.Add(new ListItem(set.Name, new[] { set.CultureCode }));
                if (set.CultureCode == MainForm.Conf.Language)
                {
                    selind = i;
                }
                i++;
            }
            ddlLanguage.SelectedIndex    = selind;
            chkAlertWindows.Checked      = MainForm.Conf.CreateAlertWindows;
            chkOverlay.Checked           = MainForm.Conf.ShowOverlayControls;
            chkInterrupt.Checked         = MainForm.Conf.ScreensaverWakeup;
            chkEnableIPv6.Checked        = !MainForm.Conf.IPv6Disabled;
            chkRecycle.Checked           = MainForm.Conf.DeleteToRecycleBin;
            txtAppendLinkText.Text       = MainForm.Conf.AppendLinkText;
            numMJPEGStreamInterval.Value = MainForm.Conf.MJPEGStreamInterval;
            txtAlertOnDisconnect.Text    = MainForm.Conf.AlertOnDisconnect;
            txtAlertOnReconnect.Text     = MainForm.Conf.AlertOnReconnect;
            txtArchive.Text = MainForm.Conf.Archive;
            SetSSLText();


            txtAlertSubject.Text = MainForm.Conf.MailAlertSubject;
            txtAlertBody.Text    = MainForm.Conf.MailAlertBody;
            txtSMSBody.Text      = MainForm.Conf.SMSAlert;

            foreach (string s in StartupModes)
            {
                ddlStartupMode.Items.Add(LocRm.GetString(s));
            }

            foreach (string s in Priorities)
            {
                ddlPriority.Items.Add(LocRm.GetString(s));
            }
            ddlStartupMode.SelectedIndex = MainForm.Conf.StartupMode;

            foreach (var grid in MainForm.Conf.GridViews)
            {
                ddlStartUpForm.Items.Add(grid.name);
            }

            ddlPriority.SelectedIndex = MainForm.Conf.Priority - 1;

            ddlStartUpForm.SelectedItem = MainForm.Conf.StartupForm;
            if (ddlStartUpForm.SelectedItem == null)
            {
                ddlStartUpForm.SelectedIndex = 0;
            }

            ddlPlayback.Items.AddRange(PlaybackModes);

            if (MainForm.Conf.PlaybackMode < 0)
            {
                MainForm.Conf.PlaybackMode = 0;
            }

            if (MainForm.Conf.PlaybackMode < ddlPlayback.Items.Count)
            {
                ddlPlayback.SelectedIndex = MainForm.Conf.PlaybackMode;
            }
            try
            {
                numJPEGQuality.Value = MainForm.Conf.JPEGQuality;
            }
            catch (Exception)
            {
            }
            chkBigButtons.Checked = MainForm.Conf.BigButtons;

            selind = -1;
            i      = 1;
            try
            {
                ddlTalkMic.Items.Add(LocRm.GetString("None"));

                for (int n = 0; n < WaveIn.DeviceCount; n++)
                {
                    ddlTalkMic.Items.Add(WaveIn.GetCapabilities(n).ProductName);
                    if (WaveIn.GetCapabilities(n).ProductName == MainForm.Conf.TalkMic)
                    {
                        selind = i;
                    }
                    i++;
                }
                ddlTalkMic.Enabled = true;
                if (selind > -1)
                {
                    ddlTalkMic.SelectedIndex = selind;
                }
                else
                {
                    if (ddlTalkMic.Items.Count == 1)
                    {
                        ddlTalkMic.Items.Add(_noDevices);
                        ddlTalkMic.Enabled       = false;
                        ddlTalkMic.SelectedIndex = 1;
                    }
                    else
                    {
                        ddlTalkMic.SelectedIndex = 0;
                    }
                }
            }
            catch (ApplicationException ex)
            {
                Logger.LogExceptionToFile(ex);
                ddlTalkMic.Items.Add(_noDevices);
                ddlTalkMic.Enabled = false;
            }

            ddlJoystick.Items.Add(LocRm.GetString("None"));

            _jst = new JoystickDevice();
            var ij = 0;

            _sticks = _jst.FindJoysticks();
            i       = 1;
            foreach (string js in _sticks)
            {
                var nameid = js.Split('|');
                ddlJoystick.Items.Add(nameid[0]);
                if (nameid[1] == MainForm.Conf.Joystick.id)
                {
                    ij = i;
                }
                i++;
            }

            ddlJoystick.SelectedIndex = ij;


            jaxis1.ID          = MainForm.Conf.Joystick.XAxis;
            jaxis1.SupportDPad = true;
            jaxis1.Invert      = MainForm.Conf.Joystick.InvertXAxis;

            jaxis2.ID     = MainForm.Conf.Joystick.YAxis;
            jaxis2.Invert = MainForm.Conf.Joystick.InvertYAxis;

            jaxis3.ID     = MainForm.Conf.Joystick.ZAxis;
            jaxis3.Invert = MainForm.Conf.Joystick.InvertZAxis;

            jbutton1.ID = MainForm.Conf.Joystick.Record;
            jbutton2.ID = MainForm.Conf.Joystick.Snapshot;
            jbutton3.ID = MainForm.Conf.Joystick.Talk;
            jbutton4.ID = MainForm.Conf.Joystick.Listen;
            jbutton5.ID = MainForm.Conf.Joystick.Play;
            jbutton6.ID = MainForm.Conf.Joystick.Next;
            jbutton7.ID = MainForm.Conf.Joystick.Previous;
            jbutton8.ID = MainForm.Conf.Joystick.Stop;
            jbutton9.ID = MainForm.Conf.Joystick.MaxMin;

            jbutton1.GetInput += JbuttonGetInput;
            jbutton2.GetInput += JbuttonGetInput;
            jbutton3.GetInput += JbuttonGetInput;
            jbutton4.GetInput += JbuttonGetInput;
            jbutton5.GetInput += JbuttonGetInput;
            jbutton6.GetInput += JbuttonGetInput;
            jbutton7.GetInput += JbuttonGetInput;
            jbutton8.GetInput += JbuttonGetInput;
            jbutton9.GetInput += JbuttonGetInput;

            jaxis1.GetInput += JaxisGetInput;
            jaxis2.GetInput += JaxisGetInput;
            jaxis3.GetInput += JaxisGetInput;

            chkGZip.Checked = MainForm.Conf.EnableGZip;
            numDisconnectNotification.Value = MainForm.Conf.DisconnectNotificationDelay;
            mediaDirectoryEditor1.Enabled   = Helper.HasFeature(Enums.Features.Storage);
            HideTab(tabPage11, Helper.HasFeature(Enums.Features.Plugins));

            //important leave here:
            chkPasswordProtect.Checked = MainForm.Conf.Enable_Password_Protect;
            if (Helper.HasFeature(Enums.Features.Plugins))
            {
                ListPlugins();
            }

            chkUseiSpy.Checked      = !MainForm.Conf.UseSMTP;
            txtSMTPFromAddress.Text = MainForm.Conf.SMTPFromAddress;
            txtSMTPUsername.Text    = MainForm.Conf.SMTPUsername;
            txtSMTPPassword.Text    = MainForm.Conf.SMTPPassword;
            txtSMTPServer.Text      = MainForm.Conf.SMTPServer;
            chkSMTPUseSSL.Checked   = MainForm.Conf.SMTPSSL;
            numSMTPPort.Value       = MainForm.Conf.SMTPPort;

            ftpEditor1.Init(MainForm.Conf.FTPServers);
            chkOpenGrabs.Checked = MainForm.Conf.OpenGrabs;
            numFileCache.Value   = MainForm.Conf.VLCFileCache;
            rtbReferrers.Text    = MainForm.Conf.Referers;
            chkPasswordProtectOnStart.Checked = MainForm.Conf.Password_Protect_Startup;

            chkEnableLogging.Checked = MainForm.Conf.Logging.Enabled;
            numMaxLogSize.Value      = MainForm.Conf.Logging.FileSize;
            numKeepLogs.Value        = MainForm.Conf.Logging.KeepDays;

            _loaded = true;
        }
示例#29
0
 private void btnCenterAxes_Click(object sender, EventArgs e)
 {
     CenterAxes();
     MessageBox.Show(this, LocRm.GetString("AxesCentered"));
 }
示例#30
0
        private void SettingsLoad(object sender, EventArgs e)
        {
            UISync.Init(this);
            tcTabs.SelectedIndex = InitialTab;
            //lblBackground.Text = MainForm.Conf.BackgroundImage;
            chkErrorReporting.Checked     = MainForm.Conf.Enable_Error_Reporting;
            chkCheckForUpdates.Checked    = MainForm.Conf.Enable_Update_Check;
            chkPasswordProtect.Checked    = MainForm.Conf.Enable_Password_Protect;
            chkShowGettingStarted.Checked = MainForm.Conf.Enabled_ShowGettingStarted;

            if (MainForm.Conf.Password_Protect_Password != "")
            {
                txtPassword.Text = MainForm.Conf.Password_Protect_Password;
            }
            _rkApp                 = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", false);
            chkStartup.Checked     = (_rkApp != null && _rkApp.GetValue("iSpy") != null);
            txtMediaDirectory.Text = MainForm.Conf.MediaDirectory;

            btnDetectColor.BackColor     = MainForm.Conf.ActivityColor.ToColor();
            btnNoDetectColor.BackColor   = MainForm.Conf.NoActivityColor.ToColor();
            btnColorTracking.BackColor   = MainForm.Conf.TrackingColor.ToColor();
            btnColorVolume.BackColor     = MainForm.Conf.VolumeLevelColor.ToColor();
            btnColorMain.BackColor       = MainForm.Conf.MainColor.ToColor();
            btnColorArea.BackColor       = MainForm.Conf.AreaColor.ToColor();
            btnColorBack.BackColor       = MainForm.Conf.BackColor.ToColor();
            btnBorderHighlight.BackColor = MainForm.Conf.BorderHighlightColor.ToColor();
            btnBorderDefault.BackColor   = MainForm.Conf.BorderDefaultColor.ToColor();
            btnTimestampColor.BackColor  = MainForm.Conf.TimestampColor.ToColor();
            txtDaysDelete.Text           = MainForm.Conf.DeleteFilesOlderThanDays.ToString();
            txtMaxMediaSize.Value        = MainForm.Conf.MaxMediaFolderSizeMB;
            chkAutoSchedule.Checked      = MainForm.Conf.AutoSchedule;
            numMaxCPU.Value = MainForm.Conf.CPUMax;
            numMaxRecordingThreads.Value = MainForm.Conf.MaxRecordingThreads;
            numRedraw.Value              = MainForm.Conf.MaxRedrawRate;
            numMediaPanelItems.Value     = MainForm.Conf.PreviewItems;
            txtTrayIcon.Text             = MainForm.Conf.TrayIconText;
            chkMinimise.Checked          = MainForm.Conf.MinimiseOnClose;
            chkSpeechRecognition.Checked = MainForm.Conf.SpeechRecognition;

            if (chkMonitor.Checked && !MainForm.Conf.Monitor)
            {
                Process.Start(Program.AppPath + "iSpyMonitor.exe");
            }
            chkMonitor.Checked = MainForm.Conf.Monitor;

            //ddlImageMode.SelectedItem = MainForm.Conf.BackgroundImageMode;

            tbOpacity.Value = MainForm.Conf.Opacity;
            SetColors();

            gbStorage.Enabled = chkStorage.Checked = MainForm.Conf.Enable_Storage_Management;

            txtYouTubePassword.Text = MainForm.Conf.YouTubePassword;
            txtYouTubeUsername.Text = MainForm.Conf.YouTubeUsername;
            chkBalloon.Checked      = MainForm.Conf.BalloonTips;

            txtIPCameraTimeout.Value      = MainForm.Conf.IPCameraTimeout;
            txtServerReceiveTimeout.Value = MainForm.Conf.ServerReceiveTimeout;
            txtServerName.Text            = MainForm.Conf.ServerName;
            rtbAccessList.Text            = MainForm.Conf.AllowedIPList;

            int i = 0, selind = 0;

            foreach (TranslationsTranslationSet set in LocRm.TranslationSets.OrderBy(p => p.Name))
            {
                ddlLanguage.Items.Add(new ListItem(set.Name, new[] { set.CultureCode }));
                if (set.CultureCode == MainForm.Conf.Language)
                {
                    selind = i;
                }
                i++;
            }
            ddlLanguage.SelectedIndex = selind;
            chkAlertWindows.Checked   = MainForm.Conf.CreateAlertWindows;
            chkOverlay.Checked        = MainForm.Conf.ShowOverlayControls;
            ddlPriority.SelectedIndex = MainForm.Conf.Priority - 1;
            chkInterrupt.Checked      = MainForm.Conf.ScreensaverWakeup;
            chkEnableIPv6.Checked     = !MainForm.Conf.IPv6Disabled;
            chkRecycle.Checked        = MainForm.Conf.DeleteToRecycleBin;
            var pbModes = LocRm.GetString("PlaybackModes").Split(',');

            foreach (var s in pbModes)
            {
                ddlPlayback.Items.Add(s.Trim());
            }

            if (MainForm.Conf.PlaybackMode < 0)
            {
                MainForm.Conf.PlaybackMode = 0;
            }
            ddlPlayback.SelectedIndex = MainForm.Conf.PlaybackMode;
            try
            {
                numJPEGQuality.Value = MainForm.Conf.JPEGQuality;
            }
            catch (Exception)
            {
            }
            chkStopRecording.Checked = MainForm.Conf.StopSavingOnStorageLimit;
            chkBigButtons.Checked    = MainForm.Conf.BigButtons;

            selind = -1;
            i      = 0;
            try
            {
                for (int n = 0; n < WaveIn.DeviceCount; n++)
                {
                    ddlTalkMic.Items.Add(WaveIn.GetCapabilities(n).ProductName);
                    if (WaveIn.GetCapabilities(n).ProductName == MainForm.Conf.TalkMic)
                    {
                        selind = i;
                    }
                    i++;
                }
                ddlTalkMic.Enabled = true;
                if (selind > -1)
                {
                    ddlTalkMic.SelectedIndex = selind;
                }
                else
                {
                    if (ddlTalkMic.Items.Count == 0)
                    {
                        ddlTalkMic.Items.Add(_noDevices);
                        ddlTalkMic.Enabled       = false;
                        ddlTalkMic.SelectedIndex = 0;
                    }
                    else
                    {
                        ddlTalkMic.SelectedIndex = 0;
                    }
                }
            }
            catch (ApplicationException ex)
            {
                Log.Error("", ex);//MainForm.LogExceptionToFile(ex);
                ddlTalkMic.Items.Add(_noDevices);
                ddlTalkMic.Enabled = false;
            }
        }