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;
2using System.Collections.Generic;
3using System.Text;
4
6{
7 public struct Win32ServiceCredentials : IEquatable<Win32ServiceCredentials>
8 {
9 public string UserName { get; }
10
11 public string Password { get; }
12
13 public Win32ServiceCredentials(string userName, string password)
14 {
15 UserName = userName;
16 Password = password;
17 }
18
19 public static Win32ServiceCredentials LocalSystem = new Win32ServiceCredentials(@".\LocalSystem", password: null);
20
21 public static Win32ServiceCredentials LocalService = new Win32ServiceCredentials(@"NT AUTHORITY\LocalService", password: null);
22
23 public static Win32ServiceCredentials NetworkService = new Win32ServiceCredentials(@"NT AUTHORITY\NetworkService", password: null);
24
25 public bool Equals(Win32ServiceCredentials other)
26 {
27 return string.Equals(UserName, other.UserName) && string.Equals(Password, other.Password);
28 }
29
30 public override bool Equals(object obj)
31 {
32 if (obj is null)
33 return false;
34 else
36 }
37
38 public override int GetHashCode()
39 {
40 unchecked
41 {
42 return ((UserName?.GetHashCode() ?? 0)*397) ^ (Password?.GetHashCode() ?? 0);
43 }
44 }
45
46 public static bool operator ==(Win32ServiceCredentials left, Win32ServiceCredentials right)
47 {
48 return left.Equals(right);
49 }
50
51 public static bool operator !=(Win32ServiceCredentials left, Win32ServiceCredentials right)
52 {
53 return !left.Equals(right);
54 }
55 }
56}