-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserSystem.cs
42 lines (37 loc) · 1.04 KB
/
UserSystem.cs
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
using System;
using System.Collections.Generic;
namespace FalloutOS
{
public class UserSystem
{
private Dictionary<string, string> users;
public UserSystem()
{
users = new Dictionary<string, string>();
}
public void AddUser(string username, string password)
{
if (!users.ContainsKey(username))
{
users.Add(username, password);
Console.WriteLine($"User '{username}' added successfully.");
}
else
{
Console.WriteLine($"Error: User '{username}' already exists.");
}
}
public bool AuthenticateUser(string username, string password)
{
if (users.TryGetValue(username, out string storedPassword))
{
return password == storedPassword;
}
return false;
}
public bool CanExecuteCommand(string username, string command)
{
return true;
}
}
}