コード例 #1
0
        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");
        }
コード例 #2
0
 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"));
         }
     }
 }
コード例 #3
0
        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());
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: MyHomeLibrary/FB2ePub
        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);
        }