nuget_package_config_manager /nuget.packages/NugetPackage.cs

Language C# Lines 77
MD5 Hash 7fcd26304d5f42dc5558b4a12a34a776 Estimated Cost $1,656 (why?)
Repository https://bitbucket.org/nisbus/nuget_package_config_manager.git View Raw File View Project SPDX
 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ReactiveUI;

namespace nuget.packages
{
    public class NugetPackage : ReactiveObject,IComparable
    {
        private string _Id;
        public string Id 
        {
            get { return _Id; }
            set { this.RaiseAndSetIfChanged(x => x.Id, value); }
        }
        private string _Version;
        public string Version 
        {
            get { return _Version; }
            set { this.RaiseAndSetIfChanged(x => x.Version, value); }
        }
        private string _AllowedVersions;
        public string AllowedVersions 
        {
            get { return _AllowedVersions; }
            set { this.RaiseAndSetIfChanged(x => x.AllowedVersions, value); }
        }
        private string _TargetFramework;
        public string TargetFramework 
        {
            get { return _TargetFramework; }
            set { this.RaiseAndSetIfChanged(x => x.TargetFramework, value); }
        }

        public string Project { get; private set; }

        public NugetPackage(string id, string version, string allowedVersion, string targetFramework, string project)
        {
            Id = id;
            Version = version;
            AllowedVersions = allowedVersion;
            TargetFramework = targetFramework;
            Project = project;
        }

        public int CompareTo(object obj)
        {
            var compareTo = obj as NugetPackage;
            if (compareTo != null)
            {
                if (compareTo.Id == Id && Version == compareTo.Version)
                    return 0;
                else return 1;
            }
            else
                return -1;
        }

        public override string ToString()
        {
            string asString = string.Empty;
            if(!string.IsNullOrEmpty(Id))
                asString += string.Format(@" id=""{0}""", Id);
            if (!string.IsNullOrEmpty(Version))
                asString += string.Format(@" version=""{0}""",Version);
            if (!string.IsNullOrEmpty(AllowedVersions))
                asString += string.Format(@" allowedVersions=""{0}""", AllowedVersions);
            if (!string.IsNullOrEmpty(TargetFramework))
                asString += string.Format(@" targetFramework=""{0}""", TargetFramework);

            return "<package"+asString+"/>";
        }
    }
}
Back to Top