Skip to content

Commit fe63074

Browse files
authored
Merge pull request #334 from codebude/enhancement/wifi-payload-generator-improvement
Added new optional parameter to disable Hex-escaping
2 parents a77a90d + 80a5122 commit fe63074

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

QRCoder/PayloadGenerator.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ public class WiFi : Payload
2929
/// <param name="password">Password of the WiFi network</param>
3030
/// <param name="authenticationMode">Authentification mode (WEP, WPA, WPA2)</param>
3131
/// <param name="isHiddenSSID">Set flag, if the WiFi network hides its SSID</param>
32-
public WiFi(string ssid, string password, Authentication authenticationMode, bool isHiddenSSID = false)
32+
/// <param name="escapeHexStrings">Set flag, if ssid/password is delivered as HEX string. Note: May not be supported on iOS devices.</param>
33+
public WiFi(string ssid, string password, Authentication authenticationMode, bool isHiddenSSID = false, bool escapeHexStrings = true)
3334
{
3435
this.ssid = EscapeInput(ssid);
35-
this.ssid = isHexStyle(this.ssid) ? "\"" + this.ssid + "\"" : this.ssid;
36+
this.ssid = escapeHexStrings && isHexStyle(this.ssid) ? "\"" + this.ssid + "\"" : this.ssid;
3637
this.password = EscapeInput(password);
37-
this.password = isHexStyle(this.password) ? "\"" + this.password + "\"" : this.password;
38+
this.password = escapeHexStrings && isHexStyle(this.password) ? "\"" + this.password + "\"" : this.password;
3839
this.authenticationMode = authenticationMode.ToString();
3940
this.isHiddenSsid = isHiddenSSID;
4041
}

0 commit comments

Comments
 (0)