public bool Validate() { bool status = false; try { var xDoc = XDocument.Load(EnhanceLog.Set(Hashtable, "SubKeys", true)); replaceModel = xDoc.Descendants("Replacer").Select(x => new ReplaceModel { DirectoryPath = x.Attribute("Directory").Value, Pattern = x.Attribute("Pattern").Value, Contains = x.Attribute("Contains").Value }).FirstOrDefault(); replaceModels = xDoc.Element("Replacer").Elements("Line").Select(x => new ReplaceModel { DirectoryPath = x.Attribute("Directory") == null ? replaceModel.DirectoryPath : x.Attribute("Directory").Value, Pattern = x.Attribute("Pattern") == null ? replaceModel.DirectoryPath : x.Attribute("Pattern").Value, Contains = x.Attribute("Contains") == null ? replaceModel.DirectoryPath : x.Attribute("Contains").Value, MatchValue = x.Attribute("Match").Value, ReplaceValue = x.Attribute("Replace").Value }).ToList(); status = true; } catch (Exception ex) { logger.Error(ex); } return(status); }
public bool Validate() { bool status = false; try { var fileFullPath = Path.GetFullPath(EnhanceLog.Set(Hashtable, "FilePath", true)); fileModel = new FileModel(fileFullPath); status = File.Exists(fileFullPath); } catch (Exception ex) { logger.Error(ex); } return(status); }
public bool Validate() { bool status = false; try { var subKey = EnhanceLog.Set(Hashtable, "SubKeys"); var key = EnhanceLog.Set(Hashtable, "Key"); var value = EnhanceLog.Set(Hashtable, "Value", false, string.Empty); registryModels = subKey.Split(',').Select(r => new RegistryModel { SubKey = r, Key = key, Value = value }); status = true; } catch (Exception ex) { logger.Error(ex); } return(status); }