wasSharp – Diff between revs 7 and 26
?pathlinks?
Rev 7 | Rev 26 | |||
---|---|---|---|---|
1 | /////////////////////////////////////////////////////////////////////////// |
1 | /////////////////////////////////////////////////////////////////////////// |
|
2 | // Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 // |
2 | // Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 // |
|
3 | // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // |
3 | // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // |
|
4 | // rights of fair usage, the disclaimer and warranty conditions. // |
4 | // rights of fair usage, the disclaimer and warranty conditions. // |
|
5 | /////////////////////////////////////////////////////////////////////////// |
5 | /////////////////////////////////////////////////////////////////////////// |
|
6 | |
6 | |
|
7 | using System; |
7 | using System; |
|
8 | using System.IO; |
8 | using System.IO; |
|
9 | using System.Linq; |
9 | using System.Linq; |
|
10 | |
10 | |
|
11 | namespace wasSharp |
11 | namespace wasSharp |
|
12 | { |
12 | { |
|
13 | public static class Strings |
13 | public static class String |
|
14 | { |
14 | { |
|
15 | /////////////////////////////////////////////////////////////////////////// |
15 | /////////////////////////////////////////////////////////////////////////// |
|
16 | // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
16 | // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
|
17 | /////////////////////////////////////////////////////////////////////////// |
17 | /////////////////////////////////////////////////////////////////////////// |
|
18 | /// <summary> |
18 | /// <summary> |
|
19 | /// Combine multiple paths. |
19 | /// Combine multiple paths. |
|
20 | /// </summary> |
20 | /// </summary> |
|
21 | /// <param name="paths">an array of paths</param> |
21 | /// <param name="paths">an array of paths</param> |
|
22 | /// <returns>a combined path</returns> |
22 | /// <returns>a combined path</returns> |
|
23 | public static string PathCombine(params string[] paths) |
23 | public static string PathCombine(params string[] paths) |
|
24 | { |
24 | { |
|
25 | return paths.Aggregate((x, y) => Path.Combine(x, y)); |
25 | return paths.Aggregate((x, y) => Path.Combine(x, y)); |
|
26 | } |
26 | } |
|
27 | |
27 | |
|
28 | /////////////////////////////////////////////////////////////////////////// |
28 | /////////////////////////////////////////////////////////////////////////// |
|
29 | // Copyright (C) 2016 Wizardry and Steamworks - License: GNU GPLv3 // |
29 | // Copyright (C) 2016 Wizardry and Steamworks - License: GNU GPLv3 // |
|
30 | /////////////////////////////////////////////////////////////////////////// |
30 | /////////////////////////////////////////////////////////////////////////// |
|
31 | /// <summary> |
31 | /// <summary> |
|
32 | /// Determines if two strings are equal. |
32 | /// Determines if two strings are equal. |
|
33 | /// </summary> |
33 | /// </summary> |
|
34 | /// <param name="a">first string</param> |
34 | /// <param name="a">first string</param> |
|
35 | /// <param name="b">second string</param> |
35 | /// <param name="b">second string</param> |
|
36 | /// <param name="comparison">string comparison to use</param> |
36 | /// <param name="comparison">string comparison to use</param> |
|
37 | /// <returns>true if the strings are equal</returns> |
37 | /// <returns>true if the strings are equal</returns> |
|
38 | public static bool StringEquals(string a, string b, StringComparison comparison) |
38 | public static bool Equals(string a, string b, StringComparison comparison) |
|
39 | { |
39 | { |
|
40 | return (a == null && b == null) || (a.Length == b.Length && string.Equals(a, b, comparison)); |
40 | return (a == null && b == null) || (a.Length == b.Length && string.Equals(a, b, comparison)); |
|
41 | } |
41 | } |
|
42 | |
42 | |
|
43 | /////////////////////////////////////////////////////////////////////////// |
43 | /////////////////////////////////////////////////////////////////////////// |
|
44 | // Copyright (C) 2016 Wizardry and Steamworks - License: GNU GPLv3 // |
44 | // Copyright (C) 2016 Wizardry and Steamworks - License: GNU GPLv3 // |
|
45 | /////////////////////////////////////////////////////////////////////////// |
45 | /////////////////////////////////////////////////////////////////////////// |
|
46 | /// <summary> |
46 | /// <summary> |
|
47 | /// Determines if two strings are equal. |
47 | /// Determines if two strings are equal. |
|
48 | /// </summary> |
48 | /// </summary> |
|
49 | /// <param name="a">first string</param> |
49 | /// <param name="a">first string</param> |
|
50 | /// <param name="b">second string</param> |
50 | /// <param name="b">second string</param> |
|
51 | /// <returns>true if the strings are equal</returns> |
51 | /// <returns>true if the strings are equal</returns> |
|
52 | public static bool StringEquals(string a, string b) |
52 | public static bool Equals(string a, string b) |
|
53 | { |
53 | { |
|
54 | return (a == null && b == null) || (a != null && b != null && a.Length == b.Length && string.Equals(a, b)); |
54 | return (a == null && b == null) || (a != null && b != null && a.Length == b.Length && string.Equals(a, b)); |
|
55 | } |
55 | } |
|
56 | } |
56 | } |
|
57 | } |
57 | } |
|
58 | |
58 | |
|
59 |
|
59 |
|
|
60 | |
60 | |
|
61 | |
61 | |
|
62 | |
62 | |