private void Button1Click(object sender, EventArgs e) { string err = ""; if (err != "") { MessageBox.Show(err, LocRm.GetString("Error")); return; } SaveSMTPSettings(); if (!string.IsNullOrEmpty(MainForm.Conf.ArchiveNew)) { if (!MainForm.Conf.ArchiveNew.EndsWith(@"\")) { MainForm.Conf.ArchiveNew += @"\"; } } MainForm.Iconfont = new Font(FontFamily.GenericSansSerif, MainForm.Conf.BigButtons ? 22 : 15, FontStyle.Bold, GraphicsUnit.Pixel); MainForm.Conf.TalkMic = ""; MainForm.SetPriority(); LocalServer.ReloadAllowedIPs(); LocalServer.ReloadAllowedReferrers(); //SetStorageOptions(); MainForm.ReloadColors(); DialogResult = DialogResult.OK; Close(); }
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 = ""; MainForm.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.AllowedIPs = null; 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.AllowedReferers = null; 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); if (_rkApp != null) { _rkApp.SetValue("iSpy", "\"" + Application.ExecutablePath + "\" -silent", RegistryValueKind.String); } } catch (Exception ex) { MessageBox.Show(ex.Message); 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); MainForm.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(); }
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(); }