├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── config.yml ├── .gitignore ├── CS2ServerPicker.sln ├── CS2ServerPicker ├── App.Designer.vb ├── App.config ├── App.resx ├── App.vb ├── CS2ServerPicker.vbproj ├── My Project │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Resources.resx │ ├── Settings.Designer.vb │ └── Settings.settings ├── Presets │ ├── AddPresetForm.Designer.vb │ ├── AddPresetForm.resx │ ├── AddPresetForm.vb │ ├── DeletePresetForm.Designer.vb │ ├── DeletePresetForm.resx │ ├── DeletePresetForm.vb │ ├── Presets.Designer.vb │ ├── Presets.resx │ ├── Presets.vb │ ├── UpdatePresetForm.Designer.vb │ ├── UpdatePresetForm.resx │ └── UpdatePresetForm.vb ├── Services │ ├── DataGridViewService.vb │ ├── LogService.vb │ ├── PingService.vb │ ├── ProcessService.vb │ ├── ServerService.vb │ └── VersionService.vb ├── Settings.Designer.vb ├── Settings.resx ├── Settings.vb ├── app.manifest ├── asset │ ├── GitHub-Mark.png │ ├── Paypal.png │ ├── Settings.png │ ├── fav_icon.ico │ └── flags │ │ ├── Alibaba Cloud Beijing - Mobile (China) (pekm).png │ │ ├── Alibaba Cloud Beijing - Telecom (China) (pekt).png │ │ ├── Alibaba Cloud Beijing - Unicom (China) (peku).png │ │ ├── Alibaba Cloud Chengdu - Mobile (China) (ctum).png │ │ ├── Alibaba Cloud Chengdu - Telecom (China) (ctut).png │ │ ├── Alibaba Cloud Chengdu - Unicom (China) (ctuu).png │ │ ├── Alibaba Cloud Shanghai - Mobile (China) (pvgm).png │ │ ├── Alibaba Cloud Shanghai - Telecom (China) (pvgt).png │ │ ├── Alibaba Cloud Shanghai - Unicom (China) (pvgu).png │ │ ├── Alibaba Cloud Shanghai Alicloud - Mobile (China) (pvgm).png │ │ ├── Alibaba Cloud Shanghai Alicloud - Telecom (China) (pvgt).png │ │ ├── Alibaba Cloud Shanghai Alicloud - Unicom (China) (pvgu).png │ │ ├── Amsterdam (Netherlands) (ams).png │ │ ├── Atlanta (Georgia) (atl).png │ │ ├── Buenos Aires (Argentina) (eze).png │ │ ├── Chennai - Ambattur (India) (maa2).png │ │ ├── Chicago (Illinois) (ord).png │ │ ├── China.png │ │ ├── Dallas (Texas) (dfw).png │ │ ├── Dubai (United Arab Emirates) (dxb).png │ │ ├── Frankfurt (Germany) (fra).png │ │ ├── Helsinki (Finland) (hel).png │ │ ├── Hong Kong (hkg).png │ │ ├── India.png │ │ ├── Japan.png │ │ ├── Johannesburg (South Africa) (jnb).png │ │ ├── Lima (Peru) (lim).png │ │ ├── London (England) (lhr).png │ │ ├── Los Angeles (California) (lax).png │ │ ├── Madrid (Spain) (mad).png │ │ ├── Multiplay Amsterdam (Netherlands) (ams4).png │ │ ├── Multiplay Dallas (Texas) (dfw2).png │ │ ├── Multiplay Hong Kong (hkg4).png │ │ ├── Mumbai (India) (bom2).png │ │ ├── New York (jfk).png │ │ ├── Paris (France) (par).png │ │ ├── Perfect World (sha-4) Backbone (Shanghai, China) (shb).png │ │ ├── Perfect World Guangdong 1 (China) (pwg).png │ │ ├── Perfect World Guangdong 2 - Mobile (China) (canm).png │ │ ├── Perfect World Guangdong 2 - Telecom (China) (cant).png │ │ ├── Perfect World Guangdong 2 - Unicom (China) (canu).png │ │ ├── Perfect World Hebei (China) (pwu).png │ │ ├── Perfect World Shanghai - Mobile (China) (sham).png │ │ ├── Perfect World Shanghai - Telecom (China) (shat).png │ │ ├── Perfect World Shanghai - Unicom (China) (shau).png │ │ ├── Perfect World Tianjin (China) (pwj).png │ │ ├── Perfect World Tianjin - Mobile (China) (tsnm).png │ │ ├── Perfect World Tianjin - Telecom (China) (tsnt).png │ │ ├── Perfect World Tianjin - Unicom (China) (tsnu).png │ │ ├── Perfect World Wuhan (China) (pww).png │ │ ├── Perfect World Zhejiang (China) (pwz).png │ │ ├── Santiago (Chile) (scl).png │ │ ├── Sao Paulo (Brazil) (gru).png │ │ ├── Seattle (Washington) (sea).png │ │ ├── Seoul (South Korea) (seo).png │ │ ├── Singapore (sgp).png │ │ ├── Sterling (Virginia) (iad).png │ │ ├── Stockholm (Sweden).png │ │ ├── Stockholm - Bromma (Sweden) (sto2).png │ │ ├── Stockholm - Kista (Sweden) (sto).png │ │ ├── Sydney (Australia) (syd).png │ │ ├── Tencent Guangzhou - Mobile (China) (tgdm).png │ │ ├── Tencent Guangzhou - Telecom (China) (tgdt).png │ │ ├── Tencent Guangzhou - Unicom (China) (tgdu).png │ │ ├── Tokyo Koto City (Japan) (tyo).png │ │ ├── Vienna (Austria) (vie).png │ │ └── Warsaw (Poland) (waw).png ├── fav_icon.ico └── packages.config ├── LICENSE └── README.md /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a bug report with needed information 4 | title: '' 5 | labels: [bug,needs-triage] 6 | assignees: [FN-FAL113] 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce (Important)** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Error File (Required)** 24 | Upload the error file located in the application's executable directory. 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore 5 | 6 | # Added by owner 7 | bin 8 | obj 9 | packages 10 | 11 | # User-specific files 12 | *.rsuser 13 | *.suo 14 | *.user 15 | *.userosscache 16 | *.sln.docstates 17 | 18 | # User-specific files (MonoDevelop/Xamarin Studio) 19 | *.userprefs 20 | 21 | # Mono auto generated files 22 | mono_crash.* 23 | 24 | # Build results 25 | [Dd]ebug/ 26 | [Dd]ebugPublic/ 27 | [Rr]elease/ 28 | [Rr]eleases/ 29 | x64/ 30 | x86/ 31 | [Ww][Ii][Nn]32/ 32 | [Aa][Rr][Mm]/ 33 | [Aa][Rr][Mm]64/ 34 | bld/ 35 | [Bb]in/ 36 | [Oo]bj/ 37 | [Ll]og/ 38 | [Ll]ogs/ 39 | 40 | # Visual Studio 2015/2017 cache/options directory 41 | .vs/ 42 | # Uncomment if you have tasks that create the project's static files in wwwroot 43 | #wwwroot/ 44 | 45 | # Visual Studio 2017 auto generated files 46 | Generated\ Files/ 47 | 48 | # MSTest test Results 49 | [Tt]est[Rr]esult*/ 50 | [Bb]uild[Ll]og.* 51 | 52 | # NUnit 53 | *.VisualState.xml 54 | TestResult.xml 55 | nunit-*.xml 56 | 57 | # Build Results of an ATL Project 58 | [Dd]ebugPS/ 59 | [Rr]eleasePS/ 60 | dlldata.c 61 | 62 | # Benchmark Results 63 | BenchmarkDotNet.Artifacts/ 64 | 65 | # .NET Core 66 | project.lock.json 67 | project.fragment.lock.json 68 | artifacts/ 69 | 70 | # ASP.NET Scaffolding 71 | ScaffoldingReadMe.txt 72 | 73 | # StyleCop 74 | StyleCopReport.xml 75 | 76 | # Files built by Visual Studio 77 | *_i.c 78 | *_p.c 79 | *_h.h 80 | *.ilk 81 | *.meta 82 | *.obj 83 | *.iobj 84 | *.pch 85 | *.pdb 86 | *.ipdb 87 | *.pgc 88 | *.pgd 89 | *.rsp 90 | *.sbr 91 | *.tlb 92 | *.tli 93 | *.tlh 94 | *.tmp 95 | *.tmp_proj 96 | *_wpftmp.csproj 97 | *.log 98 | *.tlog 99 | *.vspscc 100 | *.vssscc 101 | .builds 102 | *.pidb 103 | *.svclog 104 | *.scc 105 | 106 | # Chutzpah Test files 107 | _Chutzpah* 108 | 109 | # Visual C++ cache files 110 | ipch/ 111 | *.aps 112 | *.ncb 113 | *.opendb 114 | *.opensdf 115 | *.sdf 116 | *.cachefile 117 | *.VC.db 118 | *.VC.VC.opendb 119 | 120 | # Visual Studio profiler 121 | *.psess 122 | *.vsp 123 | *.vspx 124 | *.sap 125 | 126 | # Visual Studio Trace Files 127 | *.e2e 128 | 129 | # TFS 2012 Local Workspace 130 | $tf/ 131 | 132 | # Guidance Automation Toolkit 133 | *.gpState 134 | 135 | # ReSharper is a .NET coding add-in 136 | _ReSharper*/ 137 | *.[Rr]e[Ss]harper 138 | *.DotSettings.user 139 | 140 | # TeamCity is a build add-in 141 | _TeamCity* 142 | 143 | # DotCover is a Code Coverage Tool 144 | *.dotCover 145 | 146 | # AxoCover is a Code Coverage Tool 147 | .axoCover/* 148 | !.axoCover/settings.json 149 | 150 | # Coverlet is a free, cross platform Code Coverage Tool 151 | coverage*.json 152 | coverage*.xml 153 | coverage*.info 154 | 155 | # Visual Studio code coverage results 156 | *.coverage 157 | *.coveragexml 158 | 159 | # NCrunch 160 | _NCrunch_* 161 | .*crunch*.local.xml 162 | nCrunchTemp_* 163 | 164 | # MightyMoose 165 | *.mm.* 166 | AutoTest.Net/ 167 | 168 | # Web workbench (sass) 169 | .sass-cache/ 170 | 171 | # Installshield output folder 172 | [Ee]xpress/ 173 | 174 | # DocProject is a documentation generator add-in 175 | DocProject/buildhelp/ 176 | DocProject/Help/*.HxT 177 | DocProject/Help/*.HxC 178 | DocProject/Help/*.hhc 179 | DocProject/Help/*.hhk 180 | DocProject/Help/*.hhp 181 | DocProject/Help/Html2 182 | DocProject/Help/html 183 | 184 | # Click-Once directory 185 | publish/ 186 | 187 | # Publish Web Output 188 | *.[Pp]ublish.xml 189 | *.azurePubxml 190 | # Note: Comment the next line if you want to checkin your web deploy settings, 191 | # but database connection strings (with potential passwords) will be unencrypted 192 | *.pubxml 193 | *.publishproj 194 | 195 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 196 | # checkin your Azure Web App publish settings, but sensitive information contained 197 | # in these scripts will be unencrypted 198 | PublishScripts/ 199 | 200 | # NuGet Packages 201 | *.nupkg 202 | # NuGet Symbol Packages 203 | *.snupkg 204 | # The packages folder can be ignored because of Package Restore 205 | **/[Pp]ackages/* 206 | # except build/, which is used as an MSBuild target. 207 | !**/[Pp]ackages/build/ 208 | # Uncomment if necessary however generally it will be regenerated when needed 209 | #!**/[Pp]ackages/repositories.config 210 | # NuGet v3's project.json files produces more ignorable files 211 | *.nuget.props 212 | *.nuget.targets 213 | 214 | # Microsoft Azure Build Output 215 | csx/ 216 | *.build.csdef 217 | 218 | # Microsoft Azure Emulator 219 | ecf/ 220 | rcf/ 221 | 222 | # Windows Store app package directories and files 223 | AppPackages/ 224 | BundleArtifacts/ 225 | Package.StoreAssociation.xml 226 | _pkginfo.txt 227 | *.appx 228 | *.appxbundle 229 | *.appxupload 230 | 231 | # Visual Studio cache files 232 | # files ending in .cache can be ignored 233 | *.[Cc]ache 234 | # but keep track of directories ending in .cache 235 | !?*.[Cc]ache/ 236 | 237 | # Others 238 | ClientBin/ 239 | ~$* 240 | *~ 241 | *.dbmdl 242 | *.dbproj.schemaview 243 | *.jfm 244 | *.pfx 245 | *.publishsettings 246 | orleans.codegen.cs 247 | 248 | # Including strong name files can present a security risk 249 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 250 | #*.snk 251 | 252 | # Since there are multiple workflows, uncomment next line to ignore bower_components 253 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 254 | #bower_components/ 255 | 256 | # RIA/Silverlight projects 257 | Generated_Code/ 258 | 259 | # Backup & report files from converting an old project file 260 | # to a newer Visual Studio version. Backup files are not needed, 261 | # because we have git ;-) 262 | _UpgradeReport_Files/ 263 | Backup*/ 264 | UpgradeLog*.XML 265 | UpgradeLog*.htm 266 | ServiceFabricBackup/ 267 | *.rptproj.bak 268 | 269 | # SQL Server files 270 | *.mdf 271 | *.ldf 272 | *.ndf 273 | 274 | # Business Intelligence projects 275 | *.rdl.data 276 | *.bim.layout 277 | *.bim_*.settings 278 | *.rptproj.rsuser 279 | *- [Bb]ackup.rdl 280 | *- [Bb]ackup ([0-9]).rdl 281 | *- [Bb]ackup ([0-9][0-9]).rdl 282 | 283 | # Microsoft Fakes 284 | FakesAssemblies/ 285 | 286 | # GhostDoc plugin setting file 287 | *.GhostDoc.xml 288 | 289 | # Node.js Tools for Visual Studio 290 | .ntvs_analysis.dat 291 | node_modules/ 292 | 293 | # Visual Studio 6 build log 294 | *.plg 295 | 296 | # Visual Studio 6 workspace options file 297 | *.opt 298 | 299 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 300 | *.vbw 301 | 302 | # Visual Studio 6 auto-generated project file (contains which files were open etc.) 303 | *.vbp 304 | 305 | # Visual Studio 6 workspace and project file (working project files containing files to include in project) 306 | *.dsw 307 | *.dsp 308 | 309 | # Visual Studio 6 technical files 310 | *.ncb 311 | *.aps 312 | 313 | # Visual Studio LightSwitch build output 314 | **/*.HTMLClient/GeneratedArtifacts 315 | **/*.DesktopClient/GeneratedArtifacts 316 | **/*.DesktopClient/ModelManifest.xml 317 | **/*.Server/GeneratedArtifacts 318 | **/*.Server/ModelManifest.xml 319 | _Pvt_Extensions 320 | 321 | # Paket dependency manager 322 | .paket/paket.exe 323 | paket-files/ 324 | 325 | # FAKE - F# Make 326 | .fake/ 327 | 328 | # CodeRush personal settings 329 | .cr/personal 330 | 331 | # Python Tools for Visual Studio (PTVS) 332 | __pycache__/ 333 | *.pyc 334 | 335 | # Cake - Uncomment if you are using it 336 | # tools/** 337 | # !tools/packages.config 338 | 339 | # Tabs Studio 340 | *.tss 341 | 342 | # Telerik's JustMock configuration file 343 | *.jmconfig 344 | 345 | # BizTalk build output 346 | *.btp.cs 347 | *.btm.cs 348 | *.odx.cs 349 | *.xsd.cs 350 | 351 | # OpenCover UI analysis results 352 | OpenCover/ 353 | 354 | # Azure Stream Analytics local run output 355 | ASALocalRun/ 356 | 357 | # MSBuild Binary and Structured Log 358 | *.binlog 359 | 360 | # NVidia Nsight GPU debugger configuration file 361 | *.nvuser 362 | 363 | # MFractors (Xamarin productivity tool) working folder 364 | .mfractor/ 365 | 366 | # Local History for Visual Studio 367 | .localhistory/ 368 | 369 | # Visual Studio History (VSHistory) files 370 | .vshistory/ 371 | 372 | # BeatPulse healthcheck temp database 373 | healthchecksdb 374 | 375 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 376 | MigrationBackup/ 377 | 378 | # Ionide (cross platform F# VS Code tools) working folder 379 | .ionide/ 380 | 381 | # Fody - auto-generated XML schema 382 | FodyWeavers.xsd 383 | 384 | # VS Code files for those working on multiple tools 385 | .vscode/* 386 | !.vscode/settings.json 387 | !.vscode/tasks.json 388 | !.vscode/launch.json 389 | !.vscode/extensions.json 390 | *.code-workspace 391 | 392 | # Local History for Visual Studio Code 393 | .history/ 394 | 395 | # Windows Installer files from build outputs 396 | *.cab 397 | *.msi 398 | *.msix 399 | *.msm 400 | *.msp 401 | 402 | # JetBrains Rider 403 | *.sln.iml 404 | -------------------------------------------------------------------------------- /CS2ServerPicker.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.13.35818.85 d17.13 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CS2ServerPicker", "CS2ServerPicker\CS2ServerPicker.vbproj", "{E7AEBBA1-5F96-40A4-B5ED-0503A6BA4FD5}" 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 | {E7AEBBA1-5F96-40A4-B5ED-0503A6BA4FD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {E7AEBBA1-5F96-40A4-B5ED-0503A6BA4FD5}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {E7AEBBA1-5F96-40A4-B5ED-0503A6BA4FD5}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {E7AEBBA1-5F96-40A4-B5ED-0503A6BA4FD5}.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 = {F07B959D-BD84-426A-B725-ADC5C3FA9856} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /CS2ServerPicker/App.Designer.vb: -------------------------------------------------------------------------------- 1 |  2 | Partial Class App 3 | Inherits System.Windows.Forms.Form 4 | 5 | 'Form overrides dispose to clean up the component list. 6 | 7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean) 8 | Try 9 | If disposing AndAlso components IsNot Nothing Then 10 | components.Dispose() 11 | End If 12 | Finally 13 | MyBase.Dispose(disposing) 14 | End Try 15 | End Sub 16 | 17 | 'Required by the Windows Form Designer 18 | Private components As System.ComponentModel.IContainer 19 | 20 | 'NOTE: The following procedure is required by the Windows Form Designer 21 | 'It can be modified using the Windows Form Designer. 22 | 'Do not modify it using the code editor. 23 | 24 | Private Sub InitializeComponent() 25 | Me.components = New System.ComponentModel.Container() 26 | Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() 27 | Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(App)) 28 | Me.RefreshButton = New System.Windows.Forms.Button() 29 | Me.MainDataGridView = New System.Windows.Forms.DataGridView() 30 | Me.Flag = New System.Windows.Forms.DataGridViewImageColumn() 31 | Me.Servers = New System.Windows.Forms.DataGridViewTextBoxColumn() 32 | Me.Latency = New System.Windows.Forms.DataGridViewTextBoxColumn() 33 | Me.UnblockAllButton = New System.Windows.Forms.Button() 34 | Me.BlockSelectedButton = New System.Windows.Forms.Button() 35 | Me.UnblockSelectedButton = New System.Windows.Forms.Button() 36 | Me.BlockAllButton = New System.Windows.Forms.Button() 37 | Me.InfoButton = New System.Windows.Forms.Button() 38 | Me.ProgBar = New System.Windows.Forms.ProgressBar() 39 | Me.ClusterButton = New System.Windows.Forms.Button() 40 | Me.PresetsButton = New System.Windows.Forms.Button() 41 | Me.SettingsIcon = New System.Windows.Forms.PictureBox() 42 | Me.PictureBox2 = New System.Windows.Forms.PictureBox() 43 | Me.PictureBox1 = New System.Windows.Forms.PictureBox() 44 | Me.DonateToolTip = New System.Windows.Forms.ToolTip(Me.components) 45 | Me.GithubToolTip = New System.Windows.Forms.ToolTip(Me.components) 46 | CType(Me.MainDataGridView, System.ComponentModel.ISupportInitialize).BeginInit() 47 | CType(Me.SettingsIcon, System.ComponentModel.ISupportInitialize).BeginInit() 48 | CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit() 49 | CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() 50 | Me.SuspendLayout() 51 | ' 52 | 'RefreshButton 53 | ' 54 | Me.RefreshButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) 55 | Me.RefreshButton.Location = New System.Drawing.Point(599, 26) 56 | Me.RefreshButton.Name = "RefreshButton" 57 | Me.RefreshButton.Size = New System.Drawing.Size(87, 26) 58 | Me.RefreshButton.TabIndex = 1 59 | Me.RefreshButton.Text = "Refresh" 60 | Me.RefreshButton.UseVisualStyleBackColor = True 61 | ' 62 | 'MainDataGridView 63 | ' 64 | Me.MainDataGridView.AllowUserToAddRows = False 65 | Me.MainDataGridView.AllowUserToDeleteRows = False 66 | Me.MainDataGridView.AllowUserToOrderColumns = True 67 | Me.MainDataGridView.AllowUserToResizeRows = False 68 | Me.MainDataGridView.BorderStyle = System.Windows.Forms.BorderStyle.None 69 | DataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter 70 | DataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control 71 | DataGridViewCellStyle1.Font = New System.Drawing.Font("Arial", 8.5!) 72 | DataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText 73 | DataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight 74 | DataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText 75 | DataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] 76 | Me.MainDataGridView.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle1 77 | Me.MainDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize 78 | Me.MainDataGridView.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.Flag, Me.Servers, Me.Latency}) 79 | Me.MainDataGridView.Location = New System.Drawing.Point(76, 58) 80 | Me.MainDataGridView.Name = "MainDataGridView" 81 | Me.MainDataGridView.RowHeadersVisible = False 82 | Me.MainDataGridView.RowHeadersWidth = 51 83 | Me.MainDataGridView.RowTemplate.Height = 24 84 | Me.MainDataGridView.Size = New System.Drawing.Size(610, 313) 85 | Me.MainDataGridView.TabIndex = 0 86 | ' 87 | 'Flag 88 | ' 89 | Me.Flag.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill 90 | Me.Flag.FillWeight = 19.25134! 91 | Me.Flag.HeaderText = "" 92 | Me.Flag.MinimumWidth = 10 93 | Me.Flag.Name = "Flag" 94 | Me.Flag.ReadOnly = True 95 | Me.Flag.Resizable = System.Windows.Forms.DataGridViewTriState.[False] 96 | ' 97 | 'Servers 98 | ' 99 | Me.Servers.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill 100 | Me.Servers.FillWeight = 140.3743! 101 | Me.Servers.HeaderText = "Servers" 102 | Me.Servers.MinimumWidth = 6 103 | Me.Servers.Name = "Servers" 104 | Me.Servers.ReadOnly = True 105 | Me.Servers.Resizable = System.Windows.Forms.DataGridViewTriState.[False] 106 | ' 107 | 'Latency 108 | ' 109 | Me.Latency.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill 110 | Me.Latency.FillWeight = 140.3743! 111 | Me.Latency.HeaderText = "Latency" 112 | Me.Latency.MinimumWidth = 6 113 | Me.Latency.Name = "Latency" 114 | Me.Latency.ReadOnly = True 115 | Me.Latency.Resizable = System.Windows.Forms.DataGridViewTriState.[False] 116 | ' 117 | 'UnblockAllButton 118 | ' 119 | Me.UnblockAllButton.BackColor = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer)) 120 | Me.UnblockAllButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Bold) 121 | Me.UnblockAllButton.Location = New System.Drawing.Point(423, 391) 122 | Me.UnblockAllButton.Name = "UnblockAllButton" 123 | Me.UnblockAllButton.Size = New System.Drawing.Size(89, 50) 124 | Me.UnblockAllButton.TabIndex = 3 125 | Me.UnblockAllButton.Text = "Unblock All" 126 | Me.UnblockAllButton.UseVisualStyleBackColor = False 127 | ' 128 | 'BlockSelectedButton 129 | ' 130 | Me.BlockSelectedButton.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer)) 131 | Me.BlockSelectedButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Bold) 132 | Me.BlockSelectedButton.Location = New System.Drawing.Point(241, 391) 133 | Me.BlockSelectedButton.Name = "BlockSelectedButton" 134 | Me.BlockSelectedButton.Size = New System.Drawing.Size(94, 50) 135 | Me.BlockSelectedButton.TabIndex = 3 136 | Me.BlockSelectedButton.Text = "Block Selected" 137 | Me.BlockSelectedButton.UseVisualStyleBackColor = False 138 | ' 139 | 'UnblockSelectedButton 140 | ' 141 | Me.UnblockSelectedButton.BackColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer)) 142 | Me.UnblockSelectedButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Bold) 143 | Me.UnblockSelectedButton.Location = New System.Drawing.Point(518, 391) 144 | Me.UnblockSelectedButton.Name = "UnblockSelectedButton" 145 | Me.UnblockSelectedButton.Size = New System.Drawing.Size(95, 50) 146 | Me.UnblockSelectedButton.TabIndex = 3 147 | Me.UnblockSelectedButton.Text = "Unblock Selected" 148 | Me.UnblockSelectedButton.UseVisualStyleBackColor = False 149 | ' 150 | 'BlockAllButton 151 | ' 152 | Me.BlockAllButton.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) 153 | Me.BlockAllButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Bold) 154 | Me.BlockAllButton.Location = New System.Drawing.Point(145, 391) 155 | Me.BlockAllButton.Name = "BlockAllButton" 156 | Me.BlockAllButton.Size = New System.Drawing.Size(90, 50) 157 | Me.BlockAllButton.TabIndex = 3 158 | Me.BlockAllButton.Text = "Block All" 159 | Me.BlockAllButton.UseVisualStyleBackColor = False 160 | ' 161 | 'InfoButton 162 | ' 163 | Me.InfoButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) 164 | Me.InfoButton.Location = New System.Drawing.Point(76, 28) 165 | Me.InfoButton.Name = "InfoButton" 166 | Me.InfoButton.Size = New System.Drawing.Size(75, 24) 167 | Me.InfoButton.TabIndex = 4 168 | Me.InfoButton.Text = "Info" 169 | Me.InfoButton.UseVisualStyleBackColor = True 170 | ' 171 | 'ProgBar 172 | ' 173 | Me.ProgBar.Location = New System.Drawing.Point(300, 28) 174 | Me.ProgBar.MarqueeAnimationSpeed = 20 175 | Me.ProgBar.Name = "ProgBar" 176 | Me.ProgBar.Size = New System.Drawing.Size(154, 25) 177 | Me.ProgBar.Style = System.Windows.Forms.ProgressBarStyle.Marquee 178 | Me.ProgBar.TabIndex = 6 179 | Me.ProgBar.Visible = False 180 | ' 181 | 'ClusterButton 182 | ' 183 | Me.ClusterButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) 184 | Me.ClusterButton.Location = New System.Drawing.Point(506, 26) 185 | Me.ClusterButton.Name = "ClusterButton" 186 | Me.ClusterButton.Size = New System.Drawing.Size(87, 26) 187 | Me.ClusterButton.TabIndex = 7 188 | Me.ClusterButton.Text = "Uncluster" 189 | Me.ClusterButton.UseVisualStyleBackColor = True 190 | ' 191 | 'PresetsButton 192 | ' 193 | Me.PresetsButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) 194 | Me.PresetsButton.Location = New System.Drawing.Point(157, 27) 195 | Me.PresetsButton.Name = "PresetsButton" 196 | Me.PresetsButton.Size = New System.Drawing.Size(87, 26) 197 | Me.PresetsButton.TabIndex = 8 198 | Me.PresetsButton.Text = "Presets" 199 | Me.PresetsButton.UseVisualStyleBackColor = True 200 | ' 201 | 'SettingsIcon 202 | ' 203 | Me.SettingsIcon.BackgroundImage = Global.CS2ServerPicker.My.Resources.Resources.Settings 204 | Me.SettingsIcon.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch 205 | Me.SettingsIcon.Cursor = System.Windows.Forms.Cursors.Hand 206 | Me.SettingsIcon.Location = New System.Drawing.Point(662, 434) 207 | Me.SettingsIcon.Name = "SettingsIcon" 208 | Me.SettingsIcon.Size = New System.Drawing.Size(24, 24) 209 | Me.SettingsIcon.TabIndex = 10 210 | Me.SettingsIcon.TabStop = False 211 | ' 212 | 'PictureBox2 213 | ' 214 | Me.PictureBox2.BackColor = System.Drawing.Color.Transparent 215 | Me.PictureBox2.BackgroundImage = Global.CS2ServerPicker.My.Resources.Resources.Paypal 216 | Me.PictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch 217 | Me.PictureBox2.Cursor = System.Windows.Forms.Cursors.Hand 218 | Me.PictureBox2.Location = New System.Drawing.Point(723, 435) 219 | Me.PictureBox2.Margin = New System.Windows.Forms.Padding(4) 220 | Me.PictureBox2.Name = "PictureBox2" 221 | Me.PictureBox2.Size = New System.Drawing.Size(22, 22) 222 | Me.PictureBox2.TabIndex = 9 223 | Me.PictureBox2.TabStop = False 224 | Me.DonateToolTip.SetToolTip(Me.PictureBox2, "PayPal Donation :')") 225 | ' 226 | 'PictureBox1 227 | ' 228 | Me.PictureBox1.BackColor = System.Drawing.Color.Transparent 229 | Me.PictureBox1.BackgroundImage = Global.CS2ServerPicker.My.Resources.Resources.GitHub_Mark 230 | Me.PictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch 231 | Me.PictureBox1.Cursor = System.Windows.Forms.Cursors.Hand 232 | Me.PictureBox1.ErrorImage = Global.CS2ServerPicker.My.Resources.Resources.Warsaw__Poland___waw_ 233 | Me.PictureBox1.Location = New System.Drawing.Point(693, 435) 234 | Me.PictureBox1.Margin = New System.Windows.Forms.Padding(4) 235 | Me.PictureBox1.Name = "PictureBox1" 236 | Me.PictureBox1.Size = New System.Drawing.Size(22, 22) 237 | Me.PictureBox1.TabIndex = 5 238 | Me.PictureBox1.TabStop = False 239 | Me.GithubToolTip.SetToolTip(Me.PictureBox1, "Github Repository") 240 | ' 241 | 'DonateToolTip 242 | ' 243 | Me.DonateToolTip.AutomaticDelay = 300 244 | Me.DonateToolTip.AutoPopDelay = 3000 245 | Me.DonateToolTip.InitialDelay = 150 246 | Me.DonateToolTip.ReshowDelay = 60 247 | ' 248 | 'GithubToolTip 249 | ' 250 | Me.GithubToolTip.AutomaticDelay = 300 251 | Me.GithubToolTip.AutoPopDelay = 3000 252 | Me.GithubToolTip.InitialDelay = 150 253 | Me.GithubToolTip.ReshowDelay = 60 254 | ' 255 | 'App 256 | ' 257 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 14.0!) 258 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font 259 | Me.ClientSize = New System.Drawing.Size(756, 463) 260 | Me.Controls.Add(Me.SettingsIcon) 261 | Me.Controls.Add(Me.PictureBox2) 262 | Me.Controls.Add(Me.PresetsButton) 263 | Me.Controls.Add(Me.ClusterButton) 264 | Me.Controls.Add(Me.ProgBar) 265 | Me.Controls.Add(Me.PictureBox1) 266 | Me.Controls.Add(Me.InfoButton) 267 | Me.Controls.Add(Me.BlockAllButton) 268 | Me.Controls.Add(Me.UnblockSelectedButton) 269 | Me.Controls.Add(Me.BlockSelectedButton) 270 | Me.Controls.Add(Me.UnblockAllButton) 271 | Me.Controls.Add(Me.RefreshButton) 272 | Me.Controls.Add(Me.MainDataGridView) 273 | Me.Font = New System.Drawing.Font("Arial", 8.5!) 274 | Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog 275 | Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) 276 | Me.MaximizeBox = False 277 | Me.Name = "App" 278 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen 279 | Me.Text = "Counter Strike 2 Server Picker" 280 | CType(Me.MainDataGridView, System.ComponentModel.ISupportInitialize).EndInit() 281 | CType(Me.SettingsIcon, System.ComponentModel.ISupportInitialize).EndInit() 282 | CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).EndInit() 283 | CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit() 284 | Me.ResumeLayout(False) 285 | 286 | End Sub 287 | Friend WithEvents RefreshButton As Button 288 | Friend WithEvents MainDataGridView As DataGridView 289 | Friend WithEvents UnblockAllButton As Button 290 | Friend WithEvents BlockSelectedButton As Button 291 | Friend WithEvents UnblockSelectedButton As Button 292 | Friend WithEvents BlockAllButton As Button 293 | Friend WithEvents InfoButton As Button 294 | Friend WithEvents PictureBox1 As PictureBox 295 | Friend WithEvents ProgBar As ProgressBar 296 | Friend WithEvents ClusterButton As Button 297 | Friend WithEvents PresetsButton As Button 298 | Friend WithEvents PictureBox2 As PictureBox 299 | Friend WithEvents Flag As DataGridViewImageColumn 300 | Friend WithEvents Servers As DataGridViewTextBoxColumn 301 | Friend WithEvents Latency As DataGridViewTextBoxColumn 302 | Friend WithEvents SettingsIcon As PictureBox 303 | Friend WithEvents DonateToolTip As ToolTip 304 | Friend WithEvents GithubToolTip As ToolTip 305 | End Class 306 | -------------------------------------------------------------------------------- /CS2ServerPicker/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | True 18 | 19 | 20 | True 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /CS2ServerPicker/App.vb: -------------------------------------------------------------------------------- 1 | Public Class App 2 | 3 | #If DEBUG Then 4 | Public Debug = True 5 | #Else 6 | Public Debug = False 7 | #End If 8 | 9 | Private serverDictClustered As New Dictionary(Of String, String) 10 | 11 | Private serverDictUnclustered As New Dictionary(Of String, String) 12 | 13 | Private pingObjsDict As New Dictionary(Of String, Net.NetworkInformation.Ping) 14 | 15 | Private pendingOperation As Boolean = False 16 | 17 | Private isClustered As Boolean = My.Settings.Is_Clustered 18 | 19 | Public Function Get_Server_Dictionary_Clustered() As Dictionary(Of String, String) 20 | Return serverDictClustered 21 | End Function 22 | 23 | Public Function Get_Server_Dictionary_Unclustered() As Dictionary(Of String, String) 24 | Return serverDictUnclustered 25 | End Function 26 | 27 | Public Function Get_Ping_Objects_Dictionary() As Dictionary(Of String, Net.NetworkInformation.Ping) 28 | Return pingObjsDict 29 | End Function 30 | 31 | Public Function Get_Pending_Operation() As Boolean 32 | Return pendingOperation 33 | End Function 34 | 35 | Public Sub Set_Pending_Operation(bool As Boolean) 36 | pendingOperation = bool 37 | 38 | ProgBar.Visible = bool 39 | End Sub 40 | 41 | Public Function Get_Is_Clustered() As Boolean 42 | Return isClustered 43 | End Function 44 | 45 | Public Sub Set_Is_Clustered(bool As Boolean) 46 | isClustered = bool 47 | End Sub 48 | 49 | Public Function Get_DataGridView_Control() As DataGridView 50 | Return MainDataGridView 51 | End Function 52 | 53 | Private Sub RefreshButton_Click(sender As Object, e As EventArgs) Handles RefreshButton.Click 54 | Ping_All_Servers() 55 | End Sub 56 | 57 | Private Sub MainDataGridView_SelectionChanged(sender As Object, e As EventArgs) Handles MainDataGridView.SelectionChanged 58 | ' when selecting a single or multiple cell then also select whole row 59 | For Each cell As DataGridViewCell In MainDataGridView.SelectedCells 60 | MainDataGridView.Rows(cell.RowIndex).Selected = True 61 | Next 62 | End Sub 63 | 64 | Private Async Sub App_Load(sender As Object, e As EventArgs) Handles MyBase.Load 65 | ' Append to window title if using debug build 66 | If Debug Then 67 | Text = Text + " (DEBUG Build)" 68 | End If 69 | 70 | Version_Check() 71 | 72 | Set_Pending_Operation(True) 73 | 74 | Dim serverRevision As String = Await Fetch_Server_Data() 75 | 76 | Set_Pending_Operation(False) 77 | 78 | ' if app failed to retrieve server data or somehow steam api got updated with different response structure 79 | If serverRevision = "null" Then 80 | Return 81 | End If 82 | 83 | Load_Server_List() 84 | 85 | If Not My.Settings.Server_Revision = serverRevision Then 86 | MessageBox.Show("Server data just got updated by Valve! All blocked servers will be unblocked in order to synchronize new server data.", "Please Standby") 87 | 88 | My.Settings.Server_Revision = serverRevision 89 | My.Settings.Save() 90 | My.Settings.Reload() 91 | 92 | Await Block_Unblock_All_Servers(False) 93 | Else 94 | Ping_All_Servers() 95 | End If 96 | 97 | If isClustered Then 98 | ClusterButton.Text = "Uncluster" 99 | Else 100 | ClusterButton.Text = "Cluster" 101 | End If 102 | End Sub 103 | 104 | Private Sub App_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing 105 | Cancel_Pending_Ping() 106 | End Sub 107 | 108 | Private Async Sub BlockAllButton_Click(sender As Object, e As EventArgs) Handles BlockAllButton.Click 109 | Await Block_Unblock_All_Servers(True) 110 | End Sub 111 | 112 | Private Async Sub UnblockAllButton_Click(sender As Object, e As EventArgs) Handles UnblockAllButton.Click 113 | Await Block_Unblock_All_Servers(False) 114 | End Sub 115 | 116 | Private Sub BlockSelectedButton_Click(sender As Object, e As EventArgs) Handles BlockSelectedButton.Click 117 | Block_Unblock_Selected_Servers(True) 118 | End Sub 119 | 120 | Private Sub UnblockSelectedButton_Click(sender As Object, e As EventArgs) Handles UnblockSelectedButton.Click 121 | Block_Unblock_Selected_Servers(False) 122 | End Sub 123 | 124 | Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click 125 | Process.Start("https://github.com/FN-FAL113/cs2-server-picker") 126 | End Sub 127 | 128 | Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click 129 | Process.Start("https://www.paypal.com/paypalme/fnfal113") 130 | End Sub 131 | 132 | Private Sub InfoButton_Click(sender As Object, e As EventArgs) Handles InfoButton.Click 133 | MessageBox.Show( 134 | "How to select server/s:" + Environment.NewLine + 135 | " - hold down CTRL and left click any server." + Environment.NewLine + 136 | " - hold down LEFT CLICK on a server then drag down." + Environment.NewLine + 137 | Environment.NewLine + 138 | "Note:" + Environment.NewLine + 139 | " - Blocked servers will be automatically unblocked if server data is updated on next launch." + Environment.NewLine + 140 | " - You may ping single or multiple selected server/s by double clicking on the highlighted region." + Environment.NewLine + 141 | " - Servers that get un/clustered are China, India, Japan, Stockholm." + Environment.NewLine + 142 | Environment.NewLine + 143 | "Author: FN-FAL113 (github username)" + Environment.NewLine + 144 | "License: GNU General Public License V3" + Environment.NewLine + 145 | "App Version: " + IIf(Debug, "DEBUG", "2.5.0"), 146 | "App Info" 147 | ) 148 | End Sub 149 | 150 | Private Sub MainDataGridView_SortCompare(sender As Object, e As DataGridViewSortCompareEventArgs) Handles MainDataGridView.SortCompare 151 | ' sort latency column by splitting "ms" and parsing numeric value 152 | e.Handled = True 153 | 154 | If e.CellValue1 Is Nothing Or e.CellValue2 Is Nothing Then Return 155 | 156 | If e.Column.Index = 2 Then 157 | Dim cell1Val As Integer = Integer.Parse(IIf(e.CellValue1.ToString().Contains("ms"), e.CellValue1.ToString().Split("ms")(0), "999999")) 158 | Dim cell2Val As Integer = Integer.Parse(IIf(e.CellValue2.ToString().Contains("ms"), e.CellValue2.ToString().Split("ms")(0), "999999")) 159 | 160 | e.SortResult = cell1Val.CompareTo(cell2Val) 161 | End If 162 | End Sub 163 | 164 | Private Sub MainDataGridView_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles MainDataGridView.CellDoubleClick 165 | If e.RowIndex = -1 Or MainDataGridView.SelectedRows.Count <= 0 Then 166 | Return 167 | End If 168 | 169 | Ping_Servers(MainDataGridView.SelectedRows) 170 | End Sub 171 | 172 | Private Async Sub ClusterButton_Click(sender As Object, e As EventArgs) Handles ClusterButton.Click 173 | If pendingOperation Then 174 | MessageBox.Show("Operation in progress, please wait a moment...") 175 | 176 | Return 177 | End If 178 | 179 | MessageBox.Show("App will unblock all servers before " + IIf(isClustered, "unclustering", "clustering") + " servers. Please standby...", "Info") 180 | 181 | Await Block_Unblock_All_Servers(False, False) 182 | 183 | Clear_DataGridView_Rows() 184 | 185 | If isClustered Then 186 | ClusterButton.Text = "Cluster" 187 | 188 | isClustered = False 189 | Else 190 | ClusterButton.Text = "Uncluster" 191 | 192 | isClustered = True 193 | End If 194 | 195 | Load_Server_List() 196 | 197 | ' save clustered settings 198 | My.Settings.Is_Clustered = isClustered 199 | My.Settings.Save() 200 | My.Settings.Reload() 201 | End Sub 202 | 203 | Private Sub PresetsButton_Click(sender As Object, e As EventArgs) Handles PresetsButton.Click 204 | Presets.ShowDialog() 205 | Presets.Activate() 206 | End Sub 207 | 208 | Private Sub SettingsIcon_Click(sender As Object, e As EventArgs) Handles SettingsIcon.Click 209 | Settings.ShowDialog() 210 | Settings.Activate() 211 | End Sub 212 | End Class 213 | -------------------------------------------------------------------------------- /CS2ServerPicker/CS2ServerPicker.vbproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {E7AEBBA1-5F96-40A4-B5ED-0503A6BA4FD5} 8 | WinExe 9 | CS2ServerPicker.My.MyApplication 10 | CS2ServerPicker 11 | CS2ServerPicker 12 | 512 13 | WindowsForms 14 | v4.7.2 15 | true 16 | true 17 | false 18 | publish\ 19 | true 20 | Disk 21 | false 22 | Foreground 23 | 7 24 | Days 25 | false 26 | false 27 | true 28 | https://github.com/FN-FAL113/csgo-server-picker 29 | https://github.com/FN-FAL113/csgo-server-picker/issues 30 | CSGO Server Picker 31 | FN-FAL113 32 | 0 33 | 1.0.0.%2a 34 | false 35 | true 36 | true 37 | 38 | 39 | AnyCPU 40 | true 41 | full 42 | true 43 | true 44 | bin\Debug\ 45 | CS2ServerPicker.xml 46 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 47 | 48 | 49 | AnyCPU 50 | pdbonly 51 | false 52 | true 53 | true 54 | bin\Release\ 55 | CS2ServerPicker.xml 56 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 57 | 58 | 59 | On 60 | 61 | 62 | Binary 63 | 64 | 65 | Off 66 | 67 | 68 | On 69 | 70 | 71 | app.manifest 72 | 73 | 74 | B7CDE7AA7A16A2E552E612A4854914A174C5BF99 75 | 76 | 77 | CSGOServerPicker_TemporaryKey.pfx 78 | 79 | 80 | false 81 | 82 | 83 | false 84 | 85 | 86 | LocalIntranet 87 | 88 | 89 | fav_icon.ico 90 | 91 | 92 | 93 | ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | Form 122 | 123 | 124 | App.vb 125 | Form 126 | 127 | 128 | AddPresetForm.vb 129 | 130 | 131 | Form 132 | 133 | 134 | DeletePresetForm.vb 135 | 136 | 137 | Form 138 | 139 | 140 | Presets.vb 141 | 142 | 143 | Form 144 | 145 | 146 | UpdatePresetForm.vb 147 | 148 | 149 | Form 150 | 151 | 152 | 153 | 154 | 155 | 156 | True 157 | Application.myapp 158 | True 159 | 160 | 161 | True 162 | True 163 | Resources.resx 164 | 165 | 166 | True 167 | Settings.settings 168 | True 169 | 170 | 171 | 172 | 173 | 174 | Settings.vb 175 | 176 | 177 | Form 178 | 179 | 180 | 181 | 182 | App.vb 183 | 184 | 185 | VbMyResourcesResXFileCodeGenerator 186 | Resources.Designer.vb 187 | My.Resources 188 | Designer 189 | 190 | 191 | AddPresetForm.vb 192 | 193 | 194 | DeletePresetForm.vb 195 | 196 | 197 | Presets.vb 198 | 199 | 200 | UpdatePresetForm.vb 201 | 202 | 203 | Settings.vb 204 | 205 | 206 | 207 | 208 | 209 | MyApplicationCodeGenerator 210 | Application.Designer.vb 211 | 212 | 213 | SettingsSingleFileGenerator 214 | My 215 | Settings.Designer.vb 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | False 226 | Microsoft .NET Framework 4.7.2 %28x86 and x64%29 227 | true 228 | 229 | 230 | False 231 | .NET Framework 3.5 SP1 232 | false 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | -------------------------------------------------------------------------------- /CS2ServerPicker/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 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 | Option Strict On 12 | Option Explicit On 13 | 14 | 15 | Namespace My 16 | 17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes, 18 | ' or if you encounter build errors in this file, go to the Project Designer 19 | ' (go to Project Properties or double-click the My Project node in 20 | ' Solution Explorer), and make changes on the Application tab. 21 | ' 22 | Partial Friend Class MyApplication 23 | 24 | _ 25 | Public Sub New() 26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) 27 | Me.IsSingleInstance = false 28 | Me.EnableVisualStyles = true 29 | Me.SaveMySettingsOnExit = true 30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses 31 | End Sub 32 | 33 | _ 34 | Protected Overrides Sub OnCreateMainForm() 35 | Me.MainForm = Global.CS2ServerPicker.App 36 | End Sub 37 | End Class 38 | End Namespace 39 | -------------------------------------------------------------------------------- /CS2ServerPicker/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | true 4 | App 5 | false 6 | 0 7 | true 8 | 0 9 | true 10 | -------------------------------------------------------------------------------- /CS2ServerPicker/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System.Resources 2 | Imports System 3 | Imports System.Reflection 4 | Imports System.Runtime.InteropServices 5 | 6 | ' General Information about an assembly is controlled through the following 7 | ' set of attributes. Change these attribute values to modify the information 8 | ' associated with an assembly. 9 | 10 | ' Review the values of the assembly attributes 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 22 | 23 | 24 | ' Version information for an assembly consists of the following four values: 25 | ' 26 | ' Major Version 27 | ' Minor Version 28 | ' Build Number 29 | ' Revision 30 | ' 31 | ' You can specify all the values or you can default the Build and Revision Numbers 32 | ' by using the '*' as shown below: 33 | ' 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /CS2ServerPicker/My Project/Settings.Designer.vb: -------------------------------------------------------------------------------- 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 | Option Strict On 12 | Option Explicit On 13 | 14 | 15 | Namespace My 16 | 17 | _ 20 | Partial Friend NotInheritable Class MySettings 21 | Inherits Global.System.Configuration.ApplicationSettingsBase 22 | 23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) 24 | 25 | #Region "My.Settings Auto-Save Functionality" 26 | #If _MyType = "WindowsForms" Then 27 | Private Shared addedHandler As Boolean 28 | 29 | Private Shared addedHandlerLockObject As New Object 30 | 31 | _ 32 | Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) 33 | If My.Application.SaveMySettingsOnExit Then 34 | My.Settings.Save() 35 | End If 36 | End Sub 37 | #End If 38 | #End Region 39 | 40 | Public Shared ReadOnly Property [Default]() As MySettings 41 | Get 42 | 43 | #If _MyType = "WindowsForms" Then 44 | If Not addedHandler Then 45 | SyncLock addedHandlerLockObject 46 | If Not addedHandler Then 47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings 48 | addedHandler = True 49 | End If 50 | End SyncLock 51 | End If 52 | #End If 53 | Return defaultInstance 54 | End Get 55 | End Property 56 | 57 | _ 60 | Public Property Server_Revision() As String 61 | Get 62 | Return CType(Me("Server_Revision"),String) 63 | End Get 64 | Set 65 | Me("Server_Revision") = value 66 | End Set 67 | End Property 68 | 69 | _ 72 | Public Property Is_Clustered() As Boolean 73 | Get 74 | Return CType(Me("Is_Clustered"),Boolean) 75 | End Get 76 | Set 77 | Me("Is_Clustered") = value 78 | End Set 79 | End Property 80 | 81 | _ 84 | Public Property VersionCheckOnStartup() As Boolean 85 | Get 86 | Return CType(Me("VersionCheckOnStartup"),Boolean) 87 | End Get 88 | Set 89 | Me("VersionCheckOnStartup") = value 90 | End Set 91 | End Property 92 | End Class 93 | End Namespace 94 | 95 | Namespace My 96 | 97 | _ 100 | Friend Module MySettingsProperty 101 | 102 | _ 103 | Friend ReadOnly Property Settings() As Global.CS2ServerPicker.My.MySettings 104 | Get 105 | Return Global.CS2ServerPicker.My.MySettings.Default 106 | End Get 107 | End Property 108 | End Module 109 | End Namespace 110 | -------------------------------------------------------------------------------- /CS2ServerPicker/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | True 10 | 11 | 12 | True 13 | 14 | 15 | -------------------------------------------------------------------------------- /CS2ServerPicker/Presets/AddPresetForm.Designer.vb: -------------------------------------------------------------------------------- 1 |  _ 2 | Partial Class AddPresetForm 3 | Inherits System.Windows.Forms.Form 4 | 5 | 'Form overrides dispose to clean up the component list. 6 | _ 7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean) 8 | Try 9 | If disposing AndAlso components IsNot Nothing Then 10 | components.Dispose() 11 | End If 12 | Finally 13 | MyBase.Dispose(disposing) 14 | End Try 15 | End Sub 16 | 17 | 'Required by the Windows Form Designer 18 | Private components As System.ComponentModel.IContainer 19 | 20 | 'NOTE: The following procedure is required by the Windows Form Designer 21 | 'It can be modified using the Windows Form Designer. 22 | 'Do not modify it using the code editor. 23 | _ 24 | Private Sub InitializeComponent() 25 | Me.PresetServersCheckedListBox = New System.Windows.Forms.CheckedListBox() 26 | Me.PresetNameLabel = New System.Windows.Forms.Label() 27 | Me.AddPresetNameTextBox = New System.Windows.Forms.TextBox() 28 | Me.PresetServersLabel = New System.Windows.Forms.Label() 29 | Me.AddPresetButton = New System.Windows.Forms.Button() 30 | Me.ResetPresetSelectionButton = New System.Windows.Forms.Button() 31 | Me.SuspendLayout() 32 | ' 33 | 'PresetServersCheckedListBox 34 | ' 35 | Me.PresetServersCheckedListBox.CheckOnClick = True 36 | Me.PresetServersCheckedListBox.Font = New System.Drawing.Font("Arial", 8.5!) 37 | Me.PresetServersCheckedListBox.FormattingEnabled = True 38 | Me.PresetServersCheckedListBox.Location = New System.Drawing.Point(66, 100) 39 | Me.PresetServersCheckedListBox.Margin = New System.Windows.Forms.Padding(5, 5, 5, 5) 40 | Me.PresetServersCheckedListBox.Name = "PresetServersCheckedListBox" 41 | Me.PresetServersCheckedListBox.Size = New System.Drawing.Size(271, 327) 42 | Me.PresetServersCheckedListBox.TabIndex = 0 43 | ' 44 | 'PresetNameLabel 45 | ' 46 | Me.PresetNameLabel.AutoSize = True 47 | Me.PresetNameLabel.Font = New System.Drawing.Font("Arial", 8.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) 48 | Me.PresetNameLabel.Location = New System.Drawing.Point(63, 18) 49 | Me.PresetNameLabel.Margin = New System.Windows.Forms.Padding(5, 0, 5, 0) 50 | Me.PresetNameLabel.Name = "PresetNameLabel" 51 | Me.PresetNameLabel.Size = New System.Drawing.Size(99, 18) 52 | Me.PresetNameLabel.TabIndex = 1 53 | Me.PresetNameLabel.Text = "Preset Name" 54 | ' 55 | 'AddPresetNameTextBox 56 | ' 57 | Me.AddPresetNameTextBox.Font = New System.Drawing.Font("Arial", 8.5!) 58 | Me.AddPresetNameTextBox.Location = New System.Drawing.Point(66, 43) 59 | Me.AddPresetNameTextBox.Margin = New System.Windows.Forms.Padding(5, 5, 5, 5) 60 | Me.AddPresetNameTextBox.Name = "AddPresetNameTextBox" 61 | Me.AddPresetNameTextBox.Size = New System.Drawing.Size(271, 24) 62 | Me.AddPresetNameTextBox.TabIndex = 2 63 | ' 64 | 'PresetServersLabel 65 | ' 66 | Me.PresetServersLabel.AutoSize = True 67 | Me.PresetServersLabel.Font = New System.Drawing.Font("Arial", 8.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) 68 | Me.PresetServersLabel.Location = New System.Drawing.Point(63, 75) 69 | Me.PresetServersLabel.Margin = New System.Windows.Forms.Padding(5, 0, 5, 0) 70 | Me.PresetServersLabel.Name = "PresetServersLabel" 71 | Me.PresetServersLabel.Size = New System.Drawing.Size(116, 18) 72 | Me.PresetServersLabel.TabIndex = 3 73 | Me.PresetServersLabel.Text = "Preset Servers" 74 | ' 75 | 'AddPresetButton 76 | ' 77 | Me.AddPresetButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) 78 | Me.AddPresetButton.Location = New System.Drawing.Point(214, 457) 79 | Me.AddPresetButton.Margin = New System.Windows.Forms.Padding(5, 5, 5, 5) 80 | Me.AddPresetButton.Name = "AddPresetButton" 81 | Me.AddPresetButton.Size = New System.Drawing.Size(123, 26) 82 | Me.AddPresetButton.TabIndex = 8 83 | Me.AddPresetButton.Text = "Add Preset" 84 | Me.AddPresetButton.UseVisualStyleBackColor = True 85 | ' 86 | 'ResetPresetSelectionButton 87 | ' 88 | Me.ResetPresetSelectionButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) 89 | Me.ResetPresetSelectionButton.Location = New System.Drawing.Point(66, 457) 90 | Me.ResetPresetSelectionButton.Margin = New System.Windows.Forms.Padding(5, 5, 5, 5) 91 | Me.ResetPresetSelectionButton.Name = "ResetPresetSelectionButton" 92 | Me.ResetPresetSelectionButton.Size = New System.Drawing.Size(123, 26) 93 | Me.ResetPresetSelectionButton.TabIndex = 9 94 | Me.ResetPresetSelectionButton.Text = "Reset Selection" 95 | Me.ResetPresetSelectionButton.UseVisualStyleBackColor = True 96 | ' 97 | 'AddPresetForm 98 | ' 99 | Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!) 100 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font 101 | Me.ClientSize = New System.Drawing.Size(400, 500) 102 | Me.Controls.Add(Me.ResetPresetSelectionButton) 103 | Me.Controls.Add(Me.AddPresetButton) 104 | Me.Controls.Add(Me.PresetServersLabel) 105 | Me.Controls.Add(Me.AddPresetNameTextBox) 106 | Me.Controls.Add(Me.PresetNameLabel) 107 | Me.Controls.Add(Me.PresetServersCheckedListBox) 108 | Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 7.8!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) 109 | Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog 110 | Me.Margin = New System.Windows.Forms.Padding(5, 5, 5, 5) 111 | Me.MaximizeBox = False 112 | Me.Name = "AddPresetForm" 113 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent 114 | Me.Text = "Add Preset" 115 | Me.ResumeLayout(False) 116 | Me.PerformLayout() 117 | 118 | End Sub 119 | 120 | Friend WithEvents PresetServersCheckedListBox As CheckedListBox 121 | Friend WithEvents PresetNameLabel As Label 122 | Friend WithEvents AddPresetNameTextBox As TextBox 123 | Friend WithEvents PresetServersLabel As Label 124 | Friend WithEvents AddPresetButton As Button 125 | Friend WithEvents ResetPresetSelectionButton As Button 126 | End Class 127 | -------------------------------------------------------------------------------- /CS2ServerPicker/Presets/AddPresetForm.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 | -------------------------------------------------------------------------------- /CS2ServerPicker/Presets/AddPresetForm.vb: -------------------------------------------------------------------------------- 1 | Imports Newtonsoft.Json 2 | Imports Newtonsoft.Json.Linq 3 | Imports System.IO 4 | 5 | Public Class AddPresetForm 6 | Private Sub AddPresetForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load 7 | ' reset checked list box items 8 | PresetServersCheckedListBox.Items.Clear() 9 | 10 | ' load server dictionary names to checked list box on add preset form load 11 | Dim serverDictionary As Dictionary(Of String, String) = IIf(App.Get_Is_Clustered(), App.Get_Server_Dictionary_Clustered(), App.Get_Server_Dictionary_Unclustered()) 12 | 13 | For Each kvp As KeyValuePair(Of String, String) In serverDictionary 14 | PresetServersCheckedListBox.Items.Add(kvp.Key) 15 | Next 16 | End Sub 17 | 18 | Private Sub AddPresetButton_Click(sender As Object, e As EventArgs) Handles AddPresetButton.Click 19 | ' add/create a preset from selected servers on add preset button click 20 | Dim presetName As String = AddPresetNameTextBox.Text 21 | Dim presetNameTrimmed = presetName.Replace(" ", "") 22 | Dim regex As Text.RegularExpressions.Regex = New Text.RegularExpressions.Regex("[^a-zA-Z0-9 ]") 23 | 24 | If String.IsNullOrWhiteSpace(presetName) Or regex.IsMatch(presetName) Then 25 | MessageBox.Show("Preset name field cannot be empty nor have special characters.", "Info") 26 | 27 | Return 28 | End If 29 | 30 | If PresetServersCheckedListBox.CheckedItems.Count <= 0 Then 31 | MessageBox.Show("Please select atleast 1 or more servers to add a preset.", "Info") 32 | 33 | Return 34 | End If 35 | 36 | Try 37 | ' deserialize presets back to its complex form 38 | Dim jObj As JObject = JObject.Parse(File.ReadAllText("presets.json")) 39 | 40 | If jObj.ContainsKey(presetNameTrimmed) Then 41 | MessageBox.Show("Given preset name already exists.", "Info") 42 | 43 | Return 44 | End If 45 | 46 | ' property uses trimmed preset name, access unmodified name through child prop (presetName) 47 | jObj.Add(presetNameTrimmed, New JObject( 48 | New JProperty("presetName", presetName), 49 | New JProperty("clustered", App.Get_Is_Clustered()), 50 | New JProperty("servers", JArray.FromObject(PresetServersCheckedListBox.CheckedItems)) 51 | ) 52 | ) 53 | 54 | ' serialize jObj to primitive form in presets json file 55 | File.WriteAllText("presets.json", JsonConvert.SerializeObject(jObj, Formatting.Indented)) 56 | 57 | ' refresh/reload presets control data grids 58 | Presets.Load_Presets() 59 | 60 | MessageBox.Show("Succesfully added preset!", "Info") 61 | Catch ex As Exception 62 | Log_Exception_To_File(ex, "An error has occured while adding preset!") 63 | 64 | MessageBox.Show("An error has occured while adding preset! Please upload error file to github issue tracker.", "Add Preset Error") 65 | End Try 66 | End Sub 67 | 68 | Private Sub ResetPresetSelectionButton_Click(sender As Object, e As EventArgs) Handles ResetPresetSelectionButton.Click 69 | Dim checkedIndexes As CheckedListBox.CheckedIndexCollection = PresetServersCheckedListBox.CheckedIndices 70 | 71 | If checkedIndexes.Count = 0 Then 72 | Return 73 | End If 74 | 75 | For Each selectedIndex As Integer In checkedIndexes 76 | PresetServersCheckedListBox.SetItemChecked(selectedIndex, False) 77 | Next 78 | End Sub 79 | End Class -------------------------------------------------------------------------------- /CS2ServerPicker/Presets/DeletePresetForm.Designer.vb: -------------------------------------------------------------------------------- 1 |  _ 2 | Partial Class DeletePresetForm 3 | Inherits System.Windows.Forms.Form 4 | 5 | 'Form overrides dispose to clean up the component list. 6 | _ 7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean) 8 | Try 9 | If disposing AndAlso components IsNot Nothing Then 10 | components.Dispose() 11 | End If 12 | Finally 13 | MyBase.Dispose(disposing) 14 | End Try 15 | End Sub 16 | 17 | 'Required by the Windows Form Designer 18 | Private components As System.ComponentModel.IContainer 19 | 20 | 'NOTE: The following procedure is required by the Windows Form Designer 21 | 'It can be modified using the Windows Form Designer. 22 | 'Do not modify it using the code editor. 23 | _ 24 | Private Sub InitializeComponent() 25 | Me.PresetConfirmationLabel = New System.Windows.Forms.Label() 26 | Me.DeletePresetButton = New System.Windows.Forms.Button() 27 | Me.CloseDeletePresetFormButton = New System.Windows.Forms.Button() 28 | Me.SuspendLayout() 29 | ' 30 | 'PresetConfirmationLabel 31 | ' 32 | Me.PresetConfirmationLabel.AutoSize = True 33 | Me.PresetConfirmationLabel.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Bold) 34 | Me.PresetConfirmationLabel.Location = New System.Drawing.Point(85, 44) 35 | Me.PresetConfirmationLabel.Name = "PresetConfirmationLabel" 36 | Me.PresetConfirmationLabel.Size = New System.Drawing.Size(179, 18) 37 | Me.PresetConfirmationLabel.TabIndex = 3 38 | Me.PresetConfirmationLabel.Text = "Delete selected preset?" 39 | ' 40 | 'DeletePresetButton 41 | ' 42 | Me.DeletePresetButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) 43 | Me.DeletePresetButton.Location = New System.Drawing.Point(40, 87) 44 | Me.DeletePresetButton.Name = "DeletePresetButton" 45 | Me.DeletePresetButton.Size = New System.Drawing.Size(97, 26) 46 | Me.DeletePresetButton.TabIndex = 9 47 | Me.DeletePresetButton.Text = "Yes" 48 | Me.DeletePresetButton.UseVisualStyleBackColor = True 49 | ' 50 | 'CloseDeletePresetFormButton 51 | ' 52 | Me.CloseDeletePresetFormButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) 53 | Me.CloseDeletePresetFormButton.Location = New System.Drawing.Point(165, 87) 54 | Me.CloseDeletePresetFormButton.Name = "CloseDeletePresetFormButton" 55 | Me.CloseDeletePresetFormButton.Size = New System.Drawing.Size(97, 26) 56 | Me.CloseDeletePresetFormButton.TabIndex = 10 57 | Me.CloseDeletePresetFormButton.Text = "No" 58 | Me.CloseDeletePresetFormButton.UseVisualStyleBackColor = True 59 | ' 60 | 'DeletePresetForm 61 | ' 62 | Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!) 63 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font 64 | Me.ClientSize = New System.Drawing.Size(306, 140) 65 | Me.Controls.Add(Me.CloseDeletePresetFormButton) 66 | Me.Controls.Add(Me.DeletePresetButton) 67 | Me.Controls.Add(Me.PresetConfirmationLabel) 68 | Me.Font = New System.Drawing.Font("Arial", 8.5!) 69 | Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog 70 | Me.MaximizeBox = False 71 | Me.Name = "DeletePresetForm" 72 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent 73 | Me.Text = "Delete Preset" 74 | Me.ResumeLayout(False) 75 | Me.PerformLayout() 76 | 77 | End Sub 78 | Friend WithEvents PresetConfirmationLabel As Label 79 | Friend WithEvents DeletePresetButton As Button 80 | Friend WithEvents CloseDeletePresetFormButton As Button 81 | End Class 82 | -------------------------------------------------------------------------------- /CS2ServerPicker/Presets/DeletePresetForm.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 | -------------------------------------------------------------------------------- /CS2ServerPicker/Presets/DeletePresetForm.vb: -------------------------------------------------------------------------------- 1 | Imports Newtonsoft.Json 2 | Imports Newtonsoft.Json.Linq 3 | Imports System.IO 4 | 5 | Public Class DeletePresetForm 6 | Private Sub DeletePresetButton_Click(sender As Object, e As EventArgs) Handles DeletePresetButton.Click 7 | ' delete a preset from given preset name on delete preset button click 8 | Dim presetName As String = Presets.PresetsDataGridView.SelectedCells.Item(0).Value 9 | 10 | If String.IsNullOrWhiteSpace(presetName) Then 11 | MessageBox.Show("Preset name field cannot be empty.", "Info") 12 | 13 | Return 14 | End If 15 | 16 | Try 17 | Dim jObj As JObject = JObject.Parse(File.ReadAllText("presets.json")) 18 | 19 | If Not jObj.ContainsKey(presetName.Replace(" ", "")) Then 20 | MessageBox.Show("Given preset name does not exists.", "Info") 21 | 22 | Return 23 | End If 24 | 25 | ' remove property from jObj 26 | jObj.Remove(presetName.Replace(" ", "")) 27 | 28 | ' serialize jObj to presets json file 29 | File.WriteAllText("presets.json", JsonConvert.SerializeObject(jObj, Formatting.Indented)) 30 | 31 | ' refresh/reload presets control data grids 32 | Presets.Load_Presets() 33 | Catch ex As Exception 34 | Log_Exception_To_File(ex, "An error has occured while deleting preset!") 35 | 36 | MessageBox.Show("An error has occured while deleting preset! Please upload error file to github issue tracker.", "Delete Preset Error") 37 | 38 | Return 39 | End Try 40 | 41 | MessageBox.Show("Succesfully deleted preset!") 42 | 43 | Close() 44 | End Sub 45 | 46 | Private Sub CloseDeletePresetFormButton_Click(sender As Object, e As EventArgs) Handles CloseDeletePresetFormButton.Click 47 | Close() 48 | End Sub 49 | End Class -------------------------------------------------------------------------------- /CS2ServerPicker/Presets/Presets.Designer.vb: -------------------------------------------------------------------------------- 1 |  2 | Partial Class Presets 3 | Inherits System.Windows.Forms.Form 4 | 5 | 'Form overrides dispose to clean up the component list. 6 | 7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean) 8 | Try 9 | If disposing AndAlso components IsNot Nothing Then 10 | components.Dispose() 11 | End If 12 | Finally 13 | MyBase.Dispose(disposing) 14 | End Try 15 | End Sub 16 | 17 | 'Required by the Windows Form Designer 18 | Private components As System.ComponentModel.IContainer 19 | 20 | 'NOTE: The following procedure is required by the Windows Form Designer 21 | 'It can be modified using the Windows Form Designer. 22 | 'Do not modify it using the code editor. 23 | 24 | Private Sub InitializeComponent() 25 | Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() 26 | Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() 27 | Me.PresetsDataGridView = New System.Windows.Forms.DataGridView() 28 | Me.PresetList = New System.Windows.Forms.DataGridViewTextBoxColumn() 29 | Me.PresetServerListDataGridView = New System.Windows.Forms.DataGridView() 30 | Me.PresetServers = New System.Windows.Forms.DataGridViewTextBoxColumn() 31 | Me.BlockPresetServersButton = New System.Windows.Forms.Button() 32 | Me.AddPresetFormButton = New System.Windows.Forms.Button() 33 | Me.DeletePresetFormButton = New System.Windows.Forms.Button() 34 | Me.BlockExceptPresetServersButton = New System.Windows.Forms.Button() 35 | Me.UpdatePresetFormButton = New System.Windows.Forms.Button() 36 | CType(Me.PresetsDataGridView, System.ComponentModel.ISupportInitialize).BeginInit() 37 | CType(Me.PresetServerListDataGridView, System.ComponentModel.ISupportInitialize).BeginInit() 38 | Me.SuspendLayout() 39 | ' 40 | 'PresetsDataGridView 41 | ' 42 | Me.PresetsDataGridView.AllowUserToAddRows = False 43 | Me.PresetsDataGridView.AllowUserToDeleteRows = False 44 | Me.PresetsDataGridView.AllowUserToOrderColumns = True 45 | Me.PresetsDataGridView.AllowUserToResizeRows = False 46 | Me.PresetsDataGridView.BorderStyle = System.Windows.Forms.BorderStyle.None 47 | DataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter 48 | DataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control 49 | DataGridViewCellStyle1.Font = New System.Drawing.Font("Arial", 8.5!) 50 | DataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText 51 | DataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight 52 | DataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText 53 | DataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] 54 | Me.PresetsDataGridView.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle1 55 | Me.PresetsDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize 56 | Me.PresetsDataGridView.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.PresetList}) 57 | Me.PresetsDataGridView.Location = New System.Drawing.Point(30, 56) 58 | Me.PresetsDataGridView.MultiSelect = False 59 | Me.PresetsDataGridView.Name = "PresetsDataGridView" 60 | Me.PresetsDataGridView.RowHeadersVisible = False 61 | Me.PresetsDataGridView.RowHeadersWidth = 51 62 | Me.PresetsDataGridView.RowTemplate.Height = 24 63 | Me.PresetsDataGridView.Size = New System.Drawing.Size(243, 320) 64 | Me.PresetsDataGridView.TabIndex = 0 65 | ' 66 | 'PresetList 67 | ' 68 | Me.PresetList.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill 69 | Me.PresetList.HeaderText = "Presets" 70 | Me.PresetList.MinimumWidth = 6 71 | Me.PresetList.Name = "PresetList" 72 | Me.PresetList.ReadOnly = True 73 | Me.PresetList.Resizable = System.Windows.Forms.DataGridViewTriState.[False] 74 | ' 75 | 'PresetServerListDataGridView 76 | ' 77 | Me.PresetServerListDataGridView.AllowUserToAddRows = False 78 | Me.PresetServerListDataGridView.AllowUserToDeleteRows = False 79 | Me.PresetServerListDataGridView.AllowUserToOrderColumns = True 80 | Me.PresetServerListDataGridView.AllowUserToResizeRows = False 81 | DataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter 82 | DataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control 83 | DataGridViewCellStyle2.Font = New System.Drawing.Font("Arial", 8.5!) 84 | DataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText 85 | DataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight 86 | DataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText 87 | DataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] 88 | Me.PresetServerListDataGridView.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle2 89 | Me.PresetServerListDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize 90 | Me.PresetServerListDataGridView.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.PresetServers}) 91 | Me.PresetServerListDataGridView.Location = New System.Drawing.Point(299, 56) 92 | Me.PresetServerListDataGridView.Name = "PresetServerListDataGridView" 93 | Me.PresetServerListDataGridView.ReadOnly = True 94 | Me.PresetServerListDataGridView.RowHeadersVisible = False 95 | Me.PresetServerListDataGridView.RowHeadersWidth = 51 96 | Me.PresetServerListDataGridView.RowTemplate.Height = 24 97 | Me.PresetServerListDataGridView.Size = New System.Drawing.Size(458, 390) 98 | Me.PresetServerListDataGridView.TabIndex = 1 99 | ' 100 | 'PresetServers 101 | ' 102 | Me.PresetServers.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill 103 | Me.PresetServers.HeaderText = "Preset Servers" 104 | Me.PresetServers.MinimumWidth = 6 105 | Me.PresetServers.Name = "PresetServers" 106 | Me.PresetServers.ReadOnly = True 107 | Me.PresetServers.Resizable = System.Windows.Forms.DataGridViewTriState.[False] 108 | ' 109 | 'BlockPresetServersButton 110 | ' 111 | Me.BlockPresetServersButton.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) 112 | Me.BlockPresetServersButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Bold) 113 | Me.BlockPresetServersButton.Location = New System.Drawing.Point(159, 396) 114 | Me.BlockPresetServersButton.Name = "BlockPresetServersButton" 115 | Me.BlockPresetServersButton.Size = New System.Drawing.Size(114, 50) 116 | Me.BlockPresetServersButton.TabIndex = 4 117 | Me.BlockPresetServersButton.Text = "Block Preset" 118 | Me.BlockPresetServersButton.UseVisualStyleBackColor = False 119 | ' 120 | 'AddPresetFormButton 121 | ' 122 | Me.AddPresetFormButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Bold) 123 | Me.AddPresetFormButton.Location = New System.Drawing.Point(405, 24) 124 | Me.AddPresetFormButton.Name = "AddPresetFormButton" 125 | Me.AddPresetFormButton.Size = New System.Drawing.Size(109, 26) 126 | Me.AddPresetFormButton.TabIndex = 8 127 | Me.AddPresetFormButton.Text = "Add Preset" 128 | Me.AddPresetFormButton.UseVisualStyleBackColor = True 129 | ' 130 | 'DeletePresetFormButton 131 | ' 132 | Me.DeletePresetFormButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Bold) 133 | Me.DeletePresetFormButton.Location = New System.Drawing.Point(648, 24) 134 | Me.DeletePresetFormButton.Name = "DeletePresetFormButton" 135 | Me.DeletePresetFormButton.Size = New System.Drawing.Size(109, 26) 136 | Me.DeletePresetFormButton.TabIndex = 9 137 | Me.DeletePresetFormButton.Text = "Delete Preset" 138 | Me.DeletePresetFormButton.UseVisualStyleBackColor = True 139 | ' 140 | 'BlockExceptPresetServersButton 141 | ' 142 | Me.BlockExceptPresetServersButton.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(128, Byte), Integer)) 143 | Me.BlockExceptPresetServersButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Bold) 144 | Me.BlockExceptPresetServersButton.Location = New System.Drawing.Point(30, 396) 145 | Me.BlockExceptPresetServersButton.Name = "BlockExceptPresetServersButton" 146 | Me.BlockExceptPresetServersButton.Size = New System.Drawing.Size(123, 50) 147 | Me.BlockExceptPresetServersButton.TabIndex = 10 148 | Me.BlockExceptPresetServersButton.Text = "Block Except " & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Preset" 149 | Me.BlockExceptPresetServersButton.UseVisualStyleBackColor = False 150 | ' 151 | 'UpdatePresetFormButton 152 | ' 153 | Me.UpdatePresetFormButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Bold) 154 | Me.UpdatePresetFormButton.Location = New System.Drawing.Point(520, 24) 155 | Me.UpdatePresetFormButton.Name = "UpdatePresetFormButton" 156 | Me.UpdatePresetFormButton.Size = New System.Drawing.Size(122, 26) 157 | Me.UpdatePresetFormButton.TabIndex = 11 158 | Me.UpdatePresetFormButton.Text = "Update Preset" 159 | Me.UpdatePresetFormButton.UseVisualStyleBackColor = True 160 | ' 161 | 'Presets 162 | ' 163 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 14.0!) 164 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font 165 | Me.ClientSize = New System.Drawing.Size(800, 479) 166 | Me.Controls.Add(Me.UpdatePresetFormButton) 167 | Me.Controls.Add(Me.BlockExceptPresetServersButton) 168 | Me.Controls.Add(Me.DeletePresetFormButton) 169 | Me.Controls.Add(Me.AddPresetFormButton) 170 | Me.Controls.Add(Me.BlockPresetServersButton) 171 | Me.Controls.Add(Me.PresetServerListDataGridView) 172 | Me.Controls.Add(Me.PresetsDataGridView) 173 | Me.Font = New System.Drawing.Font("Arial", 8.5!) 174 | Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog 175 | Me.MaximizeBox = False 176 | Me.Name = "Presets" 177 | Me.Text = "Presets" 178 | CType(Me.PresetsDataGridView, System.ComponentModel.ISupportInitialize).EndInit() 179 | CType(Me.PresetServerListDataGridView, System.ComponentModel.ISupportInitialize).EndInit() 180 | Me.ResumeLayout(False) 181 | 182 | End Sub 183 | 184 | Friend WithEvents PresetsDataGridView As DataGridView 185 | Friend WithEvents PresetServerListDataGridView As DataGridView 186 | Friend WithEvents BlockPresetServersButton As Button 187 | Friend WithEvents AddPresetFormButton As Button 188 | Friend WithEvents DeletePresetFormButton As Button 189 | Friend WithEvents PresetList As DataGridViewTextBoxColumn 190 | Friend WithEvents PresetServers As DataGridViewTextBoxColumn 191 | Friend WithEvents BlockExceptPresetServersButton As Button 192 | Friend WithEvents UpdatePresetFormButton As Button 193 | End Class 194 | -------------------------------------------------------------------------------- /CS2ServerPicker/Presets/Presets.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | True 122 | 123 | 124 | True 125 | 126 | -------------------------------------------------------------------------------- /CS2ServerPicker/Presets/Presets.vb: -------------------------------------------------------------------------------- 1 | Imports Newtonsoft.Json.Linq 2 | Imports System.IO 3 | 4 | Public Class Presets 5 | Private Sub AddPresetFormButton_Click(sender As Object, e As EventArgs) Handles AddPresetFormButton.Click 6 | AddPresetForm.ShowDialog() 7 | AddPresetForm.Activate() 8 | End Sub 9 | 10 | Private Sub DeletePresetFormButton_Click(sender As Object, e As EventArgs) Handles DeletePresetFormButton.Click 11 | If PresetsDataGridView.SelectedCells.Count <= 0 Then 12 | MessageBox.Show("Please select a preset to delete.", "Info") 13 | 14 | Return 15 | End If 16 | 17 | DeletePresetForm.ShowDialog() 18 | DeletePresetForm.Activate() 19 | End Sub 20 | 21 | Private Sub UpdatePresetFormButton_Click(sender As Object, e As EventArgs) Handles UpdatePresetFormButton.Click 22 | If PresetsDataGridView.SelectedCells.Count <= 0 Then 23 | MessageBox.Show("Please select a preset to update.", "Info") 24 | 25 | Return 26 | End If 27 | 28 | UpdatePresetForm.ShowDialog() 29 | UpdatePresetForm.Activate() 30 | End Sub 31 | 32 | Private Sub BlockPresetServersButton_Click(sender As Object, e As EventArgs) Handles BlockPresetServersButton.Click 33 | If PresetServerListDataGridView.Rows.Count <= 0 Then 34 | MessageBox.Show("Please select a preset above.", "Info") 35 | 36 | Return 37 | End If 38 | 39 | ActiveForm.Close() 40 | 41 | Block_Except_Preset_Servers(False) 42 | End Sub 43 | 44 | Private Sub BlockExceptPresetServersButton_Click(sender As Object, e As EventArgs) Handles BlockExceptPresetServersButton.Click 45 | If PresetServerListDataGridView.Rows.Count <= 0 Then 46 | MessageBox.Show("Please select a preset above.", "Info") 47 | 48 | Return 49 | End If 50 | 51 | ActiveForm.Close() 52 | 53 | Block_Except_Preset_Servers(True) 54 | End Sub 55 | 56 | Private Sub Presets_Load(sender As Object, e As EventArgs) Handles MyBase.Load 57 | Load_Presets() 58 | End Sub 59 | 60 | Private Sub PresetsDataGridView_CellEnter(sender As Object, e As DataGridViewCellEventArgs) Handles PresetsDataGridView.CellEnter 61 | ' load selected preset servers 62 | ' this event gets fired twice on initial form load, cell value validations needed 63 | Dim presetName As String = PresetsDataGridView.Rows(e.RowIndex).Cells(0).Value 64 | 65 | If String.IsNullOrWhiteSpace(presetName) Then 66 | Return 67 | End If 68 | 69 | Load_Preset_Servers(presetName) 70 | End Sub 71 | 72 | Public Sub Load_Presets() 73 | ' load presets into presets data grid view 74 | 75 | ' clear preset and preset servers datagrid view rows 76 | PresetsDataGridView.Rows.Clear() 77 | PresetServerListDataGridView.Rows.Clear() 78 | 79 | Try 80 | ' create preset json file if not exists 81 | If Not File.Exists("presets.json") Then 82 | File.WriteAllText("presets.json", "{}") 83 | 84 | Return 85 | End If 86 | 87 | Dim presetsObj As JToken = JObject.Parse(File.ReadAllText("presets.json")) 88 | 89 | ' iterate presetsObj children properties to be added inside presets datagrid view 90 | For Each preset As JProperty In presetsObj 91 | ' skip adding preset if preset cluster boolean value is not equal to current cluster setting 92 | If Not CBool(preset.Value.SelectToken("clustered")) = App.Get_Is_Clustered() Then 93 | Continue For 94 | End If 95 | 96 | Dim rowIndex As Integer = PresetsDataGridView.Rows.Add() 97 | 98 | PresetsDataGridView.Rows(rowIndex).Cells(0).Value = preset.Value.SelectToken("presetName") 99 | Next 100 | Catch ex As Exception 101 | Log_Exception_To_File(ex, "An error has occured while loading presets!") 102 | 103 | MessageBox.Show("An error has occured while loading presets! Please upload error file to github issue tracker.", "Load Presets Error") 104 | End Try 105 | End Sub 106 | 107 | Public Sub Load_Preset_Servers(presetName As String) 108 | ' clear preset servers datagrid view rows 109 | PresetServerListDataGridView.Rows.Clear() 110 | 111 | Try 112 | ' this will only get triggered probably if presets.json file was deleted before loading preset servers 113 | If Not File.Exists("presets.json") Then 114 | MessageBox.Show("Presets missing! Presets file must have been deleted.", "Info") 115 | 116 | Load_Presets() 117 | 118 | Return 119 | End If 120 | 121 | Dim presetsObj As JObject = JObject.Parse(File.ReadAllText("presets.json")) 122 | 123 | ' iterate selected preset JArray servers to be added inside preset servers datagrid view 124 | ' escape preset name prop key to prevent invalid json path exception 125 | For Each server As JValue In presetsObj.SelectToken("['" + presetName.Replace(" ", "") + "']" + "." + "servers") 126 | Dim rowIndex As Integer = PresetServerListDataGridView.Rows.Add() 127 | 128 | PresetServerListDataGridView.Rows(rowIndex).Cells(0).Value = server 129 | Next 130 | Catch ex As Exception 131 | Log_Exception_To_File(ex, "An error has occured while loading preset servers!") 132 | 133 | MessageBox.Show("An error has occured while loading preset servers! Please upload error file to github issue tracker", "Load Preset Servers Error") 134 | End Try 135 | End Sub 136 | End Class -------------------------------------------------------------------------------- /CS2ServerPicker/Presets/UpdatePresetForm.Designer.vb: -------------------------------------------------------------------------------- 1 |  _ 2 | Partial Class UpdatePresetForm 3 | Inherits System.Windows.Forms.Form 4 | 5 | 'Form overrides dispose to clean up the component list. 6 | _ 7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean) 8 | Try 9 | If disposing AndAlso components IsNot Nothing Then 10 | components.Dispose() 11 | End If 12 | Finally 13 | MyBase.Dispose(disposing) 14 | End Try 15 | End Sub 16 | 17 | 'Required by the Windows Form Designer 18 | Private components As System.ComponentModel.IContainer 19 | 20 | 'NOTE: The following procedure is required by the Windows Form Designer 21 | 'It can be modified using the Windows Form Designer. 22 | 'Do not modify it using the code editor. 23 | _ 24 | Private Sub InitializeComponent() 25 | Me.ResetPresetSelectionButton = New System.Windows.Forms.Button() 26 | Me.UpdatePresetButton = New System.Windows.Forms.Button() 27 | Me.PresetServersLabel = New System.Windows.Forms.Label() 28 | Me.UpdatePresetNameTextBox = New System.Windows.Forms.TextBox() 29 | Me.PresetNameLabel = New System.Windows.Forms.Label() 30 | Me.PresetServersCheckedListBox = New System.Windows.Forms.CheckedListBox() 31 | Me.SuspendLayout() 32 | ' 33 | 'ResetPresetSelectionButton 34 | ' 35 | Me.ResetPresetSelectionButton.Font = New System.Drawing.Font("Arial", 8.5!) 36 | Me.ResetPresetSelectionButton.Location = New System.Drawing.Point(66, 457) 37 | Me.ResetPresetSelectionButton.Name = "ResetPresetSelectionButton" 38 | Me.ResetPresetSelectionButton.Size = New System.Drawing.Size(123, 26) 39 | Me.ResetPresetSelectionButton.TabIndex = 15 40 | Me.ResetPresetSelectionButton.Text = "Reset Selection" 41 | Me.ResetPresetSelectionButton.UseVisualStyleBackColor = True 42 | ' 43 | 'UpdatePresetButton 44 | ' 45 | Me.UpdatePresetButton.Font = New System.Drawing.Font("Arial", 8.5!) 46 | Me.UpdatePresetButton.Location = New System.Drawing.Point(214, 457) 47 | Me.UpdatePresetButton.Name = "UpdatePresetButton" 48 | Me.UpdatePresetButton.Size = New System.Drawing.Size(123, 26) 49 | Me.UpdatePresetButton.TabIndex = 14 50 | Me.UpdatePresetButton.Text = "Update Preset" 51 | Me.UpdatePresetButton.UseVisualStyleBackColor = True 52 | ' 53 | 'PresetServersLabel 54 | ' 55 | Me.PresetServersLabel.AutoSize = True 56 | Me.PresetServersLabel.Font = New System.Drawing.Font("Arial", 8.75!, System.Drawing.FontStyle.Bold) 57 | Me.PresetServersLabel.Location = New System.Drawing.Point(63, 75) 58 | Me.PresetServersLabel.Name = "PresetServersLabel" 59 | Me.PresetServersLabel.Size = New System.Drawing.Size(116, 18) 60 | Me.PresetServersLabel.TabIndex = 13 61 | Me.PresetServersLabel.Text = "Preset Servers" 62 | ' 63 | 'UpdatePresetNameTextBox 64 | ' 65 | Me.UpdatePresetNameTextBox.Font = New System.Drawing.Font("Arial", 8.5!) 66 | Me.UpdatePresetNameTextBox.Location = New System.Drawing.Point(66, 43) 67 | Me.UpdatePresetNameTextBox.Name = "UpdatePresetNameTextBox" 68 | Me.UpdatePresetNameTextBox.Size = New System.Drawing.Size(271, 24) 69 | Me.UpdatePresetNameTextBox.TabIndex = 12 70 | ' 71 | 'PresetNameLabel 72 | ' 73 | Me.PresetNameLabel.AutoSize = True 74 | Me.PresetNameLabel.Font = New System.Drawing.Font("Arial", 8.75!, System.Drawing.FontStyle.Bold) 75 | Me.PresetNameLabel.Location = New System.Drawing.Point(63, 18) 76 | Me.PresetNameLabel.Name = "PresetNameLabel" 77 | Me.PresetNameLabel.Size = New System.Drawing.Size(99, 18) 78 | Me.PresetNameLabel.TabIndex = 11 79 | Me.PresetNameLabel.Text = "Preset Name" 80 | ' 81 | 'PresetServersCheckedListBox 82 | ' 83 | Me.PresetServersCheckedListBox.CheckOnClick = True 84 | Me.PresetServersCheckedListBox.Font = New System.Drawing.Font("Arial", 8.5!) 85 | Me.PresetServersCheckedListBox.FormattingEnabled = True 86 | Me.PresetServersCheckedListBox.Location = New System.Drawing.Point(66, 100) 87 | Me.PresetServersCheckedListBox.Name = "PresetServersCheckedListBox" 88 | Me.PresetServersCheckedListBox.Size = New System.Drawing.Size(271, 327) 89 | Me.PresetServersCheckedListBox.TabIndex = 10 90 | ' 91 | 'UpdatePresetForm 92 | ' 93 | Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!) 94 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font 95 | Me.ClientSize = New System.Drawing.Size(400, 500) 96 | Me.Controls.Add(Me.ResetPresetSelectionButton) 97 | Me.Controls.Add(Me.UpdatePresetButton) 98 | Me.Controls.Add(Me.PresetServersLabel) 99 | Me.Controls.Add(Me.UpdatePresetNameTextBox) 100 | Me.Controls.Add(Me.PresetNameLabel) 101 | Me.Controls.Add(Me.PresetServersCheckedListBox) 102 | Me.Font = New System.Drawing.Font("Arial", 8.5!) 103 | Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog 104 | Me.MaximizeBox = False 105 | Me.Name = "UpdatePresetForm" 106 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent 107 | Me.Text = "Update Preset" 108 | Me.ResumeLayout(False) 109 | Me.PerformLayout() 110 | 111 | End Sub 112 | 113 | Friend WithEvents ResetPresetSelectionButton As Button 114 | Friend WithEvents UpdatePresetButton As Button 115 | Friend WithEvents PresetServersLabel As Label 116 | Friend WithEvents UpdatePresetNameTextBox As TextBox 117 | Friend WithEvents PresetNameLabel As Label 118 | Friend WithEvents PresetServersCheckedListBox As CheckedListBox 119 | End Class 120 | -------------------------------------------------------------------------------- /CS2ServerPicker/Presets/UpdatePresetForm.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 | -------------------------------------------------------------------------------- /CS2ServerPicker/Presets/UpdatePresetForm.vb: -------------------------------------------------------------------------------- 1 | Imports System.IO 2 | Imports Newtonsoft.Json 3 | Imports Newtonsoft.Json.Linq 4 | 5 | Public Class UpdatePresetForm 6 | 7 | Private initialPresetName As String 8 | 9 | Private Sub UpdatePresetForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load 10 | ' reset checked list box items 11 | PresetServersCheckedListBox.Items.Clear() 12 | 13 | ' will be used to select unmodified JObject instead of using updated preset name 14 | initialPresetName = Presets.PresetsDataGridView.SelectedCells.Item(0).Value 15 | 16 | UpdatePresetNameTextBox.Text = initialPresetName 17 | 18 | ' load server dictionary names to checked list box on add preset form load 19 | Dim serverDictionary As Dictionary(Of String, String) = IIf(App.Get_Is_Clustered(), App.Get_Server_Dictionary_Clustered(), App.Get_Server_Dictionary_Unclustered()) 20 | 21 | Dim presetServersDataGridView As DataGridView = Presets.PresetServerListDataGridView 22 | 23 | Dim presetServerNames As HashSet(Of String) = New HashSet(Of String) 24 | 25 | ' collect preset server names as basis for displaying preset servers 26 | For Each presetRow As DataGridViewRow In presetServersDataGridView.Rows 27 | presetServerNames.Add(presetRow.Cells(0).Value) 28 | Next 29 | 30 | For Each serverKvp As KeyValuePair(Of String, String) In serverDictionary 31 | Dim serverIndex As Integer = PresetServersCheckedListBox.Items.Add(serverKvp.Key) 32 | 33 | ' conditionally check preset servers 34 | If presetServerNames.Contains(serverKvp.Key) Then 35 | PresetServersCheckedListBox.SetItemChecked(serverIndex, True) 36 | End If 37 | Next 38 | End Sub 39 | 40 | Private Sub UpdatePresetButton_Click(sender As Object, e As EventArgs) Handles UpdatePresetButton.Click 41 | Dim presetName As String = UpdatePresetNameTextBox.Text 42 | Dim presetNameTrimmed = presetName.Replace(" ", "") 43 | Dim regex As Text.RegularExpressions.Regex = New Text.RegularExpressions.Regex("[^a-zA-Z0-9 ]") 44 | 45 | If String.IsNullOrWhiteSpace(presetName) Or regex.IsMatch(presetName) Then 46 | MessageBox.Show("Preset name field cannot be empty nor have any special characters.", "Info") 47 | 48 | Return 49 | End If 50 | 51 | If PresetServersCheckedListBox.CheckedItems.Count <= 0 Then 52 | MessageBox.Show("Please select preset servers.", "Info") 53 | 54 | Return 55 | End If 56 | 57 | Try 58 | ' deserialize presets back to its complex form 59 | Dim jObj As JObject = JObject.Parse(File.ReadAllText("presets.json")) 60 | 61 | ' remove old property, an exception will be thrown if same property exist 62 | jObj.Remove(initialPresetName.Replace(" ", "")) 63 | 64 | ' property uses trimmed preset name, untrimmed preset name through a child prop (presetName) 65 | jObj.Add(presetNameTrimmed, New JObject( 66 | New JProperty("presetName", presetName), 67 | New JProperty("clustered", App.Get_Is_Clustered()), 68 | New JProperty("servers", JArray.FromObject(PresetServersCheckedListBox.CheckedItems)) 69 | ) 70 | ) 71 | 72 | ' serialize jObj to primitive form in presets json file 73 | File.WriteAllText("presets.json", JsonConvert.SerializeObject(jObj, Formatting.Indented)) 74 | 75 | ' refresh/reload presets control data grids 76 | Presets.Load_Presets() 77 | 78 | initialPresetName = presetName 79 | 80 | MessageBox.Show("Succesfully updated preset!", "Info") 81 | Catch ex As Exception 82 | Log_Exception_To_File(ex, "An error has occured while updating preset!") 83 | 84 | MessageBox.Show("An error has occured while updating preset! Please upload error file to github issue tracker.", "Update Preset Error") 85 | End Try 86 | End Sub 87 | 88 | Private Sub ResetPresetSelectionButton_Click(sender As Object, e As EventArgs) Handles ResetPresetSelectionButton.Click 89 | Dim checkedIndexes As CheckedListBox.CheckedIndexCollection = PresetServersCheckedListBox.CheckedIndices 90 | 91 | If checkedIndexes.Count = 0 Then 92 | Return 93 | End If 94 | 95 | For Each selectedIndex As Integer In checkedIndexes 96 | PresetServersCheckedListBox.SetItemChecked(selectedIndex, False) 97 | Next 98 | End Sub 99 | End Class -------------------------------------------------------------------------------- /CS2ServerPicker/Services/DataGridViewService.vb: -------------------------------------------------------------------------------- 1 | Module DataGridViewService 2 | 3 | Public Sub Load_Server_List() 4 | Dim serverDict As Dictionary(Of String, String) = IIf(App.Get_Is_Clustered(), App.Get_Server_Dictionary_Clustered(), App.Get_Server_Dictionary_Unclustered) 5 | 6 | Dim dg As DataGridView = App.Get_DataGridView_Control() 7 | 8 | ' display each server name key value from server dictionary in the datagridview control 9 | For Each kvp As KeyValuePair(Of String, String) In serverDict 10 | Dim rowIndex As Integer = App.Get_DataGridView_Control().Rows().Add() 11 | 12 | dg.Rows(rowIndex).Cells(0).Value = My.Resources.ResourceManager.GetObject(kvp.Key) 13 | dg.Rows(rowIndex).Cells(1).Value = kvp.Key 14 | Next 15 | 16 | End Sub 17 | 18 | Public Sub Clear_Column_Values() 19 | For Each row As DataGridViewRow In App.Get_DataGridView_Control().Rows 20 | row.Cells(2).Value = String.Empty 21 | row.Cells(2).Style.BackColor = Color.Empty 22 | Next 23 | End Sub 24 | 25 | Public Sub Clear_DataGridView_Rows() 26 | App.Get_DataGridView_Control.Rows.Clear() 27 | End Sub 28 | End Module 29 | -------------------------------------------------------------------------------- /CS2ServerPicker/Services/LogService.vb: -------------------------------------------------------------------------------- 1 | Imports System.IO 2 | 3 | Module LogService 4 | Public Sub Log_To_File(text As String, Optional fileName As String = "") 5 | File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + 6 | IIf(Not fileName = "", fileName, "log_" + DateTimeOffset.Now.ToUnixTimeSeconds.ToString()) + ".txt", 7 | text + Environment.NewLine) 8 | End Sub 9 | 10 | Public Sub Log_Exception_To_File(exception As Exception, errorFrom As String, Optional fileName As String = "") 11 | File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + 12 | IIf(Not fileName = "", fileName, "error_" + DateTimeOffset.Now.ToUnixTimeSeconds.ToString()) + ".txt", 13 | errorFrom + Environment.NewLine + exception.Message) 14 | End Sub 15 | End Module 16 | -------------------------------------------------------------------------------- /CS2ServerPicker/Services/PingService.vb: -------------------------------------------------------------------------------- 1 | Module PingService 2 | 3 | Public Async Sub Ping_Servers(dgRows As DataGridViewSelectedRowCollection) 4 | ' DO NOT call this procedure in a separate thread 5 | ' it references UI controls which can only be accessed in the UI thread 6 | Dim serverDict As Dictionary(Of String, String) = IIf(App.Get_Is_Clustered(), App.Get_Server_Dictionary_Clustered(), App.Get_Server_Dictionary_Unclustered()) 7 | 8 | For Each dgRow As DataGridViewRow In dgRows 9 | Dim serverName As String = dgRow.Cells(1).Value 10 | ' string of addresses joined by "," wil be splitted where each address is pinged 11 | Dim addresses As String = serverDict.Item(serverName) 12 | 13 | Cancel_Pending_Ping(serverName) 14 | 15 | dgRow.Cells(2).Value = "Refreshing..." 16 | 17 | Await Task.Run(Sub() Ping_Handler(addresses, dgRow)) 18 | Next 19 | End Sub 20 | 21 | Public Async Sub Ping_All_Servers() 22 | ' DO NOT call this procedure in a separate thread 23 | Clear_Column_Values() 24 | 25 | Cancel_Pending_Ping() 26 | 27 | Dim serverDictionary As Dictionary(Of String, String) = IIf(App.Get_Is_Clustered(), App.Get_Server_Dictionary_Clustered(), App.Get_Server_Dictionary_Unclustered()) 28 | 29 | For Each dgRow As DataGridViewRow In App.Get_DataGridView_Control().Rows() 30 | ' comma separated server addresses, will get split 31 | Dim addresses As String = serverDictionary.Item(dgRow.Cells(1).Value) 32 | 33 | Await Task.Run(Sub() Ping_Handler(addresses, dgRow)) 34 | Next 35 | End Sub 36 | 37 | Public Async Sub Ping_Handler(addresses As String, row As DataGridViewRow) 38 | If Is_Server_Blocked_Or_Unblocked(row.Cells(1).Value, True) Then 39 | ' do not ping if server is blocked 40 | row.Cells(1).Style.BackColor = Color.FromArgb(255, 128, 128) 41 | row.Cells(2).Style.BackColor = Color.FromArgb(255, 128, 128) 42 | row.Cells(2).Value = "Blocked" 43 | 44 | Return 45 | ElseIf row.Cells(1).Style.BackColor = Color.FromArgb(255, 128, 128) Then 46 | ' if server is not blocked and cell back color is red then unset color 47 | row.Cells(1).Style.BackColor = Color.Empty 48 | row.Cells(2).Style.BackColor = Color.Empty 49 | End If 50 | 51 | Dim ping As New Net.NetworkInformation.Ping 52 | Dim pingObjsDict As Dictionary(Of String, Net.NetworkInformation.Ping) = App.Get_Ping_Objects_Dictionary() 53 | Dim pingResult As Integer = 0 54 | 55 | ' add created ping obj to dictionary that gets cleared on subsequent refresh or form close 56 | If Not pingObjsDict.ContainsKey(row.Cells(1).Value) Then 57 | pingObjsDict.Add(row.Cells(1).Value, ping) 58 | End If 59 | 60 | row.Cells(2).Value = "Getting latency..." 61 | 62 | ' this loop maintains its context through suspension points (Await) so I don't have to worry about race conditions 63 | For Each address As String In addresses.Split(",") 64 | Try 65 | Dim result = Await ping.SendPingAsync(address) 66 | 67 | ' exit loop on first successful ping 68 | If result.RoundtripTime > 0 Then 69 | pingResult = result.RoundtripTime 70 | 71 | row.Cells(2).Value = pingResult.ToString() + "ms" 72 | row.Cells(2).Style.BackColor = Color.LightGreen 73 | 74 | Exit For 75 | End If 76 | Catch ex As Exception 77 | Continue For 78 | End Try 79 | Next 80 | 81 | If pingResult = 0 Then 82 | row.Cells(2).Value = "Ping timed out, try again..." 83 | row.Cells(2).Style.BackColor = Color.Orange 84 | End If 85 | 86 | ping.Dispose() 87 | End Sub 88 | 89 | Public Sub Cancel_Pending_Ping(Optional serverName As String = "") 90 | Dim pingObjs = App.Get_Ping_Objects_Dictionary() 91 | 92 | If pingObjs.Count <= 0 Then 93 | Return 94 | End If 95 | 96 | If String.IsNullOrEmpty(serverName) Then 97 | For Each ping As Net.NetworkInformation.Ping In pingObjs.Values 98 | ping.SendAsyncCancel() 99 | ping.Dispose() 100 | Next 101 | 102 | pingObjs.Clear() 103 | ElseIf pingObjs.ContainsKey(serverName) Then 104 | pingObjs.Item(serverName).SendAsyncCancel() 105 | pingObjs.Item(serverName).Dispose() 106 | 107 | pingObjs.Remove(serverName) 108 | End If 109 | End Sub 110 | End Module 111 | -------------------------------------------------------------------------------- /CS2ServerPicker/Services/ProcessService.vb: -------------------------------------------------------------------------------- 1 | Module ProcessService 2 | Public Function Create_Custom_CMD_Process() As Process 3 | Dim proc As Process = New Process() 4 | 5 | proc.StartInfo.FileName = "cmd.exe" 6 | proc.StartInfo.UseShellExecute = False 7 | proc.StartInfo.RedirectStandardError = True 8 | proc.StartInfo.RedirectStandardOutput = True 9 | proc.StartInfo.CreateNoWindow = True 10 | 11 | Return proc 12 | End Function 13 | End Module 14 | -------------------------------------------------------------------------------- /CS2ServerPicker/Services/ServerService.vb: -------------------------------------------------------------------------------- 1 | Imports System.IO 2 | Imports System.Net 3 | Imports Newtonsoft.Json.Linq 4 | Module ServerService 5 | 6 | Private clusterDict As New Dictionary(Of String, String) From { 7 | {"China", "Perfect,Hong Kong,Alibaba,Tencent"}, 8 | {"Japan", "Tokyo"}, 9 | {"Stockholm (Sweden)", "Stockholm"}, 10 | {"India", "Chennai,Mumbai"} 11 | } 12 | 13 | Private netshPath As String = Path.Combine(Environment.SystemDirectory, "netsh.exe") 14 | 15 | Public Async Function Fetch_Server_Data() As Task(Of String) 16 | Try 17 | Dim webReq As String = Await New WebClient().DownloadStringTaskAsync("https://api.steampowered.com/ISteamApps/GetSDRConfig/v1/?appid=730") 18 | 19 | Dim mainJson As JObject = JObject.Parse(webReq) 20 | Dim serverRevision As String = mainJson.SelectToken("revision").ToString() 21 | 22 | If serverRevision Is Nothing Then 23 | MessageBox.Show("Failed to load server data!" + Environment.NewLine + Environment.NewLine + 24 | "Possible solutions:" + Environment.NewLine + 25 | "1. Please make sure you are connected to the internet and no third-party software is blocking the app's internet access." + Environment.NewLine + 26 | "2. Use VPN incase your ISP has blocked access to numerous internet services, you may turn off the vpn after using this app." + Environment.NewLine + 27 | "3. Report to github tracker if previous steps are not able to resolve the issue.", "Server Data Fetch Error") 28 | 29 | Return "null" 30 | End If 31 | 32 | If My.Settings.Server_Revision Is Nothing Or String.IsNullOrEmpty(My.Settings.Server_Revision) Then 33 | My.Settings.Server_Revision = serverRevision 34 | My.Settings.Save() 35 | My.Settings.Reload() 36 | End If 37 | 38 | ' loop every server prop that holds an object that contains server info 39 | For Each serverProp As JProperty In mainJson.SelectToken("pops") 40 | ' if serverProp object value has relays prop then loop its Object array value 41 | If serverProp.Value.SelectToken("relays") IsNot Nothing Then 42 | Dim ipObjArr As JArray = serverProp.Value.SelectToken("relays") ' array of objects 43 | Dim ipArr As List(Of String) = New List(Of String) 44 | 45 | ' collect server relay addresses to an array 46 | For Each ipToken As JObject In ipObjArr 47 | ipArr.Add(ipToken.SelectToken("ipv4").ToString()) 48 | Next 49 | 50 | Dim serverName As String = serverProp.Value.SelectToken("desc").ToString() + " (" + serverProp.Name + ")" 51 | 52 | Dim serverIsClustered As Boolean = False 53 | 54 | ' if server is part of clustered servers then add/concatenate its ip addresses to its cluster name key 55 | For Each clusterKvp As KeyValuePair(Of String, String) In clusterDict ' traverse every cluster 56 | For Each clusterValue As String In clusterKvp.Value.Split(",") ' traverse cluster comma-separated server name values 57 | If serverName.Contains(clusterValue) Then ' check if server name prop is included as cluster array value 58 | If Not App.Get_Server_Dictionary_Clustered().ContainsKey(clusterKvp.Key) Then ' initialize cluster with values 59 | App.Get_Server_Dictionary_Clustered().Add(clusterKvp.Key, String.Join(",", ipArr)) 60 | Else ' concatenate server ip to clustered server 61 | App.Get_Server_Dictionary_Clustered().Item(clusterKvp.Key) = App.Get_Server_Dictionary_Clustered().Item(clusterKvp.Key) _ 62 | + "," + String.Join(",", ipArr) 63 | End If 64 | 65 | serverIsClustered = True 66 | End If 67 | Next 68 | Next 69 | 70 | ' Different server network IDs and geolocation that has existing server name prop were added. 71 | ' Validations on the dictionary to prevent duplicate key exception. 72 | If Not App.Get_Server_Dictionary_Unclustered().ContainsKey(serverName) Then 73 | App.Get_Server_Dictionary_Unclustered().Add(serverName, String.Join(",", ipArr)) 74 | Else 75 | App.Get_Server_Dictionary_Unclustered().Item(serverName) = App.Get_Server_Dictionary_Unclustered().Item(serverName) _ 76 | + "," + String.Join(",", ipArr) 77 | End If 78 | 79 | ' server is not part of clustered servers 80 | If Not serverIsClustered Then 81 | If Not App.Get_Server_Dictionary_Clustered().ContainsKey(serverName) Then 82 | App.Get_Server_Dictionary_Clustered().Add(serverName, String.Join(",", ipArr)) 83 | Else 84 | App.Get_Server_Dictionary_Clustered().Item(serverName) = App.Get_Server_Dictionary_Clustered().Item(serverName) _ 85 | + "," + String.Join(",", ipArr) 86 | End If 87 | End If 88 | End If 89 | Next 90 | 91 | Return serverRevision 92 | Catch ex As Exception 93 | Log_Exception_To_File(ex, "An error has occurred while retrieving or displaying server data!") 94 | 95 | MessageBox.Show("An error has occurred while retrieving or displaying server data! Please upload error file to github issue tracker", "Server Data Fetch/Display Error") 96 | 97 | Return "null" 98 | End Try 99 | End Function 100 | 101 | Public Async Sub Block_Except_Preset_Servers(Optional exceptPresetServers As Boolean = False) 102 | If App.Get_Pending_Operation() Then 103 | MessageBox.Show("Operation in progress, please wait a moment...") 104 | 105 | Return 106 | End If 107 | 108 | ' unblock all servers first before doing a block by preset 109 | Await Block_Unblock_All_Servers(False, False) 110 | 111 | ' is passed as a reference, should be cloned in case of unwanted modification 112 | Dim serverDictionary As Dictionary(Of String, String) = IIf(App.Get_Is_Clustered(), App.Get_Server_Dictionary_Clustered(), App.Get_Server_Dictionary_Unclustered()) 113 | 114 | Dim presetServersDataGridView As DataGridView = Presets.PresetServerListDataGridView 115 | 116 | App.Set_Pending_Operation(True) 117 | 118 | Cancel_Pending_Ping() 119 | 120 | ' offload this blocking task into a seperate thread from the thread pool to lessen load in the UI thread 121 | Await Task.Run(Sub() Handle_Block_Except_Preset_Servers(presetServersDataGridView, serverDictionary, exceptPresetServers)) 122 | 123 | App.Set_Pending_Operation(False) 124 | 125 | Ping_All_Servers() 126 | End Sub 127 | 128 | Private Sub Handle_Block_Except_Preset_Servers(presetServersDataGridView As DataGridView, serverDictionary As Dictionary(Of String, String), exceptPresetServers As Boolean) 129 | Dim proc As Process = Create_Custom_CMD_Process() 130 | 131 | Dim presetServerNames As HashSet(Of String) = New HashSet(Of String) 132 | 133 | ' collect preset server names as basis for the next operation 134 | For Each presetRow As DataGridViewRow In presetServersDataGridView.Rows 135 | presetServerNames.Add(presetRow.Cells(0).Value) 136 | Next 137 | 138 | ' traverse servers, conditionally diff preset server names against the dictionary 139 | For Each serverKvp As KeyValuePair(Of String, String) In serverDictionary 140 | ' skip blocking preset servers 141 | If exceptPresetServers And presetServerNames.Contains(serverKvp.Key) Then 142 | Continue For 143 | End If 144 | 145 | ' block preset servers only 146 | If Not exceptPresetServers And Not presetServerNames.Contains(serverKvp.Key) Then 147 | Continue For 148 | End If 149 | 150 | Try 151 | proc.StartInfo.Arguments = $"/c {netshPath} advfirewall firewall add rule " + 152 | "name=CS2ServerPicker_" + serverKvp.Key.Replace(" ", "") + " dir=out action=block protocol=ANY " + 153 | "remoteip=" + serverKvp.Value 154 | proc.Start() 155 | proc.WaitForExit() 156 | 157 | If proc.ExitCode = 1 Or proc.ExitCode < 0 Then 158 | Throw New Exception("StdOut: " + proc.StandardOutput.ReadToEnd() + Environment.NewLine + "StdErr: " + proc.StandardError.ReadToEnd()) 159 | 160 | Continue For 161 | End If 162 | Catch ex As Exception 163 | Log_Exception_To_File(ex, "An error has occurred while blocking servers by preset!") 164 | 165 | MessageBox.Show("An error has occurred while blocking servers by preset! Please upload error file to github issue tracker.", "Error") 166 | End Try 167 | Next 168 | 169 | proc.Dispose() 170 | End Sub 171 | 172 | Public Async Sub Block_Unblock_Selected_Servers(block As Boolean) 173 | Dim mainDataGridView As DataGridView = App.Get_DataGridView_Control() 174 | Dim serverDictionary As Dictionary(Of String, String) = IIf(App.Get_Is_Clustered(), App.Get_Server_Dictionary_Clustered(), App.Get_Server_Dictionary_Unclustered()) 175 | 176 | Dim selectedRows As DataGridViewSelectedRowCollection = mainDataGridView.SelectedRows 177 | 178 | If App.Get_Pending_Operation() Then 179 | MessageBox.Show("Operation in progress, please wait a moment...") 180 | 181 | Return 182 | End If 183 | 184 | If selectedRows.Count <= 0 Then 185 | MessageBox.Show("You haven't selected any server.", "Info") 186 | 187 | Return 188 | End If 189 | 190 | App.Set_Pending_Operation(True) 191 | 192 | Cancel_Pending_Ping() 193 | 194 | ' offload this blocking task into a seperate thread from the thread pool to lessen load in the UI thread 195 | Await Task.Run(Sub() Handle_Block_Unblock_Selected_Servers(mainDataGridView, serverDictionary, block)) 196 | 197 | App.Set_Pending_Operation(False) 198 | 199 | Ping_Servers(selectedRows) 200 | End Sub 201 | 202 | Private Sub Handle_Block_Unblock_Selected_Servers(mainDataGridView As DataGridView, serverDictionary As Dictionary(Of String, String), block As Boolean) 203 | Dim proc As Process = Create_Custom_CMD_Process() 204 | 205 | ' traverse every datagrid row and block/unblock selected servers 206 | For Each row As DataGridViewRow In mainDataGridView.SelectedRows 207 | If Is_Server_Blocked_Or_Unblocked(row.Cells(1).Value, block) Then 208 | Continue For 209 | End If 210 | 211 | Try 212 | Dim region As String = row.Cells(1).Value 213 | 214 | proc.StartInfo.Arguments = $"/c {netshPath} advfirewall firewall " + If(block, "add", "delete") + " rule " + 215 | "name=CS2ServerPicker_" + region.Replace(" ", "") + If(block, " dir=out action=block protocol=ANY " + 216 | "remoteip=" + serverDictionary.Item(region), "") 217 | proc.Start() 218 | proc.WaitForExit() 219 | 220 | If proc.ExitCode = 1 Or proc.ExitCode < 0 Then 221 | Throw New Exception("StdOut: " + proc.StandardOutput.ReadToEnd() + Environment.NewLine + "StdErr: " + proc.StandardError.ReadToEnd()) 222 | 223 | Continue For 224 | End If 225 | Catch ex As Exception 226 | Log_Exception_To_File(ex, "An error has occurred while blocking/unblocking selected server!") 227 | 228 | MessageBox.Show("An error has occurred while blocking/unblocking selected server! Please upload error file to github issue tracker.", "Error") 229 | End Try 230 | Next 231 | 232 | proc.Dispose() 233 | End Sub 234 | 235 | Public Async Function Block_Unblock_All_Servers(block As Boolean, Optional pingServers As Boolean = True) As Task 236 | ' this method was converted async since its invoked by other methods/tasks and 237 | ' it does not evaluate synchronously due to its async operation that must be awaited 238 | Dim serverDictionary As Dictionary(Of String, String) = IIf(App.Get_Is_Clustered(), App.Get_Server_Dictionary_Clustered(), App.Get_Server_Dictionary_Unclustered()) 239 | Dim mainDataGridView As DataGridView = App.Get_DataGridView_Control() 240 | 241 | If App.Get_Pending_Operation() Then 242 | MessageBox.Show("Operation in progress, please wait a moment...") 243 | 244 | Return 245 | End If 246 | 247 | App.Set_Pending_Operation(True) 248 | 249 | Cancel_Pending_Ping() 250 | 251 | ' offload this blocking task into a seperate thread from the thread pool to lessen load in the UI thread 252 | Await Task.Run(Sub() Handle_Block_Unblock_All_Servers(mainDataGridView, serverDictionary, block)) 253 | 254 | App.Set_Pending_Operation(False) 255 | 256 | If pingServers Then 257 | Ping_All_Servers() 258 | End If 259 | End Function 260 | 261 | Private Sub Handle_Block_Unblock_All_Servers(mainDataGridView As DataGridView, serverDictionary As Dictionary(Of String, String), block As Boolean) 262 | Dim proc As Process = Create_Custom_CMD_Process() 263 | 264 | ' traverse every datagrid row and block/unblock all servers 265 | For Each row As DataGridViewRow In mainDataGridView.Rows 266 | Dim region As String = row.Cells(1).Value 267 | 268 | If Is_Server_Blocked_Or_Unblocked(region, block) Then 269 | Continue For 270 | End If 271 | 272 | Try 273 | proc.StartInfo.Arguments = $"/c {netshPath} advfirewall firewall " + If(block, "add", "delete") + " rule " + 274 | "name=CS2ServerPicker_" + region.Replace(" ", "") + If(block, " dir=out action=block protocol=ANY " + 275 | "remoteip=" + serverDictionary.Item(region), "") 276 | proc.Start() 277 | proc.WaitForExit() 278 | 279 | If proc.ExitCode = 1 Or proc.ExitCode < 0 Then 280 | Throw New Exception("StdOut: " + proc.StandardOutput.ReadToEnd() + Environment.NewLine + "StdErr: " + proc.StandardError.ReadToEnd()) 281 | 282 | Continue For 283 | End If 284 | Catch ex As Exception 285 | Log_Exception_To_File(ex, "An error has occurred while blocking/unblocking all servers!") 286 | 287 | MessageBox.Show("An error has occurred while blocking/unblocking all servers! Please upload error file to github issue tracker.", "Error") 288 | End Try 289 | Next 290 | 291 | proc.Dispose() 292 | End Sub 293 | 294 | Public Function Is_Server_Blocked_Or_Unblocked(region As String, block As Boolean) As Boolean 295 | Dim proc As Process = Create_Custom_CMD_Process() 296 | Dim result As Boolean = False 297 | Dim is_rule_exist As Boolean 298 | Dim region_trimmed As String = region.Replace(" ", "") 299 | 300 | proc.StartInfo.Arguments = $"/c {netshPath} advfirewall firewall show rule name=CS2ServerPicker_" + region_trimmed 301 | proc.Start() 302 | proc.WaitForExit() 303 | 304 | ' retrieve command output from stdout descriptor 305 | Dim procOutput = proc.StandardOutput.ReadToEnd() 306 | 307 | is_rule_exist = procOutput.Contains("CS2ServerPicker_" + region_trimmed) 308 | 309 | ' if rule does exist and is being blocked, return true to skip blocking. 310 | ' if rule does not exist and is being unblocked, return true to skip unblocking. 311 | If (is_rule_exist And block) Or (Not is_rule_exist And Not block) Then 312 | result = True 313 | End If 314 | 315 | proc.Dispose() 316 | 317 | Return result 318 | End Function 319 | End Module 320 | -------------------------------------------------------------------------------- /CS2ServerPicker/Services/VersionService.vb: -------------------------------------------------------------------------------- 1 | Imports System.Net 2 | Imports Newtonsoft.Json.Linq 3 | 4 | Module VersionService 5 | Public Async Sub Version_Check() 6 | Try 7 | If Not My.Settings.VersionCheckOnStartup Or App.Debug Then 8 | Return 9 | End If 10 | 11 | Dim wClient As WebClient = New WebClient() 12 | 13 | ' github requires a user-agent header on non-browser request 14 | wClient.Headers.Set("User-Agent", "cs2-server-picker") 15 | 16 | Dim releasesRes As String = Await wClient.DownloadStringTaskAsync("https://api.github.com/repositories/649341649/releases") 17 | 18 | Dim releasesJsonArr As JArray = JArray.Parse(releasesRes) 19 | 20 | ' vb app assembly versioning has 4 components 21 | Dim latestReleaseVersion As String = releasesJsonArr(0).SelectToken("tag_name").ToString().Split("v")(1) + ".0" 22 | 23 | If Not latestReleaseVersion = App.ProductVersion Then 24 | Dim versionCheck As DialogResult = MessageBox.Show(App, "New version available! Go to releases?", "Version Check", MessageBoxButtons.YesNo, MessageBoxIcon.Information) 25 | 26 | If versionCheck = DialogResult.Yes Then 27 | Process.Start("https://github.com/FN-FAL113/cs2-server-picker/releases") 28 | End If 29 | End If 30 | 31 | wClient.Dispose() 32 | Catch ex As Exception 33 | MessageBox.Show(App, "Failed to check for new version! Check your internet connection.", "Version Check", MessageBoxButtons.OK, MessageBoxIcon.Warning) 34 | End Try 35 | End Sub 36 | End Module 37 | -------------------------------------------------------------------------------- /CS2ServerPicker/Settings.Designer.vb: -------------------------------------------------------------------------------- 1 |  _ 2 | Partial Class Settings 3 | Inherits System.Windows.Forms.Form 4 | 5 | 'Form overrides dispose to clean up the component list. 6 | _ 7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean) 8 | Try 9 | If disposing AndAlso components IsNot Nothing Then 10 | components.Dispose() 11 | End If 12 | Finally 13 | MyBase.Dispose(disposing) 14 | End Try 15 | End Sub 16 | 17 | 'Required by the Windows Form Designer 18 | Private components As System.ComponentModel.IContainer 19 | 20 | 'NOTE: The following procedure is required by the Windows Form Designer 21 | 'It can be modified using the Windows Form Designer. 22 | 'Do not modify it using the code editor. 23 | _ 24 | Private Sub InitializeComponent() 25 | Me.VersionCheckerCheckBox = New System.Windows.Forms.CheckBox() 26 | Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() 27 | Me.TableLayoutPanel2 = New System.Windows.Forms.TableLayoutPanel() 28 | Me.CheckFirewallButton = New System.Windows.Forms.Button() 29 | Me.ResetFirewallButton = New System.Windows.Forms.Button() 30 | Me.TableLayoutPanel1.SuspendLayout() 31 | Me.TableLayoutPanel2.SuspendLayout() 32 | Me.SuspendLayout() 33 | ' 34 | 'VersionCheckerCheckBox 35 | ' 36 | Me.VersionCheckerCheckBox.Anchor = System.Windows.Forms.AnchorStyles.None 37 | Me.VersionCheckerCheckBox.AutoSize = True 38 | Me.VersionCheckerCheckBox.Font = New System.Drawing.Font("Arial", 8.5!) 39 | Me.VersionCheckerCheckBox.Location = New System.Drawing.Point(83, 3) 40 | Me.VersionCheckerCheckBox.Name = "VersionCheckerCheckBox" 41 | Me.VersionCheckerCheckBox.Size = New System.Drawing.Size(244, 21) 42 | Me.VersionCheckerCheckBox.TabIndex = 0 43 | Me.VersionCheckerCheckBox.Text = "Check for new version on startup" 44 | Me.VersionCheckerCheckBox.UseVisualStyleBackColor = True 45 | ' 46 | 'TableLayoutPanel1 47 | ' 48 | Me.TableLayoutPanel1.Anchor = System.Windows.Forms.AnchorStyles.None 49 | Me.TableLayoutPanel1.ColumnCount = 1 50 | Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle()) 51 | Me.TableLayoutPanel1.Controls.Add(Me.VersionCheckerCheckBox, 0, 0) 52 | Me.TableLayoutPanel1.Controls.Add(Me.TableLayoutPanel2, 0, 2) 53 | Me.TableLayoutPanel1.Location = New System.Drawing.Point(12, 25) 54 | Me.TableLayoutPanel1.Name = "TableLayoutPanel1" 55 | Me.TableLayoutPanel1.RowCount = 3 56 | Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle()) 57 | Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) 58 | Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 46.0!)) 59 | Me.TableLayoutPanel1.Size = New System.Drawing.Size(408, 166) 60 | Me.TableLayoutPanel1.TabIndex = 1 61 | ' 62 | 'TableLayoutPanel2 63 | ' 64 | Me.TableLayoutPanel2.ColumnCount = 2 65 | Me.TableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) 66 | Me.TableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) 67 | Me.TableLayoutPanel2.Controls.Add(Me.CheckFirewallButton, 1, 0) 68 | Me.TableLayoutPanel2.Controls.Add(Me.ResetFirewallButton, 0, 0) 69 | Me.TableLayoutPanel2.Location = New System.Drawing.Point(3, 123) 70 | Me.TableLayoutPanel2.Name = "TableLayoutPanel2" 71 | Me.TableLayoutPanel2.RowCount = 1 72 | Me.TableLayoutPanel2.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30.0!)) 73 | Me.TableLayoutPanel2.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30.0!)) 74 | Me.TableLayoutPanel2.Size = New System.Drawing.Size(405, 38) 75 | Me.TableLayoutPanel2.TabIndex = 2 76 | ' 77 | 'CheckFirewallButton 78 | ' 79 | Me.CheckFirewallButton.Anchor = System.Windows.Forms.AnchorStyles.None 80 | Me.CheckFirewallButton.AutoSize = True 81 | Me.CheckFirewallButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Bold) 82 | Me.CheckFirewallButton.Location = New System.Drawing.Point(237, 4) 83 | Me.CheckFirewallButton.Name = "CheckFirewallButton" 84 | Me.CheckFirewallButton.Size = New System.Drawing.Size(133, 30) 85 | Me.CheckFirewallButton.TabIndex = 2 86 | Me.CheckFirewallButton.Text = "Check Firewall" 87 | Me.CheckFirewallButton.UseVisualStyleBackColor = True 88 | ' 89 | 'ResetFirewallButton 90 | ' 91 | Me.ResetFirewallButton.Anchor = System.Windows.Forms.AnchorStyles.None 92 | Me.ResetFirewallButton.AutoSize = True 93 | Me.ResetFirewallButton.Font = New System.Drawing.Font("Arial", 8.5!, System.Drawing.FontStyle.Bold) 94 | Me.ResetFirewallButton.Location = New System.Drawing.Point(34, 4) 95 | Me.ResetFirewallButton.Name = "ResetFirewallButton" 96 | Me.ResetFirewallButton.Size = New System.Drawing.Size(133, 30) 97 | Me.ResetFirewallButton.TabIndex = 1 98 | Me.ResetFirewallButton.Text = "Reset Firewall" 99 | Me.ResetFirewallButton.UseVisualStyleBackColor = True 100 | ' 101 | 'Settings 102 | ' 103 | Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!) 104 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font 105 | Me.ClientSize = New System.Drawing.Size(432, 203) 106 | Me.Controls.Add(Me.TableLayoutPanel1) 107 | Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog 108 | Me.MaximizeBox = False 109 | Me.MinimizeBox = False 110 | Me.Name = "Settings" 111 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent 112 | Me.Text = "Settings" 113 | Me.TableLayoutPanel1.ResumeLayout(False) 114 | Me.TableLayoutPanel1.PerformLayout() 115 | Me.TableLayoutPanel2.ResumeLayout(False) 116 | Me.TableLayoutPanel2.PerformLayout() 117 | Me.ResumeLayout(False) 118 | 119 | End Sub 120 | 121 | Friend WithEvents VersionCheckerCheckBox As CheckBox 122 | Friend WithEvents TableLayoutPanel1 As TableLayoutPanel 123 | Friend WithEvents ResetFirewallButton As Button 124 | Friend WithEvents TableLayoutPanel2 As TableLayoutPanel 125 | Friend WithEvents CheckFirewallButton As Button 126 | End Class 127 | -------------------------------------------------------------------------------- /CS2ServerPicker/Settings.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 | -------------------------------------------------------------------------------- /CS2ServerPicker/Settings.vb: -------------------------------------------------------------------------------- 1 | Imports System.IO 2 | 3 | Public Class Settings 4 | 5 | Private netshPath As String = Path.Combine(Environment.SystemDirectory, "netsh.exe") 6 | 7 | Private Sub VersionCheckerCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles VersionCheckerCheckBox.CheckedChanged 8 | My.Settings.VersionCheckOnStartup = VersionCheckerCheckBox.Checked 9 | My.Settings.Save() 10 | My.Settings.Reload() 11 | End Sub 12 | 13 | Private Sub Settings_Load(sender As Object, e As EventArgs) Handles MyBase.Load 14 | VersionCheckerCheckBox.Checked = My.Settings.VersionCheckOnStartup 15 | End Sub 16 | 17 | Private Sub ResetFirewallButton_Click(sender As Object, e As EventArgs) Handles ResetFirewallButton.Click 18 | Dim resetWindowsFirewallRes As DialogResult = MessageBox.Show("This will attempt to reset windows firewall to its default state. Confirm action?", "Reset Windows Firewall", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) 19 | 20 | If resetWindowsFirewallRes = DialogResult.No Then 21 | Return 22 | End If 23 | 24 | Try 25 | Dim proc As Process = Create_Custom_CMD_Process() 26 | 27 | proc.StartInfo.Arguments = $"/c {netshPath} advfirewall reset" 28 | proc.Start() 29 | proc.WaitForExit() 30 | 31 | If proc.ExitCode = 1 Or proc.ExitCode < 0 Then 32 | Throw New Exception("Sdtout: " + proc.StandardOutput.ReadToEnd() + Environment.NewLine + "Stderr: " + proc.StandardError.ReadToEnd()) 33 | End If 34 | 35 | MessageBox.Show("Windows firewall reset successful!", "Reset Windows Firewall", MessageBoxButtons.OK, MessageBoxIcon.Information) 36 | 37 | proc.Dispose() 38 | Catch ex As Exception 39 | Log_Exception_To_File(ex, "An error has occurred while resetting windows firewall!") 40 | 41 | MessageBox.Show("An error has occurred while resetting windows firewall!", "Error") 42 | End Try 43 | End Sub 44 | 45 | Private Sub CheckFirewallButton_Click(sender As Object, e As EventArgs) Handles CheckFirewallButton.Click 46 | Dim checkWindowsFirewallRes As DialogResult = MessageBox.Show("This will attempt to check current state of windows firewall. Confirm action?", "Check Windows Firewall", MessageBoxButtons.YesNo, MessageBoxIcon.Information) 47 | 48 | If checkWindowsFirewallRes = DialogResult.No Then 49 | Return 50 | End If 51 | 52 | Try 53 | Dim proc As Process = Create_Custom_CMD_Process() 54 | 55 | proc.StartInfo.Arguments = $"/c {netshPath} advfirewall show allprofiles state" 56 | proc.Start() 57 | proc.WaitForExit() 58 | 59 | If proc.ExitCode = 1 Or proc.ExitCode < 0 Then 60 | Throw New Exception("On firewall check" + Environment.NewLine + "StdOut: " + proc.StandardOutput.ReadToEnd() + Environment.NewLine + "StdErr: " + proc.StandardError.ReadToEnd()) 61 | End If 62 | 63 | If proc.StandardOutput.ReadToEnd().Contains("OFF") Then 64 | Dim enableWinFirewallRes As DialogResult = MessageBox.Show("This will attempt to enable windows firewall. Confirm action?", "Enable Windows Firewall", MessageBoxButtons.YesNo, MessageBoxIcon.Information) 65 | 66 | If enableWinFirewallRes = DialogResult.No Then 67 | Return 68 | End If 69 | 70 | proc.StartInfo.Arguments = $"/c {netshPath} advfirewall set allprofiles state on" 71 | proc.Start() 72 | proc.WaitForExit() 73 | 74 | If proc.ExitCode = 1 Or proc.ExitCode < 0 Then 75 | Throw New Exception("On firewall enable" + Environment.NewLine + "StdOut: " + proc.StandardOutput.ReadToEnd() + Environment.NewLine + "StdErr: " + proc.StandardError.ReadToEnd()) 76 | End If 77 | 78 | MessageBox.Show("Windows firewall profile states successfully enabled!", "Enable Windows Firewall", MessageBoxButtons.OK, MessageBoxIcon.Information) 79 | Else 80 | MessageBox.Show("Windows firewall profile states are all enabled.", "Windows Firewall Status", MessageBoxButtons.OK, MessageBoxIcon.Information) 81 | End If 82 | 83 | proc.Dispose() 84 | Catch ex As Exception 85 | Log_Exception_To_File(ex, "An error has occurred while checking/enabling windows firewall!") 86 | 87 | MessageBox.Show("An error has occurred while checking/enabling windows firewall!", "Error") 88 | End Try 89 | End Sub 90 | End Class -------------------------------------------------------------------------------- /CS2ServerPicker/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 50 | 58 | 59 | 73 | -------------------------------------------------------------------------------- /CS2ServerPicker/asset/GitHub-Mark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/GitHub-Mark.png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/Paypal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/Paypal.png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/Settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/Settings.png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/fav_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/fav_icon.ico -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Alibaba Cloud Beijing - Mobile (China) (pekm).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Alibaba Cloud Beijing - Mobile (China) (pekm).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Alibaba Cloud Beijing - Telecom (China) (pekt).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Alibaba Cloud Beijing - Telecom (China) (pekt).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Alibaba Cloud Beijing - Unicom (China) (peku).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Alibaba Cloud Beijing - Unicom (China) (peku).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Alibaba Cloud Chengdu - Mobile (China) (ctum).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Alibaba Cloud Chengdu - Mobile (China) (ctum).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Alibaba Cloud Chengdu - Telecom (China) (ctut).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Alibaba Cloud Chengdu - Telecom (China) (ctut).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Alibaba Cloud Chengdu - Unicom (China) (ctuu).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Alibaba Cloud Chengdu - Unicom (China) (ctuu).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Alibaba Cloud Shanghai - Mobile (China) (pvgm).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Alibaba Cloud Shanghai - Mobile (China) (pvgm).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Alibaba Cloud Shanghai - Telecom (China) (pvgt).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Alibaba Cloud Shanghai - Telecom (China) (pvgt).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Alibaba Cloud Shanghai - Unicom (China) (pvgu).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Alibaba Cloud Shanghai - Unicom (China) (pvgu).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Alibaba Cloud Shanghai Alicloud - Mobile (China) (pvgm).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Alibaba Cloud Shanghai Alicloud - Mobile (China) (pvgm).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Alibaba Cloud Shanghai Alicloud - Telecom (China) (pvgt).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Alibaba Cloud Shanghai Alicloud - Telecom (China) (pvgt).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Alibaba Cloud Shanghai Alicloud - Unicom (China) (pvgu).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Alibaba Cloud Shanghai Alicloud - Unicom (China) (pvgu).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Amsterdam (Netherlands) (ams).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Amsterdam (Netherlands) (ams).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Atlanta (Georgia) (atl).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Atlanta (Georgia) (atl).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Buenos Aires (Argentina) (eze).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Buenos Aires (Argentina) (eze).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Chennai - Ambattur (India) (maa2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Chennai - Ambattur (India) (maa2).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Chicago (Illinois) (ord).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Chicago (Illinois) (ord).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/China.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/China.png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Dallas (Texas) (dfw).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Dallas (Texas) (dfw).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Dubai (United Arab Emirates) (dxb).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Dubai (United Arab Emirates) (dxb).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Frankfurt (Germany) (fra).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Frankfurt (Germany) (fra).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Helsinki (Finland) (hel).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Helsinki (Finland) (hel).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Hong Kong (hkg).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Hong Kong (hkg).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/India.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/India.png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Japan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Japan.png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Johannesburg (South Africa) (jnb).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Johannesburg (South Africa) (jnb).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Lima (Peru) (lim).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Lima (Peru) (lim).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/London (England) (lhr).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/London (England) (lhr).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Los Angeles (California) (lax).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Los Angeles (California) (lax).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Madrid (Spain) (mad).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Madrid (Spain) (mad).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Multiplay Amsterdam (Netherlands) (ams4).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Multiplay Amsterdam (Netherlands) (ams4).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Multiplay Dallas (Texas) (dfw2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Multiplay Dallas (Texas) (dfw2).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Multiplay Hong Kong (hkg4).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Multiplay Hong Kong (hkg4).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Mumbai (India) (bom2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Mumbai (India) (bom2).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/New York (jfk).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/New York (jfk).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Paris (France) (par).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Paris (France) (par).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Perfect World (sha-4) Backbone (Shanghai, China) (shb).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Perfect World (sha-4) Backbone (Shanghai, China) (shb).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Perfect World Guangdong 1 (China) (pwg).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Perfect World Guangdong 1 (China) (pwg).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Perfect World Guangdong 2 - Mobile (China) (canm).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Perfect World Guangdong 2 - Mobile (China) (canm).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Perfect World Guangdong 2 - Telecom (China) (cant).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Perfect World Guangdong 2 - Telecom (China) (cant).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Perfect World Guangdong 2 - Unicom (China) (canu).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Perfect World Guangdong 2 - Unicom (China) (canu).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Perfect World Hebei (China) (pwu).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Perfect World Hebei (China) (pwu).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Perfect World Shanghai - Mobile (China) (sham).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Perfect World Shanghai - Mobile (China) (sham).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Perfect World Shanghai - Telecom (China) (shat).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Perfect World Shanghai - Telecom (China) (shat).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Perfect World Shanghai - Unicom (China) (shau).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Perfect World Shanghai - Unicom (China) (shau).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Perfect World Tianjin (China) (pwj).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Perfect World Tianjin (China) (pwj).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Perfect World Tianjin - Mobile (China) (tsnm).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Perfect World Tianjin - Mobile (China) (tsnm).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Perfect World Tianjin - Telecom (China) (tsnt).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Perfect World Tianjin - Telecom (China) (tsnt).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Perfect World Tianjin - Unicom (China) (tsnu).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Perfect World Tianjin - Unicom (China) (tsnu).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Perfect World Wuhan (China) (pww).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Perfect World Wuhan (China) (pww).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Perfect World Zhejiang (China) (pwz).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Perfect World Zhejiang (China) (pwz).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Santiago (Chile) (scl).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Santiago (Chile) (scl).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Sao Paulo (Brazil) (gru).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Sao Paulo (Brazil) (gru).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Seattle (Washington) (sea).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Seattle (Washington) (sea).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Seoul (South Korea) (seo).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Seoul (South Korea) (seo).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Singapore (sgp).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Singapore (sgp).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Sterling (Virginia) (iad).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Sterling (Virginia) (iad).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Stockholm (Sweden).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Stockholm (Sweden).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Stockholm - Bromma (Sweden) (sto2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Stockholm - Bromma (Sweden) (sto2).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Stockholm - Kista (Sweden) (sto).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Stockholm - Kista (Sweden) (sto).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Sydney (Australia) (syd).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Sydney (Australia) (syd).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Tencent Guangzhou - Mobile (China) (tgdm).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Tencent Guangzhou - Mobile (China) (tgdm).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Tencent Guangzhou - Telecom (China) (tgdt).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Tencent Guangzhou - Telecom (China) (tgdt).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Tencent Guangzhou - Unicom (China) (tgdu).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Tencent Guangzhou - Unicom (China) (tgdu).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Tokyo Koto City (Japan) (tyo).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Tokyo Koto City (Japan) (tyo).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Vienna (Austria) (vie).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Vienna (Austria) (vie).png -------------------------------------------------------------------------------- /CS2ServerPicker/asset/flags/Warsaw (Poland) (waw).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/asset/flags/Warsaw (Poland) (waw).png -------------------------------------------------------------------------------- /CS2ServerPicker/fav_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FN-FAL113/cs2-server-picker/db39432f55d55ddd2aa1328aa61c0135754f36fd/CS2ServerPicker/fav_icon.ico -------------------------------------------------------------------------------- /CS2ServerPicker/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Counter Strike 2 Server Picker 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | A lightweight server picker for CS2. Previously developed for CS:GO and now for CS2! All regions available are included for freedom of selection. Still showing passion for the game since I started playing way back 2013. 11 | 12 | ## ⬇️ Download 13 | ### [Releases](https://github.com/FN-FAL113/csgo-server-picker/releases) 14 | 15 | ## 📷 Screenshot 16 | ![CS2ServerPicker](https://github.com/user-attachments/assets/e5c7c2a7-c560-4826-bcd5-9540d66abec6) 17 | ![Demo.gif](https://github.com/FN-FAL113/cs2-server-picker/assets/88238718/a46e515c-d591-49e2-ac98-f6f0088bf8eb) 18 | 19 | ## 🧪 Test Result 20 |
21 | Test 1 22 | 23 | ![Initial Setup](https://github.com/user-attachments/assets/3461718d-a33a-47f0-aef2-156ed76b5e1b) 24 | ![In-Game Result](https://github.com/user-attachments/assets/e26bd22f-bd0c-4c70-891d-a5ae6f091e40) 25 |
26 | 27 |
28 | Test 2 29 | 30 | ![Screenshot 2025-06-06 193216](https://github.com/user-attachments/assets/c15af912-d964-4461-b706-2a8bb0c2d00b) 31 | ![20250606193344_1](https://github.com/user-attachments/assets/57ae9c7f-afca-42fa-b88a-9e77bca83570) 32 | ![20250608195438_1](https://github.com/user-attachments/assets/d7ebd25f-6f17-414d-994f-f217b2d05864) 33 |
34 | 35 | ## ⚙️ Requirements 36 | - Windows 10 or above 37 | - Works on Windows 8.1 but requires [.NET Framework 4.7.2](https://dotnet.microsoft.com/en-us/download/dotnet-framework/thank-you/net472-web-installer) to be installed separately. 38 | 39 | ## ❔FAQ 40 | **1. How it works, will I get banned?!** 41 | - The app does not modify any game or system files, I can assure you are safe from being banned when using the app as long as you do not download from untrusted sources. It will add necessary firewall policies to block game server relay ip addresses from being accessed by your network thus skipping them in-game when finding a match. 42 | 43 | **2. Not being routed to lowest ping server or not working on your location?** 44 | - Due to the fact that we can only access and block **_IP relay addresses_** from valve's network points around the world rather than the game's actual server IP addresses directly, which are **_not exposed_** publicly, either your connection got relayed to the nearest available server due to **_how Steam Datagram relay works_** or **_your location might be a factor_**. 45 | - Re-routing can also happen anytime, even mid-game. One of the best ways to test it out is to block low-ping servers and leave out high-ping servers that are far from your current region. If your ping is high in-game, then you are being routed properly, and the blocked IP relays are not able to re-route you to a nearby server. I was able to test this out properly way back. 46 | - Some solutions that might help out but are not guaranteed: turning off any vpn, uninstalling third-party antivirus and let windefender manage the firewall. 47 | - ISP-related issues, such as bad routing or high ping, are out of scope and control since the app only adds firewall entries. Please contact your ISP instead. 48 | 49 | **3. Why it requires admin permission on execution?
** 50 | - This is due to how Windows requires elevated execution when adding the necessary firewall policies. If the app is running in normal mode, it will not be able to do its operations and will throw errors. 51 | 52 | **4. Windows smartscreen detected unrecognized app/publisher
** 53 | - The app requires a registered publisher which costs a lot of money. Rest assured the app is safe and has been tested already with more than 10k downloads. 54 | 55 | ![image](https://github.com/FN-FAL113/csgo-server-picker/assets/88238718/fe0af8a8-4195-457e-bbbf-3a772e7f646c) 56 | 57 | **5. I'm receiving frequent timeouts when a match is being confirmed
** 58 | - You may have blocked many servers, for optimal searching and relaying block only the necessary server relays. 59 | 60 | **6. Why windows only?
** 61 | - The app is written using VB.NET, and Windows platform still dominates the gaming scene due to better compatibility. [Steam Charts](https://store.steampowered.com/hwsurvey/) has great statistics on this. 62 | 63 | **7. Will this work for Deadlock?** 64 | - CS2 and Deadlock servers utilize same server relay addresses. Although I haven't tested it, there is a high chance it will work for deadlock and some reddit posts have recommended this app, give it a shot 😉. 65 | 66 | ## 📔 To Do 67 | - TBD 68 | 69 | ## 💡 Contributors 70 | - @Mohamad82Bz (for testing out the app on EU Servers and providing necessary details) 71 | - contributors on pull requests and issue tracker 72 | - donors for heart-warming donations 73 | 74 | ## 🔽 Disclaimer 75 | - This project or its author are not affiliated, associated, authorized, endorsed by valve, its affiliates or subsidiaries. Images, names and other form of trademark are registered to their respective owners. 76 | 77 | ## 💖 Support the Project/Dev 78 | - I develop stuff for free with dedication and hard work. Sharing this project with fellow gamers or giving it a star is a huge sign of appreciation!
79 | 80 | Donate with PayPal 81 | 82 | --------------------------------------------------------------------------------