|
@@ -31,6 +31,7 @@ namespace xicheji
|
|
var config = new Config
|
|
var config = new Config
|
|
{
|
|
{
|
|
ServicePort = xdoc.Root!.Element("Service")?.Attribute("Port")?.Value ?? "9999",
|
|
ServicePort = xdoc.Root!.Element("Service")?.Attribute("Port")?.Value ?? "9999",
|
|
|
|
+ DBString = xdoc.Root!.Element("Service")?.Attribute("DBString")?.Value ?? "DataSource=xicheji.db",
|
|
|
|
|
|
Server = xdoc.Root!.Element("Platform")?.Attribute("Server")?.Value ?? "",
|
|
Server = xdoc.Root!.Element("Platform")?.Attribute("Server")?.Value ?? "",
|
|
UploadInterval = int.Parse(xdoc.Root!.Element("Platform")?.Attribute("ReceiveInterval")?.Value ?? "2"),
|
|
UploadInterval = int.Parse(xdoc.Root!.Element("Platform")?.Attribute("ReceiveInterval")?.Value ?? "2"),
|
|
@@ -79,6 +80,7 @@ namespace xicheji
|
|
var xdoc = XDocument.Load(configFileName);
|
|
var xdoc = XDocument.Load(configFileName);
|
|
var xService = xdoc.Root!.Element("Service");
|
|
var xService = xdoc.Root!.Element("Service");
|
|
xService?.SetAttributeValue("Port", config.ServicePort);
|
|
xService?.SetAttributeValue("Port", config.ServicePort);
|
|
|
|
+ xService?.SetAttributeValue("DBString", config.DBString);
|
|
|
|
|
|
var xPlatform = xdoc.Root!.Element("Platform");
|
|
var xPlatform = xdoc.Root!.Element("Platform");
|
|
xPlatform?.SetAttributeValue("Server", config.Server);
|
|
xPlatform?.SetAttributeValue("Server", config.Server);
|
|
@@ -97,7 +99,7 @@ namespace xicheji
|
|
xCamera?.SetAttributeValue("UserName", config.CameraUserName);
|
|
xCamera?.SetAttributeValue("UserName", config.CameraUserName);
|
|
xCamera?.SetAttributeValue("Password", config.CameraPassword);
|
|
xCamera?.SetAttributeValue("Password", config.CameraPassword);
|
|
|
|
|
|
- xdoc.Save("config2.xml");
|
|
|
|
|
|
+ xdoc.Save(configFileName);
|
|
}
|
|
}
|
|
|
|
|
|
public static Variable? FindVariable(string variableName)
|
|
public static Variable? FindVariable(string variableName)
|
|
@@ -113,6 +115,7 @@ namespace xicheji
|
|
public class Config
|
|
public class Config
|
|
{
|
|
{
|
|
public string ServicePort { get; set; } = string.Empty;
|
|
public string ServicePort { get; set; } = string.Empty;
|
|
|
|
+ public string DBString { get; set; } = string.Empty;
|
|
|
|
|
|
public string Server { get; set; } = string.Empty;
|
|
public string Server { get; set; } = string.Empty;
|
|
public int UploadInterval { get; internal set; }
|
|
public int UploadInterval { get; internal set; }
|