SHOW:
|
|
- or go back to the newest paste.
1 | Source: https://github.com/ispysoftware/iSpy/commit/28fcbda3b9ef345adac54fdf098e2c1e1dd5a5d3 | |
2 | diff -Naur iSpy-master/MainForm.cs iSpy-master-mod/MainForm.cs | |
3 | --- iSpy-master/MainForm.cs 2015-11-02 02:03:08.000000000 -0800 | |
4 | +++ iSpy-master-mod/MainForm.cs 2015-11-02 20:18:26.000000000 -0800 | |
5 | @@ -256,6 +256,7 @@ | |
6 | private ToolStripMenuItem _helpToolstripMenuItem; | |
7 | private Timer _houseKeepingTimer; | |
8 | private ToolStripMenuItem _iPCameraToolStripMenuItem; | |
9 | + private ToolStripMenuItem _quickAddIpCameraToolStripMenuItem; | |
10 | private string _lastPath = Program.AppDataPath; | |
11 | private ToolStripMenuItem _listenToolStripMenuItem; | |
12 | private ToolStripMenuItem _localCameraToolStripMenuItem; | |
13 | @@ -3315,6 +3316,11 @@ | |
14 | AddCamera(1); | |
15 | } | |
16 | ||
17 | + private void QuickAddToolStripMenuItemClick(object sender, EventArgs e) | |
18 | + { | |
19 | + QuickAddCamera(); | |
20 | + } | |
21 | + | |
22 | private void MicrophoneToolStripMenuItemClick(object sender, EventArgs e) | |
23 | { | |
24 | AddMicrophone(0); | |
25 | @@ -4527,6 +4533,7 @@ | |
26 | this._toolStripDropDownButton2 = new System.Windows.Forms.ToolStripDropDownButton(); | |
27 | this._localCameraToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); | |
28 | this._iPCameraToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); | |
29 | + this._quickAddIpCameraToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); | |
30 | this.iPCameraWithWizardToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); | |
31 | this.oNVIFCameraToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); | |
32 | this._floorPlanToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); | |
33 | @@ -5492,6 +5499,7 @@ | |
34 | this._toolStripDropDownButton2.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { | |
35 | this._localCameraToolStripMenuItem, | |
36 | this._iPCameraToolStripMenuItem, | |
37 | + this._quickAddIpCameraToolStripMenuItem, | |
38 | this.iPCameraWithWizardToolStripMenuItem, | |
39 | this.oNVIFCameraToolStripMenuItem, | |
40 | this._floorPlanToolStripMenuItem, | |
41 | @@ -5527,6 +5535,16 @@ | |
42 | this._iPCameraToolStripMenuItem.Text = "IP Camera"; | |
43 | this._iPCameraToolStripMenuItem.Click += new System.EventHandler(this.IpCameraToolStripMenuItemClick); | |
44 | // | |
45 | + // _quickAddIpCameraToolStripMenuItem | |
46 | + // | |
47 | + this._quickAddIpCameraToolStripMenuItem.Image = global::iSpyApplication.Properties.Resources.Computer; | |
48 | + this._quickAddIpCameraToolStripMenuItem.Margin = new System.Windows.Forms.Padding(0, 4, 0, 0); | |
49 | + this._quickAddIpCameraToolStripMenuItem.Name = "_quickAddIpCameraToolStripMenuItem"; | |
50 | + this._quickAddIpCameraToolStripMenuItem.Padding = new System.Windows.Forms.Padding(0); | |
51 | + this._quickAddIpCameraToolStripMenuItem.Size = new System.Drawing.Size(402, 24); | |
52 | + this._quickAddIpCameraToolStripMenuItem.Text = "Foscam (and Knockoffs)"; | |
53 | + this._quickAddIpCameraToolStripMenuItem.Click += new System.EventHandler(this.QuickAddToolStripMenuItemClick); | |
54 | + // | |
55 | // iPCameraWithWizardToolStripMenuItem | |
56 | // | |
57 | this.iPCameraWithWizardToolStripMenuItem.Image = global::iSpyApplication.Properties.Resources.Computer; | |
58 | diff -Naur iSpy-master/MainForm_Configuration.cs iSpy-master-mod/MainForm_Configuration.cs | |
59 | --- iSpy-master/MainForm_Configuration.cs 2015-11-02 02:03:08.000000000 -0800 | |
60 | +++ iSpy-master-mod/MainForm_Configuration.cs 2015-11-02 21:21:46.000000000 -0800 | |
61 | @@ -2251,6 +2251,117 @@ | |
62 | LoadPreviews(); | |
63 | } | |
64 | ||
65 | + private void QuickAddCamera() | |
66 | + { | |
67 | + CameraWindow cw = NewCameraWindow(1); | |
68 | + | |
69 | + string cameraIP = string.Empty; | |
70 | + string cameraUser = string.Empty; | |
71 | + string cameraPassword = string.Empty; | |
72 | + | |
73 | + if (ShowInputDialog("IP", ref cameraIP) != DialogResult.OK) return; | |
74 | + if (ShowInputDialog("Username", ref cameraUser) != DialogResult.OK) return; | |
75 | + if (ShowInputDialog("Password", ref cameraPassword) != DialogResult.OK) return; | |
76 | + | |
77 | + // needed for talk | |
78 | + string rawCameraIP = cameraIP.Split(':')[0]; | |
79 | + int cameraPort = 80; | |
80 | + if (cameraIP.Contains(":")) | |
81 | + { | |
82 | + int.TryParse(cameraIP.Split(':')[1], out cameraPort); | |
83 | + } | |
84 | + | |
85 | + // disable annoying stuff | |
86 | + cw.Camobject.alerts.active = false; | |
87 | + cw.Camobject.detector.recordonalert = false; | |
88 | + cw.Camobject.detector.recordondetect = false; | |
89 | + cw.Camobject.detector.type = "None"; | |
90 | + | |
91 | + // setup talk | |
92 | + cw.Camobject.settings.audioport = cameraPort; | |
93 | + cw.Camobject.settings.audiomodel = "Foscam"; | |
94 | + cw.Camobject.settings.audioip = rawCameraIP; | |
95 | + cw.Camobject.settings.audiousername = cameraUser; | |
96 | + cw.Camobject.settings.audiopassword = cameraPassword; | |
97 | + | |
98 | + // setup misc cam settings | |
99 | + cw.Camobject.settings.login = cameraUser; | |
100 | + cw.Camobject.settings.password = cameraPassword; | |
101 | + | |
102 | + // setup video source (VLC) | |
103 | + cw.Camobject.settings.videosourcestring = string.Format("http://{1}:{2}@{0}/videostream.cgi?usr={1}&pwd={2}", cameraIP, cameraUser, cameraPassword); | |
104 | + cw.Camobject.settings.sourceindex = 5; | |
105 | + | |
106 | + TopMost = false; | |
107 | + var ac = new AddCamera { CameraControl = cw, StartWizard = false, IsNew = true, MainClass = this }; | |
108 | + ac.ShowDialog(this); | |
109 | + if (ac.DialogResult == DialogResult.OK) | |
110 | + { | |
111 | + UnlockLayout(); | |
112 | + SetNewStartPosition(); | |
113 | + if (cw.VolumeControl != null && !cw.VolumeControl.IsEnabled) | |
114 | + cw.VolumeControl.Enable(); | |
115 | + NeedsSync = true; | |
116 | + } | |
117 | + else | |
118 | + { | |
119 | + int cid = cw.Camobject.id; | |
120 | + cw.Disable(); | |
121 | + _pnlCameras.Controls.Remove(cw); | |
122 | + cw.Dispose(); | |
123 | + Cameras.RemoveAll(p => p.id == cid); | |
124 | + } | |
125 | + ac.Dispose(); | |
126 | + TopMost = Conf.AlwaysOnTop; | |
127 | + } | |
128 | + | |
129 | + // http://stackoverflow.com/a/17546909 | |
130 | + private DialogResult ShowInputDialog(string caption, ref string input) | |
131 | + { | |
132 | + System.Drawing.Size size = new System.Drawing.Size(200, 95); | |
133 | + Form inputBox = new Form(); | |
134 | + | |
135 | + inputBox.StartPosition = FormStartPosition.CenterParent; | |
136 | + inputBox.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; | |
137 | + inputBox.ClientSize = size; | |
138 | + inputBox.Text = caption; | |
139 | + | |
140 | + System.Windows.Forms.Label label = new Label(); | |
141 | + label.Size = new System.Drawing.Size(size.Width - 10, 23); | |
142 | + label.Location = new System.Drawing.Point(5, 5); | |
143 | + label.Text = caption; | |
144 | + inputBox.Controls.Add(label); | |
145 | + | |
146 | + System.Windows.Forms.TextBox textBox = new TextBox(); | |
147 | + textBox.Size = new System.Drawing.Size(size.Width - 10, 23); | |
148 | + textBox.Location = new System.Drawing.Point(5, 28); | |
149 | + textBox.Text = input; | |
150 | + inputBox.Controls.Add(textBox); | |
151 | + | |
152 | + Button okButton = new Button(); | |
153 | + okButton.DialogResult = System.Windows.Forms.DialogResult.OK; | |
154 | + okButton.Name = "okButton"; | |
155 | + okButton.Size = new System.Drawing.Size(75, 23); | |
156 | + okButton.Text = "&OK"; | |
157 | + okButton.Location = new System.Drawing.Point(size.Width - 80 - 80, 64); | |
158 | + inputBox.Controls.Add(okButton); | |
159 | + | |
160 | + Button cancelButton = new Button(); | |
161 | + cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; | |
162 | + cancelButton.Name = "cancelButton"; | |
163 | + cancelButton.Size = new System.Drawing.Size(75, 23); | |
164 | + cancelButton.Text = "&Cancel"; | |
165 | + cancelButton.Location = new System.Drawing.Point(size.Width - 80, 64); | |
166 | + inputBox.Controls.Add(cancelButton); | |
167 | + | |
168 | + inputBox.AcceptButton = okButton; | |
169 | + inputBox.CancelButton = cancelButton; | |
170 | + | |
171 | + DialogResult result = inputBox.ShowDialog(); | |
172 | + input = textBox.Text; | |
173 | + return result; | |
174 | + } | |
175 | + | |
176 | private void AddCamera(int videoSourceIndex, bool startWizard = false) | |
177 | { | |
178 | CameraWindow cw = NewCameraWindow(videoSourceIndex); |