summaryrefslogtreecommitdiff
path: root/modules/mono/editor/GodotTools/GodotTools/MonoBuildInfo.cs
blob: 858e852392d0ec6a0348384bc199fbbc7a733ea9 (plain)
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
using System;
using Godot;
using Godot.Collections;
using GodotTools.Internals;
using Path = System.IO.Path;

namespace GodotTools
{
    [Serializable]
    public sealed class MonoBuildInfo : Reference // TODO Remove Reference once we have proper serialization
    {
        public string Solution { get; }
        public string Configuration { get; }
        public Array<string> CustomProperties { get; } = new Array<string>(); // TODO Use List once we have proper serialization

        public string LogsDirPath => Path.Combine(GodotSharpDirs.BuildLogsDirs, $"{Solution.MD5Text()}_{Configuration}");

        public override bool Equals(object obj)
        {
            if (obj is MonoBuildInfo other)
                return other.Solution == Solution && other.Configuration == Configuration;

            return false;
        }

        public override int GetHashCode()
        {
            unchecked
            {
                int hash = 17;
                hash = hash * 29 + Solution.GetHashCode();
                hash = hash * 29 + Configuration.GetHashCode();
                return hash;
            }
        }

        private MonoBuildInfo()
        {
        }

        public MonoBuildInfo(string solution, string configuration)
        {
            Solution = solution;
            Configuration = configuration;
        }
    }
}