forked from nkast/MonoGame
-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Package.cs
52 lines (41 loc) · 1.28 KB
/
Package.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (C)2024 Nick Kastellanos
using System;
namespace Microsoft.Xna.Framework.Content.Pipeline.Builder
{
public struct Package : IComparable<Package>
{
public string Name;
public string Version;
public static Package Parse(string packageReference)
{
packageReference.Trim();
Package package;
package.Name = packageReference;
package.Version = String.Empty;
string[] split = packageReference.Split(' ');
if (split.Length == 2)
{
package.Name = split[0].Trim();
package.Version = split[1].Trim();
}
return package;
}
public override string ToString()
{
string result = this.Name;
if (this.Version != String.Empty)
result += " " + this.Version;
return result;
}
int IComparable<Package>.CompareTo(Package other)
{
int compName = this.Name.CompareTo(other.Name);
if (compName != 0)
return compName;
int compVersion = this.Version.CompareTo(other.Version);
if (compVersion != 0)
return compVersion;
return 0;
}
}
}