├── .gitattributes
├── .gitignore
├── Gateway Sample Application.sln
├── Gateway Sample Application
├── App.config
├── FormMain.Designer.cs
├── FormMain.cs
├── FormMain.resx
├── Gateway Sample Application.csproj
├── Gateway.cs
├── License.txt
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Setup
│ └── Gateway Sample Application.nsi
└── packages.config
├── LICENSE
├── README.md
└── appveyor.yml
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.jfm
193 | *.pfx
194 | *.publishsettings
195 | node_modules/
196 | orleans.codegen.cs
197 |
198 | # Since there are multiple workflows, uncomment next line to ignore bower_components
199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
200 | #bower_components/
201 |
202 | # RIA/Silverlight projects
203 | Generated_Code/
204 |
205 | # Backup & report files from converting an old project file
206 | # to a newer Visual Studio version. Backup files are not needed,
207 | # because we have git ;-)
208 | _UpgradeReport_Files/
209 | Backup*/
210 | UpgradeLog*.XML
211 | UpgradeLog*.htm
212 |
213 | # SQL Server files
214 | *.mdf
215 | *.ldf
216 |
217 | # Business Intelligence projects
218 | *.rdl.data
219 | *.bim.layout
220 | *.bim_*.settings
221 |
222 | # Microsoft Fakes
223 | FakesAssemblies/
224 |
225 | # GhostDoc plugin setting file
226 | *.GhostDoc.xml
227 |
228 | # Node.js Tools for Visual Studio
229 | .ntvs_analysis.dat
230 |
231 | # Visual Studio 6 build log
232 | *.plg
233 |
234 | # Visual Studio 6 workspace options file
235 | *.opt
236 |
237 | # Visual Studio LightSwitch build output
238 | **/*.HTMLClient/GeneratedArtifacts
239 | **/*.DesktopClient/GeneratedArtifacts
240 | **/*.DesktopClient/ModelManifest.xml
241 | **/*.Server/GeneratedArtifacts
242 | **/*.Server/ModelManifest.xml
243 | _Pvt_Extensions
244 |
245 | # Paket dependency manager
246 | .paket/paket.exe
247 | paket-files/
248 |
249 | # FAKE - F# Make
250 | .fake/
251 |
252 | # JetBrains Rider
253 | .idea/
254 | *.sln.iml
255 |
256 | # CodeRush
257 | .cr/
258 |
259 | # Python Tools for Visual Studio (PTVS)
260 | __pycache__/
261 | *.pyc
--------------------------------------------------------------------------------
/Gateway Sample Application.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27428.2027
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gateway Sample Application", "Gateway Sample Application\Gateway Sample Application.csproj", "{D173B3AF-D33B-48F6-A67A-43CA3668AE07}"
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 | {D173B3AF-D33B-48F6-A67A-43CA3668AE07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {D173B3AF-D33B-48F6-A67A-43CA3668AE07}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {D173B3AF-D33B-48F6-A67A-43CA3668AE07}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {D173B3AF-D33B-48F6-A67A-43CA3668AE07}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {83ACF767-C445-4E25-9E41-88C94D4CBC07}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/Gateway Sample Application/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | https://smsgateway.rbsoft.org
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Gateway Sample Application/FormMain.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Gateway_Sample_Application
2 | {
3 | partial class FormMain
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.textBoxNumber = new System.Windows.Forms.TextBox();
32 | this.textBoxMessage = new System.Windows.Forms.TextBox();
33 | this.buttonSend = new System.Windows.Forms.Button();
34 | this.numericUpDownMessagesCount = new System.Windows.Forms.NumericUpDown();
35 | this.buttonSendMultiple = new System.Windows.Forms.Button();
36 | this.tabControl = new System.Windows.Forms.TabControl();
37 | this.tabPageSender = new System.Windows.Forms.TabPage();
38 | this.tabPageSettings = new System.Windows.Forms.TabPage();
39 | this.propertyGridSettings = new System.Windows.Forms.PropertyGrid();
40 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMessagesCount)).BeginInit();
41 | this.tabControl.SuspendLayout();
42 | this.tabPageSender.SuspendLayout();
43 | this.tabPageSettings.SuspendLayout();
44 | this.SuspendLayout();
45 | //
46 | // textBoxNumber
47 | //
48 | this.textBoxNumber.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
49 | | System.Windows.Forms.AnchorStyles.Right)));
50 | this.textBoxNumber.Location = new System.Drawing.Point(8, 6);
51 | this.textBoxNumber.Name = "textBoxNumber";
52 | this.textBoxNumber.Size = new System.Drawing.Size(537, 20);
53 | this.textBoxNumber.TabIndex = 0;
54 | //
55 | // textBoxMessage
56 | //
57 | this.textBoxMessage.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
58 | | System.Windows.Forms.AnchorStyles.Left)
59 | | System.Windows.Forms.AnchorStyles.Right)));
60 | this.textBoxMessage.Location = new System.Drawing.Point(8, 32);
61 | this.textBoxMessage.Multiline = true;
62 | this.textBoxMessage.Name = "textBoxMessage";
63 | this.textBoxMessage.Size = new System.Drawing.Size(537, 198);
64 | this.textBoxMessage.TabIndex = 1;
65 | //
66 | // buttonSend
67 | //
68 | this.buttonSend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
69 | this.buttonSend.Location = new System.Drawing.Point(440, 236);
70 | this.buttonSend.Name = "buttonSend";
71 | this.buttonSend.Size = new System.Drawing.Size(105, 23);
72 | this.buttonSend.TabIndex = 3;
73 | this.buttonSend.Text = "Send";
74 | this.buttonSend.UseVisualStyleBackColor = true;
75 | this.buttonSend.Click += new System.EventHandler(this.ButtonSend_Click);
76 | //
77 | // numericUpDownMessagesCount
78 | //
79 | this.numericUpDownMessagesCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
80 | this.numericUpDownMessagesCount.Location = new System.Drawing.Point(8, 239);
81 | this.numericUpDownMessagesCount.Minimum = new decimal(new int[] {
82 | 1,
83 | 0,
84 | 0,
85 | 0});
86 | this.numericUpDownMessagesCount.Name = "numericUpDownMessagesCount";
87 | this.numericUpDownMessagesCount.Size = new System.Drawing.Size(60, 20);
88 | this.numericUpDownMessagesCount.TabIndex = 4;
89 | this.numericUpDownMessagesCount.Value = new decimal(new int[] {
90 | 1,
91 | 0,
92 | 0,
93 | 0});
94 | //
95 | // buttonSendMultiple
96 | //
97 | this.buttonSendMultiple.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
98 | this.buttonSendMultiple.Location = new System.Drawing.Point(329, 236);
99 | this.buttonSendMultiple.Name = "buttonSendMultiple";
100 | this.buttonSendMultiple.Size = new System.Drawing.Size(105, 23);
101 | this.buttonSendMultiple.TabIndex = 5;
102 | this.buttonSendMultiple.Text = "Send Multiple";
103 | this.buttonSendMultiple.UseVisualStyleBackColor = true;
104 | this.buttonSendMultiple.Click += new System.EventHandler(this.ButtonSendMultiple_Click);
105 | //
106 | // tabControl
107 | //
108 | this.tabControl.Controls.Add(this.tabPageSender);
109 | this.tabControl.Controls.Add(this.tabPageSettings);
110 | this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
111 | this.tabControl.Location = new System.Drawing.Point(0, 0);
112 | this.tabControl.Name = "tabControl";
113 | this.tabControl.SelectedIndex = 0;
114 | this.tabControl.Size = new System.Drawing.Size(561, 293);
115 | this.tabControl.TabIndex = 6;
116 | //
117 | // tabPageSender
118 | //
119 | this.tabPageSender.Controls.Add(this.textBoxNumber);
120 | this.tabPageSender.Controls.Add(this.numericUpDownMessagesCount);
121 | this.tabPageSender.Controls.Add(this.buttonSendMultiple);
122 | this.tabPageSender.Controls.Add(this.textBoxMessage);
123 | this.tabPageSender.Controls.Add(this.buttonSend);
124 | this.tabPageSender.Location = new System.Drawing.Point(4, 22);
125 | this.tabPageSender.Name = "tabPageSender";
126 | this.tabPageSender.Padding = new System.Windows.Forms.Padding(3);
127 | this.tabPageSender.Size = new System.Drawing.Size(553, 267);
128 | this.tabPageSender.TabIndex = 0;
129 | this.tabPageSender.Text = "Sender";
130 | this.tabPageSender.UseVisualStyleBackColor = true;
131 | //
132 | // tabPageSettings
133 | //
134 | this.tabPageSettings.Controls.Add(this.propertyGridSettings);
135 | this.tabPageSettings.Location = new System.Drawing.Point(4, 22);
136 | this.tabPageSettings.Name = "tabPageSettings";
137 | this.tabPageSettings.Padding = new System.Windows.Forms.Padding(3);
138 | this.tabPageSettings.Size = new System.Drawing.Size(553, 267);
139 | this.tabPageSettings.TabIndex = 1;
140 | this.tabPageSettings.Text = "Settings";
141 | this.tabPageSettings.UseVisualStyleBackColor = true;
142 | //
143 | // propertyGridSettings
144 | //
145 | this.propertyGridSettings.Dock = System.Windows.Forms.DockStyle.Fill;
146 | this.propertyGridSettings.Location = new System.Drawing.Point(3, 3);
147 | this.propertyGridSettings.Name = "propertyGridSettings";
148 | this.propertyGridSettings.Size = new System.Drawing.Size(547, 261);
149 | this.propertyGridSettings.TabIndex = 0;
150 | this.propertyGridSettings.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.PropertyGridSettings_PropertyValueChanged);
151 | //
152 | // FormMain
153 | //
154 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
155 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
156 | this.ClientSize = new System.Drawing.Size(561, 293);
157 | this.Controls.Add(this.tabControl);
158 | this.Name = "FormMain";
159 | this.ShowIcon = false;
160 | this.Text = "Gateway Sample App";
161 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMessagesCount)).EndInit();
162 | this.tabControl.ResumeLayout(false);
163 | this.tabPageSender.ResumeLayout(false);
164 | this.tabPageSender.PerformLayout();
165 | this.tabPageSettings.ResumeLayout(false);
166 | this.ResumeLayout(false);
167 |
168 | }
169 |
170 | #endregion
171 |
172 | private System.Windows.Forms.TextBox textBoxNumber;
173 | private System.Windows.Forms.TextBox textBoxMessage;
174 | private System.Windows.Forms.Button buttonSend;
175 | private System.Windows.Forms.NumericUpDown numericUpDownMessagesCount;
176 | private System.Windows.Forms.Button buttonSendMultiple;
177 | private System.Windows.Forms.TabControl tabControl;
178 | private System.Windows.Forms.TabPage tabPageSender;
179 | private System.Windows.Forms.TabPage tabPageSettings;
180 | private System.Windows.Forms.PropertyGrid propertyGridSettings;
181 | }
182 | }
183 |
184 |
--------------------------------------------------------------------------------
/Gateway Sample Application/FormMain.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Forms;
6 | using Gateway_Sample_Application.Properties;
7 | using Newtonsoft.Json;
8 | using static SMS.API;
9 |
10 | namespace Gateway_Sample_Application
11 | {
12 | public partial class FormMain : Form
13 | {
14 | public FormMain()
15 | {
16 | InitializeComponent();
17 | propertyGridSettings.SelectedObject = Settings.Default;
18 | }
19 |
20 | private void ButtonSend_Click(object sender, EventArgs e)
21 | {
22 | try
23 | {
24 | //Dictionary[] messages = SMS.API.SendMessageToContactsList(1, textBoxMessage.Text, SMS.API.Option.USE_SPECIFIED, new[] {"1"});
25 | long timestamp = (long) DateTime.UtcNow.AddMinutes(2).Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
26 | SendSingleMessage(textBoxNumber.Text, textBoxMessage.Text, null, timestamp);
27 | //var contact = AddContact(1, textBoxNumber.Text);
28 | //contact = UnsubscribeContact(1, textBoxNumber.Text);
29 | //StringBuilder stringBuilder = new StringBuilder();
30 | //foreach (var key in contact.Keys)
31 | //{
32 | // stringBuilder.AppendLine($"{key}=>{contact[key]}");
33 | //}
34 | //MessageBox.Show(stringBuilder.ToString());
35 | MessageBox.Show("Success");
36 | }
37 | catch (Exception exception)
38 | {
39 | MessageBox.Show(exception.Message, "!Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
40 | }
41 | }
42 |
43 | private void ButtonSendMultiple_Click(object sender, EventArgs e)
44 | {
45 | List> messages = new List>();
46 | for (int i = 1; i <= numericUpDownMessagesCount.Value; i++)
47 | {
48 | var message = new Dictionary
49 | {
50 | { "number", textBoxNumber.Text },
51 | { "message", textBoxMessage.Text }
52 | };
53 | messages.Add(message);
54 | }
55 |
56 | try
57 | {
58 | long timestamp = (long)DateTime.UtcNow.AddMinutes(2).Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
59 | SendMessages(messages, Option.USE_SPECIFIED, null, timestamp);
60 | MessageBox.Show("Success");
61 | }
62 | catch (Exception exception)
63 | {
64 | MessageBox.Show(exception.Message, "!Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
65 | }
66 | }
67 |
68 | private void PropertyGridSettings_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
69 | {
70 | Settings.Default.Save();
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/Gateway Sample Application/FormMain.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Gateway Sample Application/Gateway Sample Application.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {D173B3AF-D33B-48F6-A67A-43CA3668AE07}
8 | WinExe
9 | Gateway_Sample_Application
10 | Gateway Sample Application
11 | v4.6.2
12 | 512
13 | true
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 | ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | Form
54 |
55 |
56 | FormMain.cs
57 |
58 |
59 |
60 |
61 |
62 | FormMain.cs
63 |
64 |
65 | ResXFileCodeGenerator
66 | Resources.Designer.cs
67 | Designer
68 |
69 |
70 | True
71 | Resources.resx
72 |
73 |
74 |
75 |
76 | SettingsSingleFileGenerator
77 | Settings.Designer.cs
78 |
79 |
80 | True
81 | Settings.settings
82 | True
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 | Always
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/Gateway Sample Application/Gateway.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Net;
5 | using System.Text;
6 | using System.Web;
7 | using Gateway_Sample_Application.Properties;
8 | using Newtonsoft.Json;
9 | using Newtonsoft.Json.Linq;
10 |
11 | namespace SMS
12 | {
13 | static class API
14 | {
15 | private static readonly string Server = Settings.Default.SERVER;
16 | private static readonly string Key = Settings.Default.API_KEY;
17 |
18 | public enum Option
19 | {
20 | USE_SPECIFIED = 0,
21 | USE_ALL_DEVICES = 1,
22 | USE_ALL_SIMS = 2
23 | }
24 |
25 | ///
26 | /// Send single message to specific mobile number.
27 | ///
28 | /// The mobile number where you want to send message.
29 | /// The message you want to send.
30 | /// The ID of a device you want to use to send this message.
31 | /// Set it to timestamp when you want to send this message.
32 | /// Set it to true if you want to send MMS message instead of SMS.
33 | /// Comma separated list of image links you want to attach to the message. Only works for MMS messages.
34 | /// Set it to true if you want to prioritize this message.
35 | /// If there is an error while sending a message.
36 | /// The dictionary containing information about the message.
37 | public static Dictionary SendSingleMessage(string number, string message, string device = "0",
38 | long? schedule = null, bool isMMS = false, string attachments = null, bool prioritize = false)
39 | {
40 | var values = new Dictionary
41 | {
42 | { "number", number },
43 | { "message", message },
44 | { "schedule", schedule },
45 | { "key", Key },
46 | { "devices", device },
47 | { "type", isMMS ? "mms" : "sms" },
48 | { "attachments", attachments },
49 | { "prioritize", prioritize ? 1 : 0 }
50 | };
51 |
52 | return GetObjects(GetResponse($"{Server}/services/send.php", values)["messages"])[0];
53 | }
54 |
55 | ///
56 | /// Send multiple messages to different mobile numbers.
57 | ///
58 | /// The array containing numbers and messages.
59 | /// Set this to USE_SPECIFIED if you want to use devices and SIMs specified in devices argument.
60 | /// Set this to USE_ALL_DEVICES if you want to use all available devices and their default SIM to send messages.
61 | /// Set this to USE_ALL_SIMS if you want to use all available devices and all their SIMs to send messages.
62 | /// The array of ID of devices you want to use to send these messages.
63 | /// Set it to timestamp when you want to send this message.
64 | /// Set it to true if you want to send messages using only one random device from selected devices.
65 | /// If there is an error while sending messages.
66 | /// The array containing messages.
67 | public static Dictionary[] SendMessages(List> messages,
68 | Option option = Option.USE_SPECIFIED, string[] devices = null, long? schedule = null,
69 | bool useRandomDevice = false)
70 | {
71 | var values = new Dictionary
72 | {
73 | { "messages", JsonConvert.SerializeObject(messages) },
74 | { "schedule", schedule },
75 | { "key", Key },
76 | { "devices", devices },
77 | { "option", (int)option },
78 | { "useRandomDevice", useRandomDevice }
79 | };
80 |
81 | return GetObjects(GetResponse($"{Server}/services/send.php", values)["messages"]);
82 | }
83 |
84 | ///
85 | /// Send a message to contacts in specified contacts list.
86 | ///
87 | /// The ID of the contacts list where you want to send this message.
88 | /// The message you want to send.
89 | /// Set this to USE_SPECIFIED if you want to use devices and SIMs specified in devices argument.
90 | /// Set this to USE_ALL_DEVICES if you want to use all available devices and their default SIM to send messages.
91 | /// Set this to USE_ALL_SIMS if you want to use all available devices and all their SIMs to send messages.
92 | /// The array of ID of devices you want to use to send these messages.
93 | /// Set it to timestamp when you want to send this message.
94 | /// Set it to true if you want to send MMS message instead of SMS.
95 | /// Comma separated list of image links you want to attach to the message. Only works for MMS messages.
96 | /// If there is an error while sending messages.
97 | /// The array containing messages.
98 | public static Dictionary[] SendMessageToContactsList(int listID, string message,
99 | Option option = Option.USE_SPECIFIED, string[] devices = null, long? schedule = null, bool isMMS = false,
100 | string attachments = null)
101 | {
102 | var values = new Dictionary
103 | {
104 | { "listID", listID },
105 | { "message", message },
106 | { "schedule", schedule },
107 | { "key", Key },
108 | { "devices", devices },
109 | { "option", (int)option },
110 | { "type", isMMS ? "mms" : "sms" },
111 | { "attachments", attachments }
112 | };
113 |
114 | return GetObjects(GetResponse($"{Server}/services/send.php", values)["messages"]);
115 | }
116 |
117 | ///
118 | /// Get a message using the ID.
119 | ///
120 | /// The ID of a message you want to retrieve.
121 | /// If there is an error while getting a message.
122 | /// The dictionary containing information about the message.
123 | public static Dictionary GetMessageByID(int id)
124 | {
125 | var values = new Dictionary
126 | {
127 | { "key", Key },
128 | { "id", id }
129 | };
130 |
131 | return GetObjects(GetResponse($"{Server}/services/read-messages.php", values)["messages"])[0];
132 | }
133 |
134 | ///
135 | /// Get messages using the Group ID.
136 | ///
137 | /// The group ID of messages you want to retrieve.
138 | /// If there is an error while getting messages.
139 | /// The array containing messages.
140 | public static Dictionary[] GetMessagesByGroupID(string groupID)
141 | {
142 | var values = new Dictionary
143 | {
144 | { "key", Key },
145 | { "groupId", groupID }
146 | };
147 |
148 | return GetObjects(GetResponse($"{Server}/services/read-messages.php", values)["messages"]);
149 | }
150 |
151 | ///
152 | /// Get messages using the status.
153 | ///
154 | /// The status of messages you want to retrieve.
155 | /// The deviceID of the device which messages you want to retrieve.
156 | /// Sim slot of the device which messages you want to retrieve. Similar to array index. 1st slot is 0 and 2nd is 1.
157 | /// Search for messages sent or received after this time.
158 | /// Search for messages sent or received before this time.
159 | /// If there is an error while getting messages.
160 | /// The array containing messages.
161 | public static Dictionary[] GetMessagesByStatus(string status, int? deviceID = null,
162 | int? simSlot = null, long? startTimestamp = null,
163 | long? endTimestamp = null)
164 | {
165 | var values = new Dictionary
166 | {
167 | { "key", Key },
168 | { "status", status },
169 | { "deviceID", deviceID },
170 | { "simSlot", simSlot },
171 | { "startTimestamp", startTimestamp },
172 | { "endTimestamp", endTimestamp }
173 | };
174 |
175 | return GetObjects(GetResponse($"{Server}/services/read-messages.php", values)["messages"]);
176 | }
177 |
178 | ///
179 | /// Resend a message using the ID.
180 | ///
181 | /// The ID of a message you want to resend.
182 | /// If there is an error while resending a message.
183 | /// The dictionary containing information about the message.
184 | public static Dictionary ResendMessageByID(int id)
185 | {
186 | var values = new Dictionary
187 | {
188 | { "key", Key },
189 | { "id", id }
190 | };
191 |
192 | return GetObjects(GetResponse($"{Server}/services/resend.php", values)["messages"])[0];
193 | }
194 |
195 | ///
196 | /// Resend messages using the Group ID.
197 | ///
198 | /// The group ID of messages you want to resend.
199 | /// The status of messages you want to resend.
200 | /// If there is an error while resending messages.
201 | /// The array containing messages.
202 | public static Dictionary[] ResendMessagesByGroupID(string groupID, string status = null)
203 | {
204 | var values = new Dictionary
205 | {
206 | { "key", Key },
207 | { "groupId", groupID },
208 | { "status", status }
209 | };
210 |
211 | return GetObjects(GetResponse($"{Server}/services/resend.php", values)["messages"]);
212 | }
213 |
214 | ///
215 | /// Resend messages using the status.
216 | ///
217 | /// The status of messages you want to resend.
218 | /// The deviceID of the device which messages you want to resend.
219 | /// Sim slot of the device which messages you want to resend. Similar to array index. 1st slot is 0 and 2nd is 1.
220 | /// Resend messages sent or received after this time.
221 | /// Resend messages sent or received before this time.
222 | /// If there is an error while resending messages.
223 | /// The array containing messages.
224 | public static Dictionary[] ResendMessagesByStatus(string status, int? deviceID = null,
225 | int? simSlot = null, long? startTimestamp = null,
226 | long? endTimestamp = null)
227 | {
228 | var values = new Dictionary
229 | {
230 | { "key", Key },
231 | { "status", status },
232 | { "deviceID", deviceID },
233 | { "simSlot", simSlot },
234 | { "startTimestamp", startTimestamp },
235 | { "endTimestamp", endTimestamp }
236 | };
237 |
238 | return GetObjects(GetResponse($"{Server}/services/resend.php", values)["messages"]);
239 | }
240 |
241 | ///
242 | /// Add a new contact to contacts list.
243 | ///
244 | /// The ID of the contacts list where you want to add this contact.
245 | /// The mobile number of the contact.
246 | /// The name of the contact.
247 | /// Set it to true if you want to resubscribe this contact if it already exists.
248 | /// A dictionary containing details about a newly added contact.
249 | public static Dictionary AddContact(int listID, string number, string name = null,
250 | bool resubscribe = false)
251 | {
252 | var values = new Dictionary
253 | {
254 | { "key", Key },
255 | { "listID", listID },
256 | { "number", number },
257 | { "name", name },
258 | { "resubscribe", resubscribe ? '1' : '0' },
259 | };
260 | JObject jObject = (JObject)GetResponse($"{Server}/services/manage-contacts.php", values)["contact"];
261 | return jObject.ToObject>();
262 | }
263 |
264 | ///
265 | /// Unsubscribe a contact from the contacts list.
266 | ///
267 | /// The ID of the contacts list from which you want to unsubscribe this contact.
268 | /// The mobile number of the contact.
269 | /// A dictionary containing details about the unsubscribed contact.
270 | public static Dictionary UnsubscribeContact(int listID, string number)
271 | {
272 | var values = new Dictionary
273 | {
274 | { "key", Key },
275 | { "listID", listID },
276 | { "number", number },
277 | { "unsubscribe", '1' }
278 | };
279 | JObject jObject = (JObject)GetResponse($"{Server}/services/manage-contacts.php", values)["contact"];
280 | return jObject.ToObject>();
281 | }
282 |
283 | ///
284 | /// Get remaining message credits.
285 | ///
286 | /// If there is an error while getting message credits.
287 | /// The amount of message credits left.
288 | public static string GetBalance()
289 | {
290 | var values = new Dictionary
291 | {
292 | { "key", Key }
293 | };
294 | JToken credits = GetResponse($"{Server}/services/send.php", values)["credits"];
295 | if (credits.Type != JTokenType.Null)
296 | {
297 | return credits.ToString();
298 | }
299 |
300 | return "Unlimited";
301 | }
302 |
303 | ///
304 | /// Send USSD request.
305 | ///
306 | /// USSD request you want to execute. e.g. *150#
307 | /// The ID of a device you want to use to send this message.
308 | /// Sim you want to use for this USSD request. Similar to array index. 1st slot is 0 and 2nd is 1.
309 | /// If there is an error while sending a USSD request.
310 | /// A dictionary containing details about USSD request that was sent.
311 | public static Dictionary SendUssdRequest(string request, int device, int? simSlot = null)
312 | {
313 | var values = new Dictionary
314 | {
315 | { "key", Key },
316 | { "request", request },
317 | { "device", device },
318 | { "sim", simSlot }
319 | };
320 |
321 | JObject jObject = (JObject)GetResponse($"{Server}/services/send-ussd-request.php", values)["request"];
322 | return jObject.ToObject>();
323 | }
324 |
325 | ///
326 | /// Get a USSD request using the ID.
327 | ///
328 | /// The ID of a USSD request you want to retrieve.
329 | /// If there is an error while getting a USSD request.
330 | /// A dictionary containing details about USSD request you requested.
331 | public static Dictionary GetUssdRequestByID(int id)
332 | {
333 | var values = new Dictionary
334 | {
335 | { "key", Key },
336 | { "id", id }
337 | };
338 |
339 | return GetObjects(GetResponse($"{Server}/services/read-ussd-requests.php", values)["requests"])[0];
340 | }
341 |
342 | ///
343 | /// Get USSD requests using the request text.
344 | ///
345 | /// The request text you want to look for.
346 | /// The deviceID of the device which USSD requests you want to retrieve.
347 | /// Sim slot of the device which USSD requests you want to retrieve. Similar to array index. 1st slot is 0 and 2nd is 1.
348 | /// Search for USSD requests sent after this time.
349 | /// Search for USSD requests sent before this time.
350 | /// If there is an error while getting USSD requests.
351 | /// The array containing USSD requests.
352 | public static Dictionary[] GetUssdRequests(string request, int? deviceID = null,
353 | int? simSlot = null, int? startTimestamp = null, int? endTimestamp = null)
354 | {
355 | var values = new Dictionary
356 | {
357 | { "key", Key },
358 | { "request", request },
359 | { "deviceID", deviceID },
360 | { "simSlot", simSlot },
361 | { "startTimestamp", startTimestamp },
362 | { "endTimestamp", endTimestamp }
363 | };
364 |
365 | return GetObjects(GetResponse($"{Server}/services/read-ussd-requests.php", values)["requests"]);
366 | }
367 |
368 | ///
369 | /// Get all enabled devices.
370 | ///
371 | /// If there is an error while getting devices.
372 | /// The array containing all enabled devices
373 | public static Dictionary[] GetDevices()
374 | {
375 | var values = new Dictionary
376 | {
377 | { "key", Key }
378 | };
379 |
380 | return GetObjects(GetResponse($"{Server}/services/get-devices.php", values)["devices"]);
381 | }
382 |
383 | private static Dictionary[] GetObjects(JToken messagesJToken)
384 | {
385 | JArray jArray = (JArray)messagesJToken;
386 | var messages = new Dictionary[jArray.Count];
387 | for (var index = 0; index < jArray.Count; index++)
388 | {
389 | messages[index] = jArray[index].ToObject>();
390 | }
391 |
392 | return messages;
393 | }
394 |
395 | private static JToken GetResponse(string url, Dictionary postData)
396 | {
397 | var request = (HttpWebRequest)WebRequest.Create(url);
398 | var dataString = CreateDataString(postData);
399 | var data = Encoding.UTF8.GetBytes(dataString);
400 |
401 | request.Method = "POST";
402 | request.ContentType = "application/x-www-form-urlencoded";
403 | request.ContentLength = data.Length;
404 | ServicePointManager.Expect100Continue = true;
405 | ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
406 | using (var stream = request.GetRequestStream())
407 | {
408 | stream.Write(data, 0, data.Length);
409 | }
410 |
411 | var response = (HttpWebResponse)request.GetResponse();
412 |
413 | if (response.StatusCode == HttpStatusCode.OK)
414 | {
415 | using (StreamReader streamReader = new StreamReader(response.GetResponseStream()))
416 | {
417 | var jsonResponse = streamReader.ReadToEnd();
418 | try
419 | {
420 | JObject jObject = JObject.Parse(jsonResponse);
421 | if ((bool)jObject["success"])
422 | {
423 | return jObject["data"];
424 | }
425 |
426 | throw new Exception(jObject["error"]["message"].ToString());
427 | }
428 | catch (JsonReaderException)
429 | {
430 | if (string.IsNullOrEmpty(jsonResponse))
431 | {
432 | throw new InvalidDataException(
433 | "Missing data in request. Please provide all the required information to send messages.");
434 | }
435 |
436 | throw new Exception(jsonResponse);
437 | }
438 | }
439 | }
440 |
441 | throw new WebException($"HTTP Error : {(int)response.StatusCode} {response.StatusCode}");
442 | }
443 |
444 | private static string CreateDataString(Dictionary data)
445 | {
446 | StringBuilder dataString = new StringBuilder();
447 | bool first = true;
448 | foreach (var obj in data)
449 | {
450 | if (obj.Value != null)
451 | {
452 | if (first)
453 | {
454 | first = false;
455 | }
456 | else
457 | {
458 | dataString.Append("&");
459 | }
460 |
461 | dataString.Append(HttpUtility.UrlEncode(obj.Key));
462 | dataString.Append("=");
463 | dataString.Append(obj.Value is string[]
464 | ? HttpUtility.UrlEncode(JsonConvert.SerializeObject(obj.Value))
465 | : HttpUtility.UrlEncode(obj.Value.ToString()));
466 | }
467 | }
468 |
469 | return dataString.ToString();
470 | }
471 | }
472 | }
--------------------------------------------------------------------------------
/Gateway Sample Application/License.txt:
--------------------------------------------------------------------------------
1 | Gateway Sample Application
2 | RBSoft
3 | http://rbsoft.org/downloads/sms-gateway
4 | http://rbsoft.uservoice.com
5 |
6 | MIT License
7 |
8 | Copyright (c) 2018-2022 RBSoft
9 |
10 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/Gateway Sample Application/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 Gateway_Sample_Application
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 FormMain());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Gateway Sample Application/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("Gateway Sample Application")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("RBSoft")]
12 | [assembly: AssemblyProduct("Gateway Sample Application")]
13 | [assembly: AssemblyCopyright("Copyright © 2018-2022 RBSoft")]
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("d173b3af-d33b-48f6-a67a-43ca3668ae07")]
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 |
--------------------------------------------------------------------------------
/Gateway Sample Application/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Gateway_Sample_Application.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("Gateway_Sample_Application.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 |
--------------------------------------------------------------------------------
/Gateway Sample Application/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Gateway Sample Application/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Gateway_Sample_Application.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("https://smsgateway.rbsoft.org")]
29 | public string SERVER {
30 | get {
31 | return ((string)(this["SERVER"]));
32 | }
33 | set {
34 | this["SERVER"] = value;
35 | }
36 | }
37 |
38 | [global::System.Configuration.UserScopedSettingAttribute()]
39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
40 | [global::System.Configuration.DefaultSettingValueAttribute("")]
41 | public string API_KEY {
42 | get {
43 | return ((string)(this["API_KEY"]));
44 | }
45 | set {
46 | this["API_KEY"] = value;
47 | }
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Gateway Sample Application/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | https://smsgateway.rbsoft.org
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Gateway Sample Application/Setup/Gateway Sample Application.nsi:
--------------------------------------------------------------------------------
1 | ; Script generated by the HM NIS Edit Script Wizard.
2 |
3 | ; HM NIS Edit Wizard helper defines
4 | !define PRODUCT_NAME "Gateway Sample Application"
5 | !define PRODUCT_VERSION "1.0"
6 | !define PRODUCT_PUBLISHER "RBSoft, Inc."
7 | !define PRODUCT_WEB_SITE "http://rbsoft.org"
8 | !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Gateway Sample Application.exe"
9 | !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
10 | !define PRODUCT_UNINST_ROOT_KEY "HKLM"
11 |
12 | SetCompressor lzma
13 |
14 | ; MUI 1.67 compatible ------
15 | !include "MUI.nsh"
16 | !include "DotNetChecker.nsh"
17 |
18 | ; MUI Settings
19 | !define MUI_ABORTWARNING
20 | !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\nsis3-install.ico"
21 | !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\nsis3-uninstall.ico"
22 |
23 | ; Welcome page
24 | !insertmacro MUI_PAGE_WELCOME
25 | ; License page
26 | !insertmacro MUI_PAGE_LICENSE "..\bin\Release\License.txt"
27 | ; Directory page
28 | !insertmacro MUI_PAGE_DIRECTORY
29 | ; Instfiles page
30 | !insertmacro MUI_PAGE_INSTFILES
31 | ; Finish page
32 | !define MUI_FINISHPAGE_RUN "$INSTDIR\Gateway Sample Application.exe"
33 | !insertmacro MUI_PAGE_FINISH
34 |
35 | ; Uninstaller pages
36 | !insertmacro MUI_UNPAGE_INSTFILES
37 |
38 | ; Language files
39 | !insertmacro MUI_LANGUAGE "English"
40 |
41 | ; Reserve files
42 | !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
43 |
44 | ; MUI end ------
45 |
46 | Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
47 | OutFile "..\..\Gateway.Sample.Application.Setup.exe"
48 | InstallDir "$PROGRAMFILES\RBSoft\Gateway Sample Application"
49 | InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
50 | ShowInstDetails show
51 | ShowUnInstDetails show
52 |
53 | Section "MainSection" SEC01
54 | !insertmacro CheckNetFramework 462
55 |
56 | SetOutPath "$INSTDIR"
57 | File "..\bin\Release\Gateway Sample Application.exe"
58 | CreateDirectory "$SMPROGRAMS\Gateway Sample Application"
59 | CreateShortCut "$SMPROGRAMS\Gateway Sample Application\Gateway Sample Application.lnk" "$INSTDIR\Gateway Sample Application.exe"
60 | CreateShortCut "$DESKTOP\Gateway Sample Application.lnk" "$INSTDIR\Gateway Sample Application.exe"
61 | File "..\bin\Release\Gateway Sample Application.exe.config"
62 | File "..\bin\Release\Gateway Sample Application.pdb"
63 | File "..\bin\Release\License.txt"
64 | File "..\bin\Release\Newtonsoft.Json.dll"
65 | File "..\bin\Release\Newtonsoft.Json.xml"
66 | SectionEnd
67 |
68 | Section -AdditionalIcons
69 | WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
70 | CreateShortCut "$SMPROGRAMS\Gateway Sample Application\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
71 | CreateShortCut "$SMPROGRAMS\Gateway Sample Application\Uninstall.lnk" "$INSTDIR\uninst.exe"
72 | SectionEnd
73 |
74 | Section -Post
75 | WriteUninstaller "$INSTDIR\uninst.exe"
76 | WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\Gateway Sample Application.exe"
77 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
78 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
79 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Gateway Sample Application.exe"
80 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
81 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
82 | WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
83 | SectionEnd
84 |
85 |
86 | Function un.onUninstSuccess
87 | HideWindow
88 | MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
89 | FunctionEnd
90 |
91 | Function un.onInit
92 | MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
93 | Abort
94 | FunctionEnd
95 |
96 | Section Uninstall
97 | Delete "$INSTDIR\${PRODUCT_NAME}.url"
98 | Delete "$INSTDIR\uninst.exe"
99 | Delete "$INSTDIR\Newtonsoft.Json.xml"
100 | Delete "$INSTDIR\Newtonsoft.Json.dll"
101 | Delete "$INSTDIR\License.txt"
102 | Delete "$INSTDIR\Gateway Sample Application.pdb"
103 | Delete "$INSTDIR\Gateway Sample Application.exe.config"
104 | Delete "$INSTDIR\Gateway Sample Application.exe"
105 |
106 | Delete "$SMPROGRAMS\Gateway Sample Application\Uninstall.lnk"
107 | Delete "$SMPROGRAMS\Gateway Sample Application\Website.lnk"
108 | Delete "$DESKTOP\Gateway Sample Application.lnk"
109 | Delete "$SMPROGRAMS\Gateway Sample Application\Gateway Sample Application.lnk"
110 |
111 | RMDir "$SMPROGRAMS\Gateway Sample Application"
112 | RMDir "$INSTDIR"
113 |
114 | DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
115 | DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
116 | SetAutoClose true
117 | SectionEnd
--------------------------------------------------------------------------------
/Gateway Sample Application/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018-2022 RBSoft
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Gateway Sample Application
2 |
3 | A desktop application that uses API available in SMS Gateway to send messages.
4 |
5 | ## Requirements
6 |
7 | * [SMS Gateway](https://rbsoft.org/downloads/sms-gateway) Account
8 | * [Microsoft .NET Framework 4.6.2](https://www.microsoft.com/en-in/download/details.aspx?id=42642)
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: 1.0.0.{build}
2 | skip_branch_with_pr: true
3 | image: Visual Studio 2017
4 |
5 | # clone directory
6 | clone_folder: c:\project
7 |
8 | # build platform, i.e. x86, x64, Any CPU. This setting is optional.
9 | platform: Any CPU
10 |
11 | # build Configuration, i.e. Debug, Release, etc.
12 | configuration: Release
13 |
14 | before_build:
15 | - cmd: nuget restore
16 |
17 | build:
18 | verbosity: minimal
19 |
20 | install:
21 | # NSIS Paths
22 | # https://www.appveyor.com/docs/build-environment/#tools
23 | - set PATH=%PATH%;C:\Program Files (x86)\NSIS;
24 |
25 | # NSIS Plugin (NsisDotNetChecker)
26 | - appveyor DownloadFile https://github.com/ReVolly/NsisDotNetChecker/archive/master.zip
27 | - 7z e master.zip -o"C:\Program Files (x86)\NSIS\Include" DotNetChecker.nsh -r
28 | - 7z e master.zip -o"C:\Program Files (x86)\NSIS\Plugins\x86-ansi" DotNetChecker.dll -r
29 |
30 | after_build:
31 | - cmd: 7z a Gateway.Sample.Application.Portable.zip "c:\project\Gateway Sample Application\bin\Release\*"
32 | - cmd: makensis.exe "c:\project\Gateway Sample Application\Setup\Gateway Sample Application.nsi"
33 |
34 | artifacts:
35 | - path: Gateway.Sample.Application.Setup.exe
36 | - path: Gateway.Sample.Application.Portable.zip
37 |
38 | deploy:
39 | release: $(APPVEYOR_REPO_TAG_NAME)
40 | description: '// TODO: Write Release Notes'
41 | provider: GitHub
42 | auth_token:
43 | secure: WHW27Nvc8zNhfyhxIYdl/NwbrkFzvSX0vE4/CS8iByPXM6rcztWhUrDXJ7eejLBY
44 | draft: false
45 | prerelease: false
46 | on:
47 | branch: master # release from master branch only
48 | appveyor_repo_tag: true # deploy on tag push only
--------------------------------------------------------------------------------