Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Win32ServiceCredentials.cs
1using System;
2
4{
10 public struct Win32ServiceCredentials(string userName, string password)
11 : IEquatable<Win32ServiceCredentials>
12 {
16 public string UserName { get; } = userName;
17
21 public string Password { get; } = password;
22
26 public static readonly Win32ServiceCredentials LocalSystem = new(@".\LocalSystem", password: null);
27
31 public static readonly Win32ServiceCredentials LocalService = new(@"NT AUTHORITY\LocalService", password: null);
32
36 public static readonly Win32ServiceCredentials NetworkService = new(@"NT AUTHORITY\NetworkService", password: null);
37
43 public bool Equals(Win32ServiceCredentials Other)
44 {
45 return string.Equals(this.UserName, Other.UserName) &&
46 string.Equals(this.Password, Other.Password);
47 }
48
50 public override bool Equals(object obj)
51 {
52 if (obj is null)
53 return false;
54 else
55 {
56 return obj is Win32ServiceCredentials Win32ServiceCredentials &&
57 this.Equals(Win32ServiceCredentials);
58 }
59 }
60
62 public override int GetHashCode()
63 {
64 unchecked
65 {
66 return ((this.UserName?.GetHashCode() ?? 0) * 397) ^
67 (this.Password?.GetHashCode() ?? 0);
68 }
69 }
70
77 public static bool operator ==(Win32ServiceCredentials left, Win32ServiceCredentials right)
78 {
79 return left.Equals(right);
80 }
81
88 public static bool operator !=(Win32ServiceCredentials left, Win32ServiceCredentials right)
89 {
90 return !left.Equals(right);
91 }
92 }
93}