├── .gitignore
├── .vs
└── TeboCam
│ ├── FileContentIndex
│ └── read.lock
│ ├── v15
│ └── .suo
│ ├── v16
│ ├── .suo
│ └── TestStore
│ │ └── 0
│ │ ├── 000-0000.testlog
│ │ └── testlog.manifest
│ └── v17
│ ├── .suo
│ └── HierarchyCache.v1.txt
├── Build commands
└── build.txt
├── README.md
├── TeboCam.sln
├── TeboCam.suo
├── TeboCam.v12.suo
├── Tebocam
├── AdminCntl.Designer.cs
├── AdminCntl.cs
├── AdminCntl.resx
├── ApiClient.cs
├── ApiProcess.cs
├── AssemblyInfo.cs
├── Camera.cs
├── CameraAlarm.cs
├── CameraButtonsCntl.Designer.cs
├── CameraButtonsCntl.cs
├── CameraButtonsCntl.resx
├── CameraRig.cs
├── CameraWindow.cs
├── CameraWindow.resx
├── CaptureDeviceForm.cs
├── CaptureDeviceForm.resx
├── CommandLine.cs
├── ConfigData.cs
├── ControlRoomCntl.Designer.cs
├── ControlRoomCntl.cs
├── ControlRoomCntl.resx
├── Delegates.cs
├── FileInfoClass.cs
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── Graph.cs
├── GroupCameraButton.cs
├── IMail.cs
├── ImageDisplayer.Designer.cs
├── ImageDisplayer.cs
├── ImageDisplayer.resx
├── ImageProcessor.cs
├── ImagePub.cs
├── ImageThumbs.cs
├── InputBoxDialog.cs
├── InputBoxDialog.resx
├── Interfaces.cs
├── Internet.cs
├── Ionic.Zip.XML
├── Ionic.Zip.dll
├── Ionic.Zip.pdb
├── LeftRightMid.cs
├── LevelControl.Designer.cs
├── LevelControl.cs
├── LevelControl.resx
├── Log.cs
├── MessageDialog.cs
├── Movement.cs
├── OpenVideo.cs
├── Ping.cs
├── Prompt.cs
├── Properties
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Publisher.cs
├── Pulse.cs
├── Queue.cs
├── Resources
│ ├── 1.gif
│ ├── 2.gif
│ ├── 3.gif
│ ├── 4.gif
│ ├── 5.gif
│ ├── 6.gif
│ ├── 7.gif
│ ├── 8.gif
│ ├── 9.gif
│ ├── Ximagenotavailable.bmp
│ ├── arrowIn.bmp
│ ├── arrowIn1.bmp
│ ├── arrowOut.bmp
│ ├── arrowOut1.bmp
│ ├── landscape.bmp
│ ├── level.bmp
│ ├── monitor.bmp
│ ├── noImage.bmp
│ ├── nolandscape.bmp
│ ├── nolandscape1.bmp
│ ├── nolandscape2.bmp
│ ├── nolevel.bmp
│ └── nolevel1.bmp
├── Serialization.cs
├── Sound.cs
├── StastisticalData.cs
├── TeboCam.csproj
├── TeboCam.csproj.user
├── TeboCam.ico
├── TebocamControls
│ ├── AlertFilenameCntl.Designer.cs
│ ├── AlertFilenameCntl.cs
│ ├── AlertFilenameCntl.resx
│ ├── AlertTimeSettingsCntl.Designer.cs
│ ├── AlertTimeSettingsCntl.cs
│ ├── AlertTimeSettingsCntl.resx
│ ├── EmailHostSettingsCntl.Designer.cs
│ ├── EmailHostSettingsCntl.cs
│ ├── EmailHostSettingsCntl.resx
│ ├── EmailIntelligenceCntl.Designer.cs
│ ├── EmailIntelligenceCntl.cs
│ ├── EmailIntelligenceCntl.resx
│ ├── EmailSettingsCntl.Designer.cs
│ ├── EmailSettingsCntl.cs
│ ├── EmailSettingsCntl.resx
│ ├── FileAdminCntl.Designer.cs
│ ├── FileAdminCntl.cs
│ ├── FileAdminCntl.resx
│ ├── FrameRateCntl.Designer.cs
│ ├── FrameRateCntl.cs
│ ├── FrameRateCntl.resx
│ ├── FreezeGuardCntl.Designer.cs
│ ├── FreezeGuardCntl.cs
│ ├── FreezeGuardCntl.resx
│ ├── FtpSettingsCntl.Designer.cs
│ ├── FtpSettingsCntl.cs
│ ├── FtpSettingsCntl.resx
│ ├── GenerateWebpageCntl.Designer.cs
│ ├── GenerateWebpageCntl.cs
│ ├── GenerateWebpageCntl.resx
│ ├── ImagesSavedFolderCntl.Designer.cs
│ ├── ImagesSavedFolderCntl.cs
│ ├── ImagesSavedFolderCntl.resx
│ ├── InternetConnectionCheckCntl.Designer.cs
│ ├── InternetConnectionCheckCntl.cs
│ ├── InternetConnectionCheckCntl.resx
│ ├── LogCntl.Designer.cs
│ ├── LogCntl.cs
│ ├── LogCntl.resx
│ ├── LogFileManagementCntl.Designer.cs
│ ├── LogFileManagementCntl.cs
│ ├── LogFileManagementCntl.resx
│ ├── MiscCntl.Designer.cs
│ ├── MiscCntl.cs
│ ├── MiscCntl.resx
│ ├── MotionAlarmCntl.Designer.cs
│ ├── MotionAlarmCntl.cs
│ ├── MotionAlarmCntl.resx
│ ├── MovementStatisticsCntl.Designer.cs
│ ├── MovementStatisticsCntl.cs
│ ├── MovementStatisticsCntl.resx
│ ├── NotificationSettingsCntl.Designer.cs
│ ├── NotificationSettingsCntl.cs
│ ├── NotificationSettingsCntl.resx
│ ├── OnlineCntl.Designer.cs
│ ├── OnlineCntl.cs
│ ├── OnlineCntl.resx
│ ├── PasswordCntl.Designer.cs
│ ├── PasswordCntl.cs
│ ├── PasswordCntl.resx
│ ├── ProfilesCntl.Designer.cs
│ ├── ProfilesCntl.cs
│ ├── ProfilesCntl.resx
│ ├── PublishSettingsCntl.Designer.cs
│ ├── PublishSettingsCntl.cs
│ ├── PublishSettingsCntl.resx
│ ├── SecurityLockdownCntl.Designer.cs
│ ├── SecurityLockdownCntl.cs
│ ├── SecurityLockdownCntl.resx
│ ├── TebocamCntl.Designer.cs
│ ├── TebocamCntl.cs
│ ├── UpdateOptionsCntl.Designer.cs
│ ├── UpdateOptionsCntl.cs
│ └── UpdateOptionsCntl.resx
├── TebocamState.cs
├── TebowebException.cs
├── Tests
│ └── Tests.cs
├── Valid.cs
├── WaitForCam.cs
├── analyse.cs
├── analysePictureControl.Designer.cs
├── analysePictureControl.cs
├── analysePictureControl.resx
├── app.config
├── app.manifest
├── calibrate.Designer.cs
├── calibrate.cs
├── calibrate.resx
├── config.cs
├── crypt.cs
├── extensions.cs
├── fileManager.cs
├── fileprefix.Designer.cs
├── fileprefix.cs
├── fileprefix.resx
├── ftp.cs
├── fuvwltyf.ghg~
├── html.cs
├── image.Designer.cs
├── image.cs
├── image.resx
├── imageFilter.cs
├── jf2xwqc0.yiy~
├── libraries
│ ├── AForge.Imaging.dll
│ ├── AForge.Imaging.xml
│ ├── AForge.Video.DirectShow.dll
│ ├── AForge.Video.DirectShow.xml
│ ├── AForge.Video.dll
│ ├── AForge.Video.xml
│ ├── AForge.Vision.dll
│ ├── AForge.Vision.xml
│ ├── AForge.dll
│ └── AForge.xml
├── licence.cs
├── mail.cs
├── mailOLD.cs
├── packages.config
├── preferences.cs
├── preferences.designer.cs
├── preferences.resx
├── regex.cs
├── schedule.Designer.cs
├── schedule.cs
├── schedule.resx
├── sensitiveInfo.cs
├── statistics.cs
├── szuzv5nj.omt~
├── teboDebug.cs
├── time.cs
├── timestamp.Designer.cs
├── timestamp.cs
├── timestamp.resx
├── train.Designer.cs
├── train.cs
├── train.resx
├── update.cs
├── webPage.cs
├── webcamConfig.Designer.cs
├── webcamConfig.cs
├── webcamConfig.resx
└── webdata.cs
├── copy_commands
├── 1 run_me_to_copy.bat
├── Open Office Command Helper.ods
├── archive
│ └── copy_20220508_1008.bat
├── copyCommands.bat
├── copy_sensitiveInfo.bat
├── get_files.ps1
├── run_powershell_copy.bat
└── runing the powershell get_files .txt
├── properties
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
└── sensitiveInfo
└── sensitiveInfo.cs
/.gitignore:
--------------------------------------------------------------------------------
1 | /.vs/TeboCam/FileContentIndex/read.lock
2 | /.vs/TeboCam/v17/.suo
3 |
--------------------------------------------------------------------------------
/.vs/TeboCam/FileContentIndex/read.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/.vs/TeboCam/FileContentIndex/read.lock
--------------------------------------------------------------------------------
/.vs/TeboCam/v15/.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/.vs/TeboCam/v15/.suo
--------------------------------------------------------------------------------
/.vs/TeboCam/v16/.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/.vs/TeboCam/v16/.suo
--------------------------------------------------------------------------------
/.vs/TeboCam/v16/TestStore/0/000-0000.testlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/.vs/TeboCam/v16/TestStore/0/000-0000.testlog
--------------------------------------------------------------------------------
/.vs/TeboCam/v16/TestStore/0/testlog.manifest:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/.vs/TeboCam/v16/TestStore/0/testlog.manifest
--------------------------------------------------------------------------------
/.vs/TeboCam/v17/.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/.vs/TeboCam/v17/.suo
--------------------------------------------------------------------------------
/Build commands/build.txt:
--------------------------------------------------------------------------------
1 | cd C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\
2 |
3 | msbuild.exe C:\Dropbox\projects\TeboCam_OpenSource\tebocam.sln /property:Configuration=Release
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TeboCam_OpenSource
2 |
3 | Please note that you will also need to download the PulseCheck application from https://github.com/guythiebaut/PulseCheck
4 | This is a heart beat application that will restart Tebocam if Tebocam freezes.
5 |
6 | Once you have downloaded and built PulseCheck, copy the binaries from the bin folder of PulseCheck into the relevant (debug/release) bin folder of the Tebocam application.
7 | Note - You will need to build the Tebocam application first to create the Tebocam bin directories.
8 |
9 | You can also get the ready-built executable and pdb files, of the PulseCheck application, from Nuget by running the following from the command line after installing nuget on your machine:
10 | ````
11 | nuget install TeboWeb-PulseCheck
12 | ````
13 |
--------------------------------------------------------------------------------
/TeboCam.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.5.33627.172
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeboCam", "TeboCam\TeboCam.csproj", "{0FF635C0-695D-467C-B13D-BCA92E137D4B}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HeartBeat", "HeartBeat\HeartBeat.csproj", "{0BDA42DB-622E-4593-AC94-29C326985D7F}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Password", "Password\Password.csproj", "{768DF7D2-FCB8-4447-A1BA-8455C57EABFB}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {0FF635C0-695D-467C-B13D-BCA92E137D4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {0FF635C0-695D-467C-B13D-BCA92E137D4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {0FF635C0-695D-467C-B13D-BCA92E137D4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {0FF635C0-695D-467C-B13D-BCA92E137D4B}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {0BDA42DB-622E-4593-AC94-29C326985D7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {0BDA42DB-622E-4593-AC94-29C326985D7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {0BDA42DB-622E-4593-AC94-29C326985D7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {0BDA42DB-622E-4593-AC94-29C326985D7F}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {768DF7D2-FCB8-4447-A1BA-8455C57EABFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {768DF7D2-FCB8-4447-A1BA-8455C57EABFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {768DF7D2-FCB8-4447-A1BA-8455C57EABFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {768DF7D2-FCB8-4447-A1BA-8455C57EABFB}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(ExtensibilityGlobals) = postSolution
35 | SolutionGuid = {17B9B080-2FE7-40D4-B478-8BBC8AAE4B81}
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/TeboCam.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/TeboCam.suo
--------------------------------------------------------------------------------
/TeboCam.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/TeboCam.v12.suo
--------------------------------------------------------------------------------
/Tebocam/AdminCntl.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam
2 | {
3 | partial class AdminCntl
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.grpAlert = new System.Windows.Forms.GroupBox();
32 | this.btnAlert = new System.Windows.Forms.Button();
33 | this.numCamera = new System.Windows.Forms.NumericUpDown();
34 | this.chkAlertAll = new System.Windows.Forms.CheckBox();
35 | this.lblCamera = new System.Windows.Forms.Label();
36 | this.grpAlert.SuspendLayout();
37 | ((System.ComponentModel.ISupportInitialize)(this.numCamera)).BeginInit();
38 | this.SuspendLayout();
39 | //
40 | // grpAlert
41 | //
42 | this.grpAlert.Controls.Add(this.lblCamera);
43 | this.grpAlert.Controls.Add(this.chkAlertAll);
44 | this.grpAlert.Controls.Add(this.numCamera);
45 | this.grpAlert.Controls.Add(this.btnAlert);
46 | this.grpAlert.Location = new System.Drawing.Point(37, 69);
47 | this.grpAlert.Name = "grpAlert";
48 | this.grpAlert.Size = new System.Drawing.Size(275, 89);
49 | this.grpAlert.TabIndex = 0;
50 | this.grpAlert.TabStop = false;
51 | this.grpAlert.Text = "Generate alert on camera(s)";
52 | //
53 | // btnAlert
54 | //
55 | this.btnAlert.Location = new System.Drawing.Point(166, 41);
56 | this.btnAlert.Name = "btnAlert";
57 | this.btnAlert.Size = new System.Drawing.Size(98, 23);
58 | this.btnAlert.TabIndex = 0;
59 | this.btnAlert.Text = "Generate alert";
60 | this.btnAlert.UseVisualStyleBackColor = true;
61 | this.btnAlert.Click += new System.EventHandler(this.btnAlert_Click);
62 | //
63 | // numCamera
64 | //
65 | this.numCamera.Location = new System.Drawing.Point(0, 42);
66 | this.numCamera.Maximum = new decimal(new int[] {
67 | 9,
68 | 0,
69 | 0,
70 | 0});
71 | this.numCamera.Minimum = new decimal(new int[] {
72 | 1,
73 | 0,
74 | 0,
75 | 0});
76 | this.numCamera.Name = "numCamera";
77 | this.numCamera.Size = new System.Drawing.Size(60, 20);
78 | this.numCamera.TabIndex = 1;
79 | this.numCamera.Value = new decimal(new int[] {
80 | 1,
81 | 0,
82 | 0,
83 | 0});
84 | //
85 | // chkAlertAll
86 | //
87 | this.chkAlertAll.AutoSize = true;
88 | this.chkAlertAll.Location = new System.Drawing.Point(81, 45);
89 | this.chkAlertAll.Name = "chkAlertAll";
90 | this.chkAlertAll.Size = new System.Drawing.Size(79, 17);
91 | this.chkAlertAll.TabIndex = 2;
92 | this.chkAlertAll.Text = "all cameras";
93 | this.chkAlertAll.UseVisualStyleBackColor = true;
94 | //
95 | // lblCamera
96 | //
97 | this.lblCamera.AutoSize = true;
98 | this.lblCamera.Location = new System.Drawing.Point(6, 24);
99 | this.lblCamera.Name = "lblCamera";
100 | this.lblCamera.Size = new System.Drawing.Size(43, 13);
101 | this.lblCamera.TabIndex = 3;
102 | this.lblCamera.Text = "Camera";
103 | //
104 | // AdminCntl
105 | //
106 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
107 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
108 | this.Controls.Add(this.grpAlert);
109 | this.Name = "AdminCntl";
110 | this.Size = new System.Drawing.Size(362, 226);
111 | this.grpAlert.ResumeLayout(false);
112 | this.grpAlert.PerformLayout();
113 | ((System.ComponentModel.ISupportInitialize)(this.numCamera)).EndInit();
114 | this.ResumeLayout(false);
115 |
116 | }
117 |
118 | #endregion
119 |
120 | private System.Windows.Forms.GroupBox grpAlert;
121 | private System.Windows.Forms.Label lblCamera;
122 | private System.Windows.Forms.CheckBox chkAlertAll;
123 | private System.Windows.Forms.NumericUpDown numCamera;
124 | private System.Windows.Forms.Button btnAlert;
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/Tebocam/AdminCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeboCam
5 | {
6 | public partial class AdminCntl : UserControl
7 | {
8 |
9 | public AdminCntl(Form parentForm)
10 | {
11 | Initialise();
12 | }
13 |
14 | private void Initialise()
15 | {
16 | InitializeComponent();
17 | }
18 |
19 | private void btnAlert_Click(object sender, EventArgs e)
20 | {
21 | if (chkAlertAll.Checked)
22 | {
23 | foreach (var cam in CameraRig.ConnectedCameras)
24 | {
25 | TebocamState.log.AddLine(string.Format("ForceAlarm camNo:{0}", cam.camera.camNo));
26 | cam.camera.ForceAlarm();
27 | }
28 | }
29 | else
30 | {
31 | TebocamState.log.AddLine(string.Format("ForceAlarm camNo:{0}", GetCamera((int)numCamera.Value).camNo));
32 | Alarm(GetCamera((int)numCamera.Value));
33 | }
34 | }
35 |
36 | private void Alarm(Camera camera)
37 | {
38 | camera.ForceAlarm();
39 | }
40 |
41 |
42 | private Camera GetCamera(int num)
43 | {
44 | return CameraRig.getCam(CameraRig.idxFromButton(num));
45 | }
46 |
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Tebocam/AssemblyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/AssemblyInfo.cs
--------------------------------------------------------------------------------
/Tebocam/Camera.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Camera.cs
--------------------------------------------------------------------------------
/Tebocam/CameraButtonsCntl.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam
2 | {
3 | partial class CameraButtonsCntl
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.SuspendLayout();
32 | //
33 | // CameraButtonsCntl
34 | //
35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
37 | this.BackColor = System.Drawing.SystemColors.Control;
38 | this.Name = "CameraButtonsCntl";
39 | this.Size = new System.Drawing.Size(178, 36);
40 | this.ResumeLayout(false);
41 |
42 | }
43 |
44 | #endregion
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Tebocam/CameraButtonsCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Data;
4 | using System.Drawing;
5 | using System.Linq;
6 | using System.Windows.Forms;
7 |
8 | namespace TeboCam
9 | {
10 | public partial class CameraButtonsCntl : UserControl
11 | {
12 |
13 | public CameraButtonsCntl()
14 | {
15 | InitializeComponent();
16 | }
17 |
18 | public void AddButton(List ButtonGroup, ButtonDelegate butDel, ButtonDelegate actDel, bool displayActive, Size cameraButtonSize, Size activeButtonSize)
19 | {
20 |
21 | GroupCameraButton grpButton = new GroupCameraButton();
22 | grpButton.SetCameraButtonSize(cameraButtonSize.Width, cameraButtonSize.Height);
23 | grpButton.SetActiveButtonSize(activeButtonSize.Width, activeButtonSize.Height);
24 | grpButton.ActiveButton.Visible = displayActive;
25 | int lastX = 0;
26 |
27 | if (ButtonGroup.Count == 0)
28 | {
29 | grpButton.id = 1;
30 | }
31 | else
32 | {
33 | var lastButtonGroup = ButtonGroup.Select(x => x).Last();
34 | grpButton.id = lastButtonGroup.id + 1;
35 | lastX = lastButtonGroup.CameraButton.Right;
36 | }
37 |
38 | ButtonGroup.Add(grpButton);
39 | this.Controls.Add(grpButton.CameraButton);
40 | this.Controls.Add(grpButton.ActiveButton);
41 | grpButton.CameraButton.Text = grpButton.id.ToString();
42 | grpButton.CameraButton.Left = lastX + 1;
43 | grpButton.CameraButton.Top = 2;
44 | grpButton.ActiveButton.Left = grpButton.CameraButton.Left;
45 | grpButton.ActiveButton.Top = grpButton.CameraButton.Bottom + 2;
46 | grpButton.CameraButton.BackColor = Color.Silver;
47 | grpButton.ActiveButton.BackColor = Color.Silver;
48 | grpButton.camDelegate = butDel;
49 | grpButton.actDelegate = actDel;
50 | EventHandler handlerCam = (sender, args) => { grpButton.camDelegate(grpButton.id, grpButton.CameraButton, grpButton.ActiveButton); };
51 | grpButton.CameraButton.Click += handlerCam;
52 | EventHandler handlerAct = (sender, args) => { grpButton.actDelegate(grpButton.id, grpButton.CameraButton, grpButton.ActiveButton); };
53 | grpButton.ActiveButton.Click += handlerAct;
54 | }
55 |
56 | public void MoveButton(int buttonId)
57 | {
58 |
59 | }
60 |
61 | public void ButtonVisibility(bool show)
62 | {
63 |
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Tebocam/CameraWindow.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/CameraWindow.cs
--------------------------------------------------------------------------------
/Tebocam/CommandLine.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace teboweb
4 | {
5 | class CommandLine
6 | {
7 | private static string p_spaceCode = string.Empty;
8 | private static Random rand = new Random();
9 |
10 | protected static int GetRandInt(int min, int max)
11 | {
12 | return rand.Next(min, max);
13 | }
14 |
15 | //add 3 character white space replacement code to the end of the string
16 | //so that when we restore the white space we can ascertain the code to change to white space
17 | public static string finaliseCommandLine(string val)
18 | {
19 | spaceCode(val);
20 | string tmpStr = val + p_spaceCode;
21 | return tmpStr.Replace(" ", p_spaceCode);
22 | }
23 |
24 | public static string prepareCommandLine(string val)
25 | {
26 | if (val.Length > 3)
27 | {
28 | p_spaceCode = val.Substring(val.Length - 3, 3);
29 | val.Remove(val.Length - 3, 3);
30 | val = replaceCodeWithSpaces(val);
31 | }
32 |
33 | return val;
34 | }
35 |
36 | //replace white space with 3 character generated code
37 | private static string replaceCodeWithSpaces(string val)
38 | {
39 | string tmpStr = val;
40 | return tmpStr.Replace(p_spaceCode, " ");
41 | }
42 |
43 | //we need to replace spaces with 3 characters
44 | //in order to esnure that we are not using a combination in the character
45 | //string we are changing we keep generating 3 characters until we hit a unique combination
46 | private static void spaceCode(string commandStr)
47 | {
48 | string buildStr;
49 |
50 | do
51 | {
52 | buildStr = string.Empty;
53 | for (int i = 0; i < 3; i++)
54 | {
55 | buildStr += (char)GetRandInt(65, 90);
56 | }
57 |
58 | } while (commandStr.IndexOf(buildStr) != -1);
59 |
60 | p_spaceCode = buildStr;
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Tebocam/ControlRoomCntl.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam
2 | {
3 | partial class ControlRoomCntl
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.SuspendLayout();
32 | //
33 | // ControlRoomCntl
34 | //
35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
37 | this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
38 | this.Name = "ControlRoomCntl";
39 | this.Size = new System.Drawing.Size(628, 487);
40 | this.ResumeLayout(false);
41 |
42 | }
43 |
44 | #endregion
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Tebocam/ControlRoomCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Data;
4 | using System.Drawing;
5 | using System.Linq;
6 | using System.Windows.Forms;
7 |
8 | namespace TeboCam
9 | {
10 | public partial class ControlRoomCntl : UserControl
11 | {
12 |
13 | private List monitors = new List();
14 | private int windowWidth = 150;
15 | private int windowHeight = 150;
16 | Ping ping;
17 |
18 | public ControlRoomCntl(List cameras, Ping pinger)
19 | {
20 | ping = pinger;
21 | InitializeComponent();
22 | LoadCameras(cameras);
23 | }
24 |
25 | private void LoadCameras(List cameras)
26 | {
27 | for (int i = 0; i < 9; i++)
28 | {
29 | Monitor monitor = new Monitor();
30 | CameraWindow window = new CameraWindow();
31 | window.ping = ping;
32 | monitor.window = window;
33 | window.AutoSizeCameraWindow = false;
34 | window.Size = new Size(windowWidth, windowHeight);
35 | if (cameras.Count - 1 >= i)
36 | {
37 | window.Camera = cameras[i];
38 | monitor.FriendlyName = window.Camera.camNo.ToString();
39 | EventHandler handlerWindow = (sender, args) => { windowSelected(monitor.FriendlyName); };
40 | window.DoubleClick += handlerWindow;
41 | }
42 | monitors.Add(monitor);
43 | }
44 | int windowNo = 1;
45 | int xPos = -windowWidth;
46 | int yPos = -windowHeight;
47 | foreach (Monitor monitor in monitors)
48 | {
49 | if (new List() { 1, 4, 7 }.Contains(windowNo))
50 | {
51 | xPos = 2;
52 | yPos += windowHeight + 2;
53 | }
54 | else
55 | {
56 | xPos += windowWidth + 2;
57 | }
58 | monitor.window.Location = new Point(xPos, yPos);
59 | this.Controls.Add(monitor.window);
60 | windowNo++;
61 | }
62 | this.Width = monitors.Last().window.Right + 5;
63 | this.Height = monitors.Last().window.Bottom + 5;
64 |
65 | }
66 |
67 | private void windowSelected(string windowName)
68 | {
69 | CameraWindow window = monitors.Where(x => x.FriendlyName == windowName).First().window;
70 |
71 | if (window.Height != windowHeight)
72 | {
73 | monitors.ForEach(x => x.window.Size = new Size(windowWidth, windowHeight));
74 |
75 | int windowNo = 1;
76 | int xPos = -windowWidth;
77 | int yPos = -windowHeight;
78 | foreach (Monitor monitor in monitors)
79 | {
80 | if (new List() { 1, 4, 7 }.Contains(windowNo))
81 | {
82 | xPos = 2;
83 | yPos += windowHeight + 2;
84 | }
85 | else
86 | {
87 | xPos += windowWidth + 2;
88 | }
89 | monitor.window.Location = new Point(xPos, yPos);
90 | this.Controls.Add(monitor.window);
91 | windowNo++;
92 | }
93 | }
94 | else
95 | {
96 | monitors.ForEach(x => x.window.Size = new Size(0, 0));
97 | monitors.ForEach(x => x.window.Location = new Point(0, 0));
98 | window.Height = this.Height;
99 | window.Width = this.Width;
100 | }
101 | }
102 |
103 | class Monitor
104 | {
105 | public string FriendlyName;
106 | public CameraWindow window = new CameraWindow();
107 | public Point position = new Point();
108 | public Size size = new Size();
109 | }
110 |
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/Tebocam/Delegates.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 |
3 | namespace TeboCam
4 | {
5 | public class TeboCamDelegates
6 | {
7 | public delegate void RunWorkerCompletedDelegate(object sender, RunWorkerCompletedEventArgs e);
8 | public delegate void EventDelegate(object sender, T e);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Tebocam/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam
2 | {
3 | partial class News
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(News));
32 | this.info = new System.Windows.Forms.RichTextBox();
33 | this.groupBox1 = new System.Windows.Forms.GroupBox();
34 | this.radioButton4 = new System.Windows.Forms.RadioButton();
35 | this.radioButton3 = new System.Windows.Forms.RadioButton();
36 | this.radioButton2 = new System.Windows.Forms.RadioButton();
37 | this.radioButton1 = new System.Windows.Forms.RadioButton();
38 | this.groupBox1.SuspendLayout();
39 | this.SuspendLayout();
40 | //
41 | // info
42 | //
43 | this.info.BackColor = System.Drawing.Color.LemonChiffon;
44 | resources.ApplyResources(this.info, "info");
45 | this.info.Name = "info";
46 | this.info.ReadOnly = true;
47 | this.info.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.info_LinkClicked);
48 | //
49 | // groupBox1
50 | //
51 | this.groupBox1.Controls.Add(this.radioButton4);
52 | this.groupBox1.Controls.Add(this.radioButton3);
53 | this.groupBox1.Controls.Add(this.radioButton2);
54 | this.groupBox1.Controls.Add(this.radioButton1);
55 | resources.ApplyResources(this.groupBox1, "groupBox1");
56 | this.groupBox1.Name = "groupBox1";
57 | this.groupBox1.TabStop = false;
58 | //
59 | // radioButton4
60 | //
61 | resources.ApplyResources(this.radioButton4, "radioButton4");
62 | this.radioButton4.Name = "radioButton4";
63 | this.radioButton4.TabStop = true;
64 | this.radioButton4.UseVisualStyleBackColor = true;
65 | this.radioButton4.CheckedChanged += new System.EventHandler(this.radioButton4_CheckedChanged);
66 | //
67 | // radioButton3
68 | //
69 | resources.ApplyResources(this.radioButton3, "radioButton3");
70 | this.radioButton3.Name = "radioButton3";
71 | this.radioButton3.TabStop = true;
72 | this.radioButton3.UseVisualStyleBackColor = true;
73 | this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton3_CheckedChanged);
74 | //
75 | // radioButton2
76 | //
77 | resources.ApplyResources(this.radioButton2, "radioButton2");
78 | this.radioButton2.Name = "radioButton2";
79 | this.radioButton2.TabStop = true;
80 | this.radioButton2.UseVisualStyleBackColor = true;
81 | this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
82 | //
83 | // radioButton1
84 | //
85 | resources.ApplyResources(this.radioButton1, "radioButton1");
86 | this.radioButton1.Checked = true;
87 | this.radioButton1.MaximumSize = new System.Drawing.Size(52, 17);
88 | this.radioButton1.Name = "radioButton1";
89 | this.radioButton1.TabStop = true;
90 | this.radioButton1.UseVisualStyleBackColor = true;
91 | this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
92 | //
93 | // News
94 | //
95 | resources.ApplyResources(this, "$this");
96 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
97 | this.Controls.Add(this.groupBox1);
98 | this.Controls.Add(this.info);
99 | this.Name = "News";
100 | this.TopMost = true;
101 | this.groupBox1.ResumeLayout(false);
102 | this.groupBox1.PerformLayout();
103 | this.ResumeLayout(false);
104 |
105 | }
106 |
107 | #endregion
108 |
109 | private System.Windows.Forms.RichTextBox info;
110 | private System.Windows.Forms.GroupBox groupBox1;
111 | private System.Windows.Forms.RadioButton radioButton2;
112 | private System.Windows.Forms.RadioButton radioButton1;
113 | private System.Windows.Forms.RadioButton radioButton3;
114 | private System.Windows.Forms.RadioButton radioButton4;
115 | }
116 | }
--------------------------------------------------------------------------------
/Tebocam/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Windows.Forms;
4 |
5 | namespace TeboCam
6 | {
7 | public partial class News : Form
8 | {
9 |
10 | public static ArrayList newsTxt;
11 | public static ArrayList infoTxt;
12 | public static ArrayList whatsNewTxt;
13 | public static ArrayList licenseTxt;
14 |
15 | public News(ArrayList newsIn, ArrayList infoIn, ArrayList whatsNewIn, ArrayList licenseIn)
16 | {
17 | InitializeComponent();
18 |
19 |
20 | var version = Double.Parse(sensitiveInfo.ver, new System.Globalization.CultureInfo("en-GB")).ToString();
21 | this.Text += "(version " + version + ")";
22 |
23 | newsTxt = newsIn;
24 | infoTxt = infoIn;
25 | whatsNewTxt = whatsNewIn;
26 | licenseTxt = licenseIn;
27 |
28 | foreach (string line in newsIn)
29 | {
30 | info.Text = info.Text + line + "\n";
31 | }
32 |
33 | info.Invalidate();
34 |
35 | }
36 |
37 | private void radioButton1_CheckedChanged(object sender, EventArgs e)
38 | {
39 | ArrayList tmpStr;
40 |
41 | if (radioButton1.Checked)
42 | {
43 | tmpStr = newsTxt;
44 | info.Clear();
45 |
46 | foreach (string line in tmpStr)
47 | {
48 | info.Text = info.Text + line + "\n";
49 | }
50 |
51 | info.Invalidate();
52 | }
53 |
54 |
55 |
56 | }
57 |
58 | private void radioButton3_CheckedChanged(object sender, EventArgs e)
59 | {
60 |
61 | ArrayList tmpStr;
62 |
63 | if (radioButton3.Checked)
64 | {
65 | tmpStr = whatsNewTxt;
66 | info.Clear();
67 |
68 | foreach (string line in tmpStr)
69 | {
70 | info.Text = info.Text + line + "\n";
71 | }
72 |
73 | info.Invalidate();
74 | }
75 | }
76 |
77 | private void radioButton2_CheckedChanged(object sender, EventArgs e)
78 | {
79 |
80 | ArrayList tmpStr;
81 |
82 | if (radioButton2.Checked)
83 | {
84 | tmpStr = infoTxt;
85 |
86 | info.Clear();
87 |
88 | foreach (string line in tmpStr)
89 | {
90 | info.Text = info.Text + line + "\n";
91 | }
92 |
93 | info.Invalidate();
94 | }
95 |
96 | }
97 |
98 |
99 | private void radioButton4_CheckedChanged(object sender, EventArgs e)
100 | {
101 |
102 | ArrayList tmpStr;
103 |
104 | if (radioButton4.Checked)
105 | {
106 | tmpStr = licenseTxt;
107 |
108 | info.Clear();
109 |
110 | foreach (string line in tmpStr)
111 | {
112 | info.Text = info.Text + line + "\n";
113 | }
114 |
115 | info.Invalidate();
116 | }
117 |
118 | }
119 |
120 |
121 | private void info_LinkClicked(object sender, LinkClickedEventArgs e)
122 | {
123 | Internet.openInternetBrowserAt(e.LinkText);
124 | }
125 |
126 | }
127 | }
--------------------------------------------------------------------------------
/Tebocam/GroupCameraButton.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 |
4 | namespace TeboCam
5 | {
6 |
7 | public delegate void ButtonDelegate(int id, Button cameraButton, Button activeButton, bool activate = true);
8 |
9 | public class GroupCameraButton
10 | {
11 | public enum ButtonState
12 | {
13 | NotConnected,
14 | ConnectedAndInactive,
15 | ConnectedAndActive
16 | }
17 |
18 | public int id;
19 | public Button CameraButton = new Button();
20 | public ButtonState CameraButtonState { get; private set; }
21 | public ButtonDelegate camDelegate;
22 | public Button ActiveButton = new Button();
23 | public ButtonState ActiveButtonState { get; private set; }
24 | public ButtonDelegate actDelegate;
25 |
26 | public GroupCameraButton()
27 | {
28 | CameraButtonState = ButtonState.NotConnected;
29 | ActiveButtonState = ButtonState.NotConnected;
30 | }
31 |
32 | public void SetCameraButtonSize(int width, int height)
33 | {
34 | CameraButton.Size = new Size(width, height);
35 | }
36 |
37 | public void SetActiveButtonSize(int width, int height)
38 | {
39 | ActiveButton.Size = new Size(width, height);
40 | }
41 |
42 | public void CameraButtonIsActive()
43 | {
44 | CameraButton.BackColor = Color.LawnGreen;
45 | CameraButtonState = ButtonState.ConnectedAndActive;
46 | }
47 |
48 | public void CameraButtonIsConnectedAndInactive()
49 | {
50 | CameraButton.BackColor = Color.SkyBlue;
51 | CameraButtonState = ButtonState.ConnectedAndInactive;
52 | }
53 |
54 | public void CameraButtonIsNotConnected()
55 | {
56 | CameraButton.BackColor = Color.Silver;
57 | CameraButtonState = ButtonState.NotConnected;
58 | }
59 |
60 | public void ActiveButtonIsActive()
61 | {
62 | ActiveButton.BackColor = Color.LawnGreen;
63 | ActiveButtonState = ButtonState.ConnectedAndActive;
64 | }
65 |
66 | public void ActiveButtonIsInactive()
67 | {
68 | ActiveButton.BackColor = Color.Silver;
69 | ActiveButtonState = ButtonState.NotConnected;
70 | }
71 |
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/Tebocam/IMail.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam
2 | {
3 | public interface IMail
4 | {
5 | void SetExceptionHandler(IException exceptionHandler);
6 | void addAttachment(string a);
7 | void clearAttachments();
8 | bool validEmail(string emailAddress);
9 | void sendEmail(EmailFields eml);
10 | bool SpamAlert(int p_emails, int p_mins, bool p_deSpamify, int p_currTime);
11 | bool SpamIsStopped();
12 | void StopSpam(bool stop);
13 | void SetTestStatus(int status);
14 | int GetTestStatus();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Tebocam/ImageDisplayer.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam
2 | {
3 | partial class ImageDisplayer
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.SuspendLayout();
32 | //
33 | // ImageDisplayer
34 | //
35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
37 | this.Name = "ImageDisplayer";
38 | this.Size = new System.Drawing.Size(177, 180);
39 | this.Load += new System.EventHandler(this.ImageDisplayer_Load);
40 | this.ResumeLayout(false);
41 |
42 | }
43 |
44 | #endregion
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Tebocam/ImagePub.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace TeboCam
5 | {
6 | public static class ImagePub
7 | {
8 |
9 | public delegate void ImagePubEventHandler(object source, ImagePubArgs e);
10 | public static event ImagePubEventHandler publishPicture;
11 |
12 | public class ImagePubArgs : EventArgs
13 | {
14 | public string _option;
15 | public List _lst;
16 |
17 | public string option
18 | {
19 | get { return _option; }
20 | set { _option = value; }
21 | }
22 |
23 | public int _camNo;
24 | public int CamNo
25 | {
26 | get { return _camNo; }
27 | set { _camNo = value; }
28 | }
29 |
30 | public List lst
31 | {
32 | get { return _lst; }
33 | set { _lst = value; }
34 | }
35 | }
36 |
37 | public static void PubPicture(ImagePub.ImagePubArgs a)
38 | {
39 | publishPicture(null, a);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Tebocam/ImageThumbs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace TeboCam
5 | {
6 | public class ImageThumbs
7 | {
8 |
9 | //private static string[] pics = new string[20];
10 | public static int picsInWindowCount = 0;
11 | public static List thumbNames = new List();
12 | public static List thumbPics = new List();
13 | private static List thumbFiles = new List();
14 | private static bool noDataYet = true;
15 | public static IException tebowebException;
16 |
17 | private static int firstFreeBlock = 0;
18 | public static int windowsFull = 0;
19 |
20 | public static List thumbs = new List();
21 |
22 |
23 | public static void initPics(int thumbs)
24 | {
25 | picsInWindowCount = thumbs;
26 | string[] pics = new string[picsInWindowCount];
27 | thumbFiles.Add(pics);
28 | }
29 |
30 | public static string[,] populateWindow(int windowNum)
31 | {
32 |
33 | string[,] picsForWindow = new string[picsInWindowCount, 2];
34 |
35 | if (noDataYet)
36 | { return picsForWindow; }
37 |
38 | try
39 | {
40 |
41 | if (windowNum > windowsFull) { windowNum = windowsFull; }
42 |
43 | string[] firstBlock = new string[picsInWindowCount];
44 | firstBlock = thumbFiles[windowNum];
45 |
46 | int tmpInt = 0;
47 |
48 | foreach (string name in thumbNames)
49 | {
50 | string tmpStr = firstBlock[tmpInt];
51 | if (tmpStr != null)
52 | {
53 | picsForWindow[tmpInt, 0] = name;
54 | picsForWindow[tmpInt, 1] = tmpStr;
55 | }
56 | tmpInt++;
57 | }
58 | return picsForWindow;
59 | }
60 | catch (Exception e)
61 | {
62 | TebocamState.tebowebException.LogException(e);
63 | string[,] errorBlank = new string[picsInWindowCount, 2];
64 | return errorBlank;
65 | }
66 | }
67 |
68 | public static void reset()
69 | {
70 | firstFreeBlock = 0;
71 | foreach (string[] block in thumbFiles)
72 | {
73 | for (int i = 0; i < block.Length; i++)
74 | {
75 | block[i] = null;
76 | }
77 |
78 | }
79 | }
80 |
81 | public static void addThumbToPictureBox(string pic)
82 | {
83 |
84 | int firstFreeCell = 0;
85 | bool freeCell = false;
86 |
87 | string[] freeBlock = new string[picsInWindowCount];
88 | freeBlock = thumbFiles[firstFreeBlock];
89 |
90 | foreach (string cell in freeBlock)
91 | {
92 | if (cell != null)
93 | {
94 | firstFreeCell++;
95 | }
96 | else
97 | {
98 | freeCell = true;
99 | break;
100 | }
101 | }
102 |
103 | if (freeCell)
104 | {
105 | freeBlock[firstFreeCell] = pic;
106 | thumbFiles[firstFreeBlock] = freeBlock;
107 | }
108 | else
109 | {
110 | string[] newBlock = new string[picsInWindowCount];
111 | newBlock[0] = pic;
112 | thumbFiles.Add(newBlock);
113 | firstFreeBlock++;
114 | windowsFull = firstFreeBlock;
115 | }
116 | noDataYet = false;
117 | }
118 |
119 |
120 |
121 |
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/Tebocam/Interfaces.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam
2 | {
3 | public class Interfaces
4 | {
5 |
6 | public interface IEncryption
7 | {
8 |
9 | string EncryptToString(string a);
10 | string DecryptString(string a);
11 |
12 | }
13 |
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Tebocam/Internet.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeboCam
5 | {
6 | public static class Internet
7 | {
8 | public static void openInternetBrowserAt(string url)
9 | {
10 | try
11 | {
12 | System.Diagnostics.Process.Start(url);
13 | }
14 | catch (System.ComponentModel.Win32Exception ex)
15 | {
16 | TebocamState.tebowebException.LogException(ex);
17 |
18 | if (ex.ErrorCode == -2147467259)
19 | {
20 | MessageBox.Show("Your internet browser does not appear to be opening with TeboCam." + Environment.NewLine + "Please open your browser with this URL: " + url);
21 | }
22 | }
23 | catch (System.Exception other)
24 | {
25 | TebocamState.tebowebException.LogException(other);
26 | MessageBox.Show(other.Message);
27 | }
28 | }
29 |
30 | public static bool internetConnected(string site)
31 | //needs to be non blank otherwise a false positive is returned
32 | {
33 | if (site.Trim() == "") site = "s";
34 |
35 | try
36 | {
37 | System.Net.Sockets.TcpClient clnt = new System.Net.Sockets.TcpClient(site, 80);
38 | clnt.Close();
39 | return true;
40 | }
41 | catch (Exception e)
42 | {
43 | TebocamState.tebowebException.LogException(e);
44 | return false;
45 | }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Tebocam/Ionic.Zip.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Ionic.Zip.dll
--------------------------------------------------------------------------------
/Tebocam/Ionic.Zip.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Ionic.Zip.pdb
--------------------------------------------------------------------------------
/Tebocam/LeftRightMid.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace TeboCam
4 | {
5 | class LeftRightMid
6 | {
7 |
8 | public static IException tebowebException;
9 |
10 | public static string Left(string param, int length)
11 | {
12 | try
13 | {
14 | //we start at 0 since we want to get the characters starting from the
15 | //left and with the specified lenght and assign it to a variable
16 | string result = param.Substring(0, length);
17 | //return the result of the operation
18 | return result;
19 | }
20 | catch (Exception e)
21 | {
22 | TebocamState.tebowebException.LogException(e);
23 | return "";
24 | }
25 | }
26 | public static string Right(string param, int length)
27 | {
28 | //start at the index based on the lenght of the sting minus
29 | //the specified lenght and assign it a variable
30 | string result = param.Substring(param.Length - length, length);
31 | //return the result of the operation
32 | return result;
33 | }
34 |
35 | public static string Mid(string param, int startIndex, int length)
36 | {
37 | //start at the specified index in the string ang get N number of
38 | //characters depending on the lenght and assign it to a variable
39 | string result = param.Substring(startIndex, length);
40 | //return the result of the operation
41 | return result;
42 | }
43 |
44 | public static string Mid(string param, int startIndex)
45 | {
46 | //start at the specified index and return all characters after it
47 | //and assign it to a variable
48 | string result = param.Substring(startIndex);
49 | //return the result of the operation
50 | return result;
51 | }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Tebocam/Log.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 |
6 | namespace TeboCam
7 | {
8 | public interface ILog
9 | {
10 | Log ReadXMLFile(string filename);
11 | void WriteXMLFile(string filename, Log log);
12 | void AddLine(string message);
13 | void AddLine(DateTime dateTime, string message);
14 | }
15 |
16 | [Serializable]
17 | public class Log : ILog
18 | {
19 |
20 | public List Lines = new List();
21 | public string FileName = "no name";
22 | public event EventHandler LogAdded;
23 |
24 | public Log()
25 | { }
26 |
27 | public Log(string FileName)
28 | {
29 |
30 | this.FileName = FileName;
31 |
32 | }
33 |
34 | public Log ReadXMLFile(string filename)
35 | {
36 | return Serialization.SerializeFromXmlFile(filename);
37 | }
38 |
39 | public void WriteXMLFile(string filename, Log log)
40 | {
41 | if (File.Exists(filename))
42 | {
43 | File.Delete(filename);
44 | }
45 | Serialization.SerializeToXmlFile(filename, log);
46 | }
47 |
48 | public void AddLine(string message)
49 | {
50 | AddLine(DateTime.Now, message);
51 | }
52 |
53 | public void AddLine(DateTime dateTime, string message)
54 | {
55 | Lines.Add(new logLine() { DT = dateTime, Message = message });
56 | LogAdded?.Invoke(null, new EventArgs());
57 | }
58 |
59 | public long Count()
60 | {
61 | return Lines.Count();
62 | }
63 |
64 | public void Clear()
65 | {
66 | Lines.Clear();
67 | }
68 |
69 | }
70 |
71 | public class logLine
72 | {
73 |
74 | public DateTime DT;
75 | public string Message;
76 |
77 | }
78 |
79 |
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/Tebocam/MessageDialog.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace TeboCam
4 | {
5 | public static class MessageDialog
6 | {
7 | public static void messageError(string message, string title)
8 | {
9 | MessageBox.Show(message, title, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
10 | }
11 |
12 | public static void messageAlert(string message, string title)
13 | {
14 | MessageBox.Show(message, title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
15 | }
16 |
17 | public static DialogResult messageQuestionConfirm(string message, string title)
18 | {
19 | return MessageBox.Show(message, title, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
20 | }
21 | public static void messageInform(string message, string title)
22 | {
23 | MessageBox.Show(message, title, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Tebocam/Prompt.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace TeboCam
4 | {
5 |
6 | public static class Prompt
7 | {
8 | public static string ShowDialog(string text, string caption)
9 | {
10 | Form prompt = new Form()
11 | {
12 | Width = 500,
13 | Height = 150,
14 | FormBorderStyle = FormBorderStyle.FixedDialog,
15 | Text = caption,
16 | StartPosition = FormStartPosition.CenterScreen
17 | };
18 | Label textLabel = new Label() { Left = 50, Top = 20, Text = text };
19 | TextBox textBox = new TextBox() { Left = 50, Top = 50, Width = 400 };
20 | textBox.PasswordChar = '*';
21 | Button confirmation = new Button() { Text = "Ok", Left = 350, Width = 100, Top = 70, DialogResult = DialogResult.OK };
22 | confirmation.Click += (sender, e) => { prompt.Close(); };
23 | prompt.Controls.Add(textBox);
24 | prompt.Controls.Add(confirmation);
25 | prompt.Controls.Add(textLabel);
26 | prompt.AcceptButton = confirmation;
27 |
28 | return prompt.ShowDialog() == DialogResult.OK ? textBox.Text : textBox.Text;
29 | }
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/Tebocam/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace TeboCam.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Tebocam/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Tebocam/Queue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace TeboCam
5 | {
6 |
7 | public class Queue
8 | {
9 |
10 | public List QueueItems = new List();
11 |
12 | public class QueueItem
13 | {
14 | public int? CamNo = null;
15 | public DateTime DateTimeAdded = DateTime.Now;
16 | public DateTime? DateTimeProcessed;
17 | public string Instruction;
18 | public List Parms = new List();
19 | public List CamsProcessed = new List();
20 | public bool RemoveFromQueue = false;
21 | }
22 |
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Tebocam/Resources/1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/1.gif
--------------------------------------------------------------------------------
/Tebocam/Resources/2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/2.gif
--------------------------------------------------------------------------------
/Tebocam/Resources/3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/3.gif
--------------------------------------------------------------------------------
/Tebocam/Resources/4.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/4.gif
--------------------------------------------------------------------------------
/Tebocam/Resources/5.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/5.gif
--------------------------------------------------------------------------------
/Tebocam/Resources/6.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/6.gif
--------------------------------------------------------------------------------
/Tebocam/Resources/7.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/7.gif
--------------------------------------------------------------------------------
/Tebocam/Resources/8.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/8.gif
--------------------------------------------------------------------------------
/Tebocam/Resources/9.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/9.gif
--------------------------------------------------------------------------------
/Tebocam/Resources/Ximagenotavailable.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/Ximagenotavailable.bmp
--------------------------------------------------------------------------------
/Tebocam/Resources/arrowIn.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/arrowIn.bmp
--------------------------------------------------------------------------------
/Tebocam/Resources/arrowIn1.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/arrowIn1.bmp
--------------------------------------------------------------------------------
/Tebocam/Resources/arrowOut.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/arrowOut.bmp
--------------------------------------------------------------------------------
/Tebocam/Resources/arrowOut1.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/arrowOut1.bmp
--------------------------------------------------------------------------------
/Tebocam/Resources/landscape.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/landscape.bmp
--------------------------------------------------------------------------------
/Tebocam/Resources/level.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/level.bmp
--------------------------------------------------------------------------------
/Tebocam/Resources/monitor.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/monitor.bmp
--------------------------------------------------------------------------------
/Tebocam/Resources/noImage.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/noImage.bmp
--------------------------------------------------------------------------------
/Tebocam/Resources/nolandscape.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/nolandscape.bmp
--------------------------------------------------------------------------------
/Tebocam/Resources/nolandscape1.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/nolandscape1.bmp
--------------------------------------------------------------------------------
/Tebocam/Resources/nolandscape2.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/nolandscape2.bmp
--------------------------------------------------------------------------------
/Tebocam/Resources/nolevel.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/nolevel.bmp
--------------------------------------------------------------------------------
/Tebocam/Resources/nolevel1.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/Resources/nolevel1.bmp
--------------------------------------------------------------------------------
/Tebocam/Serialization.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Xml.Serialization;
6 |
7 | namespace TeboCam
8 | {
9 | public static class Serialization
10 | {
11 | public static IException tebowebException;
12 |
13 | public static bool SerializeToXmlFile(string file, T serializeThis)
14 | {
15 | try
16 | {
17 | using (StreamWriter writer = new StreamWriter(file))
18 | {
19 | XmlSerializer xmlSerializer = XmlSerializer.FromTypes(new[] { typeof(T) }).First();
20 | StringWriter textWriter = new StringWriter();
21 | xmlSerializer.Serialize(textWriter, serializeThis);
22 | string serializedXml = textWriter.ToString();
23 | writer.Write(serializedXml);
24 | writer.Flush();
25 | }
26 | }
27 | catch (Exception e)
28 | {
29 | TebocamState.tebowebException.LogException(e);
30 | throw e;
31 | }
32 | return true;
33 | }
34 |
35 | public static T SerializeFromXmlFile(string file)
36 | {
37 | try
38 | {
39 | string xmlIn;
40 | using (StreamReader streamReader = new StreamReader(file, Encoding.UTF8))
41 | {
42 | xmlIn = streamReader.ReadToEnd();
43 | }
44 | XmlSerializer xmlDeSerializer = XmlSerializer.FromTypes(new[] { typeof(T) }).First();
45 | StringReader textReader = new StringReader(xmlIn);
46 | return (T)xmlDeSerializer.Deserialize(textReader);
47 | }
48 | catch (Exception e)
49 | {
50 | TebocamState.tebowebException.LogException(e);
51 | throw e;
52 | }
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Tebocam/Sound.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Media;
4 |
5 |
6 | namespace TeboCam
7 | {
8 | public static class Sound
9 | {
10 | private static SoundPlayer player = new SoundPlayer();
11 |
12 | private static void LoadSoundCompleted(object sender, AsyncCompletedEventArgs args)
13 | {
14 | player.Play();
15 | }
16 |
17 | public static void RingMyBell(bool test)
18 | {
19 | if (ConfigurationHelper.GetCurrentProfile().soundAlertOn || test)
20 | {
21 | try
22 | {
23 | player.LoadCompleted -= new AsyncCompletedEventHandler(LoadSoundCompleted);
24 | player.LoadCompleted += new AsyncCompletedEventHandler(LoadSoundCompleted);
25 | player.SoundLocation = ConfigurationHelper.GetCurrentProfile().soundAlert;
26 | player.LoadAsync();
27 | }
28 | catch (Exception e)
29 | {
30 | TebocamState.tebowebException.LogException(e);
31 | }
32 | }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Tebocam/StastisticalData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 |
5 | namespace TeboCam
6 | {
7 | [Serializable]
8 | public class StastisticalData
9 | {
10 | public List StatisticCollection = new List();
11 |
12 | public StastisticalData()
13 | {
14 | }
15 |
16 | public Configuration ReadXmlFile(string filename)
17 | {
18 | return Serialization.SerializeFromXmlFile(filename);
19 | }
20 |
21 | public void WriteXmlFile(string filename, Configuration config)
22 | {
23 | if (File.Exists(filename))
24 | {
25 | File.Delete(filename);
26 | }
27 | Serialization.SerializeToXmlFile(filename, config);
28 | }
29 |
30 | public void NewStat(Statistic stat)
31 | {
32 | StatisticCollection.Add(stat);
33 | }
34 |
35 |
36 | [Serializable]
37 | public class Statistic
38 | {
39 | private int cameraId;
40 | private string cameraName;
41 | private int motionLevel;
42 | private int alarmLevel;
43 | private DateTime dateTime;
44 | }
45 |
46 |
47 |
48 |
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Tebocam/TeboCam.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | publish\
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | en-US
14 | false
15 | ProjectFiles
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Tebocam/TeboCam.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/TeboCam.ico
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/AlertFilenameCntl.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam
2 | {
3 | partial class AlertFilenameCntl
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.groupBox6 = new System.Windows.Forms.GroupBox();
32 | this.button35 = new System.Windows.Forms.Button();
33 | this.label12 = new System.Windows.Forms.Label();
34 | this.groupBox6.SuspendLayout();
35 | this.SuspendLayout();
36 | //
37 | // groupBox6
38 | //
39 | this.groupBox6.Controls.Add(this.button35);
40 | this.groupBox6.Controls.Add(this.label12);
41 | this.groupBox6.Location = new System.Drawing.Point(0, 0);
42 | this.groupBox6.Name = "groupBox6";
43 | this.groupBox6.Size = new System.Drawing.Size(423, 110);
44 | this.groupBox6.TabIndex = 54;
45 | this.groupBox6.TabStop = false;
46 | //
47 | // button35
48 | //
49 | this.button35.ImeMode = System.Windows.Forms.ImeMode.NoControl;
50 | this.button35.Location = new System.Drawing.Point(31, 49);
51 | this.button35.Name = "button35";
52 | this.button35.Size = new System.Drawing.Size(256, 44);
53 | this.button35.TabIndex = 95;
54 | this.button35.Text = "Set Alert File Name";
55 | this.button35.UseVisualStyleBackColor = true;
56 | this.button35.Click += new System.EventHandler(this.button35_Click);
57 | //
58 | // label12
59 | //
60 | this.label12.AutoSize = true;
61 | this.label12.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Bold);
62 | this.label12.ForeColor = System.Drawing.Color.Black;
63 | this.label12.ImeMode = System.Windows.Forms.ImeMode.NoControl;
64 | this.label12.Location = new System.Drawing.Point(21, 17);
65 | this.label12.Name = "label12";
66 | this.label12.Size = new System.Drawing.Size(266, 23);
67 | this.label12.TabIndex = 23;
68 | this.label12.Text = "Alert Filename Settings";
69 | //
70 | // AlertFilenameCntl
71 | //
72 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
73 | this.Controls.Add(this.groupBox6);
74 | this.Name = "AlertFilenameCntl";
75 | this.Size = new System.Drawing.Size(423, 110);
76 | this.groupBox6.ResumeLayout(false);
77 | this.groupBox6.PerformLayout();
78 | this.ResumeLayout(false);
79 |
80 | }
81 |
82 | #endregion
83 |
84 | private System.Windows.Forms.GroupBox groupBox6;
85 | private System.Windows.Forms.Button button35;
86 | private System.Windows.Forms.Label label12;
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/AlertFilenameCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeboCam
5 | {
6 | public partial class AlertFilenameCntl : UserControl
7 | {
8 | public delegate void FilePrefixSetDelegate(FilePrefixSettingsResultDto result);
9 | FilePrefixSetDelegate filePrefixSet;
10 |
11 | public AlertFilenameCntl(FilePrefixSetDelegate filePrefix)
12 | {
13 | InitializeComponent();
14 | filePrefixSet = filePrefix;
15 | }
16 |
17 | private void button35_Click(object sender, EventArgs e)
18 | {
19 | var record = ConfigurationHelper.GetCurrentProfile();
20 |
21 | FilePrefixSettingsDto settings = new FilePrefixSettingsDto()
22 | {
23 | ResultDelegate = new FilePrefixformDelegate(filePrefixSet),
24 | FromString = "Alert",
25 | ToolTip = record.toolTips,
26 | FileName = record.filenamePrefix,
27 | CycleStampChecked = record.cycleStampChecked,
28 | StartCycle = record.startCycle,
29 | EndCycle = record.endCycle,
30 | CurrentCycle = record.currentCycle,
31 | IncludeStamp = true,
32 | DisplayStamp = false,
33 | FileDir = string.Empty,
34 | FileDirDefault = string.Empty,
35 | ImagesSavedFolderEnabled = false,
36 | includeMotionLevel = record.includeMotionLevel
37 | };
38 |
39 | fileprefix fileprefix = new fileprefix(settings);
40 | fileprefix.StartPosition = FormStartPosition.CenterScreen;
41 | fileprefix.ShowDialog();
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/AlertTimeSettingsCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeboCam
5 | {
6 | public partial class AlertTimeSettingsCntl : UserControl
7 | {
8 | public AlertTimeSettingsCntl()
9 | {
10 | InitializeComponent();
11 | SetFieldValues();
12 | }
13 |
14 | public TextBox GetEmailNotifInterval() { return emailNotifInterval; }
15 | public TextBox GetImageFileInterval() { return imageFileInterval; }
16 |
17 |
18 | private void SetFieldValues()
19 | {
20 | emailNotifInterval.Text = ConfigurationHelper.GetCurrentProfile().emailNotifyInterval.ToString();
21 | imageFileInterval.Text = ConfigurationHelper.GetCurrentProfile().imageSaveInterval.ToString();
22 | }
23 |
24 | private void emailNotifInterval_Leave(object sender, EventArgs e)
25 | {
26 | emailNotifInterval.Text = Valid.verifyInt(emailNotifInterval.Text, 1, 9999, "1");
27 | ConfigurationHelper.GetCurrentProfile().emailNotifyInterval = Convert.ToInt64(emailNotifInterval.Text);
28 | }
29 |
30 | private void imageFileInterval_Leave(object sender, EventArgs e)
31 | {
32 | imageFileInterval.Text = Valid.verifyDouble(imageFileInterval.Text, 0.1, 9999, "1");
33 | ConfigurationHelper.GetCurrentProfile().imageSaveInterval = Convert.ToDouble(imageFileInterval.Text);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/EmailHostSettingsCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using TeboCam.TebocamControls;
4 |
5 | namespace TeboCam
6 | {
7 | public partial class EmailHostSettingsCntl : TebocamCntl
8 | {
9 | IMail mail;
10 | public Size PanelSize;
11 |
12 | public EmailHostSettingsCntl(IMail imail)
13 | {
14 | InitializeComponent();
15 | mail = imail;
16 | SetFieldValues();
17 | SetExtraControls();
18 | }
19 |
20 | public void SetUser(string val) { emailUser.Text = val; }
21 | public void SetHost(string val) { smtpHost.Text = val; }
22 | public void SetPort(string val) { smtpPort.Text = val; }
23 | public void SetSsl(bool val) { SSL.Checked = val; }
24 |
25 | private void SetExtraControls()
26 | {
27 | //var emailPasswordCntl = new PasswordCntl("Email Password", data.emailPass, delegate (Object sender, PasswordChangedArgs args) { ConfigurationHelper.GetCurrentProfile().emailPass = args.password; }, 294);
28 | //AddControl(emailPasswordCntl, emailHostSettings.Controls, new Point(16,120));
29 | emailPasswordCntl.SetDesiredWidth(294);
30 | emailPasswordCntl.SetTitle("Email Password");
31 | emailPasswordCntl.SetPaswordFieldColour(Color.LemonChiffon);
32 | emailPasswordCntl.SetValue(ConfigurationHelper.GetCurrentProfile().emailPass);
33 | emailPasswordCntl.SetPasswordChanged(delegate (Object sender, PasswordChangedArgs args) { ConfigurationHelper.GetCurrentProfile().emailPass = args.password; });
34 | }
35 |
36 | public override void AfterControlAdded()
37 | {
38 | emailPasswordCntl.AfterControlAdded();
39 | }
40 |
41 | private void SetFieldValues()
42 | {
43 | emailUser.Text = ConfigurationHelper.GetCurrentProfile().emailUser;
44 | smtpHost.Text = ConfigurationHelper.GetCurrentProfile().smtpHost;
45 | smtpPort.Text = ConfigurationHelper.GetCurrentProfile().smtpPort.ToString();
46 | SSL.Checked = ConfigurationHelper.GetCurrentProfile().EnableSsl;
47 | }
48 |
49 | private void TestBtn_Click(object sender, EventArgs e)
50 | {
51 | mail.SetTestStatus(9);
52 |
53 | var eml = new EmailFields()
54 | {
55 | SentBy = ConfigurationHelper.GetCurrentProfile().sentBy,
56 | SentByName = ConfigurationHelper.GetCurrentProfile().sentByName,
57 | SendTo = ConfigurationHelper.GetCurrentProfile().sendTo,
58 | Subject = "TeboCam Test",
59 | BodyText = "This is a test email from TeboCam",
60 | ReplyTo = ConfigurationHelper.GetCurrentProfile().replyTo,
61 | Attachments = false,
62 | CurrentTime = time.secondsSinceStart(),
63 | User = ConfigurationHelper.GetCurrentProfile().emailUser,
64 | Password = ConfigurationHelper.GetCurrentProfile().emailPass,
65 | SmtpHost = ConfigurationHelper.GetCurrentProfile().smtpHost,
66 | SmtpPort = ConfigurationHelper.GetCurrentProfile().smtpPort,
67 | EnableSsl = ConfigurationHelper.GetCurrentProfile().EnableSsl
68 | };
69 |
70 | mail.sendEmail(eml);
71 |
72 | //huge code smell!!!
73 | while (mail.GetTestStatus() == 9) { }
74 | //huge code smell!!!
75 |
76 | if (mail.GetTestStatus() == 1)
77 | {
78 | MessageDialog.messageInform("It looks like the email test was successful", "Check your email");
79 | }
80 | else
81 | {
82 | MessageDialog.messageAlert("It looks like the email test was unsuccessful", "Check your email settings");
83 | }
84 | mail.SetTestStatus(0);
85 | }
86 |
87 | private void emailUser_TextChanged(object sender, EventArgs e)
88 | {
89 | ConfigurationHelper.GetCurrentProfile().emailUser = emailUser.Text;
90 | }
91 |
92 | private void smtpHost_TextChanged(object sender, EventArgs e)
93 | {
94 | ConfigurationHelper.GetCurrentProfile().smtpHost = smtpHost.Text;
95 | }
96 |
97 | private void smtpPort_Leave(object sender, EventArgs e)
98 | {
99 | smtpPort.Text = Valid.verifyInt(smtpPort.Text, 0, 99999, "25");
100 | ConfigurationHelper.GetCurrentProfile().smtpPort = Convert.ToInt32(smtpPort.Text);
101 | }
102 |
103 | private void SSL_CheckedChanged(object sender, EventArgs e)
104 | {
105 | ConfigurationHelper.GetCurrentProfile().EnableSsl = SSL.Checked;
106 | }
107 |
108 | private void emailUser_Leave(object sender, EventArgs e)
109 | {
110 | if (!mail.validEmail(emailUser.Text))
111 | {
112 | MessageDialog.messageAlert("'Email User' is not a valid email address", "Invalid Email");
113 | emailUser.BackColor = Color.Red;
114 | }
115 | else
116 | {
117 | emailUser.BackColor = Color.LemonChiffon;
118 | }
119 | }
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/EmailIntelligenceCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeboCam
5 | {
6 | public partial class EmailIntelligenceCntl : UserControl
7 | {
8 | public EmailIntelligenceCntl()
9 | {
10 | InitializeComponent();
11 | }
12 |
13 | public void SetEmailIntelOn(bool val) { EmailIntelOn.Checked = val; }
14 | public void SetEmailIntelEmails(int val) { emailIntelEmails.Text = val.ToString(); }
15 | public void SetEmailIntelMins(int val) { emailIntelMins.Text = val.ToString(); }
16 | public void SetEmailIntelStop(bool val) { EmailIntelStop.Checked = val; }
17 | public void SetEmailIntelMosaic(bool val) { EmailIntelMosaic.Checked = val; }
18 | public void Set(bool val) { EmailIntelMosaic.Checked = val; }
19 |
20 | private void EmailIntelOn_CheckedChanged(object sender, EventArgs e)
21 | {
22 | emailIntelPanel.Enabled = EmailIntelOn.Checked;
23 | ConfigurationHelper.GetCurrentProfile().EmailIntelOn = EmailIntelOn.Checked;
24 | }
25 |
26 | private void emailIntelEmails_Leave(object sender, EventArgs e)
27 | {
28 | emailIntelEmails.Text = Valid.verifyInt(emailIntelEmails.Text, 1, 9999, "1");
29 | ConfigurationHelper.GetCurrentProfile().emailIntelEmails = Convert.ToInt32(emailIntelEmails.Text);
30 | }
31 |
32 | private void emailIntelMins_Leave(object sender, EventArgs e)
33 | {
34 | emailIntelMins.Text = Valid.verifyInt(emailIntelMins.Text, 1, 9999, "1");
35 | ConfigurationHelper.GetCurrentProfile().emailIntelMins = Convert.ToInt32(emailIntelMins.Text);
36 | }
37 |
38 | private void EmailIntelStop_CheckedChanged(object sender, EventArgs e)
39 | {
40 | ConfigurationHelper.GetCurrentProfile().EmailIntelStop = EmailIntelStop.Checked;
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/EmailSettingsCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 |
6 | namespace TeboCam
7 | {
8 | public partial class EmailSettingsCntl : UserControl
9 | {
10 | private IMail mail;
11 |
12 | public EmailSettingsCntl(IMail email)
13 | {
14 | InitializeComponent();
15 | mail = email;
16 | SetFieldValues();
17 | }
18 |
19 | public void SetPingSubject(string val) { pingSubject.Text = val; }
20 | public void SetSentByName(string val) { sentByName.Text = val; }
21 | public void SetMailBody(string val) { mailBody.Text = val; }
22 | public void SetMailSubject(string val) { mailSubject.Text = val; }
23 | public void SetReplyTo(string val) { replyTo.Text = val; }
24 | public void SetSendTo(string val) { sendTo.Text = val; }
25 | public void SetSentBy(string val) { sentBy.Text = val; }
26 |
27 | private void SetFieldValues()
28 | {
29 | pingSubject.Text = ConfigurationHelper.GetCurrentProfile().pingSubject;
30 | sentByName.Text = ConfigurationHelper.GetCurrentProfile().sentByName;
31 | mailBody.Text = ConfigurationHelper.GetCurrentProfile().mailBody;
32 | mailSubject.Text = ConfigurationHelper.GetCurrentProfile().mailSubject;
33 | replyTo.Text = ConfigurationHelper.GetCurrentProfile().replyTo;
34 | sendTo.Text = ConfigurationHelper.GetCurrentProfile().sendTo;
35 | sentBy.Text = ConfigurationHelper.GetCurrentProfile().sentBy;
36 | }
37 |
38 | private void sendTo_Leave(object sender, EventArgs e)
39 | {
40 | string[] emails = sendTo.Text.Split(';');
41 | var nonValidEmailAddressPresent = emails.Any(x => !mail.validEmail(x));
42 |
43 | if (nonValidEmailAddressPresent)
44 | {
45 | MessageDialog.messageAlert("'Send Email To' contains valid email address", "Invalid Email");
46 | sendTo.BackColor = Color.Red;
47 | }
48 | else
49 | {
50 | sendTo.BackColor = Color.LemonChiffon;
51 | }
52 | }
53 |
54 | private void sendTo_TextChanged(object sender, EventArgs e)
55 | {
56 | ConfigurationHelper.GetCurrentProfile().sendTo = sendTo.Text;
57 | }
58 |
59 | private void sentBy_Leave(object sender, EventArgs e)
60 | {
61 | if (!mail.validEmail(sentBy.Text))
62 | {
63 | MessageDialog.messageAlert("'Sent By' is not a valid email address", "Invalid Email");
64 | sentBy.BackColor = Color.Red;
65 | }
66 | else
67 | {
68 | sentBy.BackColor = Color.LemonChiffon;
69 | }
70 | }
71 |
72 | private void sentBy_TextChanged(object sender, EventArgs e)
73 | {
74 | ConfigurationHelper.GetCurrentProfile().sentBy = sentBy.Text;
75 | }
76 |
77 | private void replyTo_Leave(object sender, EventArgs e)
78 | {
79 | if (!mail.validEmail(replyTo.Text))
80 | {
81 | MessageDialog.messageAlert("'Reply To' is not a valid email address", "Invalid Email");
82 | replyTo.BackColor = Color.Red;
83 | }
84 | else
85 | {
86 | replyTo.BackColor = Color.LemonChiffon;
87 | }
88 | }
89 |
90 | private void replyTo_TextChanged(object sender, EventArgs e)
91 | {
92 | ConfigurationHelper.GetCurrentProfile().replyTo = replyTo.Text;
93 | }
94 |
95 | private void mailSubject_TextChanged(object sender, EventArgs e)
96 | {
97 | ConfigurationHelper.GetCurrentProfile().mailSubject = mailSubject.Text;
98 | }
99 |
100 | private void mailBody_TextChanged(object sender, EventArgs e)
101 | {
102 | ConfigurationHelper.GetCurrentProfile().mailBody = mailBody.Text;
103 | }
104 |
105 | private void pingSubject_TextChanged(object sender, EventArgs e)
106 | {
107 | ConfigurationHelper.GetCurrentProfile().pingSubject = pingSubject.Text;
108 | }
109 |
110 | private void sentByName_TextChanged(object sender, EventArgs e)
111 | {
112 | ConfigurationHelper.GetCurrentProfile().sentByName = sentByName.Text;
113 | }
114 |
115 | private void label5_Click(object sender, EventArgs e)
116 | {
117 |
118 | }
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/FileAdminCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Windows.Forms;
4 |
5 | namespace TeboCam
6 | {
7 | public partial class FileAdminCntl : UserControl
8 | {
9 | IFileInfo FileInfo;
10 | private Dictionary FileType;
11 | private Form containingForm;
12 |
13 | public TextBox GetLogsKeep() { return logsKeep; }
14 | public CheckBox GetLogsKeepChk() { return logsKeepChk; }
15 |
16 | private class ComboboxItem
17 | {
18 | public string Text { get; set; }
19 | public object Value { get; set; }
20 |
21 | public override string ToString()
22 | {
23 | return Text;
24 | }
25 | }
26 |
27 | public FileAdminCntl(IFileInfo fileInfo, Form form)
28 | {
29 | InitializeComponent();
30 | FileInfo = fileInfo;
31 | containingForm = form;
32 | PrepareData();
33 | PopulateFileTypesDropdown();
34 |
35 | containingForm.FormClosing += new FormClosingEventHandler(formClosing);
36 | }
37 |
38 | void formClosing(object sender, FormClosingEventArgs e)
39 | {
40 | logsKeep.Text = Valid.verifyInt(logsKeep.Text, 1, 99999, "30");
41 | ConfigurationHelper.GetCurrentProfile().logsKeep = Convert.ToInt32(logsKeep.Text);
42 | }
43 |
44 | private void PrepareData()
45 | {
46 | FileType = FileInfo.GetFileTypes();
47 | }
48 |
49 | private void PopulateFileTypesDropdown()
50 | {
51 | //https://stackoverflow.com/a/3063421
52 | foreach (var keyValuePair in FileType)
53 | {
54 | ComboboxItem item = new ComboboxItem();
55 | item.Value = keyValuePair.Key;
56 | item.Text = keyValuePair.Value;
57 | FileTypeList.Items.Add(item);
58 | }
59 |
60 | FileTypeList.SelectedIndex = 0;
61 | }
62 |
63 | private void FileTypeList_SelectedIndexChanged(object sender, EventArgs e)
64 | {
65 | var id = SelectedId();
66 | lblFileCount.Text = $"{FileInfo.GetTypeForId(id)} count: {FileInfo.GetCountForId(id)}";
67 | lblFileSize.Text = $"{FileInfo.GetTypeForId(id)} size(kB): {FileInfo.GetSizeForId(id)}";
68 | }
69 |
70 | private string SelectedId()
71 | {
72 | return (FileTypeList.SelectedItem as ComboboxItem).Value.ToString();
73 | }
74 |
75 | private void btnZipAndVaultSelectedFiles_Click(object sender, EventArgs e)
76 | {
77 | FileInfo.ArchiveFiles(SelectedId());
78 | }
79 |
80 | private void btnDeleteFiles_Click(object sender, EventArgs e)
81 | {
82 | FileInfo.DeleteFiles(SelectedId());
83 | }
84 |
85 |
86 | private void logsKeepChk_CheckedChanged(object sender, EventArgs e)
87 | {
88 | ConfigurationHelper.GetCurrentProfile().logsKeepChk = logsKeepChk.Checked;
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/FrameRateCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeboCam
5 | {
6 | public partial class FrameRateCntl : UserControl
7 | {
8 | public FrameRateCntl()
9 | {
10 | InitializeComponent();
11 | }
12 |
13 | public NumericUpDown GetNumFrameRateCalcOver() { return numFrameRateCalcOver; }
14 | public CheckBox GetChkFrameRateTrack() { return chkFrameRateTrack; }
15 |
16 | private void chkFrameRateTrack_CheckedChanged(object sender, EventArgs e)
17 | {
18 | ConfigurationHelper.GetCurrentProfile().framerateTrack = chkFrameRateTrack.Checked;
19 | CameraRig.ConnectedCameras.ForEach(x => x.camera.frameRateTrack = chkFrameRateTrack.Checked);
20 | }
21 |
22 | private void numFrameRateCalcOver_Leave(object sender, EventArgs e)
23 | {
24 | ConfigurationHelper.GetCurrentProfile().framesSecsToCalcOver = (int)numFrameRateCalcOver.Value;
25 | }
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/FreezeGuardCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeboCam
5 | {
6 | public partial class FreezeGuardCntl : UserControl
7 | {
8 | public delegate void pulseStopEventDelegate();
9 | pulseStopEventDelegate pulseStopEvent;
10 |
11 | public FreezeGuardCntl(pulseStopEventDelegate pulseStop)
12 | {
13 | InitializeComponent();
14 | pulseStopEvent = pulseStop;
15 | }
16 |
17 | public void SetFreezeGuardOn(bool val) { freezeGuardOn.Checked = val; }
18 | public void SetFreezeGuardWindow(bool val) { freezeGuardWindow.Checked = val; }
19 | public void SetPulseFreq(string val) { pulseFreq.Text = val; }
20 |
21 | private void button15_Click(object sender, EventArgs e)
22 | {
23 | if (button15.Text == "Test FreezeGuard")
24 | {
25 |
26 | pulseStopEvent();
27 | button15.Text = "Pulse Stopped";
28 |
29 | }
30 | else
31 | {
32 |
33 | pulseStopEvent();
34 | button15.Text = "Test FreezeGuard";
35 |
36 | }
37 | }
38 |
39 | private void freezeGuardOn_CheckedChanged(object sender, EventArgs e)
40 | {
41 | ConfigurationHelper.GetCurrentProfile().freezeGuard = freezeGuardOn.Checked;
42 | }
43 |
44 | private void pulseFreq_Leave(object sender, EventArgs e)
45 | {
46 | decimal result = 1m;
47 |
48 | if (!Valid.IsDecimal(pulseFreq.Text))
49 | {
50 |
51 | pulseFreq.Text = "0.5";
52 |
53 | }
54 | else
55 | {
56 |
57 | result = Convert.ToDecimal(pulseFreq.Text);
58 |
59 | if (result > 1m || result < 0.1m)
60 | {
61 | result = 1m;
62 | }
63 |
64 | pulseFreq.Text = result.ToString();
65 |
66 | }
67 |
68 | ConfigurationHelper.GetCurrentProfile().pulseFreq = result;
69 |
70 | }
71 |
72 | private void freezeGuardWindow_CheckedChanged(object sender, EventArgs e)
73 | {
74 | ConfigurationHelper.GetCurrentProfile().freezeGuardWindowShow = freezeGuardWindow.Checked;
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/FtpSettingsCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeboCam
5 | {
6 | public partial class FtpSettingsCntl : UserControl
7 | {
8 | private ILog log;
9 |
10 | public FtpSettingsCntl(ILog logger)
11 | {
12 | InitializeComponent();
13 | log = logger;
14 | SetFieldValues();
15 | }
16 |
17 | public void SetUser(string val) { ftpUser.Text = val; }
18 | public void SetRoot(string val) { ftpRoot.Text = val; }
19 |
20 | private void SetFieldValues()
21 | {
22 | ftpUser.Text = ConfigurationHelper.GetCurrentProfile().ftpUser;
23 | ftpRoot.Text = ConfigurationHelper.GetCurrentProfile().ftpRoot;
24 | }
25 |
26 |
27 | private void button2_Click(object sender, EventArgs e)
28 | {
29 | ftp.testFtp = true;
30 | ftp.testFtpError = false;
31 | FileManager.WriteFile("test");
32 | log.AddLine("ftp test: uploading file");
33 | ftp.Upload(TebocamState.xmlFolder + FileManager.testFile + ".xml", ConfigurationHelper.GetCurrentProfile().ftpRoot, ConfigurationHelper.GetCurrentProfile().ftpUser, ConfigurationHelper.GetCurrentProfile().ftpPass);
34 |
35 | if (!ftp.testFtpError)
36 | {
37 | TebocamState.log.AddLine("ftp test: deleting file");
38 | ftp.DeleteFTP(FileManager.testFile + ".xml", ConfigurationHelper.GetCurrentProfile().ftpRoot, ConfigurationHelper.GetCurrentProfile().ftpUser, ConfigurationHelper.GetCurrentProfile().ftpPass, false);
39 | if (ftp.testFtpError)
40 | {
41 | log.AddLine("Error with test ftp: deleting file");
42 | MessageDialog.messageInform("Error with test ftp: deleting file", "Error");
43 | }
44 | }
45 | else
46 | {
47 | log.AddLine("Error with test ftp: uploading file");
48 | MessageDialog.messageInform("Error with test ftp: uploading file", "Error");
49 | }
50 |
51 | if (!ftp.testFtpError)
52 | {
53 | MessageDialog.messageInform("Ftp test was successful!", "Success");
54 | }
55 |
56 | ftp.testFtp = false;
57 | ftp.testFtpError = false;
58 | }
59 |
60 | private void ftpUser_TextChanged(object sender, EventArgs e)
61 | {
62 | ConfigurationHelper.GetCurrentProfile().ftpUser = ftpUser.Text;
63 | }
64 |
65 | private void ftpRoot_TextChanged(object sender, EventArgs e)
66 | {
67 | ConfigurationHelper.GetCurrentProfile().ftpRoot = ftpRoot.Text;
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/GenerateWebpageCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeboCam
5 | {
6 | public partial class GenerateWebpageCntl : UserControl
7 | {
8 | public GenerateWebpageCntl()
9 | {
10 | InitializeComponent();
11 | }
12 |
13 | public Label GetLblImgPref() { return lblImgPref; }
14 |
15 | private void button9_Click(object sender, EventArgs e)
16 | {
17 | SaveFileDialog test = new SaveFileDialog();
18 |
19 | test.Title = "Save WebPage...";
20 | test.DefaultExt = "html";
21 | test.AddExtension = true;
22 | test.Filter = "html files (*.html)|*.html|All files (*.*)|*.*";
23 | test.FileName = "index";
24 | test.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
25 |
26 | if (test.ShowDialog() == DialogResult.OK)
27 | {
28 | string tmpStr = test.FileName;
29 | webPage.writePage(ConfigurationHelper.GetCurrentProfile().filenamePrefix, TebocamState.ImgSuffix, Convert.ToInt32(numericUpDown3.Value), Convert.ToInt32(numericUpDown4.Value), tmpStr);
30 | }
31 | }
32 |
33 | private void numericUpDown3_ValueChanged(object sender, EventArgs e)
34 | {
35 | if (numericUpDown3.Value >= numericUpDown4.Value) { numericUpDown4.Value = numericUpDown3.Value + 1; }
36 | }
37 |
38 | private void numericUpDown4_ValueChanged(object sender, EventArgs e)
39 | {
40 | if (numericUpDown4.Value <= numericUpDown3.Value) { numericUpDown4.Value = numericUpDown3.Value + 1; }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/ImagesSavedFolderCntl.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam
2 | {
3 | partial class ImagesSavedFolderCntl
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.groupBox21 = new System.Windows.Forms.GroupBox();
32 | this.radioButton11 = new System.Windows.Forms.RadioButton();
33 | this.button21 = new System.Windows.Forms.Button();
34 | this.radioButton10 = new System.Windows.Forms.RadioButton();
35 | this.groupBox21.SuspendLayout();
36 | this.SuspendLayout();
37 | //
38 | // groupBox21
39 | //
40 | this.groupBox21.Controls.Add(this.radioButton11);
41 | this.groupBox21.Controls.Add(this.button21);
42 | this.groupBox21.Controls.Add(this.radioButton10);
43 | this.groupBox21.Location = new System.Drawing.Point(0, 0);
44 | this.groupBox21.Name = "groupBox21";
45 | this.groupBox21.Size = new System.Drawing.Size(423, 81);
46 | this.groupBox21.TabIndex = 65;
47 | this.groupBox21.TabStop = false;
48 | this.groupBox21.Text = "Images Saved Folder";
49 | //
50 | // radioButton11
51 | //
52 | this.radioButton11.AutoSize = true;
53 | this.radioButton11.ImeMode = System.Windows.Forms.ImeMode.NoControl;
54 | this.radioButton11.Location = new System.Drawing.Point(15, 46);
55 | this.radioButton11.Name = "radioButton11";
56 | this.radioButton11.Size = new System.Drawing.Size(100, 17);
57 | this.radioButton11.TabIndex = 1;
58 | this.radioButton11.Text = "Custom location";
59 | this.radioButton11.UseVisualStyleBackColor = true;
60 | this.radioButton11.CheckedChanged += new System.EventHandler(this.radioButton11_CheckedChanged);
61 | //
62 | // button21
63 | //
64 | this.button21.Enabled = false;
65 | this.button21.Font = new System.Drawing.Font("Verdana", 8.25F);
66 | this.button21.ImeMode = System.Windows.Forms.ImeMode.NoControl;
67 | this.button21.Location = new System.Drawing.Point(156, 46);
68 | this.button21.Name = "button21";
69 | this.button21.Size = new System.Drawing.Size(102, 21);
70 | this.button21.TabIndex = 61;
71 | this.button21.Text = "Select folder...";
72 | this.button21.UseVisualStyleBackColor = true;
73 | this.button21.Click += new System.EventHandler(this.button21_Click);
74 | //
75 | // radioButton10
76 | //
77 | this.radioButton10.AutoSize = true;
78 | this.radioButton10.Checked = true;
79 | this.radioButton10.ImeMode = System.Windows.Forms.ImeMode.NoControl;
80 | this.radioButton10.Location = new System.Drawing.Point(15, 23);
81 | this.radioButton10.Name = "radioButton10";
82 | this.radioButton10.Size = new System.Drawing.Size(99, 17);
83 | this.radioButton10.TabIndex = 0;
84 | this.radioButton10.TabStop = true;
85 | this.radioButton10.Text = "Default location";
86 | this.radioButton10.UseVisualStyleBackColor = true;
87 | //
88 | // ImagesSavedFolderCntl
89 | //
90 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
91 | this.Controls.Add(this.groupBox21);
92 | this.Name = "ImagesSavedFolderCntl";
93 | this.Size = new System.Drawing.Size(423, 81);
94 | this.groupBox21.ResumeLayout(false);
95 | this.groupBox21.PerformLayout();
96 | this.ResumeLayout(false);
97 |
98 | }
99 |
100 | #endregion
101 |
102 | private System.Windows.Forms.GroupBox groupBox21;
103 | private System.Windows.Forms.RadioButton radioButton11;
104 | private System.Windows.Forms.Button button21;
105 | private System.Windows.Forms.RadioButton radioButton10;
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/ImagesSavedFolderCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeboCam
5 | {
6 | public partial class ImagesSavedFolderCntl : UserControl
7 | {
8 | public ImagesSavedFolderCntl()
9 | {
10 | InitializeComponent();
11 | }
12 |
13 | public RadioButton GetRadioButton11() { return radioButton11; }
14 |
15 | private void button21_Click(object sender, EventArgs e)
16 | {
17 | FolderBrowserDialog dialog = new FolderBrowserDialog();
18 | dialog.SelectedPath = ConfigurationHelper.GetCurrentProfile().imageParentFolderCust;
19 |
20 | if (dialog.ShowDialog() == DialogResult.OK)
21 | {
22 | string parent = dialog.SelectedPath;
23 |
24 | if ((parent.Length < 7) || LeftRightMid.Right(parent, 7) != @"\images")
25 | {
26 | ConfigurationHelper.GetCurrentProfile().imageParentFolderCust = parent + @"\images\";
27 | ConfigurationHelper.GetCurrentProfile().imageFolderCust = ConfigurationHelper.GetCurrentProfile().imageParentFolderCust + @"fullSize\";
28 | ConfigurationHelper.GetCurrentProfile().thumbFolderCust = ConfigurationHelper.GetCurrentProfile().imageParentFolderCust + @"thumb\";
29 | TebocamState.imageParentFolder = ConfigurationHelper.GetCurrentProfile().imageParentFolderCust;
30 | TebocamState.imageFolder = ConfigurationHelper.GetCurrentProfile().imageFolderCust;
31 | TebocamState.thumbFolder = ConfigurationHelper.GetCurrentProfile().thumbFolderCust;
32 | FileManager.CreateDirIfNotExists(ConfigurationHelper.GetCurrentProfile().imageParentFolderCust);
33 | FileManager.CreateDirIfNotExists(ConfigurationHelper.GetCurrentProfile().imageFolderCust);
34 | FileManager.CreateDirIfNotExists(ConfigurationHelper.GetCurrentProfile().thumbFolderCust);
35 | }
36 | }
37 | }
38 |
39 | private void radioButton11_CheckedChanged(object sender, EventArgs e)
40 | {
41 | ConfigurationHelper.GetCurrentProfile().imageLocCust = radioButton11.Checked;
42 | button21.Enabled = radioButton11.Checked;
43 |
44 | if (!radioButton11.Checked)
45 | {
46 | ConfigurationHelper.GetCurrentProfile().imageParentFolderCust = TebocamState.imageParentFolder = Application.StartupPath + @"\images\";
47 | ConfigurationHelper.GetCurrentProfile().imageFolderCust = TebocamState.imageParentFolder + @"fullSize\";
48 | ConfigurationHelper.GetCurrentProfile().thumbFolderCust = TebocamState.imageParentFolder + @"thumb\";
49 | TebocamState.imageParentFolder = ConfigurationHelper.GetCurrentProfile().imageParentFolderCust;
50 | TebocamState.imageFolder = ConfigurationHelper.GetCurrentProfile().imageFolderCust;
51 | TebocamState.thumbFolder = ConfigurationHelper.GetCurrentProfile().thumbFolderCust;
52 | }
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/InternetConnectionCheckCntl.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam
2 | {
3 | partial class InternetConnectionCheckCntl
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.groupBox22 = new System.Windows.Forms.GroupBox();
32 | this.txtInternetConnection = new System.Windows.Forms.TextBox();
33 | this.groupBox22.SuspendLayout();
34 | this.SuspendLayout();
35 | //
36 | // groupBox22
37 | //
38 | this.groupBox22.Controls.Add(this.txtInternetConnection);
39 | this.groupBox22.Location = new System.Drawing.Point(0, 0);
40 | this.groupBox22.Name = "groupBox22";
41 | this.groupBox22.Size = new System.Drawing.Size(483, 60);
42 | this.groupBox22.TabIndex = 70;
43 | this.groupBox22.TabStop = false;
44 | this.groupBox22.Text = "Internet Connection Check";
45 | //
46 | // txtInternetConnection
47 | //
48 | this.txtInternetConnection.BackColor = System.Drawing.Color.LemonChiffon;
49 | this.txtInternetConnection.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold);
50 | this.txtInternetConnection.ForeColor = System.Drawing.SystemColors.WindowText;
51 | this.txtInternetConnection.Location = new System.Drawing.Point(6, 20);
52 | this.txtInternetConnection.Name = "txtInternetConnection";
53 | this.txtInternetConnection.Size = new System.Drawing.Size(471, 21);
54 | this.txtInternetConnection.TabIndex = 67;
55 | this.txtInternetConnection.Leave += new System.EventHandler(this.txtInternetConnection_Leave);
56 | //
57 | // InternetConnectionCheckCntl
58 | //
59 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
60 | this.Controls.Add(this.groupBox22);
61 | this.Name = "InternetConnectionCheckCntl";
62 | this.Size = new System.Drawing.Size(483, 60);
63 | this.groupBox22.ResumeLayout(false);
64 | this.groupBox22.PerformLayout();
65 | this.ResumeLayout(false);
66 |
67 | }
68 |
69 | #endregion
70 |
71 | private System.Windows.Forms.GroupBox groupBox22;
72 | private System.Windows.Forms.TextBox txtInternetConnection;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/InternetConnectionCheckCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeboCam
5 | {
6 | public partial class InternetConnectionCheckCntl : UserControl
7 | {
8 | public InternetConnectionCheckCntl()
9 | {
10 | InitializeComponent();
11 | }
12 |
13 | public TextBox GetTxtInternetConnection() { return txtInternetConnection; }
14 |
15 | private void txtInternetConnection_Leave(object sender, EventArgs e)
16 | {
17 | if (txtInternetConnection.Text.Trim() == "") txtInternetConnection.Text = "www.google.com";
18 | ConfigurationHelper.GetCurrentProfile().internetCheck = txtInternetConnection.Text;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/LogCntl.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam
2 | {
3 | partial class LogCntl
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.txtLog = new System.Windows.Forms.RichTextBox();
32 | this.SuspendLayout();
33 | //
34 | // txtLog
35 | //
36 | this.txtLog.BackColor = System.Drawing.Color.Black;
37 | this.txtLog.Font = new System.Drawing.Font("Calibri", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
38 | this.txtLog.ForeColor = System.Drawing.Color.White;
39 | this.txtLog.Location = new System.Drawing.Point(0, 0);
40 | this.txtLog.Name = "txtLog";
41 | this.txtLog.ReadOnly = true;
42 | this.txtLog.Size = new System.Drawing.Size(405, 217);
43 | this.txtLog.TabIndex = 37;
44 | this.txtLog.Text = "";
45 | this.txtLog.WordWrap = false;
46 | this.txtLog.DoubleClick += new System.EventHandler(this.txtLog_DoubleClick);
47 | //
48 | // LogCntl
49 | //
50 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
51 | this.BackColor = System.Drawing.SystemColors.Control;
52 | this.Controls.Add(this.txtLog);
53 | this.ForeColor = System.Drawing.Color.Black;
54 | this.Name = "LogCntl";
55 | this.Size = new System.Drawing.Size(405, 217);
56 | this.ResumeLayout(false);
57 |
58 | }
59 |
60 | #endregion
61 |
62 | private System.Windows.Forms.RichTextBox txtLog;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/LogCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 |
6 | namespace TeboCam
7 | {
8 | public partial class LogCntl : UserControl
9 | {
10 | Log log;
11 |
12 | public LogCntl(Log log)
13 | {
14 | InitializeComponent();
15 | this.log = log;
16 | }
17 |
18 | public RichTextBox GetTxtLog() { return txtLog; }
19 |
20 | private void txtLog_DoubleClick(object sender, EventArgs e)
21 | {
22 | Form frm = new Form();
23 | frm.Width = 400;
24 | frm.Height = 400;
25 | frm.FormBorderStyle = FormBorderStyle.FixedSingle;
26 | var logTxt = new RichTextBox();
27 | logTxt.BackColor = Color.LemonChiffon;
28 | logTxt.ScrollBars = RichTextBoxScrollBars.Both;
29 | logTxt.Dock = DockStyle.Fill;
30 | frm.Controls.Add(logTxt);
31 | logTxt.Text = txtLog.Text;
32 | log.LogAdded += new EventHandler(delegate (Object o, EventArgs a) { txtLog.SynchronisedInvoke(() => logTxt.Text = string.Format("{0} [{1}]", TebocamState.log.Lines.Last().Message, TebocamState.log.Lines.Last().DT.ToString("yyyy/MM/dd-HH:mm:ss:fff", System.Globalization.CultureInfo.InvariantCulture)) + "\n" + logTxt.Text); });
33 | frm.Show();
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/LogFileManagementCntl.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam
2 | {
3 | partial class LogFileManagementCntl
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.groupBox19 = new System.Windows.Forms.GroupBox();
32 | this.btnAdvancedFileManagement = new System.Windows.Forms.Button();
33 | this.groupBox19.SuspendLayout();
34 | this.SuspendLayout();
35 | //
36 | // groupBox19
37 | //
38 | this.groupBox19.Controls.Add(this.btnAdvancedFileManagement);
39 | this.groupBox19.Location = new System.Drawing.Point(0, 0);
40 | this.groupBox19.Name = "groupBox19";
41 | this.groupBox19.Size = new System.Drawing.Size(483, 89);
42 | this.groupBox19.TabIndex = 67;
43 | this.groupBox19.TabStop = false;
44 | this.groupBox19.Text = "Logs file management";
45 | //
46 | // btnAdvancedFileManagement
47 | //
48 | this.btnAdvancedFileManagement.Location = new System.Drawing.Point(16, 19);
49 | this.btnAdvancedFileManagement.Name = "btnAdvancedFileManagement";
50 | this.btnAdvancedFileManagement.Size = new System.Drawing.Size(442, 54);
51 | this.btnAdvancedFileManagement.TabIndex = 59;
52 | this.btnAdvancedFileManagement.Text = "Advanced file mangement options";
53 | this.btnAdvancedFileManagement.UseVisualStyleBackColor = true;
54 | this.btnAdvancedFileManagement.Click += new System.EventHandler(this.btnAdvancedFileManagement_Click);
55 | //
56 | // LogFileManagementCntl
57 | //
58 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
59 | this.Controls.Add(this.groupBox19);
60 | this.Name = "LogFileManagementCntl";
61 | this.Size = new System.Drawing.Size(483, 89);
62 | this.groupBox19.ResumeLayout(false);
63 | this.ResumeLayout(false);
64 |
65 | }
66 |
67 | #endregion
68 |
69 | private System.Windows.Forms.GroupBox groupBox19;
70 | private System.Windows.Forms.Button btnAdvancedFileManagement;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/LogFileManagementCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeboCam
5 | {
6 | public partial class LogFileManagementCntl : UserControl
7 | {
8 | IFileInfo FileInfo;
9 |
10 | public LogFileManagementCntl(IFileInfo fileInfo)
11 | {
12 | InitializeComponent();
13 | FileInfo = fileInfo;
14 | }
15 |
16 | private void btnAdvancedFileManagement_Click(object sender, EventArgs e)
17 | {
18 | Form frm = new Form();
19 | frm.Width = 414;
20 | frm.Height = 430;
21 | frm.FormBorderStyle = FormBorderStyle.FixedSingle;
22 | FileInfo.AddAggregates();
23 | var fileAdminCntl = new FileAdminCntl(FileInfo, frm);
24 |
25 | fileAdminCntl.GetLogsKeep().Text = ConfigurationHelper.GetCurrentProfile().logsKeep.ToString();
26 | fileAdminCntl.GetLogsKeepChk().Checked = ConfigurationHelper.GetCurrentProfile().logsKeepChk;
27 | frm.Controls.Add(fileAdminCntl);
28 | frm.ShowDialog();
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/MiscCntl.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam
2 | {
3 | partial class MiscCntl
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.grpMisc = new System.Windows.Forms.GroupBox();
32 | this.chkHideWhenMinimised = new System.Windows.Forms.CheckBox();
33 | this.infoMode = new System.Windows.Forms.CheckBox();
34 | this.grpMisc.SuspendLayout();
35 | this.SuspendLayout();
36 | //
37 | // grpMisc
38 | //
39 | this.grpMisc.Controls.Add(this.chkHideWhenMinimised);
40 | this.grpMisc.Controls.Add(this.infoMode);
41 | this.grpMisc.Location = new System.Drawing.Point(0, 0);
42 | this.grpMisc.Name = "grpMisc";
43 | this.grpMisc.Size = new System.Drawing.Size(353, 76);
44 | this.grpMisc.TabIndex = 75;
45 | this.grpMisc.TabStop = false;
46 | this.grpMisc.Text = "Misc";
47 | //
48 | // chkHideWhenMinimised
49 | //
50 | this.chkHideWhenMinimised.AutoSize = true;
51 | this.chkHideWhenMinimised.ImeMode = System.Windows.Forms.ImeMode.NoControl;
52 | this.chkHideWhenMinimised.Location = new System.Drawing.Point(11, 20);
53 | this.chkHideWhenMinimised.Name = "chkHideWhenMinimised";
54 | this.chkHideWhenMinimised.Size = new System.Drawing.Size(125, 17);
55 | this.chkHideWhenMinimised.TabIndex = 72;
56 | this.chkHideWhenMinimised.Text = "Hide when minimised";
57 | this.chkHideWhenMinimised.UseVisualStyleBackColor = true;
58 | this.chkHideWhenMinimised.CheckedChanged += new System.EventHandler(this.chkHideWhenMinimised_CheckedChanged);
59 | //
60 | // infoMode
61 | //
62 | this.infoMode.AutoSize = true;
63 | this.infoMode.ImeMode = System.Windows.Forms.ImeMode.NoControl;
64 | this.infoMode.Location = new System.Drawing.Point(11, 43);
65 | this.infoMode.Name = "infoMode";
66 | this.infoMode.Size = new System.Drawing.Size(171, 17);
67 | this.infoMode.TabIndex = 71;
68 | this.infoMode.Text = "Capture live system information";
69 | this.infoMode.UseVisualStyleBackColor = true;
70 | this.infoMode.CheckedChanged += new System.EventHandler(this.infoMode_CheckedChanged);
71 | //
72 | // MiscCntl
73 | //
74 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
75 | this.Controls.Add(this.grpMisc);
76 | this.Name = "MiscCntl";
77 | this.Size = new System.Drawing.Size(353, 76);
78 | this.grpMisc.ResumeLayout(false);
79 | this.grpMisc.PerformLayout();
80 | this.ResumeLayout(false);
81 |
82 | }
83 |
84 | #endregion
85 |
86 | private System.Windows.Forms.GroupBox grpMisc;
87 | private System.Windows.Forms.CheckBox chkHideWhenMinimised;
88 | private System.Windows.Forms.CheckBox infoMode;
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/MiscCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeboCam
5 | {
6 | public partial class MiscCntl : UserControl
7 | {
8 | public MiscCntl()
9 | {
10 | InitializeComponent();
11 | }
12 |
13 | public CheckBox GetChkHideWhenMinimised() { return chkHideWhenMinimised; }
14 |
15 | private void chkHideWhenMinimised_CheckedChanged(object sender, EventArgs e)
16 | {
17 | ConfigurationHelper.GetCurrentProfile().hideWhenMinimized = chkHideWhenMinimised.Checked;
18 | }
19 |
20 | private void infoMode_CheckedChanged(object sender, EventArgs e)
21 | {
22 | teboDebug.debugOn = infoMode.Checked;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/MovementStatisticsCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Windows.Forms;
4 |
5 | namespace TeboCam
6 | {
7 | public partial class MovementStatisticsCntl : UserControl
8 | {
9 | public MovementStatisticsCntl()
10 | {
11 | InitializeComponent();
12 | }
13 |
14 | public void SetRdStatsToFileOn(bool val) { rdStatsToFileOn.Checked = val; }
15 | public void SetPnlStatsToFile(bool val) { pnlStatsToFile.Enabled = val; }
16 | public void SetChkStatsToFileTimeStamp(bool val) { chkStatsToFileTimeStamp.Checked = val; }
17 | public void SetTxtStatsToFileMb(double val) { txtStatsToFileMb.Text = val.ToString(); }
18 |
19 | private void rdStatsToFileOn_CheckedChanged(object sender, EventArgs e)
20 | {
21 | pnlStatsToFile.Enabled = rdStatsToFileOn.Checked;
22 | ConfigurationHelper.GetCurrentProfile().StatsToFileOn = rdStatsToFileOn.Checked;
23 |
24 | if (ConfigurationHelper.GetCurrentProfile().StatsToFileLocation == string.Empty)
25 | {
26 | ConfigurationHelper.GetCurrentProfile().StatsToFileLocation = Application.StartupPath + "\\" + "MovementStats.txt";
27 | }
28 | }
29 |
30 | private void btnStatsToFileLocation_Click(object sender, EventArgs e)
31 | {
32 | SaveFileDialog statsDialog = new SaveFileDialog();
33 |
34 | if (ConfigurationHelper.GetCurrentProfile().StatsToFileLocation != string.Empty)
35 | {
36 | statsDialog.InitialDirectory = Path.GetDirectoryName(ConfigurationHelper.GetCurrentProfile().StatsToFileLocation);
37 | statsDialog.FileName = Path.GetFileName(ConfigurationHelper.GetCurrentProfile().StatsToFileLocation);
38 | }
39 | else
40 | {
41 | statsDialog.InitialDirectory = Application.StartupPath;
42 | statsDialog.FileName = "MovementStats";
43 | }
44 |
45 | statsDialog.Title = "Save Statistics";
46 | statsDialog.DefaultExt = "txt";
47 | statsDialog.AddExtension = true;
48 | statsDialog.Filter = "text files (*.txt)|*.txt|All files (*.*)|*.*";
49 |
50 | if (statsDialog.ShowDialog() == DialogResult.OK)
51 | {
52 | ConfigurationHelper.GetCurrentProfile().StatsToFileLocation = statsDialog.FileName;
53 | statistics.fileName = string.Empty;
54 | }
55 | }
56 |
57 | private void txtStatsToFileMb_Leave(object sender, EventArgs e)
58 | {
59 | txtStatsToFileMb.Text = Valid.verifyDouble(txtStatsToFileMb.Text, .01, double.MaxValue, "0.01");
60 | ConfigurationHelper.GetCurrentProfile().StatsToFileMb = Convert.ToDouble(txtStatsToFileMb.Text);
61 | }
62 |
63 | private void chkStatsToFileTimeStamp_CheckedChanged(object sender, EventArgs e)
64 | {
65 | ConfigurationHelper.GetCurrentProfile().StatsToFileTimeStamp = chkStatsToFileTimeStamp.Checked;
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/PasswordCntl.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam.TebocamControls
2 | {
3 | partial class PasswordCntl
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.PasswordField = new System.Windows.Forms.TextBox();
32 | this.PasswordShowHide = new System.Windows.Forms.Button();
33 | this.lblTitle = new System.Windows.Forms.Label();
34 | this.SuspendLayout();
35 | //
36 | // PasswordField
37 | //
38 | this.PasswordField.Location = new System.Drawing.Point(0, 16);
39 | this.PasswordField.Name = "PasswordField";
40 | this.PasswordField.Size = new System.Drawing.Size(158, 20);
41 | this.PasswordField.TabIndex = 0;
42 | this.PasswordField.TextChanged += new System.EventHandler(this.PasswordField_TextChanged);
43 | //
44 | // PasswordShowHide
45 | //
46 | this.PasswordShowHide.Location = new System.Drawing.Point(160, 15);
47 | this.PasswordShowHide.Name = "PasswordShowHide";
48 | this.PasswordShowHide.Size = new System.Drawing.Size(43, 23);
49 | this.PasswordShowHide.TabIndex = 1;
50 | this.PasswordShowHide.Text = "Show";
51 | this.PasswordShowHide.UseVisualStyleBackColor = true;
52 | this.PasswordShowHide.Click += new System.EventHandler(this.PasswordShowHide_Click);
53 | //
54 | // lblTitle
55 | //
56 | this.lblTitle.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold);
57 | this.lblTitle.ForeColor = System.Drawing.Color.Black;
58 | this.lblTitle.ImeMode = System.Windows.Forms.ImeMode.NoControl;
59 | this.lblTitle.Location = new System.Drawing.Point(0, 0);
60 | this.lblTitle.Name = "lblTitle";
61 | this.lblTitle.Size = new System.Drawing.Size(109, 13);
62 | this.lblTitle.TabIndex = 13;
63 | this.lblTitle.Text = "Title";
64 | //
65 | // PasswordCntl
66 | //
67 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
68 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
69 | this.BackColor = System.Drawing.Color.Transparent;
70 | this.Controls.Add(this.lblTitle);
71 | this.Controls.Add(this.PasswordShowHide);
72 | this.Controls.Add(this.PasswordField);
73 | this.Name = "PasswordCntl";
74 | this.Size = new System.Drawing.Size(210, 40);
75 | this.ResumeLayout(false);
76 | this.PerformLayout();
77 |
78 | }
79 |
80 | #endregion
81 |
82 | private System.Windows.Forms.TextBox PasswordField;
83 | private System.Windows.Forms.Button PasswordShowHide;
84 | private System.Windows.Forms.Label lblTitle;
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/PasswordCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 |
4 | namespace TeboCam.TebocamControls
5 | {
6 | public partial class PasswordCntl : TebocamCntl
7 | {
8 | private bool TextVisible = false;
9 | private TeboCamDelegates.EventDelegate PasswordChanged;
10 | const int minimumWidth = 10;
11 | private int desiredWidth = 0;
12 |
13 | public PasswordCntl()
14 | {
15 | InitializeComponent();
16 | }
17 |
18 | public override void AfterControlAdded()
19 | {
20 | SetWidth(desiredWidth);
21 | HidePassword();
22 | }
23 |
24 | public PasswordCntl(string title, string value, TeboCamDelegates.EventDelegate passwordChanged, int width = 0, Color? passwordFieldColour = null, bool visible = false)
25 | {
26 | InitializeComponent();
27 | SetPasswordChanged(passwordChanged);
28 | SetValue(value);
29 | SetTitle(title);
30 | SetPaswordFieldColour(passwordFieldColour);
31 | desiredWidth = width;
32 |
33 | if (visible)
34 | {
35 | ShowPassword();
36 | }
37 | else
38 | {
39 | HidePassword();
40 | }
41 | }
42 |
43 | public void SetPaswordFieldColour(Color? colour)
44 | {
45 | PasswordField.BackColor = colour ?? Color.LemonChiffon;
46 | }
47 |
48 | public void SetTitle(string title)
49 | {
50 | lblTitle.Text = title;
51 | }
52 |
53 | public void SetValue(string value)
54 | {
55 | PasswordField.Text = value;
56 | }
57 |
58 | public void SetPasswordChanged(TeboCamDelegates.EventDelegate passwordChanged)
59 | {
60 | PasswordChanged = passwordChanged;
61 | }
62 |
63 | public void SetDesiredWidth(int width)
64 | {
65 | desiredWidth = width;
66 | }
67 |
68 | private void SetWidth(int newWidth)
69 | {
70 | var gapWidth = PasswordShowHide.Location.X - (PasswordField.Location.X + PasswordField.Width);
71 | var initialControlWidth = Width;
72 | var initialPasswordFieldWidth = PasswordField.Width;
73 | var growth = newWidth - (initialPasswordFieldWidth + gapWidth + PasswordShowHide.Width);
74 | Width = initialControlWidth + growth;
75 |
76 | if (newWidth < PasswordShowHide.Size.Width + gapWidth + minimumWidth)
77 | {
78 | return;
79 | }
80 |
81 | PasswordField.Width = newWidth - gapWidth - PasswordShowHide.Size.Width;
82 | var yPos = PasswordShowHide.Location.Y;
83 | var buttonLocation = new Point(PasswordField.Location.X + PasswordField.Width + gapWidth, yPos);
84 | PasswordShowHide.Location = buttonLocation;
85 | //var totalWIdth = PasswordField.Width + gapWidth + PasswordShowHide.Width;
86 | //PasswordField.Width = newWidth;
87 | }
88 |
89 | private void PasswordShowHide_Click(object sender, EventArgs e)
90 | {
91 | if (TextVisible)
92 | {
93 | HidePassword();
94 | }
95 | else
96 | {
97 | ShowPassword();
98 | }
99 | }
100 |
101 | public void HidePassword()
102 | {
103 | PasswordField.PasswordChar = '*';
104 | PasswordShowHide.Text = "Show";
105 | TextVisible = false;
106 | }
107 |
108 | public void ShowPassword()
109 | {
110 | PasswordField.PasswordChar = '\0';
111 | PasswordShowHide.Text = "Hide";
112 | TextVisible = true;
113 | }
114 |
115 | private void PasswordField_TextChanged(object sender, EventArgs e)
116 | {
117 | if (PasswordChanged != null)
118 | {
119 | PasswordChanged(this, new PasswordChangedArgs() { password = PasswordField.Text });
120 | }
121 | }
122 | }
123 |
124 | public class PasswordChangedArgs : EventArgs
125 | {
126 | private string _password;
127 |
128 | public string password
129 | {
130 | get
131 | {
132 | return _password;
133 | }
134 | set
135 | {
136 | _password = value;
137 | }
138 | }
139 | }
140 | }
141 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/SecurityLockdownCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeboCam
5 | {
6 | public partial class SecurityLockdownCntl : UserControl
7 | {
8 | public delegate void LockTebocamDelegate();
9 | LockTebocamDelegate LockTebocam;
10 | public delegate void LockDownDelegate(bool hide);
11 | LockDownDelegate LockDown;
12 |
13 | public SecurityLockdownCntl(LockTebocamDelegate lockTebocam, LockDownDelegate lockDown)
14 | {
15 | InitializeComponent();
16 | LockTebocam = lockTebocam;
17 | LockDown = lockDown;
18 | }
19 |
20 | public TextBox GetTxtLockdownPassword() { return txtLockdownPassword; }
21 | public RadioButton GetRdLockdownOn() { return rdLockdownOn; }
22 | public Button GetBtnSecurityLockdownOn() { return btnSecurityLockdownOn; }
23 |
24 | private void btnSecurityLockdownOn_Click(object sender, EventArgs e)
25 | {
26 | LockTebocam();
27 | }
28 |
29 | private void rdLockdownOff_CheckedChanged(object sender, EventArgs e)
30 | {
31 | ConfigurationHelper.GetCurrentProfile().lockdownOn = !rdLockdownOff.Checked;
32 | LockDown(!rdLockdownOff.Checked);
33 | btnSecurityLockdownOn.Enabled = !rdLockdownOff.Checked;
34 | }
35 |
36 | private void txtLockdownPassword_Leave(object sender, EventArgs e)
37 | {
38 | ConfigurationHelper.GetCurrentProfile().lockdownPassword = txtLockdownPassword.Text;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/TebocamCntl.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam.TebocamControls
2 | {
3 | partial class TebocamCntl
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | components = new System.ComponentModel.Container();
32 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
33 | }
34 |
35 | #endregion
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/TebocamCntl.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace TeboCam.TebocamControls
4 | {
5 | public partial class TebocamCntl : UserControl
6 | {
7 | public TebocamCntl()
8 | {
9 | InitializeComponent();
10 | }
11 |
12 | public virtual void AfterControlAdded() { }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Tebocam/TebocamControls/UpdateOptionsCntl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace TeboCam
5 | {
6 | public partial class UpdateOptionsCntl : UserControl
7 | {
8 | public delegate void UpdaterInstallDelegate(bool val);
9 | UpdaterInstallDelegate updaterInstall;
10 | public delegate void KeepWorkingDelegate(bool val);
11 | KeepWorkingDelegate keepWorking;
12 | public delegate void SetAPiInstanceToOffDelegate();
13 | SetAPiInstanceToOffDelegate setAPiInstanceToOff;
14 |
15 | public UpdateOptionsCntl(UpdaterInstallDelegate updaterInstall,
16 | KeepWorkingDelegate keepWorking,
17 | SetAPiInstanceToOffDelegate setAPiInstanceToOff)
18 | {
19 | InitializeComponent();
20 | this.updaterInstall = updaterInstall;
21 | this.keepWorking = keepWorking;
22 | this.setAPiInstanceToOff = setAPiInstanceToOff;
23 | }
24 |
25 | public Label GetLblCurVer() { return lblCurVer; }
26 | public Label GetLblVerAvail() { return lblVerAvail; }
27 | public CheckBox GetUpdateNotify() { return updateNotify; }
28 | public Button GetBttInstallUpdateAdmin() { return bttInstallUpdateAdmin; }
29 | public TextBox GetUpdateDebugLocationn() { return updateDebugLocation; }
30 |
31 | public void TriggerUpdate()
32 | {
33 | updaterInstall(true);
34 | keepWorking(false);
35 | setAPiInstanceToOff();
36 | }
37 |
38 | private void updateNotify_CheckedChanged(object sender, EventArgs e)
39 | {
40 | ConfigurationHelper.GetCurrentProfile().updatesNotify = updateNotify.Checked;
41 | }
42 |
43 | private void updateDebugLocation_TextChanged(object sender, EventArgs e)
44 | {
45 | ConfigurationHelper.GetCurrentProfile().updateDebugLocation = updateDebugLocation.Text;
46 | }
47 |
48 | private void bttInstallUpdateAdmin_Click(object sender, EventArgs e)
49 | {
50 | TriggerUpdate();
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Tebocam/TebocamState.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using System.Windows.Forms;
4 |
5 |
6 | namespace TeboCam
7 | {
8 | public class Update_Version_Being_Used
9 | {
10 | public const string updateVersion = "201202022100";
11 | }
12 |
13 | public static class TebocamState
14 | {
15 | public static string imageParentFolder = Application.StartupPath + @"\images\";
16 | public static string imageFolder = imageParentFolder + @"fullSize\";
17 | public static string thumbFolder = imageParentFolder + @"thumb\";
18 | public static string logFolder = Application.StartupPath + @"\logs\";
19 | public static string exceptionFolder = Application.StartupPath + @"\exceptions\";
20 | public static string xmlFolder = Application.StartupPath + @"\xml\";
21 | public static string tmpFolder = Application.StartupPath + @"\temp\";
22 | public static string resourceFolder = Application.StartupPath + @"\resources\";
23 | public static string resourceDownloadFolder = resourceFolder + @"download\";
24 | public static string vaultFolder = Application.StartupPath + @"\vault\";
25 | public static string pulseApp = Application.StartupPath + @"\FreezeGuard.exe";
26 | public static string pulseProcessName = "FreezeGuard";
27 | public const string thumbPrefix = "tmb";
28 | public const string apiGraphImgPrefix = "apiGraphImg";
29 | public const string apiCameraImgPrefix = "apiCameraImg";
30 | public const string ImgSuffix = ".jpg";
31 | public const string mosaicFile = "mosaic.jpg";
32 | public static bool testImagePublishFirst = false;
33 | public static List testImagePublishData = new List();
34 | public static Movement.AlertClass Alert = new Movement.AlertClass();
35 | public static Configuration configuration;
36 | public static Log log = new Log();
37 | public static IException tebowebException;
38 | public static ArrayList training = new ArrayList();
39 | }
40 |
41 | public class ImagePublishData
42 | {
43 | public int Sequence;
44 | public int MotionLevel;
45 | public int LowestValueOverTime;
46 | public string ImageFile;
47 | public string CameraName;
48 | public long MillisecondsSinceStart;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Tebocam/TebowebException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | namespace TeboCam
4 | {
5 |
6 | public interface IException
7 | {
8 | void LogException(Exception a);
9 | }
10 |
11 | public class TebowebException : IException
12 | {
13 |
14 | readonly bool _exceptionsLoggedToFile;
15 | readonly string _exceptionFileName;
16 | readonly string _exceptionFilePath;
17 |
18 | public TebowebException(string exceptionFilePath, string exceptionFileName)
19 | {
20 | if (exceptionFilePath != null)
21 | {
22 | _exceptionFilePath = exceptionFilePath;
23 | _exceptionFileName = exceptionFileName;
24 | _exceptionsLoggedToFile = true;
25 | }
26 |
27 | }
28 |
29 | public void LogException(Exception e)
30 | {
31 | if (_exceptionsLoggedToFile)
32 | {
33 | ExceptionToFile(e.Message + Environment.NewLine + Environment.NewLine + e.StackTrace);
34 | }
35 | }
36 |
37 | private void ExceptionToFile(string exception)
38 | {
39 | using (StreamWriter w = new StreamWriter(Path.Combine(_exceptionFilePath, _exceptionFileName), true))
40 | {
41 | string time = string.Format("[{0}]", DateTime.Now.ToString("yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture));
42 | w.WriteLine();
43 | w.WriteLine(time);
44 | w.WriteLine(exception);
45 | }
46 | }
47 |
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Tebocam/Tests/Tests.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using System;
3 |
4 | namespace TeboCam.Tests
5 | {
6 | [TestFixture]
7 | public class Tests
8 | {
9 |
10 | [Test]
11 | [Description("SendEmailTest")]
12 | public static void SendEmailTest()
13 | {
14 | var secure = EmailSecurity();
15 | IMail email = new Mail();
16 | var eml = new EmailFields()
17 | {
18 | SentBy = secure.SentBy,
19 | SentByName = secure.SentByName,
20 | SendTo = "guythiebaut@gmail.com",
21 | Subject = "Unit Test SendEmailTest",
22 | BodyText = $"{DateTime.Now} - This is a unit test for SendEmailTest from Tebocam for mailOLD",
23 | ReplyTo = secure.ReplyTo,
24 | Attachments = false,
25 | CurrentTime = 1,
26 | User = secure.User,
27 | Password = secure.Password,
28 | SmtpHost = secure.SmtpHost,
29 | SmtpPort = secure.SmtpPort,
30 | EnableSsl = secure.EnableSsl
31 | };
32 | email.sendEmail(eml);
33 | }
34 |
35 | [Test]
36 | [Description("SendEmailOLDTest")]
37 | public static void SendEmailOLDTest()
38 | {
39 | var secure = EmailSecurity();
40 | IMail email = new mailOLD();
41 | var eml = new EmailFields()
42 | {
43 | SentBy = secure.SentBy,
44 | SentByName = secure.SentByName,
45 | SendTo = "guythiebaut@gmail.com",
46 | Subject = "Unit Test SendEmailTest",
47 | BodyText = $"{DateTime.Now} - This is a unit test for SendEmailTest from Tebocam",
48 | ReplyTo = secure.ReplyTo,
49 | Attachments = false,
50 | CurrentTime = 1,
51 | User = secure.User,
52 | Password = secure.Password,
53 | SmtpHost = secure.SmtpHost,
54 | SmtpPort = secure.SmtpPort,
55 | EnableSsl = secure.EnableSsl
56 | };
57 | email.sendEmail(eml);
58 | }
59 |
60 | [Test]
61 | [Description("DummyTest")]
62 | public static void DummyTest()
63 | {
64 | Assert.AreEqual(1, 1);
65 | }
66 |
67 | private static EmailSecure EmailSecurity()
68 | {
69 | return new EmailSecure()
70 | {
71 | SmtpHost = "smtp.livemail.co.uk",
72 | User = "mail@teboweb.com",
73 | Password = "karuna123",
74 | SentBy = "mail@teboweb.com",
75 | SentByName = "Guy Thiebaut",
76 | SendTo = "guythiebaut@gmail.com",
77 | ReplyTo = "mail@teboweb.com",
78 | SmtpPort = 25,
79 | EnableSsl = true
80 | };
81 |
82 | }
83 |
84 | private class EmailSecure
85 | {
86 | public string SmtpHost;
87 | public string User;
88 | public String Password;
89 | public string SentBy;
90 | public string SentByName;
91 | public string SendTo;
92 | public string ReplyTo;
93 | public int SmtpPort;
94 | public bool EnableSsl;
95 | }
96 |
97 |
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/Tebocam/Valid.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace TeboCam
4 | {
5 | public static class Valid
6 | {
7 | public static bool IsNumeric(string inString)
8 | {
9 | System.Text.RegularExpressions.Regex objNotWholePattern = new System.Text.RegularExpressions.Regex("[^0-9]");
10 | return !objNotWholePattern.IsMatch(inString)
11 | && (inString != "");
12 | }
13 |
14 | public static bool IsDecimal(string inString)
15 | {
16 | decimal dec;
17 | return Decimal.TryParse(inString, out dec);
18 | }
19 |
20 |
21 | public static bool filenamePrefixValid(string inString)
22 | {
23 | bool tmpBool = false;
24 |
25 | System.Text.RegularExpressions.Regex valid = new System.Text.RegularExpressions.Regex("[0-9a-zA-Z]");
26 |
27 | string tmpStr = "";
28 |
29 | for (int i = 0; i < inString.Length; i++)
30 | {
31 | tmpStr = LeftRightMid.Mid(inString, i, 1);
32 | tmpBool = valid.IsMatch(tmpStr);
33 | if (!tmpBool) { break; }
34 | }
35 |
36 | return tmpBool;
37 |
38 | }
39 |
40 | public static string verifyInt(string inVal, Int64 lowerLimit, Int64 upperLimit, string errorVal)
41 | {
42 | try
43 | {
44 |
45 | if (!Valid.IsNumeric(inVal)) { return errorVal; }
46 |
47 | if (Convert.ToInt32(inVal) >= lowerLimit && Convert.ToInt32(inVal) <= upperLimit)
48 | { return inVal; }
49 | else
50 | { return errorVal; }
51 | }
52 |
53 | catch (Exception e)
54 | {
55 | TebocamState.tebowebException.LogException(e);
56 | return errorVal;
57 | }
58 | }
59 |
60 | public static string verifyDouble(string inVal, double lowerLimit, double upperLimit, string errorVal)
61 | {
62 | double tmpDouble;
63 |
64 | if (!double.TryParse(inVal, out tmpDouble))
65 | {
66 | return errorVal;
67 | }
68 | else
69 | {
70 | if (tmpDouble >= lowerLimit && tmpDouble <= upperLimit)
71 | {
72 | return inVal;
73 | }
74 | else
75 | {
76 | return errorVal;
77 | }
78 | }
79 | }
80 |
81 | public static string doubleConvert(string decString)
82 | {
83 | return Decimal.Parse(decString, new System.Globalization.CultureInfo("en-GB")).ToString();
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/Tebocam/WaitForCam.cs:
--------------------------------------------------------------------------------
1 | using AForge.Video.DirectShow;
2 | using System;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Net;
6 | using System.Net.NetworkInformation;
7 | using System.Threading;
8 |
9 | namespace TeboCam
10 | {
11 | public class WaitForCam
12 | {
13 | public delegate Camera OpenVideoSourceDelegate(VideoCaptureDevice source, AForge.Video.MJPEGStream ipStream, Boolean ip, int cameraNo);
14 | OpenVideoSourceDelegate OpenVideoSource;
15 | Configuration configuration;
16 | FilterInfoCollection filters;
17 | public delegate void PublishDelegate(int buttonNo);
18 | PublishDelegate publishCam;
19 |
20 | public WaitForCam(Configuration configuration, OpenVideoSourceDelegate OpenVideoSource, PublishDelegate publishCam)
21 | {
22 | this.configuration = configuration;
23 | this.OpenVideoSource = OpenVideoSource;
24 | this.publishCam = publishCam;
25 | }
26 |
27 | public void wait(object sender, DoWorkEventArgs e)
28 | {
29 | bool nocam;
30 | //List expectedCameras = CameraRig.cameraCredentialsListedUnderProfile(TebocamState.profileInUse);
31 | var profile = configuration.appConfigs.Where(x => x.profileName == ConfigurationHelper.GetCurrentProfileName()).First();
32 | //*****************************
33 | //IP Webcams
34 | //*****************************
35 |
36 | //find if any webcams are present
37 | for (int i = 0; i < profile.camConfigs.Count; i++)
38 | {
39 | //we have an ip webcam in the profile
40 | if (profile.camConfigs[i].ipWebcamAddress != string.Empty)
41 | {
42 | IPAddress parsedIpAddress;
43 | Uri parsedUri;
44 | //check that the url resolves
45 |
46 | //https://www.codeproject.com/Articles/1017223/CaptureManager-SDK-Capturing-Recording-and-Streami
47 | //https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_1MB.mp4
48 |
49 | if (Uri.TryCreate(profile.camConfigs[i].ipWebcamAddress, UriKind.Absolute, out parsedUri) && IPAddress.TryParse(parsedUri.DnsSafeHost, out parsedIpAddress))
50 | {
51 | var pingSender = new System.Net.NetworkInformation.Ping();
52 | PingReply reply = pingSender.Send(parsedIpAddress);
53 | //is ip webcam running?
54 | if (reply.Status == IPStatus.Success)
55 | {
56 | AForge.Video.MJPEGStream stream = new AForge.Video.MJPEGStream(profile.camConfigs[i].ipWebcamAddress);
57 |
58 | if (profile.camConfigs[i].ipWebcamUser != string.Empty)
59 | {
60 | stream.Login = profile.camConfigs[i].ipWebcamUser;
61 | stream.Password = profile.camConfigs[i].ipWebcamPassword;
62 | }
63 |
64 | Camera cam = OpenVideoSource(null, stream, true, -1);
65 | cam.frameRateTrack = ConfigurationHelper.GetCurrentProfile().framerateTrack;
66 |
67 | }
68 | }
69 | }
70 | }
71 |
72 | //*****************************
73 | //IP Webcams
74 | //*****************************
75 |
76 | //*****************************
77 | //USB Webcams
78 | //*****************************
79 | nocam = false;
80 |
81 | try
82 | {
83 | filters = new FilterInfoCollection(FilterCategory.VideoInputDevice);
84 | if (filters.Count == 0) nocam = true;
85 | }
86 | catch (ApplicationException)
87 | {
88 | nocam = true;
89 | }
90 |
91 |
92 | //we have camera(s) attached so let's connect it/them
93 | if (!nocam)
94 | {
95 | for (int i = 0; i < filters.Count; i++)
96 | {
97 | for (int c = 0; c < profile.camConfigs.Count; c++)
98 | {
99 | if (profile.camConfigs[c].ipWebcamAddress == string.Empty && filters[i].MonikerString == profile.camConfigs[c].webcam)
100 | {
101 | Thread.Sleep(1000);
102 | VideoCaptureDevice localSource = new VideoCaptureDevice(profile.camConfigs[c].webcam);
103 | Camera cam = OpenVideoSource(localSource, null, false, -1);
104 | cam.frameRateTrack = ConfigurationHelper.GetCurrentProfile().framerateTrack;
105 | }
106 | }
107 | }
108 | }
109 |
110 | //*****************************
111 | //USB Webcams
112 | //*****************************
113 |
114 | CameraRig.ConnectedCameras.ForEach(x => x.camera.frameRateTrack = ConfigurationHelper.GetCurrentProfile().framerateTrack);
115 |
116 |
117 | var publishButtonsSet = 0;
118 | foreach (var connectedCamera in CameraRig.ConnectedCameras)
119 | {
120 | if (connectedCamera.camera.publishActive)
121 | {
122 | publishCam(connectedCamera.displayButton);
123 | publishButtonsSet++;
124 | }
125 | }
126 |
127 | if (publishButtonsSet == 0 && CameraRig.ConnectedCameras.Any())
128 | {
129 | publishCam(CameraRig.ConnectedCameras.First().displayButton);
130 | }
131 | }
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/Tebocam/analyse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Drawing;
3 |
4 | namespace TeboCam
5 | {
6 | public class analyse
7 | {
8 |
9 | public List images = new List();
10 |
11 |
12 | public void newPictureControl(Bitmap picture, string name, long time, Color colour, int level)
13 | {
14 | analysePictureControl pic = new analysePictureControl(picture, name, time, colour, level);
15 | images.Add(pic);
16 | }
17 |
18 | public void newPictureControl(string picture, string name, long time, Color colour, int level)
19 | {
20 | var bitmap = new Bitmap(picture);
21 | analysePictureControl pic = new analysePictureControl(bitmap, name, time, colour, level);
22 | images.Add(pic);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Tebocam/analysePictureControl.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam
2 | {
3 | partial class analysePictureControl
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.imageBorder = new System.Windows.Forms.PictureBox();
32 | this.imageBox = new System.Windows.Forms.PictureBox();
33 | ((System.ComponentModel.ISupportInitialize)(this.imageBorder)).BeginInit();
34 | ((System.ComponentModel.ISupportInitialize)(this.imageBox)).BeginInit();
35 | this.SuspendLayout();
36 | //
37 | // imageBorder
38 | //
39 | this.imageBorder.BackColor = System.Drawing.SystemColors.Control;
40 | this.imageBorder.Location = new System.Drawing.Point(0, 0);
41 | this.imageBorder.Name = "imageBorder";
42 | this.imageBorder.Size = new System.Drawing.Size(120, 120);
43 | this.imageBorder.TabIndex = 0;
44 | this.imageBorder.TabStop = false;
45 | this.imageBorder.Paint += new System.Windows.Forms.PaintEventHandler(this.imageBorder_Paint);
46 | //
47 | // imageBox
48 | //
49 | this.imageBox.Location = new System.Drawing.Point(10, 10);
50 | this.imageBox.Name = "imageBox";
51 | this.imageBox.Size = new System.Drawing.Size(100, 100);
52 | this.imageBox.TabIndex = 1;
53 | this.imageBox.TabStop = false;
54 | //
55 | // analysePictureControl
56 | //
57 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
58 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
59 | this.Controls.Add(this.imageBox);
60 | this.Controls.Add(this.imageBorder);
61 | this.Name = "analysePictureControl";
62 | this.Size = new System.Drawing.Size(120, 120);
63 | ((System.ComponentModel.ISupportInitialize)(this.imageBorder)).EndInit();
64 | ((System.ComponentModel.ISupportInitialize)(this.imageBox)).EndInit();
65 | this.ResumeLayout(false);
66 |
67 | }
68 |
69 | #endregion
70 |
71 | private System.Windows.Forms.PictureBox imageBorder;
72 | private System.Windows.Forms.PictureBox imageBox;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Tebocam/analysePictureControl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Drawing.Drawing2D;
4 | using System.Windows.Forms;
5 |
6 | namespace TeboCam
7 | {
8 | public partial class analysePictureControl : UserControl
9 | {
10 |
11 |
12 | public string cam;
13 | public long time;
14 | public int movLevel;
15 | public Color borderColour;
16 | ToolTip calebrateImageTip = new ToolTip();
17 |
18 | public analysePictureControl()
19 | {
20 | InitializeComponent();
21 | }
22 |
23 | public analysePictureControl(Bitmap p_picture, string p_name, long p_time, Color p_borderColour, int p_level)
24 | {
25 | InitializeComponent();
26 |
27 | imageBox.Image = resizeImage(p_picture, imageBox.Width, imageBox.Height);
28 | cam = p_name;
29 | time = p_time;
30 | borderColour = p_borderColour;
31 | movLevel = p_level;
32 | calebrateImageTip.Active = true;
33 | calebrateImageTip.IsBalloon = true;
34 | calebrateImageTip.InitialDelay = 500;
35 | calebrateImageTip.AutoPopDelay = 5000;
36 | calebrateImageTip.SetToolTip(this.imageBox, "Motion level: " + p_level.ToString());
37 | }
38 |
39 | private static Bitmap resizeImage(Bitmap imgage, int width, int height)
40 | {
41 | var imgToResize = new Bitmap(imgage);
42 | var sourceWidth = imgToResize.Width;
43 | var sourceHeight = imgToResize.Height;
44 | var nPercentW = width / (float)sourceWidth;
45 | var nPercentH = height / (float)sourceHeight;
46 | var nPercent = Math.Max(nPercentH, nPercentW);
47 | var destWidth = (int)(sourceWidth * nPercent);
48 | var destHeight = (int)(sourceHeight * nPercent);
49 | var bitmap = new Bitmap(destWidth, destHeight);
50 | var g = Graphics.FromImage(bitmap);
51 | g.InterpolationMode = InterpolationMode.HighQualityBicubic;
52 | g.DrawImage(imgToResize, 0, 0, destWidth, destHeight);
53 | g.Dispose();
54 | return bitmap;
55 | }
56 |
57 | private void imageBorder_Paint(object sender, PaintEventArgs e)
58 | {
59 | e.Graphics.FillRectangle(new SolidBrush(borderColour), new Rectangle(0, 0, imageBorder.Width, imageBorder.Height));
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/Tebocam/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Tebocam/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
52 |
59 |
60 |
61 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/Tebocam/config.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using System.Windows.Forms;
4 |
5 | namespace TeboCam
6 | {
7 | public static class ConfigurationHelper
8 | {
9 | public static List profiles;
10 | private static configApplication CurrentProfile;
11 | private static string CurrentProfileName = "main";
12 |
13 | public static void LoadProfiles(List profs)
14 | {
15 | profiles = profs;
16 | }
17 |
18 | public static void LoadCurrentProfile(string profileName)
19 | {
20 | CurrentProfile = getProfile(profileName);
21 | }
22 |
23 | public static configApplication GetCurrentProfile()
24 | {
25 | return CurrentProfile;
26 | }
27 |
28 | public static string GetCurrentProfileName()
29 | {
30 | return CurrentProfileName;
31 | }
32 |
33 | public static void SetCurrentProfileName(string val)
34 | {
35 | CurrentProfileName = val;
36 | }
37 |
38 | public static void AddProfile()
39 | {
40 | configApplication data = new configApplication(new crypt());
41 | profiles.Add(data);
42 | }
43 |
44 | public static void AddProfile(string profileName)
45 | {
46 | if (!profileExists(profileName))
47 | {
48 | configApplication data = new configApplication(new crypt());
49 | //data.configDataInit();
50 | data.profileName = profileName.ToLower();
51 | profiles.Add(data);
52 | }
53 | else
54 | {
55 | MessageBox.Show("Cannot create profile as name already exists.", "Error");
56 | }
57 | }
58 |
59 | public static List getProfileList()
60 | {
61 | return profiles.Select(x => x.profileName).ToList();
62 | }
63 |
64 | public static configApplication getProfile(string profileName)
65 | {
66 | return profiles.FirstOrDefault(x => x.profileName.ToLower() == profileName.ToLower());
67 | }
68 |
69 | public static void deleteProfile(string profileName)
70 | {
71 | if (profileExists(profileName))
72 | {
73 | if (profiles.Count <= 1)
74 | {
75 | MessageBox.Show("Cannot delete profile as at least one profile must be present.", "Error");
76 | }
77 | else
78 | {
79 | for (int i = 0; i < profiles.Count; i++)
80 | {
81 | if (profiles[i].profileName == profileName)
82 | {
83 | profiles.RemoveAt(i);
84 | break;
85 | }
86 | }
87 | }
88 | }
89 | }
90 |
91 | public static void copyProfile(string copyFrom, string copyTo)
92 | {
93 | if (!profileExists(copyTo))
94 | {
95 | //configData tmpData = (configData)profiles[i]
96 | foreach (configApplication data in profiles)
97 | {
98 | if (data.profileName == copyFrom)
99 | {
100 | var newData = (configApplication)data.Clone();
101 | newData.profileName = copyTo;
102 | profiles.Add(newData);
103 | break;
104 | }
105 | }
106 | }
107 | else
108 | {
109 | MessageBox.Show("Cannot copy profile as new name already exists.", "Error");
110 | }
111 | }
112 |
113 | public static void renameProfile(string currentName, string newName)
114 | {
115 | if (!profileExists(newName))
116 | {
117 | foreach (configApplication profile in profiles)
118 | {
119 | if (profile.profileName == currentName)
120 | {
121 | profile.profileName = newName;
122 |
123 | foreach (var camConfig in profile.camConfigs)
124 | {
125 | if (camConfig.profileName == currentName)
126 | {
127 | camConfig.profileName = newName;
128 | }
129 | }
130 | break;
131 | }
132 | }
133 | }
134 | else
135 | {
136 | MessageBox.Show("Cannot rename profile as name already exists.", "Error");
137 | }
138 |
139 | }
140 |
141 |
142 | public static bool profileExists(string profileName)
143 | {
144 | return profiles.Any(x => x.profileName.ToLower() == profileName.ToLower());
145 | }
146 |
147 | public static bool InfoForProfileWebcamExists(string profileName, string webcam)
148 | {
149 | return profiles
150 | .Where(x => x.profileName == profileName)
151 | .Select(x => x.camConfigs)
152 | .First()
153 | .Where(x => x.webcam == webcam).Any();
154 | }
155 |
156 | public static configWebcam InfoForProfileWebcam(string profileName, string webcam)
157 | {
158 | return profiles
159 | .Where(x => x.profileName == profileName)
160 | .Select(x => x.camConfigs)
161 | .First()
162 | .Where(x => x.webcam == webcam).First();
163 | }
164 | }
165 | }
166 |
--------------------------------------------------------------------------------
/Tebocam/extensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 |
4 | namespace TeboCam
5 | {
6 | static class extensions
7 | {
8 |
9 | public static void SynchronisedInvoke(this ISynchronizeInvoke synchThis, Action action)
10 | {
11 | if (!synchThis.InvokeRequired)
12 | {
13 | action();
14 | }
15 | else
16 | {
17 | synchThis.Invoke(action, new object[] { });
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Tebocam/image.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam
2 | {
3 | partial class image
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.components = new System.ComponentModel.Container();
32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(image));
33 | this.trackBar1 = new System.Windows.Forms.TrackBar();
34 | this.label32 = new System.Windows.Forms.Label();
35 | this.val = new System.Windows.Forms.TextBox();
36 | this.hideLog = new System.Windows.Forms.Button();
37 | this.button1 = new System.Windows.Forms.Button();
38 | this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
39 | this.label1 = new System.Windows.Forms.Label();
40 | ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
41 | this.SuspendLayout();
42 | //
43 | // trackBar1
44 | //
45 | resources.ApplyResources(this.trackBar1, "trackBar1");
46 | this.trackBar1.Maximum = 100;
47 | this.trackBar1.Name = "trackBar1";
48 | this.trackBar1.TickFrequency = 10;
49 | this.trackBar1.Scroll += new System.EventHandler(this.trackBar1_Scroll);
50 | //
51 | // label32
52 | //
53 | resources.ApplyResources(this.label32, "label32");
54 | this.label32.ForeColor = System.Drawing.Color.Black;
55 | this.label32.Name = "label32";
56 | //
57 | // val
58 | //
59 | this.val.BackColor = System.Drawing.Color.LemonChiffon;
60 | resources.ApplyResources(this.val, "val");
61 | this.val.ForeColor = System.Drawing.SystemColors.WindowText;
62 | this.val.Name = "val";
63 | this.toolTip1.SetToolTip(this.val, resources.GetString("val.ToolTip"));
64 | this.val.TextChanged += new System.EventHandler(this.val_TextChanged);
65 | //
66 | // hideLog
67 | //
68 | resources.ApplyResources(this.hideLog, "hideLog");
69 | this.hideLog.Name = "hideLog";
70 | this.hideLog.UseVisualStyleBackColor = true;
71 | this.hideLog.Click += new System.EventHandler(this.hideLog_Click);
72 | //
73 | // button1
74 | //
75 | resources.ApplyResources(this.button1, "button1");
76 | this.button1.Name = "button1";
77 | this.button1.UseVisualStyleBackColor = true;
78 | this.button1.Click += new System.EventHandler(this.button1_Click);
79 | //
80 | // toolTip1
81 | //
82 | this.toolTip1.AutoPopDelay = 20000;
83 | this.toolTip1.InitialDelay = 500;
84 | this.toolTip1.IsBalloon = true;
85 | this.toolTip1.ReshowDelay = 100;
86 | this.toolTip1.ToolTipTitle = "Tip";
87 | //
88 | // label1
89 | //
90 | resources.ApplyResources(this.label1, "label1");
91 | this.label1.ForeColor = System.Drawing.Color.Black;
92 | this.label1.Name = "label1";
93 | //
94 | // image
95 | //
96 | resources.ApplyResources(this, "$this");
97 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
98 | this.Controls.Add(this.label1);
99 | this.Controls.Add(this.button1);
100 | this.Controls.Add(this.hideLog);
101 | this.Controls.Add(this.val);
102 | this.Controls.Add(this.label32);
103 | this.Controls.Add(this.trackBar1);
104 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
105 | this.MaximizeBox = false;
106 | this.MinimizeBox = false;
107 | this.Name = "image";
108 | this.Load += new System.EventHandler(this.image_Load);
109 | ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
110 | this.ResumeLayout(false);
111 | this.PerformLayout();
112 |
113 | }
114 |
115 | #endregion
116 |
117 | private System.Windows.Forms.TrackBar trackBar1;
118 | private System.Windows.Forms.Label label32;
119 | private System.Windows.Forms.TextBox val;
120 | private System.Windows.Forms.Button hideLog;
121 | private System.Windows.Forms.Button button1;
122 | private System.Windows.Forms.ToolTip toolTip1;
123 | private System.Windows.Forms.Label label1;
124 | }
125 | }
--------------------------------------------------------------------------------
/Tebocam/image.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Windows.Forms;
4 |
5 | namespace TeboCam
6 | {
7 | public partial class image : Form
8 | {
9 | private formDelegate jpegDelegate;
10 | private string fromString;
11 | private int initialVal;
12 | private bool toolTip;
13 |
14 | public image(formDelegate sender, ArrayList from)
15 | {
16 | jpegDelegate = sender;
17 | fromString = from[0].ToString();
18 | initialVal = Convert.ToInt32(from[1]);
19 | toolTip = Convert.ToBoolean(from[2]);
20 | InitializeComponent();
21 | }
22 |
23 | private void image_Load(object sender, EventArgs e)
24 | {
25 | label1.Text = fromString + " image";
26 | trackBar1.Value = initialVal;
27 | val.Text = initialVal.ToString();
28 | toolTip1.Active = toolTip;
29 | }
30 |
31 | private void hideLog_Click(object sender, EventArgs e)
32 | {
33 | ArrayList i = new ArrayList();
34 | i.Add(fromString);
35 | i.Add(Convert.ToInt32(val.Text));
36 | jpegDelegate(i); // This will call ReturnMethod in form1 and pass it val.
37 | Close();
38 | }
39 |
40 | private void button1_Click(object sender, EventArgs e)
41 | {
42 | Close();
43 | }
44 |
45 | private void val_TextChanged(object sender, EventArgs e)
46 | {
47 | val.Text = Valid.verifyInt(val.Text, 0, 100, "100");
48 | trackBar1.Value = Convert.ToInt32(val.Text);
49 | }
50 |
51 | private void trackBar1_Scroll(object sender, EventArgs e)
52 | {
53 | val.Text = trackBar1.Value.ToString();
54 | }
55 | }
56 | }
--------------------------------------------------------------------------------
/Tebocam/imageFilter.cs:
--------------------------------------------------------------------------------
1 | namespace TeboCam
2 | {
3 | class imageFilter
4 | {
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/Tebocam/libraries/AForge.Imaging.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/libraries/AForge.Imaging.dll
--------------------------------------------------------------------------------
/Tebocam/libraries/AForge.Video.DirectShow.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/libraries/AForge.Video.DirectShow.dll
--------------------------------------------------------------------------------
/Tebocam/libraries/AForge.Video.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/libraries/AForge.Video.dll
--------------------------------------------------------------------------------
/Tebocam/libraries/AForge.Vision.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/libraries/AForge.Vision.dll
--------------------------------------------------------------------------------
/Tebocam/libraries/AForge.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guythiebaut/TeboCam_OpenSource/cf28b6575cfdd5466af5106e37272b7ca920bd5f/Tebocam/libraries/AForge.dll
--------------------------------------------------------------------------------
/Tebocam/licence.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 |
4 | namespace TeboCam
5 | {
6 | class licence
7 | {
8 | private static List camsSelected = new List();
9 |
10 | public static bool licenced = false;
11 |
12 | public static int camsAllowed = 9;
13 |
14 |
15 | public static int camsSuported()
16 | {
17 |
18 | return camsAllowed;
19 |
20 | }
21 |
22 |
23 | public static bool selectCam(int cam)
24 | {
25 |
26 | if (camsSelected.Count + 1 <= camsSuported())
27 | {
28 | camsSelected.Add(cam);
29 | return true;
30 | }
31 | else
32 | {
33 | return false;
34 | }
35 |
36 | }
37 |
38 | public static void deselectCam(int cam)
39 | {
40 |
41 | for (int i = 0; i < camsSelected.Count; i++)
42 | {
43 |
44 | if (camsSelected[i] == cam) camsSelected.RemoveAt(i);
45 |
46 | }
47 |
48 | }
49 |
50 | ///
51 | /// returns a bool showing if a camera is selected as active
52 | ///
53 | /// bool
54 | public static bool aCameraIsSelected()
55 | {
56 |
57 | return camsSelected.Count > 0;
58 |
59 | }
60 |
61 |
62 | /// The camera to check.
63 | /// Bool showing if the camera is active.
64 | public static bool CamIsActive(int cam)
65 | {
66 |
67 | foreach (int camera in camsSelected)
68 | {
69 |
70 | if (camera == cam) return true;
71 |
72 | }
73 |
74 | return false;
75 |
76 |
77 | }
78 |
79 |
80 |
81 |
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/Tebocam/mail.cs:
--------------------------------------------------------------------------------
1 | using MailKit.Net.Smtp;
2 | using MimeKit;
3 | using System;
4 | using System.Collections;
5 | using System.Collections.Generic;
6 |
7 | //https://stackoverflow.com/a/46203185
8 |
9 | namespace TeboCam
10 | {
11 | class Mail : IMail
12 | {
13 | public static bool spamStopped = false;
14 | public static ArrayList attachments = new ArrayList();
15 | public static List emailTimeSent = new List();
16 | public static List EmailsSent = new List();
17 | public IException tebowebException;
18 |
19 | public void SetExceptionHandler(IException exceptionHandler)
20 | {
21 | tebowebException = exceptionHandler;
22 | }
23 |
24 | public void addAttachment(string a)
25 | {
26 | throw new NotImplementedException();
27 | }
28 |
29 | public void clearAttachments()
30 | {
31 | throw new NotImplementedException();
32 | }
33 |
34 | public void sendEmail(EmailFields eml)
35 | {
36 | var client = new SmtpClient();
37 | client.Connect(eml.SmtpHost, eml.SmtpPort, false);
38 | client.AuthenticationMechanisms.Remove("XOAUTH2");
39 | client.Authenticate(eml.User, eml.Password);
40 | var msg = new MimeMessage();
41 | msg.From.Add(new MailboxAddress("mailboxReplyTo", eml.ReplyTo));
42 | msg.To.Add(new MailboxAddress("mailboxSendTo", eml.SendTo));
43 | msg.Subject = eml.Subject;
44 |
45 | msg.Body = new TextPart("plain")
46 | {
47 | Text = eml.BodyText
48 | };
49 |
50 | client.Send(msg);
51 | client.Disconnect(true);
52 |
53 | }
54 |
55 | public bool SpamAlert(int p_emails, int p_mins, bool p_deSpamify, int p_currTime)
56 | {
57 | throw new NotImplementedException();
58 | }
59 |
60 | public bool SpamIsStopped()
61 | {
62 | throw new NotImplementedException();
63 | }
64 |
65 | public void StopSpam(bool stop)
66 | {
67 | throw new NotImplementedException();
68 | }
69 |
70 | public bool validEmail(string emailAddress)
71 | {
72 | throw new NotImplementedException();
73 | }
74 |
75 | public void SetTestStatus(int status)
76 | {
77 | throw new NotImplementedException();
78 | }
79 |
80 | public int GetTestStatus()
81 | {
82 | throw new NotImplementedException();
83 | }
84 |
85 | public class EmailSent
86 | {
87 | public string ConcatInfo = string.Empty;
88 | public int TimeSent;
89 | }
90 |
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/Tebocam/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Tebocam/regex.cs:
--------------------------------------------------------------------------------
1 | using System.Text.RegularExpressions;
2 |
3 | namespace TeboCam
4 | {
5 | class regex
6 | {
7 |
8 | public static bool match(string pattern, string val)
9 | {
10 | if (val == null) return false;
11 |
12 | try
13 | {
14 | Regex regex = new Regex(pattern, RegexOptions.IgnoreCase);
15 | return regex.IsMatch(val);
16 | }
17 | catch
18 | { return false; }
19 |
20 | }
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Tebocam/schedule.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Windows.Forms;
4 |
5 | namespace TeboCam
6 | {
7 | public partial class schedule : Form
8 | {
9 | private formDelegate scheduleDelegate;
10 | private string fromString;
11 | private bool toolTip;
12 | private string p_start;
13 | private string p_stop;
14 | private string o_start;
15 | private string o_stop;
16 |
17 | public schedule(formDelegate sender, ArrayList from)
18 | {
19 | scheduleDelegate = sender;
20 | fromString = from[0].ToString();
21 | toolTip = Convert.ToBoolean(from[1]);
22 | p_start = from[2].ToString();
23 | p_stop = from[3].ToString();
24 |
25 | InitializeComponent();
26 | }
27 |
28 | private void schedule_Load(object sender, EventArgs e)
29 | {
30 |
31 | lblTitle.Text = fromString + " Schedule";
32 | numericUpDown6.Value = Convert.ToDecimal(LeftRightMid.Left(p_start, 2));
33 | numericUpDown5.Value = Convert.ToDecimal(LeftRightMid.Right(p_start, 2));
34 | numericUpDown8.Value = Convert.ToDecimal(LeftRightMid.Left(p_stop, 2));
35 | numericUpDown7.Value = Convert.ToDecimal(LeftRightMid.Right(p_stop, 2));
36 |
37 | toolTip1.Active = toolTip;
38 |
39 | }
40 |
41 |
42 | private void numericUpDown6_ValueChanged(object sender, EventArgs e)
43 | {
44 | if (numericUpDown6.Value == 24) { numericUpDown6.Value = 0; }
45 | if (numericUpDown6.Value == -1) { numericUpDown6.Value = 23; }
46 |
47 | o_start = numericUpDown6.Value.ToString().PadLeft(2, '0') + numericUpDown5.Value.ToString().PadLeft(2, '0');
48 |
49 | }
50 |
51 | private void numericUpDown5_ValueChanged(object sender, EventArgs e)
52 | {
53 | if (numericUpDown5.Value == 60) { numericUpDown5.Value = 0; }
54 | if (numericUpDown5.Value == -1) { numericUpDown5.Value = 59; }
55 |
56 | o_start = numericUpDown6.Value.ToString().PadLeft(2, '0') + numericUpDown5.Value.ToString().PadLeft(2, '0');
57 |
58 | }
59 |
60 | private void numericUpDown8_ValueChanged(object sender, EventArgs e)
61 | {
62 | if (numericUpDown8.Value == 24) { numericUpDown8.Value = 0; }
63 | if (numericUpDown8.Value == -1) { numericUpDown8.Value = 23; }
64 |
65 | o_stop = numericUpDown8.Value.ToString().PadLeft(2, '0') + numericUpDown7.Value.ToString().PadLeft(2, '0');
66 |
67 | }
68 |
69 | private void numericUpDown7_ValueChanged(object sender, EventArgs e)
70 | {
71 | if (numericUpDown7.Value == 60) { numericUpDown7.Value = 0; }
72 | if (numericUpDown7.Value == -1) { numericUpDown7.Value = 59; }
73 |
74 | o_stop = numericUpDown8.Value.ToString().PadLeft(2, '0') + numericUpDown7.Value.ToString().PadLeft(2, '0');
75 |
76 | }
77 |
78 |
79 | private void schedule_FormClosing(object sender, FormClosingEventArgs e)
80 | {
81 |
82 | if (numericUpDown6.Value == 24) { numericUpDown6.Value = 0; }
83 | if (numericUpDown6.Value == -1) { numericUpDown6.Value = 23; }
84 | if (numericUpDown5.Value == 60) { numericUpDown5.Value = 0; }
85 | if (numericUpDown5.Value == -1) { numericUpDown5.Value = 59; }
86 | o_start = numericUpDown6.Value.ToString().PadLeft(2, '0') + numericUpDown5.Value.ToString().PadLeft(2, '0');
87 |
88 | if (numericUpDown8.Value == 24) { numericUpDown8.Value = 0; }
89 | if (numericUpDown8.Value == -1) { numericUpDown8.Value = 23; }
90 | if (numericUpDown7.Value == 60) { numericUpDown7.Value = 0; }
91 | if (numericUpDown7.Value == -1) { numericUpDown7.Value = 59; }
92 |
93 | o_stop = numericUpDown8.Value.ToString().PadLeft(2, '0') + numericUpDown7.Value.ToString().PadLeft(2, '0');
94 |
95 |
96 | ArrayList i = new ArrayList();
97 |
98 | i.Add(fromString);
99 | i.Add(o_start);
100 | i.Add(o_stop);
101 |
102 | scheduleDelegate(i); // This will call ReturnMethod in form1 and pass it val.
103 |
104 | }
105 |
106 |
107 |
108 |
109 | }
110 | }
--------------------------------------------------------------------------------
/Tebocam/sensitiveInfo.cs:
--------------------------------------------------------------------------------
1 | //EXAMPLE FOR CODE LIBRARY OPEN SOURCE
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace TeboCam
7 | {
8 | class sensitiveInfo
9 | {
10 |
11 | public static string ver = "3.003";
12 | public const string versionDt = "21/08/2011";
13 | public const string product = "TeboCam";
14 |
15 | public static string processToEnd = "TeboCam";
16 | public static string newsFile = "yourNews.Zip";//"yourNewsTest.Zip";
17 | public static string versionFile = "yourVersionFile.txt";
18 | public static string versionFileDev = "yourDevFile.txt";
19 | public static string downloadsURL = "http://YourSite.com/downloadDirectory/";
20 |
21 | public const string tebowebUrl = "http://www.YourSite.com";
22 | public static string devMachineFile = "\\yourDevFile.txt";
23 | public static string databaseTrialFile = "\\yourDatabaseTrialFile.txt";
24 | public static string ApiConnectFile = "\\YourDbaseConnectFile.txt";
25 | public const string updaterPrefix = "YourUpdaterPrefix";
26 | public const string dbaseConnectFile = "YourDbaseConnectFile";
27 |
28 | //database info
29 | public const string server = "11.111.111.11";
30 | public const string dbase = "yourDatabase";
31 | public const string uid = "YourUserId";
32 | public const string pwd = "yourPassword";
33 | //database info
34 |
35 | //WARNING - YOU NEED TO CHANGE THIS ENCRYPTION INFO AS THIS IS JUST AN EXAMPLE
36 | //crypt info
37 | public static byte[] Key = { 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123 };
38 | public static byte[] Vector = { 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123 };
39 | //crypt info
40 | //WARNING - YOU NEED TO CHANGE THIS ENCRYPTION INFO AS THIS IS JUST AN EXAMPLE
41 |
42 |
43 | }
44 | }
45 | //EXAMPLE FOR CODE LIBRARY OPEN SOURCE
--------------------------------------------------------------------------------
/Tebocam/teboDebug.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace TeboCam
7 | {
8 | class teboDebug
9 | {
10 |
11 | public static bool debugOn = false;
12 | public static bool debugToFile = false;
13 | public static string filePath = "";
14 | public static string fileName = "";
15 |
16 | private static StreamWriter debugWriter;
17 |
18 | public static int pingVal = 1000;
19 | public static int movementAddImagesVal = 2000;
20 | public static int publishImageVal = 3000;
21 | public static int webUpdateVal = 4000;
22 | public static int movementPublishVal = 5000;
23 |
24 | private static StringBuilder Outline = new StringBuilder();
25 |
26 |
27 | public static void openFile()
28 | {
29 |
30 | debugWriter = new StreamWriter(filePath + fileName, true);
31 | Outline.Length = 0;
32 |
33 | }
34 |
35 | public static void closeFile()
36 | {
37 | if (debugWriter != null)
38 | {
39 | debugWriter.Close();
40 | }
41 | }
42 |
43 | public static void writeline(string val)
44 | {
45 |
46 | if (debugOn) write(val.ToString());
47 |
48 | }
49 |
50 | public static void writeline(int val)
51 | {
52 |
53 | if (debugOn) write(val.ToString());
54 |
55 | }
56 |
57 |
58 | private static void write(string line)
59 | {
60 |
61 | Outline.Length = 0;
62 | Outline.Append(DateTime.Now.ToString("yyyy/MM/dd-HH:mm:ss:fff", System.Globalization.CultureInfo.InvariantCulture));
63 | Outline.Append(" | " + line);
64 |
65 | if (debugOn) Debug.WriteLine(Outline);
66 | if (debugToFile) debugWriter.WriteLine(Outline);
67 |
68 |
69 | }
70 |
71 |
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/Tebocam/time.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace TeboCam
4 | {
5 | class time
6 | {
7 |
8 | private const int millisecsInSecond = 1000;
9 | private const int millisecsInMinute = 60000;
10 | private const int millisecsInHour = 3600000;
11 | private const int millisecsInDay = 86400000;
12 |
13 | private const int secsInMinute = 60;
14 | private const int secsInHour = 3600;
15 | private const int secsInDay = 86400;
16 |
17 | private static int startday = 0;
18 | private static int starttime = 0;
19 |
20 | private static void setStart()
21 | {
22 | startday = Convert.ToInt32(DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture));
23 | starttime = secondsSinceMidnight();
24 | }
25 |
26 |
27 | public static int secondsSinceMidnight()
28 | {
29 | string tmpStr = DateTime.Now.ToString("HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
30 | int hour = Convert.ToInt32(LeftRightMid.Left(tmpStr, 2));
31 | int mins = Convert.ToInt32(LeftRightMid.Mid(tmpStr, 3, 2));
32 | int secs = Convert.ToInt32(LeftRightMid.Right(tmpStr, 2));
33 | int secsSinceMidnight = (hour * secsInHour) + (mins * secsInMinute) + secs;
34 | return secsSinceMidnight;
35 | }
36 |
37 | public static int secondsSinceMidnight(DateTime dt)
38 | {
39 | string tmpStr = dt.ToString("HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
40 | int hour = Convert.ToInt32(LeftRightMid.Left(tmpStr, 2));
41 | int mins = Convert.ToInt32(LeftRightMid.Mid(tmpStr, 3, 2));
42 | int secs = Convert.ToInt32(LeftRightMid.Right(tmpStr, 2));
43 | int secsSinceMidnight = (hour * secsInHour) + (mins * secsInMinute) + secs;
44 | return secsSinceMidnight;
45 | }
46 |
47 | public static int millisecondsSinceMidnight()
48 | {
49 | string tmpStr = DateTime.Now.ToString("HH:mm:ss:fff", System.Globalization.CultureInfo.InvariantCulture);
50 | int hour = Convert.ToInt32(LeftRightMid.Left(tmpStr, 2));
51 | int mins = Convert.ToInt32(LeftRightMid.Mid(tmpStr, 3, 2));
52 | int secs = Convert.ToInt32(LeftRightMid.Mid(tmpStr, 6, 2));
53 | int millisecs = Convert.ToInt32(LeftRightMid.Right(tmpStr, 3));
54 | int millisecsSinceMidnight = (hour * millisecsInHour) + (mins * millisecsInMinute) + (secs * millisecsInSecond) + millisecs;
55 | return millisecsSinceMidnight;
56 | }
57 |
58 | public static int secondsSinceStart()
59 | {
60 |
61 | if (startday == 0) setStart();
62 |
63 | int thisday = Convert.ToInt32(currentDateYYYYMMDD());
64 | int daysSinceStart = Math.Abs(thisday - startday);
65 |
66 |
67 | int result = (daysSinceStart * secsInDay) - starttime + secondsSinceMidnight();
68 | return result;
69 | }
70 |
71 | public static int secondsSinceStart(string dateTime)
72 | {
73 |
74 | DateTime dt = Convert.ToDateTime(dateTime);
75 | int firsttime = secondsSinceMidnight(dt);
76 |
77 | int thisday = Convert.ToInt32(currentDateYYYYMMDD());
78 | int firstday = Convert.ToInt32(dt.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture));
79 | int daysSinceStart = Math.Abs(thisday - firstday);
80 |
81 |
82 | int result = (daysSinceStart * secsInDay) - firsttime + secondsSinceMidnight();
83 | return result;
84 | }
85 |
86 | public static Int64 millisecondsSinceStart()
87 | {
88 |
89 | if (startday == 0) setStart();
90 |
91 | int thisday = Convert.ToInt32(currentDateYYYYMMDD());
92 | int daysSinceStart = Math.Abs(thisday - startday);
93 |
94 |
95 | Int64 result = (daysSinceStart * millisecsInDay) - (starttime * millisecsInSecond) + millisecondsSinceMidnight();
96 | return result;
97 |
98 | }
99 |
100 | public static int timeInSeconds(string time)
101 | {
102 | int hour = Convert.ToInt32(LeftRightMid.Left(time, 2));
103 | int mins = Convert.ToInt32(LeftRightMid.Right(time, 2));
104 | int secs = (hour * secsInHour) + (mins * secsInMinute);
105 | return secs;
106 | }
107 |
108 |
109 | public static string currentTime()
110 | {
111 | return DateTime.Now.ToString("HHmm", System.Globalization.CultureInfo.InvariantCulture);
112 | }
113 |
114 | public static string currentDateYYYYMMDD()
115 | {
116 | return DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
117 | }
118 |
119 | public static string currentDateTimeSql()
120 | {
121 | return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
122 | }
123 |
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/Tebocam/train.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Windows.Forms;
4 |
5 | namespace TeboCam
6 | {
7 | public partial class train : Form
8 | {
9 |
10 | private formDelegate trainDelegate;
11 | private bool toolTip;
12 | private ArrayList returnList = new ArrayList();
13 |
14 | public train(formDelegate sender, ArrayList from)
15 | {
16 | trainDelegate = sender;
17 | toolTip = Convert.ToBoolean(from[0]);
18 | from.Clear();
19 | InitializeComponent();
20 | }
21 |
22 | private void startCountdown_Click(object sender, EventArgs e)
23 | {
24 |
25 | returnList.Clear();
26 |
27 | returnList.Add(Convert.ToInt32(countVal.Text));
28 | returnList.Add(Convert.ToInt32(trainVal.Text));
29 |
30 | trainDelegate(returnList);
31 | Close();
32 |
33 | }
34 |
35 | private void cancel_Click(object sender, EventArgs e)
36 | {
37 | Close();
38 | }
39 |
40 | private void countVal_TextChanged(object sender, EventArgs e)
41 | {
42 | countVal.Text = Valid.verifyInt(countVal.Text, 1, 9999, "10");
43 | }
44 |
45 | private void trainVal_TextChanged(object sender, EventArgs e)
46 | {
47 | trainVal.Text = Valid.verifyInt(trainVal.Text, 1, 9999, "10");
48 | }
49 |
50 | private void train_Load(object sender, EventArgs e)
51 | {
52 | toolTip1.Active = toolTip;
53 | }
54 |
55 | }
56 | }
--------------------------------------------------------------------------------
/Tebocam/webPage.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace TeboCam
4 | {
5 | class webPage
6 | {
7 |
8 | public static void writePage(string prefix, string suffix, int from, int to, string fileName)
9 | {
10 | int startNum = from;
11 | int endNum = to;
12 |
13 | string trStart = "";
14 | string trEnd = "
";
15 | //string tdStart = @" | ";
17 |
18 | TextWriter tw = new StreamWriter(fileName);
19 |
20 | // write a line of text to the file
21 |
22 | tw.WriteLine("");
23 | tw.WriteLine("");
24 | tw.WriteLine("");
25 | tw.WriteLine(@"");
26 | tw.WriteLine(trStart);
27 |
28 | for (int i = startNum; i <= endNum; i++)
29 | {
30 | //tw.WriteLine(tdStart + prefix + i.ToString() + suffix + tdEnd);
31 |
32 | tw.WriteLine
33 | (
34 | "" +
35 | " + suffix + @") | "
36 | );
37 |
38 | if (i % 10 == 0)
39 | {
40 | tw.WriteLine(trEnd);
41 | tw.WriteLine(trStart);
42 | }
43 | }
44 |
45 | tw.WriteLine(trEnd);
46 | tw.WriteLine("
");
47 | tw.WriteLine("");
48 | tw.WriteLine("