forked from jamisonr/DBMulticast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServerDefinition.cs
More file actions
executable file
·86 lines (73 loc) · 1.85 KB
/
ServerDefinition.cs
File metadata and controls
executable file
·86 lines (73 loc) · 1.85 KB
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
using System;
using System.Collections;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Windows.Forms;
namespace DBMulticast
{
[XmlRoot("serverList")]
public class ServerList
{
private ArrayList listServers;
public ServerList()
{
listServers = new ArrayList();
}
[XmlAttribute("expanded")]
public bool Expanded { get; set; }
[XmlAttribute("name")]
public string Name { get; set; }
[XmlElement("serverList")]
public List<ServerList> ServerLists { get; set; }
[XmlElement("server")]
public Server[] Servers
{
get
{
var servers = new Server[listServers.Count];
listServers.CopyTo(servers);
return servers;
}
set
{
if(value==null) return;
var servers = (Server[]) value;
listServers.Clear();
foreach (var server in servers)
listServers.Add(server);
}
}
public int AddServer(Server server)
{
return listServers.Add(server);
}
}
public class Server
{
[XmlAttribute("ServerName")] public string servername;
[XmlAttribute("Server")] public string svr;
[XmlAttribute("DB")] public string database;
[XmlAttribute("Username")] public string username;
[XmlAttribute("Password")] public string password;
[XmlAttribute("UseSSPI")] public bool usesspi;
[XmlAttribute("Type")] public string type;
public Server()
{
}
public Server(string serverName, string svr, string database, string username, string password, bool usesspi)
{
this.servername = serverName;
this.svr = svr;
this.database = database;
this.username = username;
this.password = password;
this.usesspi = usesspi;
}
public override string ToString()
{
return this.servername;
}
}
}