├── .gitattributes
├── .gitignore
├── Client
├── App.config
├── Client.csproj
├── Extensions.cs
├── Packet.cs
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Utilities.cs
├── frmClient.Designer.cs
├── frmClient.cs
└── frmClient.resx
├── LICENSE.md
├── Libraries
├── LZ4.dll
├── LZ4cc.dll
├── LZ4mm.dll
└── LZ4pn.dll
├── README.md
├── RemoteDesktopOverNetwork.sln
├── Server
├── App.config
├── Extensions.cs
├── Packet.cs
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── ScreenCapture.cs
├── ScreenChangeDetect.cs
├── Server.csproj
├── frmServer.Designer.cs
├── frmServer.cs
└── frmServer.resx
├── Test
├── App.config
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── ScreenChangeDetect.cs
├── Test.csproj
├── frmTest.Designer.cs
├── frmTest.cs
└── frmTest.resx
└── TestImages
├── 1.png
└── 2.png
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | build/
21 | bld/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opensdf
80 | *.sdf
81 | *.cachefile
82 |
83 | # Visual Studio profiler
84 | *.psess
85 | *.vsp
86 | *.vspx
87 | *.sap
88 |
89 | # TFS 2012 Local Workspace
90 | $tf/
91 |
92 | # Guidance Automation Toolkit
93 | *.gpState
94 |
95 | # ReSharper is a .NET coding add-in
96 | _ReSharper*/
97 | *.[Rr]e[Ss]harper
98 | *.DotSettings.user
99 |
100 | # JustCode is a .NET coding add-in
101 | .JustCode
102 |
103 | # TeamCity is a build add-in
104 | _TeamCity*
105 |
106 | # DotCover is a Code Coverage Tool
107 | *.dotCover
108 |
109 | # NCrunch
110 | _NCrunch_*
111 | .*crunch*.local.xml
112 | nCrunchTemp_*
113 |
114 | # MightyMoose
115 | *.mm.*
116 | AutoTest.Net/
117 |
118 | # Web workbench (sass)
119 | .sass-cache/
120 |
121 | # Installshield output folder
122 | [Ee]xpress/
123 |
124 | # DocProject is a documentation generator add-in
125 | DocProject/buildhelp/
126 | DocProject/Help/*.HxT
127 | DocProject/Help/*.HxC
128 | DocProject/Help/*.hhc
129 | DocProject/Help/*.hhk
130 | DocProject/Help/*.hhp
131 | DocProject/Help/Html2
132 | DocProject/Help/html
133 |
134 | # Click-Once directory
135 | publish/
136 |
137 | # Publish Web Output
138 | *.[Pp]ublish.xml
139 | *.azurePubxml
140 | # TODO: Comment the next line if you want to checkin your web deploy settings
141 | # but database connection strings (with potential passwords) will be unencrypted
142 | *.pubxml
143 | *.publishproj
144 |
145 | # NuGet Packages
146 | *.nupkg
147 | # The packages folder can be ignored because of Package Restore
148 | **/packages/*
149 | # except build/, which is used as an MSBuild target.
150 | !**/packages/build/
151 | # Uncomment if necessary however generally it will be regenerated when needed
152 | #!**/packages/repositories.config
153 |
154 | # Windows Azure Build Output
155 | csx/
156 | *.build.csdef
157 |
158 | # Windows Azure Emulator
159 | efc/
160 | rfc/
161 |
162 | # Windows Store app package directory
163 | AppPackages/
164 |
165 | # Visual Studio cache files
166 | # files ending in .cache can be ignored
167 | *.[Cc]ache
168 | # but keep track of directories ending in .cache
169 | !*.[Cc]ache/
170 |
171 | # Others
172 | ClientBin/
173 | [Ss]tyle[Cc]op.*
174 | ~$*
175 | *~
176 | *.dbmdl
177 | *.dbproj.schemaview
178 | *.pfx
179 | *.publishsettings
180 | node_modules/
181 | orleans.codegen.cs
182 |
183 | # RIA/Silverlight projects
184 | Generated_Code/
185 |
186 | # Backup & report files from converting an old project file
187 | # to a newer Visual Studio version. Backup files are not needed,
188 | # because we have git ;-)
189 | _UpgradeReport_Files/
190 | Backup*/
191 | UpgradeLog*.XML
192 | UpgradeLog*.htm
193 |
194 | # SQL Server files
195 | *.mdf
196 | *.ldf
197 |
198 | # Business Intelligence projects
199 | *.rdl.data
200 | *.bim.layout
201 | *.bim_*.settings
202 |
203 | # Microsoft Fakes
204 | FakesAssemblies/
205 |
206 | # GhostDoc plugin setting file
207 | *.GhostDoc.xml
208 |
209 | # Node.js Tools for Visual Studio
210 | .ntvs_analysis.dat
211 |
212 | # Visual Studio 6 build log
213 | *.plg
214 |
215 | # Visual Studio 6 workspace options file
216 | *.opt
217 |
218 | # Visual Studio LightSwitch build output
219 | **/*.HTMLClient/GeneratedArtifacts
220 | **/*.DesktopClient/GeneratedArtifacts
221 | **/*.DesktopClient/ModelManifest.xml
222 | **/*.Server/GeneratedArtifacts
223 | **/*.Server/ModelManifest.xml
224 | _Pvt_Extensions
225 |
226 | # Paket dependency manager
227 | .paket/paket.exe
228 |
229 | # FAKE - F# Make
230 | .fake/
231 |
232 | # =========================
233 | # Operating System Files
234 | # =========================
235 |
236 | # OSX
237 | # =========================
238 |
239 | .DS_Store
240 | .AppleDouble
241 | .LSOverride
242 |
243 | # Thumbnails
244 | ._*
245 |
246 | # Files that might appear in the root of a volume
247 | .DocumentRevisions-V100
248 | .fseventsd
249 | .Spotlight-V100
250 | .TemporaryItems
251 | .Trashes
252 | .VolumeIcon.icns
253 |
254 | # Directories potentially created on remote AFP share
255 | .AppleDB
256 | .AppleDesktop
257 | Network Trash Folder
258 | Temporary Items
259 | .apdisk
260 |
261 | # Windows
262 | # =========================
263 |
264 | # Windows image file caches
265 | Thumbs.db
266 | ehthumbs.db
267 |
268 | # Folder config file
269 | Desktop.ini
270 |
271 | # Recycle Bin used on file shares
272 | $RECYCLE.BIN/
273 |
274 | # Windows Installer files
275 | *.cab
276 | *.msi
277 | *.msm
278 | *.msp
279 |
280 | # Windows shortcuts
281 | *.lnk
282 |
--------------------------------------------------------------------------------
/Client/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Client/Client.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {B6986B23-AF44-455D-9971-32F6696BDCC2}
8 | WinExe
9 | Properties
10 | Client
11 | Client
12 | v4.5
13 | 512
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | true
20 | ..\Bins\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 | true
25 |
26 |
27 | AnyCPU
28 | none
29 | true
30 | ..\Bins\Release\
31 | TRACE
32 | prompt
33 | 4
34 | true
35 |
36 |
37 |
38 | ..\Libraries\LZ4mm.dll
39 | True
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | Form
57 |
58 |
59 | frmClient.cs
60 |
61 |
62 |
63 |
64 |
65 |
66 | frmClient.cs
67 |
68 |
69 | ResXFileCodeGenerator
70 | Resources.Designer.cs
71 | Designer
72 |
73 |
74 | True
75 | Resources.resx
76 |
77 |
78 | SettingsSingleFileGenerator
79 | Settings.Designer.cs
80 |
81 |
82 | True
83 | Settings.settings
84 | True
85 |
86 |
87 |
88 |
89 |
90 |
91 |
98 |
--------------------------------------------------------------------------------
/Client/Extensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Drawing;
4 | using System.Drawing.Imaging;
5 | using System.IO;
6 |
7 | namespace RPON.Extensions
8 | {
9 | public static class BitmapExtension
10 | {
11 | public static byte[] ToByteArray(this Bitmap image, ImageFormat format)
12 | {
13 | using (MemoryStream ms = new MemoryStream())
14 | {
15 | image.Save(ms, format);
16 | return ms.ToArray();
17 | }
18 | }
19 | }
20 |
21 | public static class ByteExtension
22 | {
23 | public static Bitmap toBitmap(this byte[] byteArrayIn)
24 | {
25 | using (MemoryStream ms = new MemoryStream(byteArrayIn))
26 | {
27 | return new Bitmap(ms);
28 | }
29 | }
30 | }
31 |
32 | public static class InvokeExtension
33 | {
34 | public static TResult SafeInvoke(this T isi, Func callFunction)
35 | where T : ISynchronizeInvoke
36 | {
37 | try
38 | {
39 | if (isi.InvokeRequired)
40 | {
41 | IAsyncResult result = isi.BeginInvoke(callFunction, new object[] {isi});
42 | object endResult = isi.EndInvoke(result);
43 | return (TResult) endResult;
44 | }
45 | else
46 | {
47 | return callFunction(isi);
48 | }
49 | }
50 | catch (Exception)
51 | {
52 | return callFunction(isi);
53 | }
54 | }
55 |
56 | public static void SafeInvoke(this T isi, Action callFunction) where T : ISynchronizeInvoke
57 | {
58 | try
59 | {
60 | if (isi.InvokeRequired) isi.BeginInvoke(callFunction, new object[] {isi});
61 | else
62 | callFunction(isi);
63 | }
64 | catch (Exception) { }
65 | }
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/Client/Packet.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace RPON.Packet
4 | {
5 | public class Data
6 | {
7 | public int type;
8 | public bool comp;
9 | public int dataSize;
10 | public byte[] dataBytes;
11 | public int bx;
12 | public int by;
13 | public int bwidth;
14 | public int bheight;
15 |
16 | public Data()
17 | {
18 | this.type = 0;
19 | this.comp = false;
20 | this.dataBytes = new byte[5];
21 | this.dataSize = 0;
22 | this.bx = 0;
23 | this.by = 0;
24 | this.bwidth = 0;
25 | this.bheight = 0;
26 | }
27 |
28 | public byte[] Serialize()
29 | {
30 | using (MemoryStream m = new MemoryStream())
31 | {
32 | using (BinaryWriter writer = new BinaryWriter(m))
33 | {
34 | writer.Write(type);
35 | writer.Write(comp);
36 | writer.Write(bx);
37 | writer.Write(by);
38 | writer.Write(bwidth);
39 | writer.Write(bheight);
40 | writer.Write(dataSize);
41 | writer.Write(dataBytes);
42 | }
43 | return m.ToArray();
44 | }
45 | }
46 |
47 | public static Data Desserialize(byte[] data)
48 | {
49 | Data result = new Data();
50 | using (MemoryStream m = new MemoryStream(data))
51 | {
52 | using (BinaryReader reader = new BinaryReader(m))
53 | {
54 | result.type = reader.ReadInt32();
55 | result.comp = reader.ReadBoolean();
56 | result.bx = reader.ReadInt32();
57 | result.by = reader.ReadInt32();
58 | result.bwidth = reader.ReadInt32();
59 | result.bheight = reader.ReadInt32();
60 | result.dataSize = reader.ReadInt32();
61 | result.dataBytes = reader.ReadBytes(result.dataSize);
62 | }
63 | }
64 | return result;
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/Client/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace Client
5 | {
6 | static class Program
7 | {
8 | ///
9 | /// The main entry point for the application.
10 | ///
11 | [STAThread]
12 | static void Main()
13 | {
14 | Application.EnableVisualStyles();
15 | Application.SetCompatibleTextRenderingDefault(false);
16 | Application.Run(new frmClient());
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Client/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Client")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Client")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("b6986b23-af44-455d-9971-32f6696bdcc2")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Client/Properties/Resources.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 Client.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Client.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Client/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Client/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 Client.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Client/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Client/Utilities.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 |
4 | namespace RPON
5 | {
6 | public static class Utils
7 | {
8 | public static void UpdateScreen(ref Bitmap screen, Image newPartialScreen, Rectangle boundingBox)
9 | {
10 | if (screen == null)
11 | {
12 | screen = new Bitmap(boundingBox.Width, boundingBox.Height);
13 | }
14 |
15 | Graphics g = null;
16 | try
17 | {
18 | lock (screen)
19 | {
20 | g = Graphics.FromImage(screen);
21 | g.DrawImage(newPartialScreen, boundingBox);
22 | g.Flush();
23 | }
24 | }
25 | catch (Exception)
26 | {
27 |
28 | }
29 | finally
30 | {
31 | if (g != null) g.Dispose();
32 | }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Client/frmClient.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Client
2 | {
3 | partial class frmClient
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.label1 = new System.Windows.Forms.Label();
32 | this.txtIP = new System.Windows.Forms.TextBox();
33 | this.txtPort = new System.Windows.Forms.TextBox();
34 | this.label2 = new System.Windows.Forms.Label();
35 | this.btnConnect = new System.Windows.Forms.Button();
36 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
37 | this.btnDisconnect = new System.Windows.Forms.Button();
38 | this.label3 = new System.Windows.Forms.Label();
39 | this.lblFPS = new System.Windows.Forms.Label();
40 | this.tsCredits = new System.Windows.Forms.ToolStrip();
41 | this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
42 | this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
43 | this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
44 | this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel();
45 | this.lblGithubLink = new System.Windows.Forms.ToolStripLabel();
46 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
47 | this.tsCredits.SuspendLayout();
48 | this.SuspendLayout();
49 | //
50 | // label1
51 | //
52 | this.label1.AutoSize = true;
53 | this.label1.Location = new System.Drawing.Point(7, 15);
54 | this.label1.Name = "label1";
55 | this.label1.Size = new System.Drawing.Size(20, 13);
56 | this.label1.TabIndex = 0;
57 | this.label1.Text = "IP:";
58 | //
59 | // txtIP
60 | //
61 | this.txtIP.Location = new System.Drawing.Point(42, 12);
62 | this.txtIP.Name = "txtIP";
63 | this.txtIP.Size = new System.Drawing.Size(150, 20);
64 | this.txtIP.TabIndex = 1;
65 | this.txtIP.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
66 | //
67 | // txtPort
68 | //
69 | this.txtPort.Location = new System.Drawing.Point(237, 12);
70 | this.txtPort.Name = "txtPort";
71 | this.txtPort.Size = new System.Drawing.Size(57, 20);
72 | this.txtPort.TabIndex = 3;
73 | this.txtPort.Text = "5869";
74 | this.txtPort.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
75 | //
76 | // label2
77 | //
78 | this.label2.AutoSize = true;
79 | this.label2.Location = new System.Drawing.Point(202, 15);
80 | this.label2.Name = "label2";
81 | this.label2.Size = new System.Drawing.Size(29, 13);
82 | this.label2.TabIndex = 2;
83 | this.label2.Text = "Port:";
84 | //
85 | // btnConnect
86 | //
87 | this.btnConnect.Location = new System.Drawing.Point(307, 11);
88 | this.btnConnect.Name = "btnConnect";
89 | this.btnConnect.Size = new System.Drawing.Size(103, 21);
90 | this.btnConnect.TabIndex = 4;
91 | this.btnConnect.Text = "Connect";
92 | this.btnConnect.UseVisualStyleBackColor = true;
93 | this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
94 | //
95 | // pictureBox1
96 | //
97 | this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
98 | | System.Windows.Forms.AnchorStyles.Left)
99 | | System.Windows.Forms.AnchorStyles.Right)));
100 | this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
101 | this.pictureBox1.Location = new System.Drawing.Point(10, 44);
102 | this.pictureBox1.Name = "pictureBox1";
103 | this.pictureBox1.Size = new System.Drawing.Size(610, 389);
104 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
105 | this.pictureBox1.TabIndex = 5;
106 | this.pictureBox1.TabStop = false;
107 | //
108 | // btnDisconnect
109 | //
110 | this.btnDisconnect.Enabled = false;
111 | this.btnDisconnect.Location = new System.Drawing.Point(416, 11);
112 | this.btnDisconnect.Name = "btnDisconnect";
113 | this.btnDisconnect.Size = new System.Drawing.Size(103, 21);
114 | this.btnDisconnect.TabIndex = 6;
115 | this.btnDisconnect.Text = "Disconnect";
116 | this.btnDisconnect.UseVisualStyleBackColor = true;
117 | this.btnDisconnect.Click += new System.EventHandler(this.btnDisconnect_Click);
118 | //
119 | // label3
120 | //
121 | this.label3.AutoSize = true;
122 | this.label3.Location = new System.Drawing.Point(537, 15);
123 | this.label3.Name = "label3";
124 | this.label3.Size = new System.Drawing.Size(30, 13);
125 | this.label3.TabIndex = 7;
126 | this.label3.Text = "FPS:";
127 | //
128 | // lblFPS
129 | //
130 | this.lblFPS.AutoSize = true;
131 | this.lblFPS.Location = new System.Drawing.Point(573, 15);
132 | this.lblFPS.Name = "lblFPS";
133 | this.lblFPS.Size = new System.Drawing.Size(13, 13);
134 | this.lblFPS.TabIndex = 8;
135 | this.lblFPS.Text = "0";
136 | //
137 | // tsCredits
138 | //
139 | this.tsCredits.BackColor = System.Drawing.SystemColors.Control;
140 | this.tsCredits.Dock = System.Windows.Forms.DockStyle.Bottom;
141 | this.tsCredits.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
142 | this.tsCredits.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
143 | this.toolStripSeparator2,
144 | this.toolStripLabel1,
145 | this.toolStripSeparator1,
146 | this.toolStripLabel2,
147 | this.lblGithubLink});
148 | this.tsCredits.Location = new System.Drawing.Point(0, 436);
149 | this.tsCredits.Name = "tsCredits";
150 | this.tsCredits.Size = new System.Drawing.Size(632, 25);
151 | this.tsCredits.TabIndex = 48;
152 | this.tsCredits.Text = "toolStrip1";
153 | //
154 | // toolStripSeparator2
155 | //
156 | this.toolStripSeparator2.Name = "toolStripSeparator2";
157 | this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
158 | //
159 | // toolStripLabel1
160 | //
161 | this.toolStripLabel1.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
162 | this.toolStripLabel1.Name = "toolStripLabel1";
163 | this.toolStripLabel1.Size = new System.Drawing.Size(108, 22);
164 | this.toolStripLabel1.Text = "Ilias Karamanis";
165 | //
166 | // toolStripSeparator1
167 | //
168 | this.toolStripSeparator1.Name = "toolStripSeparator1";
169 | this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
170 | //
171 | // toolStripLabel2
172 | //
173 | this.toolStripLabel2.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
174 | this.toolStripLabel2.Name = "toolStripLabel2";
175 | this.toolStripLabel2.Size = new System.Drawing.Size(103, 22);
176 | this.toolStripLabel2.Text = "Github Profile:";
177 | //
178 | // lblGithubLink
179 | //
180 | this.lblGithubLink.Font = new System.Drawing.Font("Segoe UI", 11.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Italic | System.Drawing.FontStyle.Underline))), System.Drawing.GraphicsUnit.Point, ((byte)(238)));
181 | this.lblGithubLink.ForeColor = System.Drawing.Color.Maroon;
182 | this.lblGithubLink.IsLink = true;
183 | this.lblGithubLink.LinkBehavior = System.Windows.Forms.LinkBehavior.AlwaysUnderline;
184 | this.lblGithubLink.LinkColor = System.Drawing.Color.Maroon;
185 | this.lblGithubLink.Name = "lblGithubLink";
186 | this.lblGithubLink.Size = new System.Drawing.Size(232, 22);
187 | this.lblGithubLink.Text = "https://github.com/KaramanisWeb";
188 | this.lblGithubLink.Click += new System.EventHandler(this.lblGithubLink_Click);
189 | //
190 | // frmClient
191 | //
192 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
193 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
194 | this.ClientSize = new System.Drawing.Size(632, 461);
195 | this.Controls.Add(this.tsCredits);
196 | this.Controls.Add(this.lblFPS);
197 | this.Controls.Add(this.label3);
198 | this.Controls.Add(this.btnDisconnect);
199 | this.Controls.Add(this.pictureBox1);
200 | this.Controls.Add(this.btnConnect);
201 | this.Controls.Add(this.txtPort);
202 | this.Controls.Add(this.label2);
203 | this.Controls.Add(this.txtIP);
204 | this.Controls.Add(this.label1);
205 | this.DoubleBuffered = true;
206 | this.Name = "frmClient";
207 | this.Text = "Client : RemoteDesktopOverNetwork";
208 | this.Load += new System.EventHandler(this.frmClient_Load);
209 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
210 | this.tsCredits.ResumeLayout(false);
211 | this.tsCredits.PerformLayout();
212 | this.ResumeLayout(false);
213 | this.PerformLayout();
214 |
215 | }
216 |
217 | #endregion
218 |
219 | private System.Windows.Forms.Label label1;
220 | private System.Windows.Forms.TextBox txtIP;
221 | private System.Windows.Forms.TextBox txtPort;
222 | private System.Windows.Forms.Label label2;
223 | private System.Windows.Forms.Button btnConnect;
224 | private System.Windows.Forms.PictureBox pictureBox1;
225 | private System.Windows.Forms.Button btnDisconnect;
226 | private System.Windows.Forms.Label label3;
227 | private System.Windows.Forms.Label lblFPS;
228 | private System.Windows.Forms.ToolStrip tsCredits;
229 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
230 | private System.Windows.Forms.ToolStripLabel toolStripLabel1;
231 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
232 | private System.Windows.Forms.ToolStripLabel toolStripLabel2;
233 | private System.Windows.Forms.ToolStripLabel lblGithubLink;
234 | }
235 | }
236 |
237 |
--------------------------------------------------------------------------------
/Client/frmClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Drawing;
4 | using System.Net;
5 | using System.Net.Sockets;
6 | using System.Windows.Forms;
7 | using RPON;
8 | using RPON.Extensions;
9 | using RPON.Packet;
10 |
11 | namespace Client
12 | {
13 | public partial class frmClient : Form
14 | {
15 | private Socket ClientSocket;
16 | private byte[] lengthBUFF = new byte[4];
17 | private bool firstImage = false;
18 | private Bitmap oldImage;
19 | private int FPS = 0;
20 | Stopwatch fpsCounter = new Stopwatch();
21 |
22 | public frmClient()
23 | {
24 | InitializeComponent();
25 | }
26 |
27 | private void Connect(bool status)
28 | {
29 | firstImage = false;
30 |
31 | btnConnect.Enabled = !status;
32 | btnDisconnect.Enabled = status;
33 | txtPort.Enabled = !status;
34 | txtIP.Enabled = !status;
35 | try
36 | {
37 | if (status)
38 | {
39 | ClientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
40 | ClientSocket.Connect(IPAddress.Parse(txtIP.Text), int.Parse(txtPort.Text));
41 | if (ClientSocket.Connected)
42 | {
43 | fpsCounter = Stopwatch.StartNew();
44 | ClientSocket.BeginReceive(lengthBUFF, 0, lengthBUFF.Length, SocketFlags.None, Begin_Receive,null);
45 | }
46 | }
47 | else
48 | {
49 | if (ClientSocket != null && ClientSocket.Connected)
50 | {
51 | ClientSocket.Shutdown(SocketShutdown.Both);
52 | ClientSocket.Disconnect(false);
53 | ClientSocket = null;
54 | }
55 | }
56 | }
57 | catch (Exception ex)
58 | {
59 | //MessageBox.Show("Exception: " + ex.Message);
60 | }
61 | }
62 |
63 | private void Begin_Receive(IAsyncResult ar)
64 | {
65 | if (ClientSocket != null)
66 | {
67 | try
68 | {
69 | ClientSocket.EndReceive(ar);
70 | byte[] Header = lengthBUFF;
71 | int length = BitConverter.ToInt32(Header, 0);
72 | byte[] Payload = ReceiveData(length, ClientSocket);
73 |
74 | if (Header.Length == 4 && Payload.Length == length)
75 | {
76 | Data DTU = Data.Desserialize(Payload);
77 | if (DTU.type != 0)
78 | {
79 | if (DTU.type == 1)
80 | {
81 | Rectangle bounds = new Rectangle(DTU.bx, DTU.by, DTU.bwidth, DTU.bheight);
82 | Image restoreIMG;
83 |
84 | if (DTU.comp)
85 | {
86 | restoreIMG =
87 | LZ4mm.LZ4Codec.Decode32(DTU.dataBytes, 0, DTU.dataBytes.Length, DTU.dataSize)
88 | .toBitmap();
89 | }
90 | else
91 | {
92 | restoreIMG = (Bitmap)DTU.dataBytes.toBitmap();
93 | }
94 |
95 | if (!firstImage)
96 | {
97 | oldImage = (Bitmap) restoreIMG;
98 | firstImage = true;
99 | }
100 | else
101 | {
102 | Utils.UpdateScreen(ref oldImage, restoreIMG, bounds);
103 | }
104 | }
105 | else if (DTU.type == 2)
106 | {
107 | oldImage = (Bitmap)DTU.dataBytes.toBitmap();
108 | }
109 |
110 | this.pictureBox1.Image = oldImage;
111 |
112 | FPS++;
113 | if (fpsCounter.ElapsedMilliseconds >= 1000)
114 | {
115 | this.Invoke(new MethodInvoker(() =>
116 | {
117 | this.lblFPS.Text = FPS.ToString();
118 | }));
119 |
120 | FPS = 0;
121 | fpsCounter = Stopwatch.StartNew();
122 | }
123 | }
124 | }
125 | }
126 | catch (Exception ex)
127 | {
128 | //MessageBox.Show("Exception: " + ex.Message);
129 | }
130 |
131 | try
132 | {
133 | if (ClientSocket.Connected)
134 | ClientSocket.BeginReceive(lengthBUFF, 0, lengthBUFF.Length, SocketFlags.None, Begin_Receive,
135 | null);
136 | }
137 | catch (Exception ex )
138 | {
139 | Connect(false);
140 | //MessageBox.Show("Exception: " + ex.Message);
141 | }
142 | }
143 | }
144 |
145 | private byte[] ReceiveData(int Length, Socket socket)
146 | {
147 | byte[] data = new byte[Length];
148 | int offset = 0;
149 |
150 | while (Length > 0)
151 | {
152 | int recv = socket.Receive(data, offset, Length, SocketFlags.None);
153 |
154 | if (recv <= 0)
155 | return new byte[0];
156 |
157 | offset += recv;
158 | Length -= recv;
159 | }
160 | return data;
161 | }
162 |
163 | private void frmClient_Load(object sender, EventArgs e)
164 | {
165 | var host = Dns.GetHostEntry(Dns.GetHostName());
166 | foreach (var ip in host.AddressList)
167 | {
168 | if (ip.AddressFamily == AddressFamily.InterNetwork)
169 | {
170 | txtIP.Text = ip.ToString();
171 | }
172 | }
173 | }
174 |
175 | private void btnConnect_Click(object sender, EventArgs e)
176 | {
177 | Connect(true);
178 | }
179 |
180 | private void btnDisconnect_Click(object sender, EventArgs e)
181 | {
182 | Connect(false);
183 | }
184 |
185 | private void lblGithubLink_Click(object sender, EventArgs e)
186 | {
187 | Process.Start(lblGithubLink.Text);
188 | }
189 | }
190 | }
191 |
--------------------------------------------------------------------------------
/Client/frmClient.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Ilias Karamanis
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Libraries/LZ4.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KaramanisDev/RemoteDesktopOverNetwork/e0bf8c779b8eef6697160703f3c13ecf63607707/Libraries/LZ4.dll
--------------------------------------------------------------------------------
/Libraries/LZ4cc.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KaramanisDev/RemoteDesktopOverNetwork/e0bf8c779b8eef6697160703f3c13ecf63607707/Libraries/LZ4cc.dll
--------------------------------------------------------------------------------
/Libraries/LZ4mm.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KaramanisDev/RemoteDesktopOverNetwork/e0bf8c779b8eef6697160703f3c13ecf63607707/Libraries/LZ4mm.dll
--------------------------------------------------------------------------------
/Libraries/LZ4pn.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KaramanisDev/RemoteDesktopOverNetwork/e0bf8c779b8eef6697160703f3c13ecf63607707/Libraries/LZ4pn.dll
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RemoteDesktopOverNetwork
2 | Application written in C# for Remote Desktop Over Network
3 |
4 | This was a project for a lesson at my University that takes advantage of some algorithms that will help for faster & a better way to share the desktop over the network from one user to another. Also, it captures logs, statistics, the last frame sent and you have the option to emulate a frame delay & drop.
5 |
6 | Big Thanks to:
7 | - LZ4 Compression: https://github.com/MiloszKrajewski/lz4net
8 | - Screen Change Detect Algorithm: http://bobcravens.com/2009/04/create-a-remote-desktop-viewer-using-c-and-wcf/
9 | - Safe Invoke Class: http://www.codeproject.com/Articles/52752/Updating-Your-Form-from-Another-Thread-without-Cre
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/RemoteDesktopOverNetwork.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\Server.csproj", "{287251A5-5886-4F43-9575-CD007B5F0E86}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client\Client.csproj", "{B6986B23-AF44-455D-9971-32F6696BDCC2}"
9 | ProjectSection(ProjectDependencies) = postProject
10 | {287251A5-5886-4F43-9575-CD007B5F0E86} = {287251A5-5886-4F43-9575-CD007B5F0E86}
11 | EndProjectSection
12 | EndProject
13 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{645D0F47-92F2-406E-A90B-5C912CDC884B}"
14 | EndProject
15 | Global
16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
17 | Debug|Any CPU = Debug|Any CPU
18 | Release|Any CPU = Release|Any CPU
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {287251A5-5886-4F43-9575-CD007B5F0E86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22 | {287251A5-5886-4F43-9575-CD007B5F0E86}.Debug|Any CPU.Build.0 = Debug|Any CPU
23 | {287251A5-5886-4F43-9575-CD007B5F0E86}.Release|Any CPU.ActiveCfg = Release|Any CPU
24 | {287251A5-5886-4F43-9575-CD007B5F0E86}.Release|Any CPU.Build.0 = Release|Any CPU
25 | {B6986B23-AF44-455D-9971-32F6696BDCC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26 | {B6986B23-AF44-455D-9971-32F6696BDCC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
27 | {B6986B23-AF44-455D-9971-32F6696BDCC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
28 | {B6986B23-AF44-455D-9971-32F6696BDCC2}.Release|Any CPU.Build.0 = Release|Any CPU
29 | {645D0F47-92F2-406E-A90B-5C912CDC884B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30 | {645D0F47-92F2-406E-A90B-5C912CDC884B}.Debug|Any CPU.Build.0 = Debug|Any CPU
31 | {645D0F47-92F2-406E-A90B-5C912CDC884B}.Release|Any CPU.ActiveCfg = Release|Any CPU
32 | {645D0F47-92F2-406E-A90B-5C912CDC884B}.Release|Any CPU.Build.0 = Release|Any CPU
33 | EndGlobalSection
34 | GlobalSection(SolutionProperties) = preSolution
35 | HideSolutionNode = FALSE
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/Server/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Server/Extensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Drawing;
4 | using System.Drawing.Imaging;
5 | using System.IO;
6 |
7 | namespace RPON.Extensions
8 | {
9 | public static class BitmapExtension
10 | {
11 | public static byte[] ToByteArray(this Bitmap image, ImageFormat format)
12 | {
13 | using (MemoryStream ms = new MemoryStream())
14 | {
15 | image.Save(ms, format);
16 | return ms.ToArray();
17 | }
18 | }
19 | }
20 |
21 | public static class ByteExtension
22 | {
23 | public static Bitmap toBitmap(this byte[] byteArrayIn)
24 | {
25 | using (MemoryStream ms = new MemoryStream(byteArrayIn))
26 | {
27 | return new Bitmap(ms);
28 | }
29 | }
30 | }
31 |
32 | public static class InvokeExtension
33 | {
34 | public static TResult SafeInvoke(this T isi, Func callFunction)
35 | where T : ISynchronizeInvoke
36 | {
37 | try
38 | {
39 | if (isi.InvokeRequired)
40 | {
41 | IAsyncResult result = isi.BeginInvoke(callFunction, new object[] { isi });
42 | object endResult = isi.EndInvoke(result);
43 | return (TResult)endResult;
44 | }
45 | else
46 | {
47 | return callFunction(isi);
48 | }
49 | }
50 | catch (Exception)
51 | {
52 | return callFunction(isi);
53 | }
54 | }
55 |
56 | public static void SafeInvoke(this T isi, Action callFunction) where T : ISynchronizeInvoke
57 | {
58 | try
59 | {
60 | if (isi.InvokeRequired) isi.BeginInvoke(callFunction, new object[] { isi });
61 | else
62 | callFunction(isi);
63 | }
64 | catch (Exception) { }
65 | }
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/Server/Packet.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace RPON.Packet
4 | {
5 | public class Data
6 | {
7 | public int type;
8 | public bool comp;
9 | public int dataSize;
10 | public byte[] dataBytes;
11 | public int bx;
12 | public int by;
13 | public int bwidth;
14 | public int bheight;
15 |
16 | public Data()
17 | {
18 | this.type = 0;
19 | this.comp = false;
20 | this.dataBytes = new byte[5];
21 | this.dataSize = 0;
22 | this.bx = 0;
23 | this.by = 0;
24 | this.bwidth = 0;
25 | this.bheight = 0;
26 | }
27 |
28 | public byte[] Serialize()
29 | {
30 | using (MemoryStream m = new MemoryStream())
31 | {
32 | using (BinaryWriter writer = new BinaryWriter(m))
33 | {
34 | writer.Write(type);
35 | writer.Write(comp);
36 | writer.Write(bx);
37 | writer.Write(by);
38 | writer.Write(bwidth);
39 | writer.Write(bheight);
40 | writer.Write(dataSize);
41 | writer.Write(dataBytes);
42 | }
43 | return m.ToArray();
44 | }
45 | }
46 |
47 | public static Data Desserialize(byte[] data)
48 | {
49 | Data result = new Data();
50 | using (MemoryStream m = new MemoryStream(data))
51 | {
52 | using (BinaryReader reader = new BinaryReader(m))
53 | {
54 | result.type = reader.ReadInt32();
55 | result.comp = reader.ReadBoolean();
56 | result.bx = reader.ReadInt32();
57 | result.by = reader.ReadInt32();
58 | result.bwidth = reader.ReadInt32();
59 | result.bheight = reader.ReadInt32();
60 | result.dataSize = reader.ReadInt32();
61 | result.dataBytes = reader.ReadBytes(result.dataSize);
62 | }
63 | }
64 | return result;
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/Server/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace Server
5 | {
6 | static class Program
7 | {
8 | ///
9 | /// The main entry point for the application.
10 | ///
11 | [STAThread]
12 | static void Main()
13 | {
14 | Application.EnableVisualStyles();
15 | Application.SetCompatibleTextRenderingDefault(false);
16 | Application.Run(new frmServer());
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Server/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Server")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Server")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("287251a5-5886-4f43-9575-cd007b5f0e86")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Server/Properties/Resources.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 Server.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Server.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Server/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Server/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 Server.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Server/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Server/ScreenCapture.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Linq;
4 | using System.Runtime.InteropServices;
5 | using System.Windows.Forms;
6 |
7 | namespace RPON
8 | {
9 | public class ScreenCapture
10 | {
11 | [StructLayout(LayoutKind.Sequential)]
12 | private struct CURSORINFO
13 | {
14 | public Int32 cbSize;
15 | public Int32 flags;
16 | public IntPtr hCursor;
17 | public POINTAPI ptScreenPos;
18 | }
19 |
20 | [StructLayout(LayoutKind.Sequential)]
21 | private struct POINTAPI
22 | {
23 | public int x;
24 | public int y;
25 | }
26 |
27 | [DllImport("user32.dll")]
28 | private static extern bool GetCursorInfo(out CURSORINFO pci);
29 |
30 | [DllImport("user32.dll", SetLastError = true)]
31 | static extern bool DrawIconEx(IntPtr hdc, int xLeft, int yTop, IntPtr hIcon, int cxWidth, int cyHeight, int istepIfAniCur, IntPtr hbrFlickerFreeDraw, int diFlags);
32 |
33 | private const Int32 CURSOR_SHOWING = 0x0001;
34 | private const Int32 DI_NORMAL = 0x0003;
35 |
36 | public static Bitmap CaptureFullScreen(bool captureMouse)
37 | {
38 | var allBounds = Screen.AllScreens.Select(s => s.Bounds).ToArray();
39 | Rectangle bounds = Rectangle.FromLTRB(allBounds.Min(b => b.Left), allBounds.Min(b => b.Top), allBounds.Max(b => b.Right), allBounds.Max(b => b.Bottom));
40 |
41 | var bitmap = CaptureScreen(bounds, captureMouse);
42 | return bitmap;
43 | }
44 |
45 | public static Bitmap CaptureSelectedScreen(int screenNumber,bool captureMouse)
46 | {
47 | Rectangle bounds = Screen.AllScreens[screenNumber].Bounds;
48 |
49 | var bitmap = CaptureScreen(bounds, captureMouse);
50 | return bitmap;
51 | }
52 |
53 | public static Bitmap CaptureScreen(Rectangle bounds, bool captureMouse)
54 | {
55 | Bitmap result = new Bitmap(bounds.Width, bounds.Height);
56 |
57 | try
58 | {
59 | using (Graphics g = Graphics.FromImage(result))
60 | {
61 | g.CopyFromScreen(bounds.Location, Point.Empty, bounds.Size);
62 |
63 | if (captureMouse)
64 | {
65 | CURSORINFO pci;
66 | pci.cbSize = Marshal.SizeOf(typeof (CURSORINFO));
67 |
68 | if (GetCursorInfo(out pci))
69 | {
70 | if (pci.flags == CURSOR_SHOWING)
71 | {
72 | var hdc = g.GetHdc();
73 | // (IntPtr)65539
74 | DrawIconEx(hdc, pci.ptScreenPos.x - bounds.X, pci.ptScreenPos.y - bounds.Y, pci.hCursor,
75 | 0, 0, 0, IntPtr.Zero, DI_NORMAL);
76 | g.ReleaseHdc();
77 | }
78 | }
79 | }
80 | }
81 | }
82 | catch
83 | {
84 | result = null;
85 | }
86 |
87 | return result;
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/Server/ScreenChangeDetect.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Drawing.Imaging;
4 |
5 | namespace RPON
6 | {
7 | public class ScreenChangeDetect
8 | {
9 | private Bitmap _prevBitmap;
10 | private Bitmap _newBitmap = new Bitmap(1, 1);
11 | private Graphics _graphics;
12 |
13 | public double PercentOfImage { get; set; }
14 |
15 | public ScreenChangeDetect(Bitmap oldIM = null)
16 | {
17 | this._prevBitmap = oldIM;
18 | Bitmap junk = new Bitmap(10, 10);
19 | _graphics = Graphics.FromImage(junk);
20 | }
21 |
22 | public Bitmap Check(Bitmap newIM, ref Rectangle bounds)
23 | {
24 | Bitmap diff = null;
25 |
26 | // Capture a new screenshot.
27 | //
28 | lock (_newBitmap)
29 | {
30 | _newBitmap = newIM;
31 |
32 | // If we have a previous screenshot, only send back
33 | // a subset that is the minimum rectangular area
34 | // that encompasses all the changed pixels.
35 | //
36 | if (_prevBitmap != null)
37 | {
38 | // Get the bounding box.
39 | //
40 | bounds = GetBoundingBoxForChanges();
41 | if (bounds == Rectangle.Empty)
42 | {
43 | // Nothing has changed.
44 | //
45 | PercentOfImage = 0.0;
46 | }
47 | else
48 | {
49 | // Get the minimum rectangular area
50 | //
51 | diff = new Bitmap(bounds.Width, bounds.Height);
52 | _graphics = Graphics.FromImage(diff);
53 | _graphics.DrawImage(_newBitmap, 0, 0, bounds, GraphicsUnit.Pixel);
54 |
55 | // Set the current bitmap as the previous to prepare
56 | // for the next screen capture.
57 | //
58 | _prevBitmap = _newBitmap;
59 |
60 | lock (_newBitmap)
61 | {
62 | PercentOfImage = 100.0 * (diff.Height * diff.Width) / (_newBitmap.Height * _newBitmap.Width);
63 | }
64 | }
65 | }
66 | // We don't have a previous screen capture. Therefore
67 | // we need to send back the whole screen this time.
68 | //
69 | else
70 | {
71 | // Set the previous bitmap to the current to prepare
72 | // for the next screen capture.
73 | //
74 | _prevBitmap = _newBitmap;
75 | diff = _newBitmap;
76 |
77 | // Create a bounding rectangle.
78 | //
79 | bounds = new Rectangle(0, 0, _newBitmap.Width, _newBitmap.Height);
80 |
81 | PercentOfImage = 100.0;
82 | }
83 | }
84 | return diff;
85 | }
86 |
87 | public void Reset()
88 | {
89 | _prevBitmap = null;
90 | _newBitmap = new Bitmap(1, 1);
91 | }
92 |
93 | private Rectangle GetBoundingBoxForChanges()
94 | {
95 | // The search algorithm starts by looking
96 | // for the top and left bounds. The search
97 | // starts in the upper-left corner and scans
98 | // left to right and then top to bottom. It uses
99 | // an adaptive approach on the pixels it
100 | // searches. Another pass is looks for the
101 | // lower and right bounds. The search starts
102 | // in the lower-right corner and scans right
103 | // to left and then bottom to top. Again, an
104 | // adaptive approach on the search area is used.
105 | //
106 |
107 | // Notice: The GetPixel member of the Bitmap class
108 | // is too slow for this purpose. This is a good
109 | // case of using unsafe code to access pointers
110 | // to increase the speed.
111 | //
112 |
113 | // Validate the images are the same shape and type.
114 | //
115 | if (_prevBitmap.Width != _newBitmap.Width ||
116 | _prevBitmap.Height != _newBitmap.Height ||
117 | _prevBitmap.PixelFormat != _newBitmap.PixelFormat)
118 | {
119 | // Not the same shape...can't do the search.
120 | //
121 | return Rectangle.Empty;
122 | }
123 |
124 | // Init the search parameters.
125 | //
126 | int width = _newBitmap.Width;
127 | int height = _newBitmap.Height;
128 | int left = width;
129 | int right = 0;
130 | int top = height;
131 | int bottom = 0;
132 |
133 | BitmapData bmNewData = null;
134 | BitmapData bmPrevData = null;
135 | try
136 | {
137 | // Lock the bits into memory.
138 | //
139 | bmNewData = _newBitmap.LockBits(
140 | new Rectangle(0, 0, _newBitmap.Width, _newBitmap.Height),
141 | ImageLockMode.ReadOnly, _newBitmap.PixelFormat);
142 | bmPrevData = _prevBitmap.LockBits(
143 | new Rectangle(0, 0, _prevBitmap.Width, _prevBitmap.Height),
144 | ImageLockMode.ReadOnly, _prevBitmap.PixelFormat);
145 |
146 | // The images are ARGB (4 bytes)
147 | //
148 | const int numBytesPerPixel = 4;
149 |
150 | // Get the number of integers (4 bytes) in each row
151 | // of the image.
152 | //
153 | int strideNew = bmNewData.Stride / numBytesPerPixel;
154 | int stridePrev = bmPrevData.Stride / numBytesPerPixel;
155 |
156 | // Get a pointer to the first pixel.
157 | //
158 | // Notice: Another speed up implemented is that I don't
159 | // need the ARGB elements. I am only trying to detect
160 | // change. So this algorithm reads the 4 bytes as an
161 | // integer and compares the two numbers.
162 | //
163 | IntPtr scanNew0 = bmNewData.Scan0;
164 | IntPtr scanPrev0 = bmPrevData.Scan0;
165 |
166 | // Enter the unsafe code.
167 | //
168 | unsafe
169 | {
170 | // Cast the safe pointers into unsafe pointers.
171 | //
172 | int* pNew = (int*)(void*)scanNew0;
173 | int* pPrev = (int*)(void*)scanPrev0;
174 |
175 | // First Pass - Find the left and top bounds
176 | // of the minimum bounding rectangle. Adapt the
177 | // number of pixels scanned from left to right so
178 | // we only scan up to the current bound. We also
179 | // initialize the bottom & right. This helps optimize
180 | // the second pass.
181 | //
182 | // For all rows of pixels (top to bottom)
183 | //
184 | for (int y = 0; y < _newBitmap.Height; y++)
185 | {
186 | // For pixels up to the current bound (left to right)
187 | //
188 | for (int x = 0; x < left; x++)
189 | {
190 | // Use pointer arithmetic to index the
191 | // next pixel in this row.
192 | //
193 | if ((pNew + x)[0] != (pPrev + x)[0])
194 | {
195 | // Found a change.
196 | //
197 | if (x < left)
198 | {
199 | left = x;
200 | }
201 | if (x > right)
202 | {
203 | right = x;
204 | }
205 | if (y < top)
206 | {
207 | top = y;
208 | }
209 | if (y > bottom)
210 | {
211 | bottom = y;
212 | }
213 | }
214 | }
215 |
216 | // Move the pointers to the next row.
217 | //
218 | pNew += strideNew;
219 | pPrev += stridePrev;
220 | }
221 |
222 | // If we did not find any changed pixels
223 | // then no need to do a second pass.
224 | //
225 | if (left != width)
226 | {
227 | // Second Pass - The first pass found at
228 | // least one different pixel and has set
229 | // the left & top bounds. In addition, the
230 | // right & bottom bounds have been initialized.
231 | // Adapt the number of pixels scanned from right
232 | // to left so we only scan up to the current bound.
233 | // In addition, there is no need to scan past
234 | // the top bound.
235 | //
236 |
237 | // Set the pointers to the first element of the
238 | // bottom row.
239 | //
240 | pNew = (int*)(void*)scanNew0;
241 | pPrev = (int*)(void*)scanPrev0;
242 | pNew += (_newBitmap.Height - 1) * strideNew;
243 | pPrev += (_prevBitmap.Height - 1) * stridePrev;
244 |
245 | // For each row (bottom to top)
246 | //
247 | for (int y = _newBitmap.Height - 1; y > top; y--)
248 | {
249 | // For each column (right to left)
250 | //
251 | for (int x = _newBitmap.Width - 1; x > right; x--)
252 | {
253 | // Use pointer arithmetic to index the
254 | // next pixel in this row.
255 | //
256 | if ((pNew + x)[0] != (pPrev + x)[0])
257 | {
258 | // Found a change.
259 | //
260 | if (x > right)
261 | {
262 | right = x;
263 | }
264 | if (y > bottom)
265 | {
266 | bottom = y;
267 | }
268 | }
269 | }
270 |
271 | // Move up one row.
272 | //
273 | pNew -= strideNew;
274 | pPrev -= stridePrev;
275 | }
276 | }
277 | }
278 | }
279 | catch (Exception)
280 | {
281 | // Do something with this info.
282 | }
283 | finally
284 | {
285 | // Unlock the bits of the image.
286 | //
287 | if (bmNewData != null)
288 | {
289 | _newBitmap.UnlockBits(bmNewData);
290 | }
291 | if (bmPrevData != null)
292 | {
293 | _prevBitmap.UnlockBits(bmPrevData);
294 | }
295 | }
296 |
297 | // Validate we found a bounding box. If not
298 | // return an empty rectangle.
299 | //
300 | int diffImgWidth = right - left + 1;
301 | int diffImgHeight = bottom - top + 1;
302 | if (diffImgHeight < 0 || diffImgWidth < 0)
303 | {
304 | // Nothing changed
305 | return Rectangle.Empty;
306 | }
307 |
308 | // Return the bounding box.
309 | //
310 | return new Rectangle(left, top, diffImgWidth, diffImgHeight);
311 | }
312 | }
313 | }
314 |
--------------------------------------------------------------------------------
/Server/Server.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {287251A5-5886-4F43-9575-CD007B5F0E86}
8 | WinExe
9 | Properties
10 | Server
11 | Server
12 | v4.5
13 | 512
14 | publish\
15 | true
16 | Disk
17 | false
18 | Foreground
19 | 7
20 | Days
21 | false
22 | false
23 | true
24 | 0
25 | 1.0.0.%2a
26 | false
27 | false
28 | true
29 |
30 |
31 | AnyCPU
32 | true
33 | full
34 | true
35 | ..\Bins\Debug\
36 | DEBUG;TRACE
37 | prompt
38 | 0
39 | true
40 |
41 |
42 | AnyCPU
43 | none
44 | true
45 | ..\Bins\Release\
46 | TRACE
47 | prompt
48 | 4
49 | true
50 |
51 |
52 |
53 | ..\Libraries\LZ4mm.dll
54 | True
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | Form
72 |
73 |
74 | frmServer.cs
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | frmServer.cs
83 |
84 |
85 | ResXFileCodeGenerator
86 | Resources.Designer.cs
87 | Designer
88 |
89 |
90 | True
91 | Resources.resx
92 |
93 |
94 | SettingsSingleFileGenerator
95 | Settings.Designer.cs
96 |
97 |
98 | True
99 | Settings.settings
100 | True
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 | False
109 | Microsoft .NET Framework 4.5 %28x86 and x64%29
110 | true
111 |
112 |
113 | False
114 | .NET Framework 3.5 SP1
115 | false
116 |
117 |
118 |
119 |
126 |
--------------------------------------------------------------------------------
/Server/frmServer.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Server
2 | {
3 | partial class frmServer
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.btnStart = new System.Windows.Forms.Button();
32 | this.btnStop = new System.Windows.Forms.Button();
33 | this.label1 = new System.Windows.Forms.Label();
34 | this.txtLocalIP = new System.Windows.Forms.TextBox();
35 | this.label2 = new System.Windows.Forms.Label();
36 | this.txtPort = new System.Windows.Forms.TextBox();
37 | this.label3 = new System.Windows.Forms.Label();
38 | this.cbxScreens = new System.Windows.Forms.ComboBox();
39 | this.label4 = new System.Windows.Forms.Label();
40 | this.lblStatus = new System.Windows.Forms.Label();
41 | this.label7 = new System.Windows.Forms.Label();
42 | this.label8 = new System.Windows.Forms.Label();
43 | this.lblFrames = new System.Windows.Forms.Label();
44 | this.label9 = new System.Windows.Forms.Label();
45 | this.label10 = new System.Windows.Forms.Label();
46 | this.lblUncomp = new System.Windows.Forms.Label();
47 | this.lblComp = new System.Windows.Forms.Label();
48 | this.label12 = new System.Windows.Forms.Label();
49 | this.pcbFrame = new System.Windows.Forms.PictureBox();
50 | this.label14 = new System.Windows.Forms.Label();
51 | this.lblCompRatio = new System.Windows.Forms.Label();
52 | this.label16 = new System.Windows.Forms.Label();
53 | this.txtLogs = new System.Windows.Forms.TextBox();
54 | this.label15 = new System.Windows.Forms.Label();
55 | this.lblSeconds = new System.Windows.Forms.Label();
56 | this.tbDelay = new System.Windows.Forms.TrackBar();
57 | this.label5 = new System.Windows.Forms.Label();
58 | this.lblDelay = new System.Windows.Forms.Label();
59 | this.lblNoAlgo = new System.Windows.Forms.Label();
60 | this.label18 = new System.Windows.Forms.Label();
61 | this.lblEfficRatio = new System.Windows.Forms.Label();
62 | this.label19 = new System.Windows.Forms.Label();
63 | this.label20 = new System.Windows.Forms.Label();
64 | this.cbMouse = new System.Windows.Forms.CheckBox();
65 | this.lblPercentOfIm = new System.Windows.Forms.Label();
66 | this.label21 = new System.Windows.Forms.Label();
67 | this.lblFramesNoAlgo = new System.Windows.Forms.Label();
68 | this.label22 = new System.Windows.Forms.Label();
69 | this.btnReset = new System.Windows.Forms.Button();
70 | this.cbAlgorithm = new System.Windows.Forms.CheckBox();
71 | this.cbStats = new System.Windows.Forms.CheckBox();
72 | this.cbLogs = new System.Windows.Forms.CheckBox();
73 | this.cbLastFrame = new System.Windows.Forms.CheckBox();
74 | this.btnClear = new System.Windows.Forms.Button();
75 | this.tsCredits = new System.Windows.Forms.ToolStrip();
76 | this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
77 | this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
78 | this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
79 | this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel();
80 | this.lblGithubLink = new System.Windows.Forms.ToolStripLabel();
81 | this.lblPacketDrop = new System.Windows.Forms.Label();
82 | this.label11 = new System.Windows.Forms.Label();
83 | this.tbPacketDrop = new System.Windows.Forms.TrackBar();
84 | ((System.ComponentModel.ISupportInitialize)(this.pcbFrame)).BeginInit();
85 | ((System.ComponentModel.ISupportInitialize)(this.tbDelay)).BeginInit();
86 | this.tsCredits.SuspendLayout();
87 | ((System.ComponentModel.ISupportInitialize)(this.tbPacketDrop)).BeginInit();
88 | this.SuspendLayout();
89 | //
90 | // btnStart
91 | //
92 | this.btnStart.Location = new System.Drawing.Point(15, 77);
93 | this.btnStart.Name = "btnStart";
94 | this.btnStart.Size = new System.Drawing.Size(119, 23);
95 | this.btnStart.TabIndex = 0;
96 | this.btnStart.Text = "Start";
97 | this.btnStart.UseVisualStyleBackColor = true;
98 | this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
99 | //
100 | // btnStop
101 | //
102 | this.btnStop.Enabled = false;
103 | this.btnStop.Location = new System.Drawing.Point(152, 77);
104 | this.btnStop.Name = "btnStop";
105 | this.btnStop.Size = new System.Drawing.Size(119, 23);
106 | this.btnStop.TabIndex = 1;
107 | this.btnStop.Text = "Stop";
108 | this.btnStop.UseVisualStyleBackColor = true;
109 | this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
110 | //
111 | // label1
112 | //
113 | this.label1.AutoSize = true;
114 | this.label1.Location = new System.Drawing.Point(12, 21);
115 | this.label1.Name = "label1";
116 | this.label1.Size = new System.Drawing.Size(74, 13);
117 | this.label1.TabIndex = 2;
118 | this.label1.Text = "Your Local IP:";
119 | //
120 | // txtLocalIP
121 | //
122 | this.txtLocalIP.Location = new System.Drawing.Point(92, 18);
123 | this.txtLocalIP.Name = "txtLocalIP";
124 | this.txtLocalIP.ReadOnly = true;
125 | this.txtLocalIP.Size = new System.Drawing.Size(179, 20);
126 | this.txtLocalIP.TabIndex = 3;
127 | this.txtLocalIP.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
128 | //
129 | // label2
130 | //
131 | this.label2.AutoSize = true;
132 | this.label2.Location = new System.Drawing.Point(14, 52);
133 | this.label2.Name = "label2";
134 | this.label2.Size = new System.Drawing.Size(72, 13);
135 | this.label2.TabIndex = 4;
136 | this.label2.Text = "Port to Listen:";
137 | //
138 | // txtPort
139 | //
140 | this.txtPort.Location = new System.Drawing.Point(92, 49);
141 | this.txtPort.Name = "txtPort";
142 | this.txtPort.Size = new System.Drawing.Size(87, 20);
143 | this.txtPort.TabIndex = 5;
144 | this.txtPort.Text = "5869";
145 | this.txtPort.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
146 | //
147 | // label3
148 | //
149 | this.label3.AutoSize = true;
150 | this.label3.Location = new System.Drawing.Point(294, 20);
151 | this.label3.Name = "label3";
152 | this.label3.Size = new System.Drawing.Size(77, 13);
153 | this.label3.TabIndex = 6;
154 | this.label3.Text = "Select Screen:";
155 | //
156 | // cbxScreens
157 | //
158 | this.cbxScreens.FormattingEnabled = true;
159 | this.cbxScreens.Location = new System.Drawing.Point(377, 17);
160 | this.cbxScreens.Name = "cbxScreens";
161 | this.cbxScreens.Size = new System.Drawing.Size(103, 21);
162 | this.cbxScreens.TabIndex = 7;
163 | this.cbxScreens.Text = " ( . . Screen . . )";
164 | this.cbxScreens.SelectedIndexChanged += new System.EventHandler(this.cbxScreens_SelectedIndexChanged);
165 | //
166 | // label4
167 | //
168 | this.label4.AutoSize = true;
169 | this.label4.Location = new System.Drawing.Point(17, 111);
170 | this.label4.Name = "label4";
171 | this.label4.Size = new System.Drawing.Size(69, 13);
172 | this.label4.TabIndex = 8;
173 | this.label4.Text = "Client Status:";
174 | //
175 | // lblStatus
176 | //
177 | this.lblStatus.AutoSize = true;
178 | this.lblStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
179 | this.lblStatus.ForeColor = System.Drawing.Color.Red;
180 | this.lblStatus.Location = new System.Drawing.Point(108, 109);
181 | this.lblStatus.Name = "lblStatus";
182 | this.lblStatus.Size = new System.Drawing.Size(95, 16);
183 | this.lblStatus.TabIndex = 9;
184 | this.lblStatus.Text = "Disconected";
185 | //
186 | // label7
187 | //
188 | this.label7.AutoSize = true;
189 | this.label7.Location = new System.Drawing.Point(4, 148);
190 | this.label7.Name = "label7";
191 | this.label7.Size = new System.Drawing.Size(271, 13);
192 | this.label7.TabIndex = 11;
193 | this.label7.Text = "____________________________________________";
194 | //
195 | // label8
196 | //
197 | this.label8.AutoSize = true;
198 | this.label8.Location = new System.Drawing.Point(14, 171);
199 | this.label8.Name = "label8";
200 | this.label8.Size = new System.Drawing.Size(69, 13);
201 | this.label8.TabIndex = 12;
202 | this.label8.Text = "Frames Sent:";
203 | //
204 | // lblFrames
205 | //
206 | this.lblFrames.AutoSize = true;
207 | this.lblFrames.Location = new System.Drawing.Point(98, 171);
208 | this.lblFrames.Name = "lblFrames";
209 | this.lblFrames.Size = new System.Drawing.Size(13, 13);
210 | this.lblFrames.TabIndex = 13;
211 | this.lblFrames.Text = "0";
212 | //
213 | // label9
214 | //
215 | this.label9.AutoSize = true;
216 | this.label9.Location = new System.Drawing.Point(14, 193);
217 | this.label9.Name = "label9";
218 | this.label9.Size = new System.Drawing.Size(68, 13);
219 | this.label9.TabIndex = 14;
220 | this.label9.Text = "KBs Uns/ed:";
221 | //
222 | // label10
223 | //
224 | this.label10.AutoSize = true;
225 | this.label10.Location = new System.Drawing.Point(14, 216);
226 | this.label10.Name = "label10";
227 | this.label10.Size = new System.Drawing.Size(70, 13);
228 | this.label10.TabIndex = 15;
229 | this.label10.Text = "KBs Com/ed:";
230 | //
231 | // lblUncomp
232 | //
233 | this.lblUncomp.AutoSize = true;
234 | this.lblUncomp.Location = new System.Drawing.Point(98, 193);
235 | this.lblUncomp.Name = "lblUncomp";
236 | this.lblUncomp.Size = new System.Drawing.Size(13, 13);
237 | this.lblUncomp.TabIndex = 16;
238 | this.lblUncomp.Text = "0";
239 | //
240 | // lblComp
241 | //
242 | this.lblComp.AutoSize = true;
243 | this.lblComp.Location = new System.Drawing.Point(98, 216);
244 | this.lblComp.Name = "lblComp";
245 | this.lblComp.Size = new System.Drawing.Size(13, 13);
246 | this.lblComp.TabIndex = 17;
247 | this.lblComp.Text = "0";
248 | //
249 | // label12
250 | //
251 | this.label12.AutoSize = true;
252 | this.label12.Location = new System.Drawing.Point(286, 148);
253 | this.label12.Name = "label12";
254 | this.label12.Size = new System.Drawing.Size(301, 13);
255 | this.label12.TabIndex = 19;
256 | this.label12.Text = "_________________________________________________";
257 | //
258 | // pcbFrame
259 | //
260 | this.pcbFrame.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
261 | this.pcbFrame.Location = new System.Drawing.Point(297, 165);
262 | this.pcbFrame.Name = "pcbFrame";
263 | this.pcbFrame.Size = new System.Drawing.Size(282, 166);
264 | this.pcbFrame.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
265 | this.pcbFrame.TabIndex = 20;
266 | this.pcbFrame.TabStop = false;
267 | //
268 | // label14
269 | //
270 | this.label14.AutoSize = true;
271 | this.label14.Location = new System.Drawing.Point(4, 376);
272 | this.label14.Name = "label14";
273 | this.label14.Size = new System.Drawing.Size(583, 13);
274 | this.label14.TabIndex = 22;
275 | this.label14.Text = "_________________________________________________________________________________" +
276 | "_______________";
277 | //
278 | // lblCompRatio
279 | //
280 | this.lblCompRatio.AutoSize = true;
281 | this.lblCompRatio.Location = new System.Drawing.Point(98, 238);
282 | this.lblCompRatio.Name = "lblCompRatio";
283 | this.lblCompRatio.Size = new System.Drawing.Size(21, 13);
284 | this.lblCompRatio.TabIndex = 24;
285 | this.lblCompRatio.Text = "0%";
286 | //
287 | // label16
288 | //
289 | this.label16.AutoSize = true;
290 | this.label16.Location = new System.Drawing.Point(14, 238);
291 | this.label16.Name = "label16";
292 | this.label16.Size = new System.Drawing.Size(76, 13);
293 | this.label16.TabIndex = 23;
294 | this.label16.Text = "Com/ed Ratio:";
295 | //
296 | // txtLogs
297 | //
298 | this.txtLogs.Location = new System.Drawing.Point(13, 393);
299 | this.txtLogs.Multiline = true;
300 | this.txtLogs.Name = "txtLogs";
301 | this.txtLogs.ReadOnly = true;
302 | this.txtLogs.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
303 | this.txtLogs.Size = new System.Drawing.Size(566, 164);
304 | this.txtLogs.TabIndex = 25;
305 | //
306 | // label15
307 | //
308 | this.label15.AutoSize = true;
309 | this.label15.Location = new System.Drawing.Point(14, 260);
310 | this.label15.Name = "label15";
311 | this.label15.Size = new System.Drawing.Size(75, 13);
312 | this.label15.TabIndex = 26;
313 | this.label15.Text = "Secs Needed:";
314 | //
315 | // lblSeconds
316 | //
317 | this.lblSeconds.AutoSize = true;
318 | this.lblSeconds.Location = new System.Drawing.Point(98, 260);
319 | this.lblSeconds.Name = "lblSeconds";
320 | this.lblSeconds.Size = new System.Drawing.Size(18, 13);
321 | this.lblSeconds.TabIndex = 27;
322 | this.lblSeconds.Text = "0s";
323 | //
324 | // tbDelay
325 | //
326 | this.tbDelay.LargeChange = 100;
327 | this.tbDelay.Location = new System.Drawing.Point(377, 43);
328 | this.tbDelay.Maximum = 6000;
329 | this.tbDelay.Name = "tbDelay";
330 | this.tbDelay.Size = new System.Drawing.Size(207, 45);
331 | this.tbDelay.TabIndex = 28;
332 | this.tbDelay.TickFrequency = 250;
333 | this.tbDelay.ValueChanged += new System.EventHandler(this.tbDelay_ValueChanged);
334 | //
335 | // label5
336 | //
337 | this.label5.AutoSize = true;
338 | this.label5.Location = new System.Drawing.Point(294, 50);
339 | this.label5.Name = "label5";
340 | this.label5.Size = new System.Drawing.Size(56, 13);
341 | this.label5.TabIndex = 29;
342 | this.label5.Text = "Delay MS:";
343 | //
344 | // lblDelay
345 | //
346 | this.lblDelay.AutoSize = true;
347 | this.lblDelay.Location = new System.Drawing.Point(350, 50);
348 | this.lblDelay.Name = "lblDelay";
349 | this.lblDelay.Size = new System.Drawing.Size(13, 13);
350 | this.lblDelay.TabIndex = 30;
351 | this.lblDelay.Text = "0";
352 | //
353 | // lblNoAlgo
354 | //
355 | this.lblNoAlgo.AutoSize = true;
356 | this.lblNoAlgo.Location = new System.Drawing.Point(130, 293);
357 | this.lblNoAlgo.Name = "lblNoAlgo";
358 | this.lblNoAlgo.Size = new System.Drawing.Size(13, 13);
359 | this.lblNoAlgo.TabIndex = 32;
360 | this.lblNoAlgo.Text = "0";
361 | //
362 | // label18
363 | //
364 | this.label18.AutoSize = true;
365 | this.label18.Location = new System.Drawing.Point(14, 293);
366 | this.label18.Name = "label18";
367 | this.label18.Size = new System.Drawing.Size(97, 13);
368 | this.label18.TabIndex = 31;
369 | this.label18.Text = "KBs w/o Algorithm:";
370 | //
371 | // lblEfficRatio
372 | //
373 | this.lblEfficRatio.AutoSize = true;
374 | this.lblEfficRatio.Location = new System.Drawing.Point(130, 315);
375 | this.lblEfficRatio.Name = "lblEfficRatio";
376 | this.lblEfficRatio.Size = new System.Drawing.Size(21, 13);
377 | this.lblEfficRatio.TabIndex = 34;
378 | this.lblEfficRatio.Text = "0%";
379 | //
380 | // label19
381 | //
382 | this.label19.AutoSize = true;
383 | this.label19.Location = new System.Drawing.Point(14, 315);
384 | this.label19.Name = "label19";
385 | this.label19.Size = new System.Drawing.Size(84, 13);
386 | this.label19.TabIndex = 33;
387 | this.label19.Text = "Efficiency Ratio:";
388 | //
389 | // label20
390 | //
391 | this.label20.AutoSize = true;
392 | this.label20.Location = new System.Drawing.Point(4, 271);
393 | this.label20.Name = "label20";
394 | this.label20.Size = new System.Drawing.Size(271, 13);
395 | this.label20.TabIndex = 35;
396 | this.label20.Text = "____________________________________________";
397 | //
398 | // cbMouse
399 | //
400 | this.cbMouse.AutoSize = true;
401 | this.cbMouse.Location = new System.Drawing.Point(486, 19);
402 | this.cbMouse.Name = "cbMouse";
403 | this.cbMouse.Size = new System.Drawing.Size(98, 17);
404 | this.cbMouse.TabIndex = 36;
405 | this.cbMouse.Text = "Capture Mouse";
406 | this.cbMouse.UseVisualStyleBackColor = true;
407 | //
408 | // lblPercentOfIm
409 | //
410 | this.lblPercentOfIm.AutoSize = true;
411 | this.lblPercentOfIm.Location = new System.Drawing.Point(404, 336);
412 | this.lblPercentOfIm.Name = "lblPercentOfIm";
413 | this.lblPercentOfIm.Size = new System.Drawing.Size(21, 13);
414 | this.lblPercentOfIm.TabIndex = 38;
415 | this.lblPercentOfIm.Text = "0%";
416 | //
417 | // label21
418 | //
419 | this.label21.AutoSize = true;
420 | this.label21.Location = new System.Drawing.Point(305, 336);
421 | this.label21.Name = "label21";
422 | this.label21.Size = new System.Drawing.Size(93, 13);
423 | this.label21.TabIndex = 37;
424 | this.label21.Text = "Percent Of Image:";
425 | //
426 | // lblFramesNoAlgo
427 | //
428 | this.lblFramesNoAlgo.AutoSize = true;
429 | this.lblFramesNoAlgo.Location = new System.Drawing.Point(130, 336);
430 | this.lblFramesNoAlgo.Name = "lblFramesNoAlgo";
431 | this.lblFramesNoAlgo.Size = new System.Drawing.Size(13, 13);
432 | this.lblFramesNoAlgo.TabIndex = 40;
433 | this.lblFramesNoAlgo.Text = "0";
434 | //
435 | // label22
436 | //
437 | this.label22.AutoSize = true;
438 | this.label22.Location = new System.Drawing.Point(14, 336);
439 | this.label22.Name = "label22";
440 | this.label22.Size = new System.Drawing.Size(112, 13);
441 | this.label22.TabIndex = 39;
442 | this.label22.Text = "Frames w/o Algorithm:";
443 | //
444 | // btnReset
445 | //
446 | this.btnReset.Location = new System.Drawing.Point(216, 136);
447 | this.btnReset.Name = "btnReset";
448 | this.btnReset.Size = new System.Drawing.Size(55, 22);
449 | this.btnReset.TabIndex = 41;
450 | this.btnReset.Text = "Reset";
451 | this.btnReset.UseVisualStyleBackColor = true;
452 | this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
453 | //
454 | // cbAlgorithm
455 | //
456 | this.cbAlgorithm.AutoSize = true;
457 | this.cbAlgorithm.Checked = true;
458 | this.cbAlgorithm.CheckState = System.Windows.Forms.CheckState.Checked;
459 | this.cbAlgorithm.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
460 | this.cbAlgorithm.ForeColor = System.Drawing.Color.Black;
461 | this.cbAlgorithm.Location = new System.Drawing.Point(297, 106);
462 | this.cbAlgorithm.Name = "cbAlgorithm";
463 | this.cbAlgorithm.Size = new System.Drawing.Size(134, 20);
464 | this.cbAlgorithm.TabIndex = 42;
465 | this.cbAlgorithm.Text = "Activate Algorithm";
466 | this.cbAlgorithm.UseVisualStyleBackColor = true;
467 | this.cbAlgorithm.CheckedChanged += new System.EventHandler(this.cbAlgorithm_CheckedChanged);
468 | //
469 | // cbStats
470 | //
471 | this.cbStats.AutoSize = true;
472 | this.cbStats.BackColor = System.Drawing.SystemColors.Control;
473 | this.cbStats.Checked = true;
474 | this.cbStats.CheckState = System.Windows.Forms.CheckState.Checked;
475 | this.cbStats.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
476 | this.cbStats.Location = new System.Drawing.Point(7, 136);
477 | this.cbStats.Name = "cbStats";
478 | this.cbStats.Size = new System.Drawing.Size(97, 24);
479 | this.cbStats.TabIndex = 43;
480 | this.cbStats.Text = "Statistics:";
481 | this.cbStats.UseVisualStyleBackColor = false;
482 | //
483 | // cbLogs
484 | //
485 | this.cbLogs.AutoSize = true;
486 | this.cbLogs.BackColor = System.Drawing.SystemColors.Control;
487 | this.cbLogs.Checked = true;
488 | this.cbLogs.CheckState = System.Windows.Forms.CheckState.Checked;
489 | this.cbLogs.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
490 | this.cbLogs.Location = new System.Drawing.Point(7, 364);
491 | this.cbLogs.Name = "cbLogs";
492 | this.cbLogs.Size = new System.Drawing.Size(116, 24);
493 | this.cbLogs.TabIndex = 44;
494 | this.cbLogs.Text = "Latest Logs:";
495 | this.cbLogs.UseVisualStyleBackColor = false;
496 | //
497 | // cbLastFrame
498 | //
499 | this.cbLastFrame.AutoSize = true;
500 | this.cbLastFrame.BackColor = System.Drawing.SystemColors.Control;
501 | this.cbLastFrame.Checked = true;
502 | this.cbLastFrame.CheckState = System.Windows.Forms.CheckState.Checked;
503 | this.cbLastFrame.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
504 | this.cbLastFrame.Location = new System.Drawing.Point(289, 136);
505 | this.cbLastFrame.Name = "cbLastFrame";
506 | this.cbLastFrame.Size = new System.Drawing.Size(147, 24);
507 | this.cbLastFrame.TabIndex = 45;
508 | this.cbLastFrame.Text = "Last Frame Sent";
509 | this.cbLastFrame.UseVisualStyleBackColor = false;
510 | //
511 | // btnClear
512 | //
513 | this.btnClear.Location = new System.Drawing.Point(524, 364);
514 | this.btnClear.Name = "btnClear";
515 | this.btnClear.Size = new System.Drawing.Size(55, 22);
516 | this.btnClear.TabIndex = 46;
517 | this.btnClear.Text = "Clear";
518 | this.btnClear.UseVisualStyleBackColor = true;
519 | this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
520 | //
521 | // tsCredits
522 | //
523 | this.tsCredits.BackColor = System.Drawing.SystemColors.Control;
524 | this.tsCredits.Dock = System.Windows.Forms.DockStyle.Bottom;
525 | this.tsCredits.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
526 | this.tsCredits.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
527 | this.toolStripSeparator2,
528 | this.toolStripLabel1,
529 | this.toolStripSeparator1,
530 | this.toolStripLabel2,
531 | this.lblGithubLink});
532 | this.tsCredits.Location = new System.Drawing.Point(0, 564);
533 | this.tsCredits.Name = "tsCredits";
534 | this.tsCredits.Size = new System.Drawing.Size(591, 25);
535 | this.tsCredits.TabIndex = 47;
536 | this.tsCredits.Text = "toolStrip1";
537 | //
538 | // toolStripSeparator2
539 | //
540 | this.toolStripSeparator2.Name = "toolStripSeparator2";
541 | this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
542 | //
543 | // toolStripLabel1
544 | //
545 | this.toolStripLabel1.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
546 | this.toolStripLabel1.Name = "toolStripLabel1";
547 | this.toolStripLabel1.Size = new System.Drawing.Size(108, 22);
548 | this.toolStripLabel1.Text = "Ilias Karamanis";
549 | //
550 | // toolStripSeparator1
551 | //
552 | this.toolStripSeparator1.Name = "toolStripSeparator1";
553 | this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
554 | //
555 | // toolStripLabel2
556 | //
557 | this.toolStripLabel2.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
558 | this.toolStripLabel2.Name = "toolStripLabel2";
559 | this.toolStripLabel2.Size = new System.Drawing.Size(103, 22);
560 | this.toolStripLabel2.Text = "Github Profile:";
561 | //
562 | // lblGithubLink
563 | //
564 | this.lblGithubLink.Font = new System.Drawing.Font("Segoe UI", 11.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Italic | System.Drawing.FontStyle.Underline))), System.Drawing.GraphicsUnit.Point, ((byte)(238)));
565 | this.lblGithubLink.ForeColor = System.Drawing.Color.Maroon;
566 | this.lblGithubLink.IsLink = true;
567 | this.lblGithubLink.LinkBehavior = System.Windows.Forms.LinkBehavior.AlwaysUnderline;
568 | this.lblGithubLink.LinkColor = System.Drawing.Color.Maroon;
569 | this.lblGithubLink.Name = "lblGithubLink";
570 | this.lblGithubLink.Size = new System.Drawing.Size(232, 22);
571 | this.lblGithubLink.Text = "https://github.com/KaramanisWeb";
572 | this.lblGithubLink.Click += new System.EventHandler(this.lblGithubLink_Click);
573 | //
574 | // lblPacketDrop
575 | //
576 | this.lblPacketDrop.AutoSize = true;
577 | this.lblPacketDrop.Location = new System.Drawing.Point(421, 80);
578 | this.lblPacketDrop.Name = "lblPacketDrop";
579 | this.lblPacketDrop.Size = new System.Drawing.Size(21, 13);
580 | this.lblPacketDrop.TabIndex = 51;
581 | this.lblPacketDrop.Text = "0%";
582 | //
583 | // label11
584 | //
585 | this.label11.AutoSize = true;
586 | this.label11.Location = new System.Drawing.Point(294, 80);
587 | this.label11.Name = "label11";
588 | this.label11.Size = new System.Drawing.Size(121, 13);
589 | this.label11.TabIndex = 50;
590 | this.label11.Text = "Packet Drop Simulation:";
591 | //
592 | // tbPacketDrop
593 | //
594 | this.tbPacketDrop.LargeChange = 10;
595 | this.tbPacketDrop.Location = new System.Drawing.Point(453, 74);
596 | this.tbPacketDrop.Maximum = 100;
597 | this.tbPacketDrop.Name = "tbPacketDrop";
598 | this.tbPacketDrop.Size = new System.Drawing.Size(131, 45);
599 | this.tbPacketDrop.TabIndex = 49;
600 | this.tbPacketDrop.TickFrequency = 10;
601 | this.tbPacketDrop.ValueChanged += new System.EventHandler(this.tbPacketDrop_ValueChanged);
602 | //
603 | // frmServer
604 | //
605 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
606 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
607 | this.ClientSize = new System.Drawing.Size(591, 589);
608 | this.Controls.Add(this.lblPacketDrop);
609 | this.Controls.Add(this.label11);
610 | this.Controls.Add(this.tbPacketDrop);
611 | this.Controls.Add(this.tsCredits);
612 | this.Controls.Add(this.btnClear);
613 | this.Controls.Add(this.cbLastFrame);
614 | this.Controls.Add(this.cbLogs);
615 | this.Controls.Add(this.cbStats);
616 | this.Controls.Add(this.cbAlgorithm);
617 | this.Controls.Add(this.btnReset);
618 | this.Controls.Add(this.lblFramesNoAlgo);
619 | this.Controls.Add(this.label22);
620 | this.Controls.Add(this.lblPercentOfIm);
621 | this.Controls.Add(this.label21);
622 | this.Controls.Add(this.cbMouse);
623 | this.Controls.Add(this.lblEfficRatio);
624 | this.Controls.Add(this.label19);
625 | this.Controls.Add(this.lblNoAlgo);
626 | this.Controls.Add(this.label18);
627 | this.Controls.Add(this.lblDelay);
628 | this.Controls.Add(this.label5);
629 | this.Controls.Add(this.lblSeconds);
630 | this.Controls.Add(this.label15);
631 | this.Controls.Add(this.txtLogs);
632 | this.Controls.Add(this.lblCompRatio);
633 | this.Controls.Add(this.label16);
634 | this.Controls.Add(this.label14);
635 | this.Controls.Add(this.pcbFrame);
636 | this.Controls.Add(this.label12);
637 | this.Controls.Add(this.lblComp);
638 | this.Controls.Add(this.lblUncomp);
639 | this.Controls.Add(this.label10);
640 | this.Controls.Add(this.label9);
641 | this.Controls.Add(this.lblFrames);
642 | this.Controls.Add(this.label8);
643 | this.Controls.Add(this.lblStatus);
644 | this.Controls.Add(this.label4);
645 | this.Controls.Add(this.cbxScreens);
646 | this.Controls.Add(this.label3);
647 | this.Controls.Add(this.txtPort);
648 | this.Controls.Add(this.label2);
649 | this.Controls.Add(this.txtLocalIP);
650 | this.Controls.Add(this.label1);
651 | this.Controls.Add(this.btnStop);
652 | this.Controls.Add(this.btnStart);
653 | this.Controls.Add(this.label7);
654 | this.Controls.Add(this.tbDelay);
655 | this.Controls.Add(this.label20);
656 | this.DoubleBuffered = true;
657 | this.MaximizeBox = false;
658 | this.MaximumSize = new System.Drawing.Size(607, 628);
659 | this.Name = "frmServer";
660 | this.Text = "Server : RemoteDesktopOverNetwork";
661 | this.Load += new System.EventHandler(this.frmServer_Load);
662 | ((System.ComponentModel.ISupportInitialize)(this.pcbFrame)).EndInit();
663 | ((System.ComponentModel.ISupportInitialize)(this.tbDelay)).EndInit();
664 | this.tsCredits.ResumeLayout(false);
665 | this.tsCredits.PerformLayout();
666 | ((System.ComponentModel.ISupportInitialize)(this.tbPacketDrop)).EndInit();
667 | this.ResumeLayout(false);
668 | this.PerformLayout();
669 |
670 | }
671 |
672 | #endregion
673 |
674 | private System.Windows.Forms.Button btnStart;
675 | private System.Windows.Forms.Button btnStop;
676 | private System.Windows.Forms.Label label1;
677 | private System.Windows.Forms.TextBox txtLocalIP;
678 | private System.Windows.Forms.Label label2;
679 | private System.Windows.Forms.TextBox txtPort;
680 | private System.Windows.Forms.Label label3;
681 | private System.Windows.Forms.ComboBox cbxScreens;
682 | private System.Windows.Forms.Label label4;
683 | private System.Windows.Forms.Label lblStatus;
684 | private System.Windows.Forms.Label label7;
685 | private System.Windows.Forms.Label label8;
686 | private System.Windows.Forms.Label lblFrames;
687 | private System.Windows.Forms.Label label9;
688 | private System.Windows.Forms.Label label10;
689 | private System.Windows.Forms.Label lblUncomp;
690 | private System.Windows.Forms.Label lblComp;
691 | private System.Windows.Forms.Label label12;
692 | private System.Windows.Forms.PictureBox pcbFrame;
693 | private System.Windows.Forms.Label label14;
694 | private System.Windows.Forms.Label lblCompRatio;
695 | private System.Windows.Forms.Label label16;
696 | private System.Windows.Forms.TextBox txtLogs;
697 | private System.Windows.Forms.Label label15;
698 | private System.Windows.Forms.Label lblSeconds;
699 | private System.Windows.Forms.TrackBar tbDelay;
700 | private System.Windows.Forms.Label label5;
701 | private System.Windows.Forms.Label lblDelay;
702 | private System.Windows.Forms.Label lblNoAlgo;
703 | private System.Windows.Forms.Label label18;
704 | private System.Windows.Forms.Label lblEfficRatio;
705 | private System.Windows.Forms.Label label19;
706 | private System.Windows.Forms.Label label20;
707 | private System.Windows.Forms.CheckBox cbMouse;
708 | private System.Windows.Forms.Label lblPercentOfIm;
709 | private System.Windows.Forms.Label label21;
710 | private System.Windows.Forms.Label label22;
711 | private System.Windows.Forms.Label lblFramesNoAlgo;
712 | private System.Windows.Forms.Button btnReset;
713 | private System.Windows.Forms.CheckBox cbAlgorithm;
714 | private System.Windows.Forms.CheckBox cbStats;
715 | private System.Windows.Forms.CheckBox cbLogs;
716 | private System.Windows.Forms.CheckBox cbLastFrame;
717 | private System.Windows.Forms.Button btnClear;
718 | private System.Windows.Forms.ToolStrip tsCredits;
719 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
720 | private System.Windows.Forms.ToolStripLabel toolStripLabel1;
721 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
722 | private System.Windows.Forms.ToolStripLabel toolStripLabel2;
723 | private System.Windows.Forms.ToolStripLabel lblGithubLink;
724 | private System.Windows.Forms.Label lblPacketDrop;
725 | private System.Windows.Forms.Label label11;
726 | private System.Windows.Forms.TrackBar tbPacketDrop;
727 | }
728 | }
729 |
730 |
--------------------------------------------------------------------------------
/Server/frmServer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Drawing;
4 | using System.Drawing.Imaging;
5 | using System.Linq;
6 | using System.Net;
7 | using System.Net.Sockets;
8 | using System.Threading;
9 | using System.Windows.Forms;
10 | using RPON;
11 | using RPON.Extensions;
12 | using RPON.Packet;
13 |
14 | namespace Server
15 | {
16 | public partial class frmServer : Form
17 | {
18 | private Socket ServerSocket;
19 | private Socket withClient = null;
20 | private bool clientConnect = false;
21 | private int desktopSelected = 0;
22 |
23 | //Statistics
24 | private int frames = 0;
25 | private float kbsentuncomp = 0;
26 | private float kbsentcomp = 0;
27 | private float compratio = 0;
28 | private float secondstook = 0;
29 | private float withoutalgo = 0;
30 | private float effiratio = 0;
31 | private int framesnoalgo = 0;
32 |
33 | //ScreenChangeDetect
34 | ScreenChangeDetect SCD = new ScreenChangeDetect();
35 |
36 | private void ServerConnect(bool status)
37 | {
38 | btnStart.Enabled = !status;
39 | btnStop.Enabled = status;
40 | txtPort.Enabled = !status;
41 |
42 | try {
43 |
44 | if (status)
45 | {
46 |
47 | ServerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
48 | ServerSocket.Bind(new IPEndPoint(0, int.Parse(txtPort.Text)));
49 | ServerSocket.Listen(10);
50 | Log("Server Started...");
51 | Log("Begin Listening...On Port: " + txtPort.Text);
52 | Log("Waiting for Client...");
53 | ServerSocket.BeginAccept(BeginAccept_Callback, null);
54 | }
55 | else
56 | {
57 | if (withClient != null && withClient.Connected)
58 | {
59 | withClient.Shutdown(SocketShutdown.Both);
60 | withClient.Disconnect(false);
61 | withClient = null;
62 | ClientConnect(false);
63 | }
64 | if (ServerSocket != null)
65 | {
66 | ServerSocket.Close();
67 | ServerSocket = null;
68 | }
69 | Log("Stopped Listening...");
70 | Log("Server Stopped..");
71 | Log("========================================================");
72 | }
73 | }
74 | catch (Exception ex)
75 | {
76 | //Log("Exception: " + ex.Message);
77 | }
78 | }
79 |
80 | private void ClientConnect(bool status)
81 | {
82 | if (status && !clientConnect)
83 | {
84 | Log("Client Connected");
85 | Log("Started Streaming Desktop Screen {"+(desktopSelected+1) +"}");
86 | lblStatus.Invoke((MethodInvoker) delegate
87 | {
88 | lblStatus.Text = "Connected";
89 | lblStatus.ForeColor = Color.LimeGreen;
90 | });
91 | }
92 | else if (!status && clientConnect)
93 | {
94 | Log("Client Disconnected");
95 | Log("Waiting for another Client...");
96 | lblStatus.Invoke((MethodInvoker)delegate
97 | {
98 | lblStatus.Text = "Disconnected";
99 | lblStatus.ForeColor = Color.Red;
100 | });
101 | }
102 | clientConnect = status;
103 | }
104 |
105 | private void UpdateStats(bool nf, float a,float b,long ms,float c)
106 | {
107 | if (cbStats.Checked)
108 | {
109 | int restPacketSize = 26;
110 |
111 | if (nf)
112 | {
113 | frames++;
114 | a += restPacketSize;
115 | b += restPacketSize;
116 | }
117 |
118 | framesnoalgo++;
119 | c += restPacketSize;
120 |
121 | kbsentcomp += a/1024;
122 | kbsentuncomp += b/1024;
123 | secondstook += (float) ms/1000f;
124 | compratio = ((kbsentuncomp - kbsentcomp)/kbsentuncomp)*100f;
125 |
126 | withoutalgo += c/1024;
127 | effiratio = 100 - (kbsentcomp/withoutalgo)*100f;
128 |
129 | lblFrames.SafeInvoke(blFrames =>
130 | {
131 | lblFrames.Text = frames.ToString();
132 | });
133 |
134 | lblComp.SafeInvoke(lblComp =>
135 | {
136 | lblComp.Text = kbsentcomp.ToString();
137 | });
138 |
139 | lblUncomp.SafeInvoke(lblUncomp =>
140 | {
141 | lblUncomp.Text = kbsentuncomp.ToString();
142 | });
143 |
144 | lblSeconds.SafeInvoke(lblSeconds =>
145 | {
146 | lblSeconds.Text = secondstook.ToString();
147 | });
148 |
149 | lblCompRatio.SafeInvoke(lblCompRatio =>
150 | {
151 | lblCompRatio.Text = compratio + "%";
152 | });
153 |
154 | lblEfficRatio.SafeInvoke(lblEfficRatio =>
155 | {
156 | lblEfficRatio.Text = effiratio + "%";
157 | });
158 |
159 | lblNoAlgo.SafeInvoke(lblNoAlgo =>
160 | {
161 | lblNoAlgo.Text = withoutalgo.ToString();
162 | });
163 |
164 | lblFramesNoAlgo.SafeInvoke(lblFramesNoAlgo =>
165 | {
166 | lblFramesNoAlgo.Text = framesnoalgo.ToString();
167 | });
168 | }
169 | }
170 |
171 | private void BeginAccept_Callback(IAsyncResult ar)
172 | {
173 | try
174 | {
175 | withClient = ServerSocket.EndAccept(ar);
176 | SCD.Reset();
177 | while (withClient.Connected)
178 | {
179 | Thread.Sleep(int.Parse(lblDelay.Text));
180 |
181 | ClientConnect(true);
182 | Stopwatch timeProcessed = Stopwatch.StartNew();
183 | Rectangle bounds = Rectangle.Empty;
184 |
185 | Data DT = new Data();
186 |
187 | Bitmap NewIM = ScreenCapture.CaptureSelectedScreen(desktopSelected, cbMouse.Checked);
188 | byte[] newIMdata = NewIM.ToByteArray(ImageFormat.Jpeg);
189 |
190 | if (cbAlgorithm.Checked)
191 | {
192 |
193 | Bitmap imageChanged = SCD.Check(NewIM, ref bounds);
194 |
195 | if (bounds != Rectangle.Empty)
196 | {
197 | if (cbLastFrame.Checked)
198 | {
199 | pcbFrame.Image = (Bitmap) imageChanged.Clone();
200 |
201 | lblPercentOfIm.SafeInvoke(p =>
202 | {
203 | p.Text = SCD.PercentOfImage + "%";
204 | });
205 | }
206 |
207 | byte[] imageDATA = imageChanged.ToByteArray(ImageFormat.Jpeg);
208 | byte[] compImage = LZ4mm.LZ4Codec.Encode32(imageDATA, 0, imageDATA.Length);
209 |
210 | DT.comp = true;
211 | if (compImage.Length > imageDATA.Length)
212 | {
213 | DT.comp = false;
214 | compImage = imageDATA;
215 | }
216 |
217 | DT.type = 1;
218 | DT.dataSize = imageDATA.Length;
219 | DT.dataBytes = compImage;
220 | DT.bx = bounds.X;
221 | DT.by = bounds.Y;
222 | DT.bwidth = bounds.Width;
223 | DT.bheight = bounds.Height;
224 |
225 | UpdateStats(true, (float) compImage.Length, (float) imageDATA.Length,
226 | timeProcessed.ElapsedMilliseconds, newIMdata.Length);
227 | Log("Frame Sent Size Uncomp: " + (imageDATA.Length/1024) + "KB Comp: " +
228 | (compImage.Length/1024) + " KB MS: " +
229 | timeProcessed.ElapsedMilliseconds + " Rate: " +
230 | (((float) imageDATA.Length - (float) compImage.Length)/(float) imageDATA.Length)*100f +
231 | "%");
232 | }
233 | else
234 | {
235 | UpdateStats(false, 0, 0, 0, newIMdata.Length);
236 | Log("No Change Detected No Frame Sent");
237 | }
238 | }
239 | else
240 | {
241 | SCD.Reset();
242 |
243 | DT.type = 2;
244 | DT.dataSize = newIMdata.Length;
245 | DT.dataBytes = newIMdata;
246 |
247 | UpdateStats(false, 0, 0, 0, newIMdata.Length);
248 | Log("Full Screen Sent Size: " + (newIMdata.Length/1024) + " KB.");
249 | }
250 |
251 | Random rnd = new Random();
252 | int rndNum = rnd.Next(1, 101);
253 | if (rndNum <= int.Parse(lblPacketDrop.Text.TrimEnd('%')))
254 | {
255 | Log("Last Packet Dropped Failed to Sent.");
256 | }
257 | else
258 | {
259 | byte[] Packet = DT.Serialize();
260 | byte[] PacketSize = BitConverter.GetBytes(Packet.Length);
261 |
262 | withClient.Send(PacketSize);
263 | withClient.Send(Packet);
264 | }
265 | timeProcessed.Stop();
266 | }
267 | }
268 | catch (Exception ex)
269 | {
270 | //Log("Exception Thrown: " + ex.Message);
271 | ClientConnect(false);
272 | }
273 | if (withClient != null && ServerSocket != null)
274 | ServerSocket.BeginAccept(BeginAccept_Callback, null);
275 | }
276 |
277 | private void Log(string text)
278 | {
279 | if (cbLogs.Checked)
280 | {
281 | txtLogs.SafeInvoke(t =>
282 | {
283 | if (t.Lines.Count() > 500)
284 | {
285 | string[] lines = t.Lines;
286 | var newLines = lines.Skip(150);
287 | t.Lines = newLines.ToArray();
288 | }
289 |
290 | t.Text += text + Environment.NewLine;
291 | t.SelectionStart = t.TextLength;
292 | t.ScrollToCaret();
293 | });
294 | }
295 | }
296 |
297 | public frmServer()
298 | {
299 | InitializeComponent();
300 | }
301 |
302 | private void frmServer_Load(object sender, EventArgs e)
303 | {
304 | for (int i = 0; i < Screen.AllScreens.Count(); i++)
305 | {
306 | cbxScreens.Items.Add("Screen {" + (1 + i)+"}");
307 | }
308 |
309 | var host = Dns.GetHostEntry(Dns.GetHostName());
310 | foreach (var ip in host.AddressList)
311 | {
312 | if (ip.AddressFamily == AddressFamily.InterNetwork)
313 | {
314 | txtLocalIP.Text = ip.ToString();
315 | }
316 | }
317 | }
318 |
319 | private void btnStart_Click(object sender, EventArgs e)
320 | {
321 | ServerConnect(true);
322 | }
323 |
324 | private void btnStop_Click(object sender, EventArgs e)
325 | {
326 | ServerConnect(false);
327 | }
328 |
329 | private void cbxScreens_SelectedIndexChanged(object sender, EventArgs e)
330 | {
331 | desktopSelected = int.Parse(cbxScreens.SelectedIndex.ToString());
332 | Log("Desktop {"+(desktopSelected +1)+ "} selected to stream !");
333 | }
334 |
335 | private void tbDelay_ValueChanged(object sender, EventArgs e)
336 | {
337 | lblDelay.Text = tbDelay.Value.ToString();
338 | }
339 |
340 | private void btnReset_Click(object sender, EventArgs e)
341 | {
342 | frames = 0;
343 | kbsentuncomp = 0;
344 | kbsentcomp = 0;
345 | compratio = 0;
346 | secondstook = 0;
347 | withoutalgo = 0;
348 | effiratio = 0;
349 | framesnoalgo = 0;
350 |
351 | lblFrames.Text = frames.ToString();
352 | lblComp.Text = kbsentcomp.ToString();
353 | lblUncomp.Text = kbsentuncomp.ToString();
354 | lblSeconds.Text = secondstook.ToString();
355 | lblCompRatio.Text = compratio + "%";
356 | lblEfficRatio.Text = effiratio + "%";
357 | lblNoAlgo.Text = withoutalgo.ToString();
358 | lblFramesNoAlgo.Text = framesnoalgo.ToString();
359 | }
360 |
361 | private void cbAlgorithm_CheckedChanged(object sender, EventArgs e)
362 | {
363 | if (cbAlgorithm.Checked)
364 | {
365 | Log("Screen Change Detection Algorithm Activated !");
366 | }
367 | else
368 | {
369 | Log("Screen Change Detection Algorithm Deactivated.");
370 | }
371 | }
372 |
373 | private void btnClear_Click(object sender, EventArgs e)
374 | {
375 | txtLogs.Text = String.Empty;
376 | }
377 |
378 | private void lblGithubLink_Click(object sender, EventArgs e)
379 | {
380 | Process.Start(lblGithubLink.Text);
381 | }
382 |
383 | private void tbPacketDrop_ValueChanged(object sender, EventArgs e)
384 | {
385 | lblPacketDrop.Text = tbPacketDrop.Value + "%";
386 | }
387 | }
388 | }
389 |
--------------------------------------------------------------------------------
/Server/frmServer.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 5
122 |
123 |
124 | 34
125 |
126 |
--------------------------------------------------------------------------------
/Test/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Test/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace Test
5 | {
6 | static class Program
7 | {
8 | ///
9 | /// The main entry point for the application.
10 | ///
11 | [STAThread]
12 | static void Main()
13 | {
14 | Application.EnableVisualStyles();
15 | Application.SetCompatibleTextRenderingDefault(false);
16 | Application.Run(new frmTest());
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Test/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Test")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Test")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("645d0f47-92f2-406e-a90b-5c912cdc884b")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Test/Properties/Resources.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 Test.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Test.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Test/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Test/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 Test.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Test/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Test/ScreenChangeDetect.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Drawing.Imaging;
4 | using Test;
5 |
6 | namespace RPON
7 | {
8 | public class ScreenChangeDetect
9 | {
10 | // Class for Testing and Logging
11 |
12 | private Bitmap _prevBitmap;
13 | private Bitmap _newBitmap = new Bitmap(1, 1);
14 | private Graphics _graphics;
15 | private frmTest _mf;
16 |
17 | public double PercentOfImage { get; set; }
18 |
19 | public void Log(string text)
20 | {
21 | if (_mf != null)
22 | {
23 | _mf.Log(text);
24 | }
25 | }
26 |
27 | public ScreenChangeDetect(frmTest mf,Bitmap oldIM = null)
28 | {
29 | this._prevBitmap = oldIM;
30 | Bitmap junk = new Bitmap(10, 10);
31 | _graphics = Graphics.FromImage(junk);
32 | _mf = mf;
33 | }
34 |
35 | public Bitmap Check(Bitmap newIM, ref Rectangle bounds)
36 | {
37 | Bitmap diff = null;
38 |
39 | // Capture a new screenshot.
40 | //
41 | lock (_newBitmap)
42 | {
43 | _newBitmap = newIM;
44 |
45 | // If we have a previous screenshot, only send back
46 | // a subset that is the minimum rectangular area
47 | // that encompasses all the changed pixels.
48 | //
49 | if (_prevBitmap != null)
50 | {
51 | // Get the bounding box.
52 | //
53 | bounds = GetBoundingBoxForChanges();
54 | if (bounds == Rectangle.Empty)
55 | {
56 | // Nothing has changed.
57 | //
58 | PercentOfImage = 0.0;
59 | }
60 | else
61 | {
62 | // Get the minimum rectangular area
63 | //
64 | diff = new Bitmap(bounds.Width, bounds.Height);
65 | _graphics = Graphics.FromImage(diff);
66 | _graphics.DrawImage(_newBitmap, 0, 0, bounds, GraphicsUnit.Pixel);
67 |
68 | // Set the current bitmap as the previous to prepare
69 | // for the next screen capture.
70 | //
71 | _prevBitmap = _newBitmap;
72 |
73 | lock (_newBitmap)
74 | {
75 | PercentOfImage = 100.0 * (diff.Height * diff.Width) / (_newBitmap.Height * _newBitmap.Width);
76 | }
77 | }
78 | }
79 | // We don't have a previous screen capture. Therefore
80 | // we need to send back the whole screen this time.
81 | //
82 | else
83 | {
84 | // Set the previous bitmap to the current to prepare
85 | // for the next screen capture.
86 | //
87 | _prevBitmap = _newBitmap;
88 | diff = _newBitmap;
89 |
90 | // Create a bounding rectangle.
91 | //
92 | bounds = new Rectangle(0, 0, _newBitmap.Width, _newBitmap.Height);
93 |
94 | PercentOfImage = 100.0;
95 | }
96 | }
97 | return diff;
98 | }
99 |
100 | public void Reset()
101 | {
102 | _prevBitmap = null;
103 | _newBitmap = new Bitmap(1, 1);
104 | }
105 |
106 | private Rectangle GetBoundingBoxForChanges()
107 | {
108 | // The search algorithm starts by looking
109 | // for the top and left bounds. The search
110 | // starts in the upper-left corner and scans
111 | // left to right and then top to bottom. It uses
112 | // an adaptive approach on the pixels it
113 | // searches. Another pass is looks for the
114 | // lower and right bounds. The search starts
115 | // in the lower-right corner and scans right
116 | // to left and then bottom to top. Again, an
117 | // adaptive approach on the search area is used.
118 | //
119 |
120 | // Notice: The GetPixel member of the Bitmap class
121 | // is too slow for this purpose. This is a good
122 | // case of using unsafe code to access pointers
123 | // to increase the speed.
124 | //
125 |
126 | // Validate the images are the same shape and type.
127 | //
128 | if (_prevBitmap.Width != _newBitmap.Width ||
129 | _prevBitmap.Height != _newBitmap.Height ||
130 | _prevBitmap.PixelFormat != _newBitmap.PixelFormat)
131 | {
132 | // Not the same shape...can't do the search.
133 | //
134 | return Rectangle.Empty;
135 | }
136 |
137 | // Init the search parameters.
138 | //
139 | int width = _newBitmap.Width;
140 | int height = _newBitmap.Height;
141 | int left = width;
142 | int right = 0;
143 | int top = height;
144 | int bottom = 0;
145 |
146 | BitmapData bmNewData = null;
147 | BitmapData bmPrevData = null;
148 | try
149 | {
150 | // Lock the bits into memory.
151 | //
152 | bmNewData = _newBitmap.LockBits(
153 | new Rectangle(0, 0, _newBitmap.Width, _newBitmap.Height),
154 | ImageLockMode.ReadOnly, _newBitmap.PixelFormat);
155 | bmPrevData = _prevBitmap.LockBits(
156 | new Rectangle(0, 0, _prevBitmap.Width, _prevBitmap.Height),
157 | ImageLockMode.ReadOnly, _prevBitmap.PixelFormat);
158 |
159 | // The images are ARGB (4 bytes)
160 | //
161 | const int numBytesPerPixel = 4;
162 |
163 | // Get the number of integers (4 bytes) in each row
164 | // of the image.
165 | //
166 | int strideNew = bmNewData.Stride / numBytesPerPixel;
167 | int stridePrev = bmPrevData.Stride / numBytesPerPixel;
168 |
169 | // Get a pointer to the first pixel.
170 | //
171 | // Notice: Another speed up implemented is that I don't
172 | // need the ARGB elements. I am only trying to detect
173 | // change. So this algorithm reads the 4 bytes as an
174 | // integer and compares the two numbers.
175 | //
176 | IntPtr scanNew0 = bmNewData.Scan0;
177 | IntPtr scanPrev0 = bmPrevData.Scan0;
178 |
179 | // Enter the unsafe code.
180 | //
181 | unsafe
182 | {
183 | // Cast the safe pointers into unsafe pointers.
184 | //
185 | int* pNew = (int*)(void*)scanNew0;
186 | int* pPrev = (int*)(void*)scanPrev0;
187 |
188 | // First Pass - Find the left and top bounds
189 | // of the minimum bounding rectangle. Adapt the
190 | // number of pixels scanned from left to right so
191 | // we only scan up to the current bound. We also
192 | // initialize the bottom & right. This helps optimize
193 | // the second pass.
194 | //
195 | // For all rows of pixels (top to bottom)
196 | //
197 | Log("First Pass");
198 | for (int y = 0; y < _newBitmap.Height; y++)
199 | {
200 | // For pixels up to the current bound (left to right)
201 | //
202 | for (int x = 0; x < left; x++)
203 | {
204 | Log("Point: X:" + x + " Y:" + y);
205 | // Use pointer arithmetic to index the
206 | // next pixel in this row.
207 | //
208 | if ((pNew + x)[0] != (pPrev + x)[0])
209 | {
210 | // Found a change.
211 | //
212 | if (x < left)
213 | {
214 | left = x;
215 | }
216 | if (x > right)
217 | {
218 | right = x;
219 | }
220 | if (y < top)
221 | {
222 | top = y;
223 | }
224 | if (y > bottom)
225 | {
226 | bottom = y;
227 | }
228 | Log("FCP: X:" + x + " Y:" + y + " Left:" + left + " Top:" + top);
229 | }
230 | }
231 |
232 | // Move the pointers to the next row.
233 | //
234 | pNew += strideNew;
235 | pPrev += stridePrev;
236 | }
237 |
238 | // If we did not find any changed pixels
239 | // then no need to do a second pass.
240 | //
241 | if (left != width)
242 | {
243 | Log("Second Pass");
244 | // Second Pass - The first pass found at
245 | // least one different pixel and has set
246 | // the left & top bounds. In addition, the
247 | // right & bottom bounds have been initialized.
248 | // Adapt the number of pixels scanned from right
249 | // to left so we only scan up to the current bound.
250 | // In addition, there is no need to scan past
251 | // the top bound.
252 | //
253 |
254 | // Set the pointers to the first element of the
255 | // bottom row.
256 | //
257 | pNew = (int*)(void*)scanNew0;
258 | pPrev = (int*)(void*)scanPrev0;
259 | pNew += (_newBitmap.Height - 1) * strideNew;
260 | pPrev += (_prevBitmap.Height - 1) * stridePrev;
261 |
262 | // For each row (bottom to top)
263 | //
264 | for (int y = _newBitmap.Height - 1; y > top; y--)
265 | {
266 | // For each column (right to left)
267 | //
268 | for (int x = _newBitmap.Width - 1; x > right; x--)
269 | {
270 | Log("Point: X:" + x + " Y:" + y);
271 | // Use pointer arithmetic to index the
272 | // next pixel in this row.
273 | //
274 | if ((pNew + x)[0] != (pPrev + x)[0])
275 | {
276 | // Found a change.
277 | //
278 | if (x > right)
279 | {
280 | right = x;
281 | }
282 | if (y > bottom)
283 | {
284 | bottom = y;
285 | }
286 | Log("FCP: X:" + x + " Y:" + y + " Right:" + right + " Bottom:" + bottom);
287 | }
288 | }
289 |
290 | // Move up one row.
291 | //
292 | pNew -= strideNew;
293 | pPrev -= stridePrev;
294 | }
295 | }
296 | }
297 | }
298 | catch (Exception)
299 | {
300 | // Do something with this info.
301 | }
302 | finally
303 | {
304 | // Unlock the bits of the image.
305 | //
306 | if (bmNewData != null)
307 | {
308 | _newBitmap.UnlockBits(bmNewData);
309 | }
310 | if (bmPrevData != null)
311 | {
312 | _prevBitmap.UnlockBits(bmPrevData);
313 | }
314 | }
315 |
316 | // Validate we found a bounding box. If not
317 | // return an empty rectangle.
318 | //
319 | int diffImgWidth = right - left + 1;
320 | int diffImgHeight = bottom - top + 1;
321 | if (diffImgHeight < 0 || diffImgWidth < 0)
322 | {
323 | // Nothing changed
324 | return Rectangle.Empty;
325 | }
326 |
327 | // Return the bounding box.
328 | //
329 | return new Rectangle(left, top, diffImgWidth, diffImgHeight);
330 | }
331 | }
332 | }
333 |
--------------------------------------------------------------------------------
/Test/Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {645D0F47-92F2-406E-A90B-5C912CDC884B}
8 | WinExe
9 | Properties
10 | Test
11 | Test
12 | v4.5
13 | 512
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | true
20 | ..\Bins\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 | true
25 | true
26 |
27 |
28 | AnyCPU
29 | none
30 | true
31 | ..\Bins\Release\
32 | TRACE
33 | prompt
34 | 4
35 | true
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | Form
53 |
54 |
55 | frmTest.cs
56 |
57 |
58 |
59 |
60 |
61 | frmTest.cs
62 |
63 |
64 | ResXFileCodeGenerator
65 | Resources.Designer.cs
66 | Designer
67 |
68 |
69 | True
70 | Resources.resx
71 |
72 |
73 | SettingsSingleFileGenerator
74 | Settings.Designer.cs
75 |
76 |
77 | True
78 | Settings.settings
79 | True
80 |
81 |
82 |
83 |
84 |
85 |
86 |
93 |
--------------------------------------------------------------------------------
/Test/frmTest.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Test
2 | {
3 | partial class frmTest
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.btnSelect1 = new System.Windows.Forms.Button();
32 | this.btnSelect2 = new System.Windows.Forms.Button();
33 | this.label1 = new System.Windows.Forms.Label();
34 | this.label2 = new System.Windows.Forms.Label();
35 | this.txtImg1 = new System.Windows.Forms.TextBox();
36 | this.txtImg2 = new System.Windows.Forms.TextBox();
37 | this.btnStart = new System.Windows.Forms.Button();
38 | this.picBox = new System.Windows.Forms.PictureBox();
39 | this.txtLogs = new System.Windows.Forms.TextBox();
40 | this.tsCredits = new System.Windows.Forms.ToolStrip();
41 | this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
42 | this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
43 | this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
44 | this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel();
45 | this.lblGithubLink = new System.Windows.Forms.ToolStripLabel();
46 | ((System.ComponentModel.ISupportInitialize)(this.picBox)).BeginInit();
47 | this.tsCredits.SuspendLayout();
48 | this.SuspendLayout();
49 | //
50 | // btnSelect1
51 | //
52 | this.btnSelect1.Location = new System.Drawing.Point(372, 21);
53 | this.btnSelect1.Name = "btnSelect1";
54 | this.btnSelect1.Size = new System.Drawing.Size(112, 20);
55 | this.btnSelect1.TabIndex = 0;
56 | this.btnSelect1.Text = "Select ...";
57 | this.btnSelect1.UseVisualStyleBackColor = true;
58 | this.btnSelect1.Click += new System.EventHandler(this.btnSelect1_Click);
59 | //
60 | // btnSelect2
61 | //
62 | this.btnSelect2.Location = new System.Drawing.Point(372, 49);
63 | this.btnSelect2.Name = "btnSelect2";
64 | this.btnSelect2.Size = new System.Drawing.Size(112, 20);
65 | this.btnSelect2.TabIndex = 1;
66 | this.btnSelect2.Text = "Select ...";
67 | this.btnSelect2.UseVisualStyleBackColor = true;
68 | this.btnSelect2.Click += new System.EventHandler(this.btnSelect2_Click);
69 | //
70 | // label1
71 | //
72 | this.label1.AutoSize = true;
73 | this.label1.Location = new System.Drawing.Point(20, 24);
74 | this.label1.Name = "label1";
75 | this.label1.Size = new System.Drawing.Size(48, 13);
76 | this.label1.TabIndex = 2;
77 | this.label1.Text = "Image 1:";
78 | //
79 | // label2
80 | //
81 | this.label2.AutoSize = true;
82 | this.label2.Location = new System.Drawing.Point(20, 53);
83 | this.label2.Name = "label2";
84 | this.label2.Size = new System.Drawing.Size(48, 13);
85 | this.label2.TabIndex = 3;
86 | this.label2.Text = "Image 2:";
87 | //
88 | // txtImg1
89 | //
90 | this.txtImg1.Location = new System.Drawing.Point(84, 21);
91 | this.txtImg1.Name = "txtImg1";
92 | this.txtImg1.ReadOnly = true;
93 | this.txtImg1.Size = new System.Drawing.Size(282, 20);
94 | this.txtImg1.TabIndex = 4;
95 | //
96 | // txtImg2
97 | //
98 | this.txtImg2.Location = new System.Drawing.Point(84, 49);
99 | this.txtImg2.Name = "txtImg2";
100 | this.txtImg2.ReadOnly = true;
101 | this.txtImg2.Size = new System.Drawing.Size(282, 20);
102 | this.txtImg2.TabIndex = 5;
103 | //
104 | // btnStart
105 | //
106 | this.btnStart.Location = new System.Drawing.Point(229, 89);
107 | this.btnStart.Name = "btnStart";
108 | this.btnStart.Size = new System.Drawing.Size(255, 23);
109 | this.btnStart.TabIndex = 6;
110 | this.btnStart.Text = "Start";
111 | this.btnStart.UseVisualStyleBackColor = true;
112 | this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
113 | //
114 | // picBox
115 | //
116 | this.picBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
117 | this.picBox.Location = new System.Drawing.Point(23, 89);
118 | this.picBox.Name = "picBox";
119 | this.picBox.Size = new System.Drawing.Size(200, 200);
120 | this.picBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
121 | this.picBox.TabIndex = 7;
122 | this.picBox.TabStop = false;
123 | //
124 | // txtLogs
125 | //
126 | this.txtLogs.Location = new System.Drawing.Point(229, 118);
127 | this.txtLogs.Multiline = true;
128 | this.txtLogs.Name = "txtLogs";
129 | this.txtLogs.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
130 | this.txtLogs.Size = new System.Drawing.Size(255, 171);
131 | this.txtLogs.TabIndex = 8;
132 | //
133 | // tsCredits
134 | //
135 | this.tsCredits.BackColor = System.Drawing.SystemColors.Control;
136 | this.tsCredits.Dock = System.Windows.Forms.DockStyle.Bottom;
137 | this.tsCredits.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
138 | this.tsCredits.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
139 | this.toolStripSeparator2,
140 | this.toolStripLabel1,
141 | this.toolStripSeparator1,
142 | this.toolStripLabel2,
143 | this.lblGithubLink});
144 | this.tsCredits.Location = new System.Drawing.Point(0, 301);
145 | this.tsCredits.Name = "tsCredits";
146 | this.tsCredits.Size = new System.Drawing.Size(506, 25);
147 | this.tsCredits.TabIndex = 49;
148 | this.tsCredits.Text = "toolStrip1";
149 | //
150 | // toolStripSeparator2
151 | //
152 | this.toolStripSeparator2.Name = "toolStripSeparator2";
153 | this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
154 | //
155 | // toolStripLabel1
156 | //
157 | this.toolStripLabel1.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
158 | this.toolStripLabel1.Name = "toolStripLabel1";
159 | this.toolStripLabel1.Size = new System.Drawing.Size(108, 22);
160 | this.toolStripLabel1.Text = "Ilias Karamanis";
161 | //
162 | // toolStripSeparator1
163 | //
164 | this.toolStripSeparator1.Name = "toolStripSeparator1";
165 | this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
166 | //
167 | // toolStripLabel2
168 | //
169 | this.toolStripLabel2.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
170 | this.toolStripLabel2.Name = "toolStripLabel2";
171 | this.toolStripLabel2.Size = new System.Drawing.Size(103, 22);
172 | this.toolStripLabel2.Text = "Github Profile:";
173 | //
174 | // lblGithubLink
175 | //
176 | this.lblGithubLink.Font = new System.Drawing.Font("Segoe UI", 11.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Italic | System.Drawing.FontStyle.Underline))), System.Drawing.GraphicsUnit.Point, ((byte)(238)));
177 | this.lblGithubLink.ForeColor = System.Drawing.Color.Maroon;
178 | this.lblGithubLink.IsLink = true;
179 | this.lblGithubLink.LinkBehavior = System.Windows.Forms.LinkBehavior.AlwaysUnderline;
180 | this.lblGithubLink.LinkColor = System.Drawing.Color.Maroon;
181 | this.lblGithubLink.Name = "lblGithubLink";
182 | this.lblGithubLink.Size = new System.Drawing.Size(232, 22);
183 | this.lblGithubLink.Text = "https://github.com/KaramanisWeb";
184 | this.lblGithubLink.Click += new System.EventHandler(this.lblGithubLink_Click);
185 | //
186 | // frmTest
187 | //
188 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
189 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
190 | this.ClientSize = new System.Drawing.Size(506, 326);
191 | this.Controls.Add(this.tsCredits);
192 | this.Controls.Add(this.txtLogs);
193 | this.Controls.Add(this.picBox);
194 | this.Controls.Add(this.btnStart);
195 | this.Controls.Add(this.txtImg2);
196 | this.Controls.Add(this.txtImg1);
197 | this.Controls.Add(this.label2);
198 | this.Controls.Add(this.label1);
199 | this.Controls.Add(this.btnSelect2);
200 | this.Controls.Add(this.btnSelect1);
201 | this.MaximizeBox = false;
202 | this.MaximumSize = new System.Drawing.Size(522, 365);
203 | this.Name = "frmTest";
204 | this.Text = "Test Algorithm";
205 | ((System.ComponentModel.ISupportInitialize)(this.picBox)).EndInit();
206 | this.tsCredits.ResumeLayout(false);
207 | this.tsCredits.PerformLayout();
208 | this.ResumeLayout(false);
209 | this.PerformLayout();
210 |
211 | }
212 |
213 | #endregion
214 |
215 | private System.Windows.Forms.Button btnSelect1;
216 | private System.Windows.Forms.Button btnSelect2;
217 | private System.Windows.Forms.Label label1;
218 | private System.Windows.Forms.Label label2;
219 | private System.Windows.Forms.TextBox txtImg1;
220 | private System.Windows.Forms.TextBox txtImg2;
221 | private System.Windows.Forms.Button btnStart;
222 | private System.Windows.Forms.PictureBox picBox;
223 | private System.Windows.Forms.TextBox txtLogs;
224 | private System.Windows.Forms.ToolStrip tsCredits;
225 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
226 | private System.Windows.Forms.ToolStripLabel toolStripLabel1;
227 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
228 | private System.Windows.Forms.ToolStripLabel toolStripLabel2;
229 | private System.Windows.Forms.ToolStripLabel lblGithubLink;
230 | }
231 | }
232 |
233 |
--------------------------------------------------------------------------------
/Test/frmTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Drawing;
4 | using System.Windows.Forms;
5 | using RPON;
6 |
7 | namespace Test
8 | {
9 | public partial class frmTest : Form
10 | {
11 | public ScreenChangeDetect SCD = new ScreenChangeDetect(null);
12 |
13 | public void Log(string text)
14 | {
15 | txtLogs.Invoke((MethodInvoker)delegate
16 | {
17 | txtLogs.Text += text + Environment.NewLine;
18 | txtLogs.SelectionStart = txtLogs.TextLength;
19 | txtLogs.ScrollToCaret();
20 | });
21 | }
22 |
23 | public void selectImage(TextBox txtb)
24 | {
25 | OpenFileDialog ofd = new OpenFileDialog();
26 | ofd.ShowDialog();
27 | txtb.Text = ofd.FileName;
28 | }
29 |
30 | public frmTest()
31 | {
32 | InitializeComponent();
33 | }
34 |
35 | private void btnSelect1_Click(object sender, EventArgs e)
36 | {
37 | selectImage(txtImg1);
38 | }
39 |
40 | private void btnSelect2_Click(object sender, EventArgs e)
41 | {
42 | selectImage(txtImg2);
43 | }
44 |
45 | private void btnStart_Click(object sender, EventArgs e)
46 | {
47 | Bitmap oldIm = (Bitmap)Image.FromFile(txtImg1.Text).Clone();
48 | Bitmap newIm = (Bitmap)Image.FromFile(txtImg2.Text).Clone();
49 | Rectangle rect = Rectangle.Empty;
50 |
51 | SCD = new ScreenChangeDetect(this,oldIm);
52 | Bitmap imageChanged = SCD.Check(newIm, ref rect);
53 | picBox.Image = (Bitmap)imageChanged.Clone();
54 | }
55 |
56 | private void lblGithubLink_Click(object sender, EventArgs e)
57 | {
58 | Process.Start(lblGithubLink.Text);
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/Test/frmTest.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------
/TestImages/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KaramanisDev/RemoteDesktopOverNetwork/e0bf8c779b8eef6697160703f3c13ecf63607707/TestImages/1.png
--------------------------------------------------------------------------------
/TestImages/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KaramanisDev/RemoteDesktopOverNetwork/e0bf8c779b8eef6697160703f3c13ecf63607707/TestImages/2.png
--------------------------------------------------------------------------------