Ejemplo n.º 1
0
 /// <summary>
 /// Creates a Empty config, returns wheter the creation was possible 
 /// </summary>
 /// <returns></returns>
 public bool CreateEmptyConfig()
 {
     string configPath = GetConfigPath();
     //Try to create Direcotry first
     if (!FolderManager.CreateDirectory(Path.GetDirectoryName(configPath))) return false;
     //Read File
     if (!File.Exists(configPath))
     {
         if (_serializer.Serialize(configPath, new ConfigDTO(), Formatting.Indented))
         {
             _logger.Error("No config File found. Empty file created at " + configPath + ".");
             _logger.Error("Please consider running the \"reconfigure\" command or editing the config file in order to get the service working.");
             return true;
         } else
         {
             _logger.Error("No config File found but creating empty file failed.");
             _logger.Error("Please try again!");
             return false;
         }
     }
     return false;
 }