public static void Parse() { if (!File.Exists(dhcpdFile)) { return; } var content = File.ReadAllText(dhcpdFile); var model = new DhcpdModel() { Active = false }; var allow = DhcpdParser.ParseAllow(content); model.Allow = allow; model = DhcpdParser.ParseParameters(model, content); model = DhcpdParser.ParseKeySecret(model, content); var reservations = DhcpdParser.ParseReservation(content); model.Reservations = reservations; var classes = DhcpdParser.ParseClass(content); model.Classes = classes; var subnets = DhcpdParser.ParseSubnet(content); model.Subnets = subnets; Application.CurrentConfiguration.Services.Dhcpd = model; ConsoleLogger.Log("[dhcpd] import existing configuration"); }
private static DhcpdConfigurationModel Parse(string text) { var model = new DhcpdConfigurationModel { IsActive = false }; var allow = DhcpdParser.ParseAllow(text); model.Allow = allow; model = DhcpdParser.ParseParameters(model, text); model = DhcpdParser.ParseKeySecret(model, text); var reservations = DhcpdParser.ParseReservation(text); model.Reservations = reservations; var classes = DhcpdParser.ParseClass(text); model.Classes = classes; var subnets = DhcpdParser.ParseSubnet(text); model.Subnets = subnets; return(model); }