Skip to content

Added new optional parameter to disable Hex-escaping #334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions QRCoder/PayloadGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ public class WiFi : Payload
/// <param name="password">Password of the WiFi network</param>
/// <param name="authenticationMode">Authentification mode (WEP, WPA, WPA2)</param>
/// <param name="isHiddenSSID">Set flag, if the WiFi network hides its SSID</param>
public WiFi(string ssid, string password, Authentication authenticationMode, bool isHiddenSSID = false)
/// <param name="escapeHexStrings">Set flag, if ssid/password is delivered as HEX string. Note: May not be supported on iOS devices.</param>
public WiFi(string ssid, string password, Authentication authenticationMode, bool isHiddenSSID = false, bool escapeHexStrings = true)
{
this.ssid = EscapeInput(ssid);
this.ssid = isHexStyle(this.ssid) ? "\"" + this.ssid + "\"" : this.ssid;
this.ssid = escapeHexStrings && isHexStyle(this.ssid) ? "\"" + this.ssid + "\"" : this.ssid;
this.password = EscapeInput(password);
this.password = isHexStyle(this.password) ? "\"" + this.password + "\"" : this.password;
this.password = escapeHexStrings && isHexStyle(this.password) ? "\"" + this.password + "\"" : this.password;
this.authenticationMode = authenticationMode.ToString();
this.isHiddenSsid = isHiddenSSID;
}
Expand Down