FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
TCSystemCS/MetaData/PersonTag.cs at develop · tgoessler/TCSystemCS · GitHub
tgoessler
TCSystemCS
Repository navigation
Code
Pull requests
6
(6)
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
TCSystemCS
/
MetaData
/
PersonTag.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
122 lines (100 loc) · 3.43 KB
Breadcrumbs
TCSystemCS
/
MetaData
/
PersonTag.cs
Copy path
File metadata and controls
122 lines (100 loc) · 3.43 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// *******************************************************************************
//
// ******* *** *** *
// * * * *
// * * * *****
// * * *** * * ** * ** ***
// * * * * * * * **** * * *
// * * * * * * * * * * *
// * *** *** * ** ** ** * *
// *
// *******************************************************************************
// see https://github.com/tgoessler/TCSystemCS for details.
// Copyright (C) 2003 - 2026 Thomas Goessler. All Rights Reserved.
// *******************************************************************************
//
// TCSystem is the legal property of its developers.
// Please refer to the COPYRIGHT file distributed with this source distribution.
//
// *******************************************************************************
#region Usings
using
System
;
using
Newtonsoft
.
Json
;
using
Newtonsoft
.
Json
.
Linq
;
using
TCSystem
.
Util
;
#endregion
namespace
TCSystem
.
MetaData
;
/// <summary>Associates a person with a detected face in an image.</summary>
/// <param name="_person">The associated person.</param>
/// <param name="_face">The associated face.</param>
public
sealed
class
PersonTag
(
Person
_person
,
Face
_face
)
:
IEquatable
<
PersonTag
>
{
#region Public
/// <inheritdoc />
public
override
bool
Equals
(
object
obj
)
{
return
EqualsUtil
.
Equals
(
this
,
obj
as
PersonTag
,
EqualsImp
)
;
}
/// <inheritdoc />
public
bool
Equals
(
PersonTag
other
)
{
return
EqualsUtil
.
Equals
(
this
,
other
,
EqualsImp
)
;
}
/// <inheritdoc />
public
override
int
GetHashCode
(
)
{
unchecked
{
int
hashCode
=
Person
.
GetHashCode
(
)
;
hashCode
=
(
hashCode
*
397
)
^
Face
.
GetHashCode
(
)
;
return
hashCode
;
}
}
/// <summary>Serializes the person tag to indented JSON.</summary>
/// <returns>The formatted JSON.</returns>
public
override
string
ToString
(
)
{
return
ToJson
(
)
.
ToString
(
Formatting
.
Indented
)
;
}
/// <summary>Serializes the person tag to compact JSON.</summary>
/// <returns>The serialized person tag.</returns>
public
string
ToJsonString
(
)
{
return
ToJson
(
)
.
ToString
(
Formatting
.
None
)
;
}
/// <summary>Deserializes a person tag from JSON.</summary>
/// <returns>The person tag, or <see langword="null" /> for null or empty input.</returns>
public
static
PersonTag
FromJsonString
(
string
jsonString
)
{
return
string
.
IsNullOrEmpty
(
jsonString
)
?
null
:
FromJson
(
JObject
.
Parse
(
jsonString
)
)
;
}
/// <summary>Gets the associated person.</summary>
public
Person
Person
=>
_person
;
/// <summary>Gets the associated face.</summary>
public
Face
Face
=>
_face
;
#endregion
#region Internal
internal
static
PersonTag
FromJson
(
JObject
jsonObject
)
{
return
new
(
Person
.
FromJson
(
(
JObject
)
jsonObject
[
"person"
]
)
,
Face
.
FromJson
(
(
JObject
)
jsonObject
[
"face"
]
)
)
;
}
internal
JObject
ToJson
(
)
{
var
obj
=
new
JObject
{
[
"person"
]
=
Person
.
ToJson
(
)
,
[
"face"
]
=
Face
.
ToJson
(
)
}
;
return
obj
;
}
#endregion
#region Private
private
bool
EqualsImp
(
PersonTag
other
)
{
return
Equals
(
Person
,
other
.
Person
)
&&
Equals
(
Face
,
other
.
Face
)
;
}
#endregion
}
Back
|
FazBrowse Home
|
New Git URL