public ActionResult GetImage(string name) { var breed = _context.Breeds.Where(b => b.Name.Replace(" ", "") == name).FirstOrDefault(); var imagePath = System.IO.File.OpenRead($"{FolderLocator.ImagesFolderLocation()}{breed.Name.Replace(" ", "")}.jpg"); return(File(imagePath, "image/jpeg")); }
private static ClusterConfigClientSettings Initialize() { try { var folder = FolderLocator.Locate(AppDomain.CurrentDomain.BaseDirectory, ClusterConfigClientDefaults.LocalFolder); if (!folder.Exists) { return(Default); } var file = new FileInfo(Path.Combine(folder.FullName, ClusterConfigClientDefaults.ConfigurationFile)); if (!file.Exists) { return(Default); } var fileParser = new FileParser(new FileParserSettings()); var fileSettings = fileParser.Parse(file); if (fileSettings == null) { return(Default); } var settings = new ClusterConfigClientSettings(); ConfigurationFileHelper.Apply(fileSettings, settings); return(settings); } catch { return(Default); } }
public FoldersController( ProbeDbContext dbContext, FolderLocator folderLocator, FolderOperator folderCleaner) { _dbContext = dbContext; _folderLocator = folderLocator; _folderOperator = folderCleaner; }
public DownloadController( FolderLocator folderLocator, ProbeDbContext dbContext, IConfiguration configuration) { _folderLocator = folderLocator; _dbContext = dbContext; _configuration = configuration; }
public FilesController( ProbeDbContext dbContext, FolderLocator folderLocator, IConfiguration configuration) { _dbContext = dbContext; _folderLocator = folderLocator; _configuration = configuration; }
private static void SetupLogAndData() { Console.WriteLine(@"FB2 to EPUB command line converter by Lord KiRon"); string logPath = Path.Combine(FolderLocator.GetLocalAppDataFolder(), @"Lord_KiRon\fb2epub.log"); SetNewLogPath(logPath); _log = LogManager.GetLogger(Assembly.GetExecutingAssembly().GetType()); // Log an info level message _log.Debug("Application [FB2EPUB] Start"); }
public DownloadController( FolderLocator folderLocator, ProbeDbContext dbContext, IConfiguration configuration, ImageCompressor imageCompressor) { _folderLocator = folderLocator; _dbContext = dbContext; _configuration = configuration; _imageCompressor = imageCompressor; }
public DownloadController( FolderLocator folderLocator, ProbeDbContext dbContext, ImageCompressor imageCompressor, TokenEnsurer tokenEnsurer, IStorageProvider storageProvider) { _folderLocator = folderLocator; _dbContext = dbContext; _imageCompressor = imageCompressor; _tokenEnsurer = tokenEnsurer; _storageProvider = storageProvider; }
public FilesController( ProbeDbContext dbContext, FolderLocator folderLocator, FolderOperator folderCleaner, IConfiguration configuration, ServiceLocation serviceLocation, TokenEnsurer tokenEnsurer) { _dbContext = dbContext; _folderLocator = folderLocator; _configuration = configuration; _serviceLocation = serviceLocation; _tokenEnsurer = tokenEnsurer; _folderCleaner = folderCleaner; }
public FilesController( ProbeDbContext dbContext, FolderLocator folderLocator, FolderCleaner folderCleaner, IConfiguration configuration, FolderRefactor folderRefactor, ServiceLocation serviceLocation) { _dbContext = dbContext; _folderLocator = folderLocator; _configuration = configuration; _folderRefactor = folderRefactor; _serviceLocation = serviceLocation; _folderCleaner = folderCleaner; }
public FilesController( ProbeDbContext dbContext, FolderLocator folderLocator, FolderOperator folderCleaner, TokenEnsurer tokenEnsurer, ProbeLocator probeLocator, IStorageProvider storageProvider) { _dbContext = dbContext; _folderLocator = folderLocator; _tokenEnsurer = tokenEnsurer; _probeLocator = probeLocator; _storageProvider = storageProvider; _folderCleaner = folderCleaner; }
static Logger() { // in case we run from DLL if (Assembly.GetEntryAssembly() == null) { // detect assembly path, the config file should be right near it string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (!string.IsNullOrEmpty(path)) { // set the path to location were we wish to log to log4net.GlobalContext.Properties["LogName"] = Path.Combine(FolderLocator.GetLocalAppDataFolder(), @"Lord_KiRon\"); // load .config file containing loggers XmlConfigurator.Configure(new FileInfo(path + @"\FB2EPubConverter.dll.config")); } } }
static void Main() { //var item = (Anchor)ElementFactory.CreateElement(new XElement("a"), HTMLElementType.HTML5); //item.Rel.Value = Anchor.RelAttributeOptions.Author; //var test = item.Generate(); string logPath = Path.Combine(FolderLocator.GetLocalAppDataFolder(), @"Lord_KiRon\"); GlobalContext.Properties["LogName"] = logPath; Log = LogManager.GetLogger(Assembly.GetExecutingAssembly().GetType()); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormGUI()); }
private DirectoryInfo Locate(int maxOutwardHops = 3) => FolderLocator.Locate(startingPoint, soughtFolder, maxOutwardHops);
static int Main(string[] args) { GlobalContext.Properties["LogName"] = Path.Combine(FolderLocator.GetLocalAppDataFolder(), "Lord KiRon\\"); Log = LogManager.GetLogger(Assembly.GetExecutingAssembly().GetType()); // Log an info level message Log.Info("FB2EPUB shell extension registration utility by Lord KiRon"); List <string> options = new List <string>(); try { foreach (var param in args) { if (IsOptionParameter(param)) { options.Add(param); } } ExtRegistrator registrator = new ExtRegistrator(); if (options.Count > 0) { string fileName = GetDllFileName(); if ((options[0].ToLower() == "/r") || (options[0].ToLower() == "-r")) { string filePath = LocationDetector.DetectLocation(fileName); if (string.IsNullOrEmpty(filePath)) { Log.ErrorFormat("Unable to locate {0}", fileName); return(1); } registrator.RegistrationPath = filePath; Log.InfoFormat("Registering {0}", filePath); registrator.Register(ExtRegistrator.RegistrationExtensionEnum.BaseSet); return(1); } if ((options[0].ToLower() == "/rall") || (options[0].ToLower() == "-rall")) { string filePath = LocationDetector.DetectLocation(fileName); if (string.IsNullOrEmpty(filePath)) { Log.ErrorFormat("Unable to locate {0}", fileName); return(1); } registrator.RegistrationPath = filePath; Log.InfoFormat("Registering {0}", filePath); registrator.Register(ExtRegistrator.RegistrationExtensionEnum.All); return(0); } if ((options[0].ToLower() == "/u") || options[0].ToLower() == "-u") { Log.Info("Unregistering"); registrator.Unregister(); return(0); } } else { Application.Run(new MainForm()); } } catch (Exception ex) { Log.Error(ex); return(2); } return(0); }