示例#1
0
        private static void GenerateConfigFile(string filePath)
        {
            if (filePath == null)
            {
                filePath = Path.Combine(Directory.GetCurrentDirectory(), "RobotConnectionData.xml");
            }

            List <MobileDebugInfoSettings> lst = new List <MobileDebugInfoSettings>
            {
                new MobileDebugInfoSettings("192.168.1.1", 443, "admin", "admin", "backup_{ip}_{MM-dd-yy_HH-mm-ss}.zip"),
                new MobileDebugInfoSettings("192.168.1.2", 443, "admin", "admin", "backup_{ip}_{MM-dd-yy_HH-mm-ss}.zip")
            };

            if (!filePath.EndsWith(".xml"))
            {
                filePath += ".xml";
            }

            if (MobileBackup.SerializeConfiguration(filePath, lst))
            {
                Console.WriteLine($"The generated config file is located at: {filePath}");
            }
            else
            {
                Console.WriteLine($"ERROR: Could not generate config file located at: {filePath}");
            }
        }