├── 01-Intro
├── Console_Hello_World
│ ├── ConsoleApplication1.sln
│ └── ConsoleApplication1
│ │ ├── ConsoleApplication1.csproj
│ │ ├── Program.cs
│ │ └── Properties
│ │ └── AssemblyInfo.cs
└── GUI_Hello_World
│ ├── SPR.Lab1.sln
│ └── SPR.Lab1
│ ├── Form1.Designer.cs
│ ├── Form1.cs
│ ├── Form1.resx
│ ├── Program.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ └── SPR.Lab1.csproj
├── 02-List_Directory
├── SPR-2.sln
└── SPR-2
│ ├── App.config
│ ├── Form1.Designer.cs
│ ├── Form1.cs
│ ├── Form1.resx
│ ├── Program.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ └── SPR-2.csproj
├── 03-Files
├── MyNotepad.sln
└── MyNotepad
│ ├── App.config
│ ├── Form1.Designer.cs
│ ├── Form1.cs
│ ├── Form1.resx
│ ├── MyNotepad.csproj
│ ├── Program.cs
│ └── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── 04-CopyFile
├── SPR-4.sln
└── SPR-4
│ ├── App.config
│ ├── Form1.Designer.cs
│ ├── Form1.cs
│ ├── Form1.resx
│ ├── Program.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ └── SPR-4.csproj
├── 05-Recursive_Copy
├── SPR-4-2.sln
└── SPR-4-2
│ ├── App.config
│ ├── Form1.Designer.cs
│ ├── Form1.cs
│ ├── Form1.resx
│ ├── Program.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ └── SPR-4-2.csproj
├── 06-Registry
├── SRP-6.sln
└── SRP-6
│ ├── App.config
│ ├── Form1.Designer.cs
│ ├── Form1.cs
│ ├── Form1.resx
│ ├── Program.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ └── SRP-6.csproj
├── 08-Environment-Variables
├── SPR-8.sln
└── SPR-8
│ ├── App.config
│ ├── Form1.Designer.cs
│ ├── Form1.cs
│ ├── Form1.resx
│ ├── Program.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ ├── SPR-8.csproj
│ └── bin
│ └── Debug
│ └── x.txt
├── 09-Networking
├── SPR-9-Client
│ ├── App.config
│ ├── Form1.Designer.cs
│ ├── Form1.cs
│ ├── Form1.resx
│ ├── Program.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ └── SPR-9-Networking-Client.csproj
├── SPR-9-Networking.sln
└── SPR-9-Networking
│ ├── App.config
│ ├── Form1.Designer.cs
│ ├── Form1.cs
│ ├── Form1.resx
│ ├── Program.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ └── SPR-9-Networking-Server.csproj
├── 10-FileStream,NetworkStrem
├── MyNetwork
│ ├── MyNetwork.csproj
│ ├── Net.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── bin
│ │ └── Debug
│ │ └── MyNetwork.dll
├── SPR-Client
│ ├── App.config
│ ├── FormClient.Designer.cs
│ ├── FormClient.cs
│ ├── FormClient.resx
│ ├── Program.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── SPR-Client.csproj
│ └── bin
│ │ └── Debug
│ │ └── MyNetwork.dll
├── SPR-Networking.sln
└── SPR-Server
│ ├── App.config
│ ├── FormServer.Designer.cs
│ ├── FormServer.cs
│ ├── FormServer.resx
│ ├── Program.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ ├── SPR-Server.csproj
│ └── bin
│ └── Debug
│ └── MyNetwork.dll
├── 11-Threading+Asynchronous_Communication
├── MyNetwork
│ ├── MyNetwork.csproj
│ ├── Net.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── bin
│ │ └── Debug
│ │ └── MyNetwork.dll
├── SPR-Client
│ ├── App.config
│ ├── FormClient.Designer.cs
│ ├── FormClient.cs
│ ├── FormClient.resx
│ ├── Program.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── SPR-Client.csproj
│ └── bin
│ │ └── Debug
│ │ └── MyNetwork.dll
├── SPR-Networking.sln
└── SPR-Server
│ ├── App.config
│ ├── FormServer.Designer.cs
│ ├── FormServer.cs
│ ├── FormServer.resx
│ ├── Program.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ ├── SPR-Server.csproj
│ └── bin
│ └── Debug
│ └── MyNetwork.dll
└── 12-Video-Streaming
├── MyNetwork
├── MyNetwork.csproj
├── Net.cs
├── Properties
│ └── AssemblyInfo.cs
└── myImage.cs
├── SPR-Client
├── App.config
├── FormClient.Designer.cs
├── FormClient.cs
├── FormClient.resx
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
└── SPR-Client.csproj
├── SPR-Networking.sln
└── SPR-Server
├── App.config
├── FormServer.Designer.cs
├── FormServer.cs
├── FormServer.resx
├── Program.cs
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
└── SPR-Server.csproj
/01-Intro/Console_Hello_World/ConsoleApplication1.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication1", "ConsoleApplication1\ConsoleApplication1.csproj", "{F00A5BD6-B105-4CD4-A311-246773696B67}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {F00A5BD6-B105-4CD4-A311-246773696B67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {F00A5BD6-B105-4CD4-A311-246773696B67}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {F00A5BD6-B105-4CD4-A311-246773696B67}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {F00A5BD6-B105-4CD4-A311-246773696B67}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/01-Intro/Console_Hello_World/ConsoleApplication1/ConsoleApplication1.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {F00A5BD6-B105-4CD4-A311-246773696B67}
8 | Exe
9 | Properties
10 | ConsoleApplication1
11 | ConsoleApplication1
12 | v2.0
13 | 512
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
51 |
--------------------------------------------------------------------------------
/01-Intro/Console_Hello_World/ConsoleApplication1/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace ConsoleApplication1
6 | {
7 | class Program
8 | {
9 | static void Main(string[] args)
10 | {
11 | //cout<<"Hello World"<
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.button1 = new System.Windows.Forms.Button();
32 | this.textBox1 = new System.Windows.Forms.TextBox();
33 | this.label1 = new System.Windows.Forms.Label();
34 | this.SuspendLayout();
35 | //
36 | // button1
37 | //
38 | this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
39 | this.button1.ForeColor = System.Drawing.Color.Red;
40 | this.button1.Location = new System.Drawing.Point(254, 90);
41 | this.button1.Name = "button1";
42 | this.button1.Size = new System.Drawing.Size(94, 94);
43 | this.button1.TabIndex = 0;
44 | this.button1.Text = "Click me";
45 | this.button1.UseVisualStyleBackColor = false;
46 | this.button1.Click += new System.EventHandler(this.button1_Click);
47 | //
48 | // textBox1
49 | //
50 | this.textBox1.Location = new System.Drawing.Point(12, 45);
51 | this.textBox1.Name = "textBox1";
52 | this.textBox1.Size = new System.Drawing.Size(336, 20);
53 | this.textBox1.TabIndex = 1;
54 | //
55 | // label1
56 | //
57 | this.label1.AutoSize = true;
58 | this.label1.Location = new System.Drawing.Point(13, 13);
59 | this.label1.Name = "label1";
60 | this.label1.Size = new System.Drawing.Size(119, 13);
61 | this.label1.TabIndex = 2;
62 | this.label1.Text = "Please write your name:";
63 | //
64 | // Form1
65 | //
66 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
67 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
68 | this.BackColor = System.Drawing.SystemColors.ActiveCaption;
69 | this.ClientSize = new System.Drawing.Size(379, 343);
70 | this.Controls.Add(this.label1);
71 | this.Controls.Add(this.textBox1);
72 | this.Controls.Add(this.button1);
73 | this.Cursor = System.Windows.Forms.Cursors.Cross;
74 | this.MaximizeBox = false;
75 | this.MinimizeBox = false;
76 | this.Name = "Form1";
77 | this.Text = "SPR - Lab1";
78 | this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
79 | this.ResumeLayout(false);
80 | this.PerformLayout();
81 |
82 | }
83 |
84 | #endregion
85 |
86 | private System.Windows.Forms.Button button1;
87 | private System.Windows.Forms.TextBox textBox1;
88 | private System.Windows.Forms.Label label1;
89 | }
90 | }
91 |
92 |
--------------------------------------------------------------------------------
/01-Intro/GUI_Hello_World/SPR.Lab1/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Text;
7 | using System.Windows.Forms;
8 |
9 | namespace SPR.Lab1
10 | {
11 | public partial class Form1 : Form
12 | {
13 | public Form1()
14 | {
15 | InitializeComponent();
16 | }
17 |
18 | private void button1_Click(object sender, EventArgs e)
19 | {
20 | //fgdsgsdfgdsjfkhg
21 | MessageBox.Show("Hello "+textBox1.Text);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/01-Intro/GUI_Hello_World/SPR.Lab1/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Windows.Forms;
4 |
5 | namespace SPR.Lab1
6 | {
7 | static class Program
8 | {
9 | ///
10 | /// The main entry point for the application.
11 | ///
12 | [STAThread]
13 | static void Main()
14 | {
15 | Application.EnableVisualStyles();
16 | Application.SetCompatibleTextRenderingDefault(false);
17 | Application.Run(new Form1());
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/01-Intro/GUI_Hello_World/SPR.Lab1/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("SPR.Lab1")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SPR.Lab1")]
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("c602eacb-b249-4359-bdc6-d38fbf590eb8")]
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 |
--------------------------------------------------------------------------------
/01-Intro/GUI_Hello_World/SPR.Lab1/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR.Lab1.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("SPR.Lab1.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 |
--------------------------------------------------------------------------------
/01-Intro/GUI_Hello_World/SPR.Lab1/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR.Lab1.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 |
--------------------------------------------------------------------------------
/01-Intro/GUI_Hello_World/SPR.Lab1/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/01-Intro/GUI_Hello_World/SPR.Lab1/SPR.Lab1.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {8AD030D8-5485-4DB7-A584-05391FAA3BAF}
8 | WinExe
9 | Properties
10 | SPR.Lab1
11 | SPR.Lab1
12 | v2.0
13 | 512
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | Form
45 |
46 |
47 | Form1.cs
48 |
49 |
50 |
51 |
52 | Form1.cs
53 |
54 |
55 | ResXFileCodeGenerator
56 | Resources.Designer.cs
57 | Designer
58 |
59 |
60 | True
61 | Resources.resx
62 |
63 |
64 | SettingsSingleFileGenerator
65 | Settings.Designer.cs
66 |
67 |
68 | True
69 | Settings.settings
70 | True
71 |
72 |
73 |
74 |
81 |
--------------------------------------------------------------------------------
/02-List_Directory/SPR-2.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPR-2", "SPR-2\SPR-2.csproj", "{1CFDB6DD-CEF4-4414-8E57-7A157D667695}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {1CFDB6DD-CEF4-4414-8E57-7A157D667695}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {1CFDB6DD-CEF4-4414-8E57-7A157D667695}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {1CFDB6DD-CEF4-4414-8E57-7A157D667695}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {1CFDB6DD-CEF4-4414-8E57-7A157D667695}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/02-List_Directory/SPR-2/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/02-List_Directory/SPR-2/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace SPR_2
2 | {
3 | partial class Form1
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.listBox1 = new System.Windows.Forms.ListBox();
32 | this.button1 = new System.Windows.Forms.Button();
33 | this.comboBox1 = new System.Windows.Forms.ComboBox();
34 | this.SuspendLayout();
35 | //
36 | // listBox1
37 | //
38 | this.listBox1.FormattingEnabled = true;
39 | this.listBox1.Location = new System.Drawing.Point(12, 40);
40 | this.listBox1.Name = "listBox1";
41 | this.listBox1.Size = new System.Drawing.Size(345, 342);
42 | this.listBox1.TabIndex = 0;
43 | this.listBox1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listBox1_MouseDoubleClick);
44 | //
45 | // button1
46 | //
47 | this.button1.Location = new System.Drawing.Point(278, 13);
48 | this.button1.Name = "button1";
49 | this.button1.Size = new System.Drawing.Size(75, 23);
50 | this.button1.TabIndex = 2;
51 | this.button1.Text = "List";
52 | this.button1.UseVisualStyleBackColor = true;
53 | this.button1.Click += new System.EventHandler(this.button1_Click);
54 | //
55 | // comboBox1
56 | //
57 | this.comboBox1.FormattingEnabled = true;
58 | this.comboBox1.Location = new System.Drawing.Point(13, 13);
59 | this.comboBox1.Name = "comboBox1";
60 | this.comboBox1.Size = new System.Drawing.Size(259, 21);
61 | this.comboBox1.TabIndex = 3;
62 | //
63 | // Form1
64 | //
65 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
66 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
67 | this.ClientSize = new System.Drawing.Size(371, 406);
68 | this.Controls.Add(this.comboBox1);
69 | this.Controls.Add(this.button1);
70 | this.Controls.Add(this.listBox1);
71 | this.Name = "Form1";
72 | this.Text = "Directory Manager";
73 | this.Load += new System.EventHandler(this.Form1_Load);
74 | this.ResumeLayout(false);
75 |
76 | }
77 |
78 | #endregion
79 |
80 | private System.Windows.Forms.ListBox listBox1;
81 | private System.Windows.Forms.Button button1;
82 | private System.Windows.Forms.ComboBox comboBox1;
83 | }
84 | }
85 |
86 |
--------------------------------------------------------------------------------
/02-List_Directory/SPR-2/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | //////////////////////////////
11 | using System.IO;
12 |
13 | namespace SPR_2
14 | {
15 | public partial class Form1 : Form
16 | {
17 | public Form1()
18 | {
19 | InitializeComponent();
20 | }
21 |
22 | private void button1_Click(object sender, EventArgs e)
23 | {
24 | listBox1.Items.Clear();
25 | listBox1.Items.Add("..");
26 | try
27 | {
28 | string[] folders = Directory.GetDirectories(comboBox1.Text);
29 | for (int i = 0; i < folders.Length; i++)
30 | {
31 | listBox1.Items.Add(folders[i]);
32 | }
33 | }
34 | catch (Exception ex)
35 | {
36 | MessageBox.Show(ex.Message);
37 | }
38 | }
39 |
40 | private void Form1_Load(object sender, EventArgs e)
41 | {
42 | comboBox1.Items.Clear();
43 |
44 | string[] drives = Directory.GetLogicalDrives();
45 | comboBox1.Items.AddRange(drives);
46 | comboBox1.SelectedIndex = 0;
47 | }
48 |
49 | private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
50 | {
51 | int index = listBox1.SelectedIndex;
52 | string path = listBox1.Items[index].ToString();
53 | //MessageBox.Show(path);
54 | listBox1.Items.Clear();
55 | listBox1.Items.Add("..");
56 | try
57 | {
58 | string[] folders = Directory.GetDirectories(path);
59 | for (int i = 0; i < folders.Length; i++)
60 | {
61 | listBox1.Items.Add(folders[i]);
62 | }
63 | }
64 | catch(Exception ex)
65 | {
66 | MessageBox.Show(ex.Message);
67 | }
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/02-List_Directory/SPR-2/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace SPR_2
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/02-List_Directory/SPR-2/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("SPR-2")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SPR-2")]
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("15fc0939-8115-4a6e-804a-b45baaa412a1")]
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 |
--------------------------------------------------------------------------------
/02-List_Directory/SPR-2/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_2.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("SPR_2.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 |
--------------------------------------------------------------------------------
/02-List_Directory/SPR-2/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_2.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 |
--------------------------------------------------------------------------------
/02-List_Directory/SPR-2/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/02-List_Directory/SPR-2/SPR-2.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {1CFDB6DD-CEF4-4414-8E57-7A157D667695}
8 | WinExe
9 | Properties
10 | SPR_2
11 | SPR-2
12 | v4.5
13 | 512
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | Form
49 |
50 |
51 | Form1.cs
52 |
53 |
54 |
55 |
56 | Form1.cs
57 |
58 |
59 | ResXFileCodeGenerator
60 | Resources.Designer.cs
61 | Designer
62 |
63 |
64 | True
65 | Resources.resx
66 |
67 |
68 | SettingsSingleFileGenerator
69 | Settings.Designer.cs
70 |
71 |
72 | True
73 | Settings.settings
74 | True
75 |
76 |
77 |
78 |
79 |
80 |
81 |
88 |
--------------------------------------------------------------------------------
/03-Files/MyNotepad.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyNotepad", "MyNotepad\MyNotepad.csproj", "{006FE1C2-5C9E-4526-A042-3F6F185E76FB}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {006FE1C2-5C9E-4526-A042-3F6F185E76FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {006FE1C2-5C9E-4526-A042-3F6F185E76FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {006FE1C2-5C9E-4526-A042-3F6F185E76FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {006FE1C2-5C9E-4526-A042-3F6F185E76FB}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/03-Files/MyNotepad/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/03-Files/MyNotepad/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | ///////////////////////////////
11 | using System.IO;//Input Output
12 |
13 | namespace MyNotepad
14 | {
15 | public partial class Form1 : Form
16 | {
17 | public Form1()
18 | {
19 | InitializeComponent();
20 | }
21 |
22 | private void saveToolStripMenuItem_Click(object sender, EventArgs e)
23 | {
24 | //File -> Save
25 | //1. Open File Dialog
26 | saveFileDialog1.ShowDialog();//Open windows
27 | string path = saveFileDialog1.FileName;//File path
28 | //2. Create File
29 | //3. Text -> File
30 | string[] text = richTextBox1.Lines;
31 | File.WriteAllLines(path, text);//Create+Write+Close
32 | //4. Close File
33 | }
34 |
35 | private void openToolStripMenuItem_Click(object sender, EventArgs e)
36 | {
37 | // 1- Open Dialog
38 | openFileDialog1.ShowDialog();
39 | string path = openFileDialog1.FileName;
40 | // 2- Read File -> Text
41 | string[] text = File.ReadAllLines(path);
42 | richTextBox1.Lines = text;
43 | }
44 |
45 | private void exitToolStripMenuItem_Click(object sender, EventArgs e)
46 | {
47 | Application.Exit();
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/03-Files/MyNotepad/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace MyNotepad
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/03-Files/MyNotepad/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("MyNotepad")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("MyNotepad")]
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("ce2b3bf1-59ef-4939-9fc0-280cd788fd69")]
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 |
--------------------------------------------------------------------------------
/03-Files/MyNotepad/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 MyNotepad.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("MyNotepad.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 |
--------------------------------------------------------------------------------
/03-Files/MyNotepad/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 MyNotepad.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 |
--------------------------------------------------------------------------------
/03-Files/MyNotepad/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/04-CopyFile/SPR-4.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPR-4", "SPR-4\SPR-4.csproj", "{6F652E6E-102C-42C8-843C-9F9E3929ADA3}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {6F652E6E-102C-42C8-843C-9F9E3929ADA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {6F652E6E-102C-42C8-843C-9F9E3929ADA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {6F652E6E-102C-42C8-843C-9F9E3929ADA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {6F652E6E-102C-42C8-843C-9F9E3929ADA3}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/04-CopyFile/SPR-4/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/04-CopyFile/SPR-4/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | //////////////////////////
11 | using System.IO;
12 |
13 | namespace SPR_4
14 | {
15 | public partial class Form1 : Form
16 | {
17 | public Form1()
18 | {
19 | InitializeComponent();
20 | }
21 |
22 | private void Form1_Load(object sender, EventArgs e)
23 | {
24 | string[] drives = Directory.GetLogicalDrives();//C: D: E: WIN API
25 | listBox1.Items.AddRange(drives);
26 | listBox2.Items.AddRange(drives);
27 | }
28 |
29 | private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
30 | {
31 |
32 | }
33 |
34 | private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
35 | {
36 |
37 | }
38 |
39 | private void listBox1_SelectedIndexChanged(object sender, MouseEventArgs e)
40 | {
41 | int index = listBox1.SelectedIndex;//UI
42 | string path = listBox1.Items[index].ToString();//UI
43 | //////////////////////////////////////
44 | string[] dirs = Directory.GetDirectories(path);//WIN API
45 | string[] files = Directory.GetFiles(path);//WIN API
46 | //////////////////////////////////////
47 | listBox1.Items.Clear();
48 | listBox1.Items.AddRange(dirs); //UI
49 | listBox1.Items.AddRange(files);//UI
50 | }
51 |
52 | private void listBox2_MouseDoubleClick(object sender, MouseEventArgs e)
53 | {
54 | int index = listBox2.SelectedIndex;//UI
55 | string path = listBox2.Items[index].ToString();//UI
56 | //////////////////////////////////////
57 | string[] dirs = Directory.GetDirectories(path);//WIN API
58 | string[] files = Directory.GetFiles(path);//WIN API
59 | //////////////////////////////////////
60 | listBox2.Items.Clear();
61 | listBox2.Items.AddRange(dirs); //UI
62 | listBox2.Items.AddRange(files);//UI
63 | }
64 |
65 | private void button1_Click(object sender, EventArgs e)
66 | {
67 | int index1 = listBox1.SelectedIndex;//UI
68 | string path1 = listBox1.Items[index1].ToString();//UI
69 |
70 | int index2 = listBox2.SelectedIndex;//UI
71 | string path2 = listBox2.Items[index2].ToString();//UI
72 | string filename = Path.GetFileName(path1);
73 | File.Copy(path1, path2 + "\\" + filename);
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/04-CopyFile/SPR-4/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace SPR_4
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/04-CopyFile/SPR-4/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("SPR-4")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SPR-4")]
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("df62c957-e167-4751-a754-3e510b00d3c3")]
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 |
--------------------------------------------------------------------------------
/04-CopyFile/SPR-4/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_4.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("SPR_4.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 |
--------------------------------------------------------------------------------
/04-CopyFile/SPR-4/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_4.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 |
--------------------------------------------------------------------------------
/04-CopyFile/SPR-4/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/04-CopyFile/SPR-4/SPR-4.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {6F652E6E-102C-42C8-843C-9F9E3929ADA3}
8 | WinExe
9 | Properties
10 | SPR_4
11 | SPR-4
12 | v4.5
13 | 512
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | Form
49 |
50 |
51 | Form1.cs
52 |
53 |
54 |
55 |
56 | Form1.cs
57 |
58 |
59 | ResXFileCodeGenerator
60 | Resources.Designer.cs
61 | Designer
62 |
63 |
64 | True
65 | Resources.resx
66 |
67 |
68 | SettingsSingleFileGenerator
69 | Settings.Designer.cs
70 |
71 |
72 | True
73 | Settings.settings
74 | True
75 |
76 |
77 |
78 |
79 |
80 |
81 |
88 |
--------------------------------------------------------------------------------
/05-Recursive_Copy/SPR-4-2.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPR-4-2", "SPR-4-2\SPR-4-2.csproj", "{043DE8D2-2341-4866-8AD9-E8257193492A}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {043DE8D2-2341-4866-8AD9-E8257193492A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {043DE8D2-2341-4866-8AD9-E8257193492A}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {043DE8D2-2341-4866-8AD9-E8257193492A}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {043DE8D2-2341-4866-8AD9-E8257193492A}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/05-Recursive_Copy/SPR-4-2/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/05-Recursive_Copy/SPR-4-2/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | ////////////////////////////
11 | using System.IO;
12 |
13 | namespace SPR_4_2
14 | {
15 | public partial class Form1 : Form
16 | {
17 | public Form1()
18 | {
19 | InitializeComponent();
20 | }
21 |
22 | private void Form1_Load(object sender, EventArgs e)
23 | {
24 | string[] directory = Directory.GetLogicalDrives();
25 | listBox1.Items.AddRange(directory);
26 | listBox2.Items.AddRange(directory);
27 | }
28 |
29 | private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
30 | {
31 | int index = listBox1.SelectedIndex;
32 | string path = listBox1.Items[index].ToString();
33 |
34 | string[] dir = Directory.GetDirectories(path);
35 | string[] files = Directory.GetFiles(path);
36 |
37 | listBox1.Items.Clear();
38 | listBox1.Items.AddRange(dir);
39 | listBox1.Items.AddRange(files);
40 | }
41 |
42 | private void listBox2_MouseDoubleClick(object sender, MouseEventArgs e)
43 | {
44 | int index = listBox2.SelectedIndex;
45 | string path = listBox2.Items[index].ToString();
46 |
47 | string[] dir = Directory.GetDirectories(path);
48 | string[] files = Directory.GetFiles(path);
49 |
50 | listBox2.Items.Clear();
51 | listBox2.Items.AddRange(dir);
52 | listBox2.Items.AddRange(files);
53 | }
54 |
55 | private void button1_Click(object sender, EventArgs e)
56 | {
57 | int index1 = listBox1.SelectedIndex;
58 | string path1 = listBox1.Items[index1].ToString();
59 | int index2 = listBox2.SelectedIndex;
60 | string path2 = listBox2.Items[index2].ToString();
61 |
62 | if (Directory.Exists(path1))
63 | {
64 | copyDirectory(path1,path2);
65 | return;
66 | }
67 |
68 | //C:\\tools\\easybcd.exe --> easybcd.exe
69 | string file_name = Path.GetFileName(path1);
70 | File.Copy(path1, path2 + "\\" + file_name);
71 | }
72 |
73 | private void copyDirectory(string path1, string path2)
74 | {
75 | string dir_name1 = Path.GetFileName(path1);
76 | Directory.CreateDirectory(path2 + "\\" + dir_name1);
77 | path2 += "\\" + dir_name1;
78 |
79 | string[] dir = Directory.GetDirectories(path1);
80 | string[] files = Directory.GetFiles(path1);
81 |
82 | for (int i = 0; i < files.Length; i++)
83 | {
84 | string file_name = Path.GetFileName(files[i]);
85 | File.Copy(files[i], path2 + "\\" + file_name);
86 | }
87 | for (int i = 0; i < dir.Length; i++)
88 | {
89 | string dir_name = Path.GetFileName(dir[i]);
90 | copyDirectory(dir[i], path2 + "\\" + dir_name);
91 | }
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/05-Recursive_Copy/SPR-4-2/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace SPR_4_2
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/05-Recursive_Copy/SPR-4-2/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("SPR-4-2")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SPR-4-2")]
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("bab9d2a6-2808-491e-948e-b558c6e8b5cd")]
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 |
--------------------------------------------------------------------------------
/05-Recursive_Copy/SPR-4-2/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_4_2.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("SPR_4_2.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 |
--------------------------------------------------------------------------------
/05-Recursive_Copy/SPR-4-2/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_4_2.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 |
--------------------------------------------------------------------------------
/05-Recursive_Copy/SPR-4-2/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/06-Registry/SRP-6.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SRP-6", "SRP-6\SRP-6.csproj", "{EB9A96CC-41F8-485A-B250-EF20CE32FA30}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {EB9A96CC-41F8-485A-B250-EF20CE32FA30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {EB9A96CC-41F8-485A-B250-EF20CE32FA30}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {EB9A96CC-41F8-485A-B250-EF20CE32FA30}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {EB9A96CC-41F8-485A-B250-EF20CE32FA30}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/06-Registry/SRP-6/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/06-Registry/SRP-6/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace SRP_6
2 | {
3 | partial class Form1
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.listBox1 = new System.Windows.Forms.ListBox();
32 | this.listBox2 = new System.Windows.Forms.ListBox();
33 | this.SuspendLayout();
34 | //
35 | // listBox1
36 | //
37 | this.listBox1.Dock = System.Windows.Forms.DockStyle.Left;
38 | this.listBox1.FormattingEnabled = true;
39 | this.listBox1.Location = new System.Drawing.Point(0, 0);
40 | this.listBox1.Name = "listBox1";
41 | this.listBox1.Size = new System.Drawing.Size(242, 403);
42 | this.listBox1.TabIndex = 0;
43 | this.listBox1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listBox1_MouseDoubleClick);
44 | //
45 | // listBox2
46 | //
47 | this.listBox2.Dock = System.Windows.Forms.DockStyle.Right;
48 | this.listBox2.FormattingEnabled = true;
49 | this.listBox2.Location = new System.Drawing.Point(248, 0);
50 | this.listBox2.Name = "listBox2";
51 | this.listBox2.Size = new System.Drawing.Size(230, 403);
52 | this.listBox2.TabIndex = 1;
53 | this.listBox2.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listBox2_MouseDoubleClick);
54 | //
55 | // Form1
56 | //
57 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
58 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
59 | this.ClientSize = new System.Drawing.Size(478, 403);
60 | this.Controls.Add(this.listBox2);
61 | this.Controls.Add(this.listBox1);
62 | this.Name = "Form1";
63 | this.Text = "Form1";
64 | this.Load += new System.EventHandler(this.Form1_Load);
65 | this.ResumeLayout(false);
66 |
67 | }
68 |
69 | #endregion
70 |
71 | private System.Windows.Forms.ListBox listBox1;
72 | private System.Windows.Forms.ListBox listBox2;
73 | }
74 | }
75 |
76 |
--------------------------------------------------------------------------------
/06-Registry/SRP-6/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | //////////////////////
11 | using Microsoft.Win32;
12 |
13 | namespace SRP_6
14 | {
15 | public partial class Form1 : Form
16 | {
17 | public Form1()
18 | {
19 | InitializeComponent();
20 | }
21 |
22 | private void Form1_Load(object sender, EventArgs e)
23 | {
24 | RegistryKey rk = Registry.CurrentUser;//HKEY_CURRENT_USER
25 | string [] keys = rk.GetSubKeyNames();
26 | listBox1.Items.AddRange(keys);
27 | }
28 | string global_key = "";
29 | private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
30 | {
31 | int index = listBox1.SelectedIndex;
32 | string key = listBox1.Items[index].ToString();
33 | if(global_key != "")
34 | global_key += "\\"+ key;
35 | else
36 | global_key += key;
37 | RegistryKey rk = Registry.CurrentUser.OpenSubKey(global_key);
38 |
39 | string[] keys = rk.GetSubKeyNames();
40 | string[] value_names = rk.GetValueNames();
41 | listBox1.Items.Clear();
42 | listBox1.Items.AddRange(keys);
43 | listBox2.Items.Clear();
44 | listBox2.Items.AddRange(value_names);
45 | }
46 |
47 | private void listBox2_MouseDoubleClick(object sender, MouseEventArgs e)
48 | {
49 | RegistryKey rk = Registry.CurrentUser.OpenSubKey(global_key);
50 | int index = listBox2.SelectedIndex;
51 | string value_name = listBox2.Items[index].ToString();
52 | string value_data = rk.GetValue(value_name).ToString();
53 | string value_kind = rk.GetValueKind(value_name).ToString();
54 |
55 | MessageBox.Show(value_kind + " -- " + value_data);
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/06-Registry/SRP-6/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace SRP_6
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/06-Registry/SRP-6/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("SRP-6")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SRP-6")]
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("8a41b1ba-bc01-43ab-84d9-2de01668bc70")]
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 |
--------------------------------------------------------------------------------
/06-Registry/SRP-6/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SRP_6.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("SRP_6.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 |
--------------------------------------------------------------------------------
/06-Registry/SRP-6/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SRP_6.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 |
--------------------------------------------------------------------------------
/06-Registry/SRP-6/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/06-Registry/SRP-6/SRP-6.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {EB9A96CC-41F8-485A-B250-EF20CE32FA30}
8 | WinExe
9 | Properties
10 | SRP_6
11 | SRP-6
12 | v4.5
13 | 512
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | Form
49 |
50 |
51 | Form1.cs
52 |
53 |
54 |
55 |
56 | Form1.cs
57 |
58 |
59 | ResXFileCodeGenerator
60 | Resources.Designer.cs
61 | Designer
62 |
63 |
64 | True
65 | Resources.resx
66 |
67 |
68 | SettingsSingleFileGenerator
69 | Settings.Designer.cs
70 |
71 |
72 | True
73 | Settings.settings
74 | True
75 |
76 |
77 |
78 |
79 |
80 |
81 |
88 |
--------------------------------------------------------------------------------
/08-Environment-Variables/SPR-8.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPR-8", "SPR-8\SPR-8.csproj", "{F7C65AE9-8584-4674-A2E5-F8E4E92DF82D}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {F7C65AE9-8584-4674-A2E5-F8E4E92DF82D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {F7C65AE9-8584-4674-A2E5-F8E4E92DF82D}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {F7C65AE9-8584-4674-A2E5-F8E4E92DF82D}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {F7C65AE9-8584-4674-A2E5-F8E4E92DF82D}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/08-Environment-Variables/SPR-8/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/08-Environment-Variables/SPR-8/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace SPR_8
2 | {
3 | partial class Form1
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.button1 = new System.Windows.Forms.Button();
32 | this.SuspendLayout();
33 | //
34 | // button1
35 | //
36 | this.button1.Location = new System.Drawing.Point(79, 26);
37 | this.button1.Name = "button1";
38 | this.button1.Size = new System.Drawing.Size(75, 23);
39 | this.button1.TabIndex = 0;
40 | this.button1.Text = "button1";
41 | this.button1.UseVisualStyleBackColor = true;
42 | this.button1.Click += new System.EventHandler(this.button1_Click);
43 | //
44 | // Form1
45 | //
46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
48 | this.ClientSize = new System.Drawing.Size(599, 354);
49 | this.Controls.Add(this.button1);
50 | this.Name = "Form1";
51 | this.Text = "Form1";
52 | this.ResumeLayout(false);
53 |
54 | }
55 |
56 | #endregion
57 |
58 | private System.Windows.Forms.Button button1;
59 | }
60 | }
61 |
62 |
--------------------------------------------------------------------------------
/08-Environment-Variables/SPR-8/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | /////////////////////////////
11 | using System.Collections;
12 | using System.IO;
13 |
14 | namespace SPR_8
15 | {
16 | public partial class Form1 : Form
17 | {
18 | public Form1()
19 | {
20 | InitializeComponent();
21 | }
22 | public void ENV2FILE()
23 | {
24 | //Environment.GetEnvironmentVariables()
25 | //Dictionary stds = new Dictionary();
26 | //stds.Add("Ahmad", "99");
27 | //stds.Add("Samer", "98");
28 | //stds.Add("Walid", "97");
29 | //stds.Add("Rama", "96");
30 | //MessageBox.Show(stds["Ahmad"].ToString());
31 | //int x = 1; object x2 = 1;
32 | //var z = "String"; object z2 = "String";
33 | //foreach (KeyValuePair item in stds)
34 | //{
35 | // MessageBox.Show(item.Key + "," + item.Value);
36 | //}
37 | //Hashtable ht = new Hashtable(
38 | // new Dictionary()
39 | // );
40 | //ht.Add("Ahmad", 75);
41 | //ht.Add("Samer", 59);
42 | //ht.Add("Walid", 38);
43 | //ht.Add("Rama", 0);
44 | Hashtable env = (Hashtable)Environment.GetEnvironmentVariables();
45 | string[] keys_val = new string[1000];
46 | int index=0;
47 | foreach (DictionaryEntry item in env)
48 | keys_val[index++] = item.Key + "---->" + item.Value;
49 | File.WriteAllLines("x.txt", keys_val);
50 | }
51 | private void button1_Click(object sender, EventArgs e)
52 | {
53 | FILE2ENV();
54 | }
55 |
56 | public void FILE2ENV()
57 | {
58 | string[] key_vals = File.ReadAllLines("x.txt");
59 | for (int i = 0; i < key_vals.Length; i++)
60 | {
61 | string key_val = key_vals[i];
62 | string[] split = new string[1] { "-->"};
63 | string key = key_val.Split(split,StringSplitOptions.RemoveEmptyEntries)[0];
64 | string value = key_val.Split(split, StringSplitOptions.RemoveEmptyEntries)[1];
65 | Environment.SetEnvironmentVariable(key, value,EnvironmentVariableTarget.User);
66 | }
67 | MessageBox.Show("Done");
68 | }
69 |
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/08-Environment-Variables/SPR-8/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace SPR_8
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/08-Environment-Variables/SPR-8/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("SPR-8")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SPR-8")]
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("bad7f6df-0c97-40ee-b3ca-e9f67e0a9af6")]
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 |
--------------------------------------------------------------------------------
/08-Environment-Variables/SPR-8/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_8.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("SPR_8.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 |
--------------------------------------------------------------------------------
/08-Environment-Variables/SPR-8/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_8.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 |
--------------------------------------------------------------------------------
/08-Environment-Variables/SPR-8/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/08-Environment-Variables/SPR-8/bin/Debug/x.txt:
--------------------------------------------------------------------------------
1 | SPR-->100
2 | DB1-->99
--------------------------------------------------------------------------------
/09-Networking/SPR-9-Client/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/09-Networking/SPR-9-Client/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace SPR_9_Client
2 | {
3 | partial class Form1
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.listBox1 = new System.Windows.Forms.ListBox();
32 | this.textBox1 = new System.Windows.Forms.TextBox();
33 | this.button1 = new System.Windows.Forms.Button();
34 | this.button2 = new System.Windows.Forms.Button();
35 | this.SuspendLayout();
36 | //
37 | // listBox1
38 | //
39 | this.listBox1.FormattingEnabled = true;
40 | this.listBox1.Location = new System.Drawing.Point(13, 13);
41 | this.listBox1.Name = "listBox1";
42 | this.listBox1.Size = new System.Drawing.Size(440, 342);
43 | this.listBox1.TabIndex = 0;
44 | //
45 | // textBox1
46 | //
47 | this.textBox1.Location = new System.Drawing.Point(19, 378);
48 | this.textBox1.Name = "textBox1";
49 | this.textBox1.Size = new System.Drawing.Size(353, 20);
50 | this.textBox1.TabIndex = 1;
51 | //
52 | // button1
53 | //
54 | this.button1.Location = new System.Drawing.Point(378, 362);
55 | this.button1.Name = "button1";
56 | this.button1.Size = new System.Drawing.Size(75, 23);
57 | this.button1.TabIndex = 3;
58 | this.button1.Text = "Send";
59 | this.button1.UseVisualStyleBackColor = true;
60 | this.button1.Click += new System.EventHandler(this.button1_Click);
61 | //
62 | // button2
63 | //
64 | this.button2.Location = new System.Drawing.Point(379, 392);
65 | this.button2.Name = "button2";
66 | this.button2.Size = new System.Drawing.Size(75, 23);
67 | this.button2.TabIndex = 4;
68 | this.button2.Text = "Receive";
69 | this.button2.UseVisualStyleBackColor = true;
70 | this.button2.Click += new System.EventHandler(this.button2_Click);
71 | //
72 | // Form1
73 | //
74 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
75 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
76 | this.ClientSize = new System.Drawing.Size(483, 432);
77 | this.Controls.Add(this.button2);
78 | this.Controls.Add(this.button1);
79 | this.Controls.Add(this.textBox1);
80 | this.Controls.Add(this.listBox1);
81 | this.Name = "Form1";
82 | this.Text = "Client";
83 | this.Load += new System.EventHandler(this.Form1_Load);
84 | this.ResumeLayout(false);
85 | this.PerformLayout();
86 |
87 | }
88 |
89 | #endregion
90 |
91 | private System.Windows.Forms.ListBox listBox1;
92 | private System.Windows.Forms.TextBox textBox1;
93 | private System.Windows.Forms.Button button1;
94 | private System.Windows.Forms.Button button2;
95 | }
96 | }
97 |
98 |
--------------------------------------------------------------------------------
/09-Networking/SPR-9-Client/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | ////////////////////////////
11 | using System.Net.Sockets;
12 |
13 | namespace SPR_9_Client
14 | {
15 | public partial class Form1 : Form
16 | {
17 | public Form1()
18 | {
19 | InitializeComponent();
20 | }
21 | TcpClient client;
22 | private void Form1_Load(object sender, EventArgs e)
23 | {
24 | string ip = "127.0.0.1";
25 | int port = 5555;
26 | client = new TcpClient(ip,port);
27 | }
28 |
29 | private void button1_Click(object sender, EventArgs e)
30 | {
31 | //Send
32 | NetworkStream ns = client.GetStream();
33 | UnicodeEncoding ue = new UnicodeEncoding();// String => Byte && Byte => String
34 | string msg = textBox1.Text;
35 | byte[] stream = ue.GetBytes(msg);
36 | ns.Write(stream, 0, stream.Length);
37 | listBox1.Items.Add("Client: " + msg);
38 | textBox1.Text = "";
39 | }
40 |
41 | private void button2_Click(object sender, EventArgs e)
42 | {
43 | //Receive
44 | NetworkStream ns = client.GetStream();
45 | UnicodeEncoding ue = new UnicodeEncoding();// String => Byte && Byte => String
46 | byte[] stream = new byte[100];
47 | ns.Read(stream, 0, stream.Length);
48 | string msg = ue.GetString(stream);
49 | listBox1.Items.Add("Server: " + msg);
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/09-Networking/SPR-9-Client/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace SPR_9_Client
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/09-Networking/SPR-9-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("SPR-9-Client")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SPR-9-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("8a24b9a3-d60d-4e5a-a52f-5c12672d82de")]
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 |
--------------------------------------------------------------------------------
/09-Networking/SPR-9-Client/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_9_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("SPR_9_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 |
--------------------------------------------------------------------------------
/09-Networking/SPR-9-Client/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_9_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 |
--------------------------------------------------------------------------------
/09-Networking/SPR-9-Client/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/09-Networking/SPR-9-Networking.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPR-9-Networking-Server", "SPR-9-Networking\SPR-9-Networking-Server.csproj", "{FDCC38EC-8E21-432A-BDC4-ABB945251E3A}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPR-9-Networking-Client", "SPR-9-Client\SPR-9-Networking-Client.csproj", "{09398A7A-6891-42B4-ADF7-E5A9B5ED796C}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {FDCC38EC-8E21-432A-BDC4-ABB945251E3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {FDCC38EC-8E21-432A-BDC4-ABB945251E3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {FDCC38EC-8E21-432A-BDC4-ABB945251E3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {FDCC38EC-8E21-432A-BDC4-ABB945251E3A}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {09398A7A-6891-42B4-ADF7-E5A9B5ED796C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {09398A7A-6891-42B4-ADF7-E5A9B5ED796C}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {09398A7A-6891-42B4-ADF7-E5A9B5ED796C}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {09398A7A-6891-42B4-ADF7-E5A9B5ED796C}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/09-Networking/SPR-9-Networking/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/09-Networking/SPR-9-Networking/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace SPR_9_Networking
2 | {
3 | partial class Form1
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.listBox1 = new System.Windows.Forms.ListBox();
32 | this.textBox1 = new System.Windows.Forms.TextBox();
33 | this.button1 = new System.Windows.Forms.Button();
34 | this.button2 = new System.Windows.Forms.Button();
35 | this.SuspendLayout();
36 | //
37 | // listBox1
38 | //
39 | this.listBox1.FormattingEnabled = true;
40 | this.listBox1.Location = new System.Drawing.Point(12, 12);
41 | this.listBox1.Name = "listBox1";
42 | this.listBox1.Size = new System.Drawing.Size(453, 290);
43 | this.listBox1.TabIndex = 0;
44 | //
45 | // textBox1
46 | //
47 | this.textBox1.Location = new System.Drawing.Point(12, 343);
48 | this.textBox1.Name = "textBox1";
49 | this.textBox1.Size = new System.Drawing.Size(353, 20);
50 | this.textBox1.TabIndex = 1;
51 | //
52 | // button1
53 | //
54 | this.button1.Location = new System.Drawing.Point(390, 327);
55 | this.button1.Name = "button1";
56 | this.button1.Size = new System.Drawing.Size(75, 23);
57 | this.button1.TabIndex = 2;
58 | this.button1.Text = "Send";
59 | this.button1.UseVisualStyleBackColor = true;
60 | this.button1.Click += new System.EventHandler(this.button1_Click);
61 | //
62 | // button2
63 | //
64 | this.button2.Location = new System.Drawing.Point(390, 356);
65 | this.button2.Name = "button2";
66 | this.button2.Size = new System.Drawing.Size(75, 23);
67 | this.button2.TabIndex = 3;
68 | this.button2.Text = "Receive";
69 | this.button2.UseVisualStyleBackColor = true;
70 | this.button2.Click += new System.EventHandler(this.button2_Click);
71 | //
72 | // Form1
73 | //
74 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
75 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
76 | this.ClientSize = new System.Drawing.Size(494, 406);
77 | this.Controls.Add(this.button2);
78 | this.Controls.Add(this.button1);
79 | this.Controls.Add(this.textBox1);
80 | this.Controls.Add(this.listBox1);
81 | this.Name = "Form1";
82 | this.Text = "Server";
83 | this.Load += new System.EventHandler(this.Form1_Load);
84 | this.ResumeLayout(false);
85 | this.PerformLayout();
86 |
87 | }
88 |
89 | #endregion
90 |
91 | private System.Windows.Forms.ListBox listBox1;
92 | private System.Windows.Forms.TextBox textBox1;
93 | private System.Windows.Forms.Button button1;
94 | private System.Windows.Forms.Button button2;
95 | }
96 | }
97 |
98 |
--------------------------------------------------------------------------------
/09-Networking/SPR-9-Networking/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | ///////////////////////////////
11 | using System.Net.Sockets;
12 |
13 | namespace SPR_9_Networking
14 | {
15 | public partial class Form1 : Form
16 | {
17 | public Form1()
18 | {
19 | InitializeComponent();
20 | }
21 | TcpClient client;
22 | private void Form1_Load(object sender, EventArgs e)
23 | {
24 | int port = 5555;
25 | TcpListener server = new TcpListener(port);
26 | server.Start();
27 | client = server.AcceptTcpClient();
28 | }
29 |
30 | private void button1_Click(object sender, EventArgs e)
31 | {
32 | //Send
33 | NetworkStream ns = client.GetStream();
34 | UnicodeEncoding ue = new UnicodeEncoding();// String => Byte && Byte => String
35 | string msg = textBox1.Text;
36 | byte[] stream = ue.GetBytes(msg);
37 | ns.Write(stream, 0, stream.Length);
38 | listBox1.Items.Add("Server: " + msg);
39 | textBox1.Text = "";
40 | }
41 |
42 | private void button2_Click(object sender, EventArgs e)
43 | {
44 | //Receive
45 | NetworkStream ns = client.GetStream();
46 | UnicodeEncoding ue = new UnicodeEncoding();// String => Byte && Byte => String
47 | byte[] stream = new byte[100];
48 | ns.Read(stream, 0, stream.Length);
49 | string msg = ue.GetString(stream);
50 | listBox1.Items.Add("Client: " + msg);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/09-Networking/SPR-9-Networking/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace SPR_9_Networking
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/09-Networking/SPR-9-Networking/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("SPR-9-Networking")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SPR-9-Networking")]
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("e6bdd226-07f9-4907-a66a-36cd56dc8c18")]
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 |
--------------------------------------------------------------------------------
/09-Networking/SPR-9-Networking/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_9_Networking.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("SPR_9_Networking.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 |
--------------------------------------------------------------------------------
/09-Networking/SPR-9-Networking/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_9_Networking.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 |
--------------------------------------------------------------------------------
/09-Networking/SPR-9-Networking/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/MyNetwork/MyNetwork.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}
8 | Library
9 | Properties
10 | MyNetwork
11 | MyNetwork
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
53 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/MyNetwork/Net.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | ////////////////////////////////
7 | using System.Net.Sockets;
8 | using System.IO;
9 |
10 | namespace MyNetwork
11 | {
12 | public class Net
13 | {
14 | TcpClient client;
15 | public bool creartServer(int port)
16 | {
17 | try
18 | {
19 | TcpListener server = new TcpListener(port);
20 | server.Start();
21 | client = server.AcceptTcpClient();
22 | return true;
23 | }
24 | catch
25 | {
26 | return false;
27 | }
28 | }
29 |
30 | public bool createClient(string ip,int port)
31 | {
32 | try
33 | {
34 | client = new TcpClient(ip, port);
35 | return true;
36 | }
37 | catch
38 | {
39 | return false;
40 | }
41 | }
42 |
43 | public bool sendMsg(string msg)
44 | {
45 | try
46 | {
47 | byte[] binary = UnicodeEncoding.Unicode.GetBytes(msg);
48 | NetworkStream ns = client.GetStream();
49 | ns.Write(binary, 0, binary.Length);
50 | return true;
51 | }
52 | catch
53 | {
54 | return false;
55 | }
56 | }
57 |
58 | public string receiveMsg()
59 | {
60 | string msg = "";
61 | try
62 | {
63 | NetworkStream ns = client.GetStream();
64 | //byte[] binary = ns.Read();
65 | byte[] binary = new byte[100];
66 | ns.Read(binary, 0, binary.Length);
67 | msg = UnicodeEncoding.Unicode.GetString(binary);
68 | return msg;
69 | }
70 | catch
71 | {
72 | return msg;
73 | }
74 | }
75 |
76 | public bool sendFile(string file)
77 | {
78 | try
79 | {
80 | FileStream fs = new FileStream(file, FileMode.Open);
81 | NetworkStream ns = client.GetStream();
82 | byte[] buffer = new byte[1024];
83 | int readbytes = 0;
84 | while ((readbytes = fs.Read(buffer, 0, buffer.Length)) > 0)
85 | {
86 | ns.Write(buffer, 0, readbytes);
87 | ns.Read(buffer, 0, 1);
88 | if (buffer[0] != 1)
89 | break;
90 | }
91 | fs.Close();
92 | ns.Close();
93 | return true;
94 | }
95 | catch
96 | {
97 | return false;
98 | }
99 | }
100 |
101 | public bool receiveFile(string file)
102 | {
103 | try
104 | {
105 | FileStream fs = new FileStream(file, FileMode.Create);
106 | NetworkStream ns = client.GetStream();
107 | byte[] buffer = new byte[1024];
108 | int readbytes = 0;
109 | while ((readbytes = ns.Read(buffer, 0, buffer.Length)) > 0)
110 | {
111 | fs.Write(buffer, 0, readbytes);
112 | buffer[0] = 1;
113 | ns.Write(buffer, 0, 1);//msg to server [cont]
114 | }
115 | fs.Close();
116 | ns.Close();
117 | return true;
118 | }
119 | catch
120 | {
121 | return false;
122 | }
123 | }
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/MyNetwork/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("MyNetwork")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("MyNetwork")]
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("fa251b00-83ba-41ad-9315-681674203580")]
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 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/MyNetwork/bin/Debug/MyNetwork.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JubbaSmail/CSharp_Windows_System_Programming/368ce98ed76f23814c28388b928f1eed69e96340/10-FileStream,NetworkStrem/MyNetwork/bin/Debug/MyNetwork.dll
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-Client/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-Client/FormClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | ////////////////////////////
11 | using MyNetwork;
12 |
13 | namespace SPR_Client
14 | {
15 | public partial class FormClient : Form
16 | {
17 | public FormClient()
18 | {
19 | InitializeComponent();
20 | }
21 | Net socket = new Net();
22 | private void Form1_Load(object sender, EventArgs e)
23 | {
24 | string ip = "127.0.0.1";
25 | int port = 6060;
26 | socket.createClient(ip, port);
27 | }
28 |
29 | private void button1_Click(object sender, EventArgs e)
30 | {
31 | //Send
32 | string msg = textBox1.Text;
33 | socket.sendMsg(msg);
34 | listBox1.Items.Add("YOU: " + msg);
35 | textBox1.Text = "";
36 | }
37 |
38 | private void button2_Click(object sender, EventArgs e)
39 | {
40 | //Receive
41 | string msg = socket.receiveMsg();
42 | listBox1.Items.Add("HIM: " + msg);
43 | }
44 |
45 | private void button3_Click(object sender, EventArgs e)
46 | {
47 | //Send File
48 | openFileDialog1.ShowDialog();
49 | string file = openFileDialog1.FileName;
50 | socket.sendFile(file);
51 | MessageBox.Show("Done");
52 | }
53 |
54 | private void button4_Click(object sender, EventArgs e)
55 | {
56 | //Recive File
57 | saveFileDialog1.ShowDialog();
58 | string file = saveFileDialog1.FileName;
59 | socket.receiveFile(file);
60 | MessageBox.Show("Done");
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-Client/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace SPR_Client
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new FormClient());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-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("SPR-Client")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SPR-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("e3052712-88d0-4917-b5c7-16a330ea5577")]
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 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-Client/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_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("SPR_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 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-Client/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_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 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-Client/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-Client/bin/Debug/MyNetwork.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JubbaSmail/CSharp_Windows_System_Programming/368ce98ed76f23814c28388b928f1eed69e96340/10-FileStream,NetworkStrem/SPR-Client/bin/Debug/MyNetwork.dll
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-Networking.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPR-Server", "SPR-Server\SPR-Server.csproj", "{F4BC0077-3648-4CF2-BA7C-679B5A8FDE22}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPR-Client", "SPR-Client\SPR-Client.csproj", "{13C0584C-069B-4646-910B-96A4DB844BC9}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyNetwork", "MyNetwork\MyNetwork.csproj", "{D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {F4BC0077-3648-4CF2-BA7C-679B5A8FDE22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {F4BC0077-3648-4CF2-BA7C-679B5A8FDE22}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {F4BC0077-3648-4CF2-BA7C-679B5A8FDE22}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {F4BC0077-3648-4CF2-BA7C-679B5A8FDE22}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {13C0584C-069B-4646-910B-96A4DB844BC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {13C0584C-069B-4646-910B-96A4DB844BC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {13C0584C-069B-4646-910B-96A4DB844BC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {13C0584C-069B-4646-910B-96A4DB844BC9}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-Server/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-Server/FormServer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | ///////////////////////////////////
11 | using MyNetwork;
12 |
13 | namespace SPR_Server
14 | {
15 | public partial class FormServer : Form
16 | {
17 | public FormServer()
18 | {
19 | InitializeComponent();
20 | }
21 | Net socket = new Net();
22 | private void Form1_Load(object sender, EventArgs e)
23 | {
24 | int port = 6060;
25 | socket.creartServer(port);
26 | }
27 |
28 | private void button1_Click(object sender, EventArgs e)
29 | {
30 | //Send
31 | string msg = textBox1.Text;
32 | socket.sendMsg(msg);
33 | listBox1.Items.Add("YOU: " + msg);
34 | textBox1.Text = "";
35 | }
36 |
37 | private void button2_Click(object sender, EventArgs e)
38 | {
39 | //Receive
40 | string msg = socket.receiveMsg();
41 | listBox1.Items.Add("HIM: " + msg);
42 | }
43 |
44 | private void button3_Click(object sender, EventArgs e)
45 | {
46 | //Send File
47 | openFileDialog1.ShowDialog();
48 | string file = openFileDialog1.FileName;
49 | socket.sendFile(file);
50 | MessageBox.Show("Done");
51 | }
52 |
53 | private void button4_Click(object sender, EventArgs e)
54 | {
55 | //Recive File
56 | saveFileDialog1.ShowDialog();
57 | string file = saveFileDialog1.FileName;
58 | socket.receiveFile(file);
59 | MessageBox.Show("Done");
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-Server/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace SPR_Server
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new FormServer());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-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("SPR-Server")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SPR-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("aaaf2202-6e9a-4299-825b-5d5ce47868f0")]
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 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-Server/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_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("SPR_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 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-Server/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_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 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-Server/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/10-FileStream,NetworkStrem/SPR-Server/bin/Debug/MyNetwork.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JubbaSmail/CSharp_Windows_System_Programming/368ce98ed76f23814c28388b928f1eed69e96340/10-FileStream,NetworkStrem/SPR-Server/bin/Debug/MyNetwork.dll
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/MyNetwork/MyNetwork.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}
8 | Library
9 | Properties
10 | MyNetwork
11 | MyNetwork
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
54 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/MyNetwork/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("MyNetwork")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("MyNetwork")]
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("fa251b00-83ba-41ad-9315-681674203580")]
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 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/MyNetwork/bin/Debug/MyNetwork.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JubbaSmail/CSharp_Windows_System_Programming/368ce98ed76f23814c28388b928f1eed69e96340/11-Threading+Asynchronous_Communication/MyNetwork/bin/Debug/MyNetwork.dll
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-Client/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-Client/FormClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | ////////////////////////////
11 | using MyNetwork;
12 |
13 | namespace SPR_Client
14 | {
15 | public partial class FormClient : Form
16 | {
17 | public FormClient()
18 | {
19 | InitializeComponent();
20 | }
21 | Net socket = new Net();
22 | private void Form1_Load(object sender, EventArgs e)
23 | {
24 | string ip = "127.0.0.1";
25 | int port = 6060;
26 | socket.createClient(ip, port);
27 | }
28 |
29 | private void button1_Click(object sender, EventArgs e)
30 | {
31 | //Send
32 | string msg = textBox1.Text;
33 | socket.sendMsg(msg);
34 | listBox1.Items.Add("YOU: " + msg);
35 | textBox1.Text = "";
36 | }
37 |
38 | private void button2_Click(object sender, EventArgs e)
39 | {
40 | //Receive
41 | string msg = socket.receiveMsg();
42 | listBox1.Items.Add("HIM: " + msg);
43 | }
44 |
45 | private void button3_Click(object sender, EventArgs e)
46 | {
47 | //Send File
48 | openFileDialog1.ShowDialog();
49 | string file = openFileDialog1.FileName;
50 | socket.sendFile(file);
51 | MessageBox.Show("Done");
52 | }
53 |
54 | private void button4_Click(object sender, EventArgs e)
55 | {
56 | //Recive File
57 | saveFileDialog1.ShowDialog();
58 | string file = saveFileDialog1.FileName;
59 | socket.receiveFile(file);
60 | MessageBox.Show("Done");
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-Client/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace SPR_Client
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new FormClient());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-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("SPR-Client")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SPR-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("e3052712-88d0-4917-b5c7-16a330ea5577")]
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 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-Client/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_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("SPR_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 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-Client/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_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 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-Client/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-Client/bin/Debug/MyNetwork.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JubbaSmail/CSharp_Windows_System_Programming/368ce98ed76f23814c28388b928f1eed69e96340/11-Threading+Asynchronous_Communication/SPR-Client/bin/Debug/MyNetwork.dll
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-Networking.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPR-Server", "SPR-Server\SPR-Server.csproj", "{F4BC0077-3648-4CF2-BA7C-679B5A8FDE22}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPR-Client", "SPR-Client\SPR-Client.csproj", "{13C0584C-069B-4646-910B-96A4DB844BC9}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyNetwork", "MyNetwork\MyNetwork.csproj", "{D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {F4BC0077-3648-4CF2-BA7C-679B5A8FDE22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {F4BC0077-3648-4CF2-BA7C-679B5A8FDE22}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {F4BC0077-3648-4CF2-BA7C-679B5A8FDE22}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {F4BC0077-3648-4CF2-BA7C-679B5A8FDE22}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {13C0584C-069B-4646-910B-96A4DB844BC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {13C0584C-069B-4646-910B-96A4DB844BC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {13C0584C-069B-4646-910B-96A4DB844BC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {13C0584C-069B-4646-910B-96A4DB844BC9}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-Server/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-Server/FormServer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | ///////////////////////////////////
11 | using MyNetwork;
12 |
13 | namespace SPR_Server
14 | {
15 | public partial class FormServer : Form
16 | {
17 | public FormServer()
18 | {
19 | InitializeComponent();
20 | }
21 | Net socket = new Net();
22 | private void Form1_Load(object sender, EventArgs e)
23 | {
24 | int port = 6060;
25 | socket.creartServer(port);
26 | }
27 |
28 | private void button1_Click(object sender, EventArgs e)
29 | {
30 | //Send
31 | string msg = textBox1.Text;
32 | socket.sendMsg(msg);
33 | listBox1.Items.Add("YOU: " + msg);
34 | textBox1.Text = "";
35 | }
36 |
37 | private void button2_Click(object sender, EventArgs e)
38 | {
39 | //Receive
40 | socket.receiveMsg(this, msg_received);
41 | }
42 |
43 | public void msg_received(string msg)
44 | {
45 | listBox1.Items.Add("HIM: " + msg);
46 | socket.receiveMsg(this, msg_received);
47 | }
48 |
49 | private void button3_Click(object sender, EventArgs e)
50 | {
51 | //Send File
52 | openFileDialog1.ShowDialog();
53 | string file = openFileDialog1.FileName;
54 | socket.sendFile(file);
55 | MessageBox.Show("Done");
56 | }
57 |
58 | private void button4_Click(object sender, EventArgs e)
59 | {
60 | //Recive File
61 | saveFileDialog1.ShowDialog();
62 | string file = saveFileDialog1.FileName;
63 | socket.receiveFile(file);
64 | MessageBox.Show("Done");
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-Server/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace SPR_Server
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new FormServer());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-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("SPR-Server")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SPR-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("aaaf2202-6e9a-4299-825b-5d5ce47868f0")]
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 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-Server/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_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("SPR_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 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-Server/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_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 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-Server/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/11-Threading+Asynchronous_Communication/SPR-Server/bin/Debug/MyNetwork.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JubbaSmail/CSharp_Windows_System_Programming/368ce98ed76f23814c28388b928f1eed69e96340/11-Threading+Asynchronous_Communication/SPR-Server/bin/Debug/MyNetwork.dll
--------------------------------------------------------------------------------
/12-Video-Streaming/MyNetwork/MyNetwork.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}
8 | Library
9 | Properties
10 | MyNetwork
11 | MyNetwork
12 | v4.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 | true
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
57 |
--------------------------------------------------------------------------------
/12-Video-Streaming/MyNetwork/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("MyNetwork")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("MyNetwork")]
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("fa251b00-83ba-41ad-9315-681674203580")]
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 |
--------------------------------------------------------------------------------
/12-Video-Streaming/SPR-Client/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/12-Video-Streaming/SPR-Client/FormClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | ////////////////////////////
11 | using MyNetwork;
12 |
13 | namespace SPR_Client
14 | {
15 | public partial class FormClient : Form
16 | {
17 | public FormClient()
18 | {
19 | InitializeComponent();
20 | }
21 | Net socket = new Net();
22 | private void Form1_Load(object sender, EventArgs e)
23 | {
24 | string ip = "127.0.0.1";
25 | int port = 6060;
26 | socket.createClient(ip, port);
27 | }
28 |
29 | private void button1_Click(object sender, EventArgs e)
30 | {
31 | //Send
32 | string msg = textBox1.Text;
33 | socket.sendMsg(msg);
34 | listBox1.Items.Add("YOU: " + msg);
35 | textBox1.Text = "";
36 | }
37 |
38 | private void button2_Click(object sender, EventArgs e)
39 | {
40 | //Receive
41 | string msg = socket.receiveMsg();
42 | listBox1.Items.Add("HIM: " + msg);
43 | }
44 |
45 | private void button3_Click(object sender, EventArgs e)
46 | {
47 | //Send File
48 | openFileDialog1.ShowDialog();
49 | string file = openFileDialog1.FileName;
50 | socket.sendFile(file);
51 | MessageBox.Show("Done");
52 | }
53 |
54 | private void button4_Click(object sender, EventArgs e)
55 | {
56 | //Recive File
57 | saveFileDialog1.ShowDialog();
58 | string file = saveFileDialog1.FileName;
59 | socket.receiveFile(file);
60 | MessageBox.Show("Done");
61 | }
62 |
63 | IWebCam webCam = null;
64 | private void button5_Click(object sender, EventArgs e)
65 | {
66 | if (webCam == null)
67 | {
68 | webCam = new IWebCam(this.Handle);
69 | timer1.Start();
70 | }
71 | }
72 |
73 | private void timer1_Tick(object sender, EventArgs e)
74 | {
75 | Image img = webCam.iWebCam_Image;
76 | if (img != null)
77 | {
78 | pictureBox1.Image = img;
79 | socket.sendImg(img);
80 | }
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/12-Video-Streaming/SPR-Client/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace SPR_Client
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new FormClient());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/12-Video-Streaming/SPR-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("SPR-Client")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SPR-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("e3052712-88d0-4917-b5c7-16a330ea5577")]
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 |
--------------------------------------------------------------------------------
/12-Video-Streaming/SPR-Client/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_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("SPR_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 |
--------------------------------------------------------------------------------
/12-Video-Streaming/SPR-Client/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_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 |
--------------------------------------------------------------------------------
/12-Video-Streaming/SPR-Client/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/12-Video-Streaming/SPR-Networking.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPR-Server", "SPR-Server\SPR-Server.csproj", "{F4BC0077-3648-4CF2-BA7C-679B5A8FDE22}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPR-Client", "SPR-Client\SPR-Client.csproj", "{13C0584C-069B-4646-910B-96A4DB844BC9}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyNetwork", "MyNetwork\MyNetwork.csproj", "{D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {F4BC0077-3648-4CF2-BA7C-679B5A8FDE22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {F4BC0077-3648-4CF2-BA7C-679B5A8FDE22}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {F4BC0077-3648-4CF2-BA7C-679B5A8FDE22}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {F4BC0077-3648-4CF2-BA7C-679B5A8FDE22}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {13C0584C-069B-4646-910B-96A4DB844BC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {13C0584C-069B-4646-910B-96A4DB844BC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {13C0584C-069B-4646-910B-96A4DB844BC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {13C0584C-069B-4646-910B-96A4DB844BC9}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {D090FABA-1937-4C9B-AF02-FBEBDCC7FD85}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/12-Video-Streaming/SPR-Server/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/12-Video-Streaming/SPR-Server/FormServer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | ///////////////////////////////////
11 | using MyNetwork;
12 |
13 | namespace SPR_Server
14 | {
15 | public partial class FormServer : Form
16 | {
17 | public FormServer()
18 | {
19 | InitializeComponent();
20 | }
21 | Net socket = new Net();
22 | private void Form1_Load(object sender, EventArgs e)
23 | {
24 | int port = 6060;
25 | socket.creartServer(port);
26 | }
27 |
28 | private void button1_Click(object sender, EventArgs e)
29 | {
30 | //Send
31 | string msg = textBox1.Text;
32 | socket.sendMsg(msg);
33 | listBox1.Items.Add("YOU: " + msg);
34 | textBox1.Text = "";
35 | }
36 |
37 | private void button2_Click(object sender, EventArgs e)
38 | {
39 | //Receive
40 | socket.receiveMsg(this, msg_received);
41 | }
42 |
43 | public void msg_received(string msg)
44 | {
45 | listBox1.Items.Add("HIM: " + msg);
46 | socket.receiveMsg(this, msg_received);
47 | }
48 |
49 | private void button3_Click(object sender, EventArgs e)
50 | {
51 | //Send File
52 | openFileDialog1.ShowDialog();
53 | string file = openFileDialog1.FileName;
54 | socket.sendFile(file);
55 | MessageBox.Show("Done");
56 | }
57 |
58 | private void button4_Click(object sender, EventArgs e)
59 | {
60 | //Recive File
61 | saveFileDialog1.ShowDialog();
62 | string file = saveFileDialog1.FileName;
63 | socket.receiveFile(file);
64 | MessageBox.Show("Done");
65 | }
66 | //10.4.44.73 :6060
67 | private void button5_Click(object sender, EventArgs e)
68 | {
69 | socket.receiveImg(this, received_img);
70 | }
71 |
72 | public void received_img(Image img)
73 | {
74 | pictureBox1.Image = img;
75 | pictureBox1.Refresh();
76 | socket.receiveImg(this, received_img);
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/12-Video-Streaming/SPR-Server/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace SPR_Server
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new FormServer());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/12-Video-Streaming/SPR-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("SPR-Server")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SPR-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("aaaf2202-6e9a-4299-825b-5d5ce47868f0")]
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 |
--------------------------------------------------------------------------------
/12-Video-Streaming/SPR-Server/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_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("SPR_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 |
--------------------------------------------------------------------------------
/12-Video-Streaming/SPR-Server/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.33440
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 SPR_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 |
--------------------------------------------------------------------------------
/12-Video-Streaming/SPR-Server/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------