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