wasSharp – Diff between revs 55 and 59
?pathlinks?
Rev 55 | Rev 59 | |||
---|---|---|---|---|
Line 15... | Line 15... | |||
15 | |
15 | |
|
16 | namespace wasSharp.Languages |
16 | namespace wasSharp.Languages |
|
17 | { |
17 | { |
|
18 | public static class XML |
18 | public static class XML |
|
19 | { |
19 | { |
|
20 | private static readonly Func<string, bool> directIsSafeXML = |
20 | private static readonly Func<string, bool> DirectIsSafeXML = |
|
21 | ((Expression<Func<string, bool>>) |
21 | ((Expression<Func<string, bool>>) |
|
22 | (data => |
22 | (data => |
|
23 | Regex.Replace(data, |
23 | Regex.Replace(data, |
|
24 | @"(" + string.Join(@"|", @"&", @"<", @">", @""", @"'") + @")", |
24 | @"(" + string.Join(@"|", @"&", @"<", @">", @""", @"'") + @")", |
|
Line 159... | Line 159... | |||
159 | /// </summary> |
159 | /// </summary> |
|
160 | /// <param name="data">the string to check</param> |
160 | /// <param name="data">the string to check</param> |
|
161 | /// <returns>true in case the string is safe</returns> |
161 | /// <returns>true in case the string is safe</returns> |
|
162 | public static bool IsSafeXML(string data) |
162 | public static bool IsSafeXML(string data) |
|
163 | { |
163 | { |
|
164 | return directIsSafeXML(data); |
164 | return DirectIsSafeXML(data); |
|
165 | } |
165 | } |
|
Line 166... | Line 166... | |||
166 | |
166 | |
|
167 | /////////////////////////////////////////////////////////////////////////// |
167 | /////////////////////////////////////////////////////////////////////////// |
|
168 | // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
168 | // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |