Example #1
0
 public ListenerService(IContainer c, bool _isServer)
 {
     container = c;
     http = c.Resolve<HTTPHandler>();
     isServer = _isServer;
     model = container.Resolve<Model>();
 }
Example #2
0
 public SharesController(IContainer c, Model m)
 {
     logger = LogManager.GetLogger("faplog");
     model = m;
     container = c;
     scanner = c.Resolve<ShareInfoService>();
 }
Example #3
0
 public WatchdogController(Model m, SharesController s, BufferService b, OverlordManagerService o)
 {
     model = m;
     shareController = s;
     bufferService = b;
     logger = LogManager.GetLogger("faplog");
     overlordLauncherService = o;
 }
Example #4
0
 public HTTPHandler(ShareInfoService i, Model m, BufferService b, ServerUploadLimiterService u)
 {
     infoService = i;
     model = m;
     bufferService = b;
     uploadLimiter = u;
     AddDefaultMimeTypes();
 }
Example #5
0
 public ConversationController(IContainer container, Model m)
 {
     windowController = container.Resolve<PopupWindowController>();
     model = m;
     this.container = container;
     uiConversations = new SafeObservingCollection<Conversation>(conversations);
     uiConversations.CollectionChanged += uiConversations_CollectionChanged;
     windowController.OnTabClosing += chatPopupController_OnTabClosing;
 }
Example #6
0
 public FAPClientHandler(Model m, ShareInfoService s, IConversationController c, BufferService b,
                         ServerUploadLimiterService sl)
 {
     model = m;
     shareInfoService = s;
     chatController = c;
     bufferService = b;
     serverUploadLimiterService = sl;
     logger = LogManager.GetLogger("faplog");
 }
Example #7
0
        public LogService(Model m)
        {
            LoggingConfiguration config = LogManager.Configuration;
            target = new LogServiceTarget(m.Messages);
            target.Layout =
                "${level}=> ${message} ${exception:format=Message} ${exception:format=Type} ${exception:format=StackTrace}";
            target.Name = "LogService";
            var wrapper = new AsyncTargetWrapper(target);

            config.AddTarget("LogService", wrapper);

            rule = new LoggingRule("*", LogLevel.Trace, target);
            config.LoggingRules.Add(rule);

            LogManager.Configuration = config;
            if (Debugger.IsAttached)
                target.Filter = LogLevel.Debug;
        }
Example #8
0
        private void Run()
        {

            if(Compose())
            {
                logService = container.Resolve<LogService>();
                logService.Filter = LogLevel.Trace;
                model = container.Resolve<Model>();
                model.Messages.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Messages_CollectionChanged);

                ApplicationCore core = new ApplicationCore(container);
                core.Load(true);
                core.StartOverlordServer();
               
                System.Console.WriteLine("Server started");
                System.Console.ReadKey();
            }
            else
            {
                System.Console.WriteLine("Program composition failed");
                System.Console.ReadKey();
            }
        }
Example #9
0
 public UpdateCheckerService(Model m)
 {
     model = m;
 }
Example #10
0
 public DownloadWorkerService(Node n, Model m, BufferService b)
 {
     remoteNode = n;
     model = m;
     bufferService = b;
 }
Example #11
0
 public CompareController(IContainer c)
 {
     viewModel = c.Resolve<CompareViewModel>();
     model = c.Resolve<Model>();
 }
Example #12
0
        protected override void OnStartup(StartupEventArgs e)
        {
            if(e.Args.Contains("WAIT"))
                Thread.Sleep(5000);

            SplashScreen appSplash = null;
            Fap.Foundation.SafeObservableStatic.Dispatcher = System.Windows.Application.Current.Dispatcher;
            SafeObservingCollectionManager.Start();
            this.DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException);
            FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

            base.OnStartup(e);
            if (Compose())
            {
                if (e.Args.Length == 1 && e.Args[0] == "WAIT")
                {
                    //Delay the application starting up, used when restarting.
                    Thread.Sleep(3000);
                }

                ApplicationCore core = container.Resolve<ApplicationCore>();

                if (!core.CheckSingleInstance())
                {
                    //An instance of fap is already running.

                    //If we got a download url then forward onto the runing instance of FAP
                    if (e.Args.Length == 2 && e.Args[0] == "-url")
                    {
                        Model model = new Model();
                        model.Load();

                        Client client = new Client(model.LocalNode);
                        AddDownload verb = new AddDownload();
                        verb.URL = e.Args[1];
                        if (client.Execute(verb, model.LocalNode))
                        {
                            //Download sent successfully
                            Shutdown(0);
                            return;
                        }
                        else
                        {
                            //Unsuccessful - Notify user
                            WPFMessageBox.Show("FAP", "Failed to add download via RPC!");
                            Shutdown(1);
                            return;
                        }
                    }
                    else
                    {
                        //Inform the user they cannot run multiple instances
                        WPFMessageBox.Show("FAP", "An instance of FAP is already running");
                        Shutdown(1);
                        return;
                    }
                }

                string img = GetImage();
                appSplash = new SplashScreen(img);
                appSplash.Show(true);

                if (core.Load(false))
                {

                    core.StartClient();
                    core.StartGUI(!(e.Args.Contains("STARTUP")));
                    //Was a url passed on startup?
                    if (e.Args.Length == 2 && e.Args[0] == "-url")
                    {
                        core.AddDownloadUrlWhenConnected(e.Args[1]);
                    }
                }
                else
                {
                    Shutdown(1);
                }
            }
            else
            {
                Shutdown(1);
            }
            if (null != appSplash)
                appSplash.Close(TimeSpan.FromSeconds(0));
        }
Example #13
0
 public SearchController(IContainer c, Model m)
 {
     container = c;
     model = m;
 }
Example #14
0
 public OverlordManagerService(IContainer c)
 {
     container = c;
     model = c.Resolve<Model>();
 }
Example #15
0
 public SettingsController(IContainer c, Model m, ApplicationCore ac)
 {
     container = c;
     model = m;
     core = ac;
 }
Example #16
0
 public CompareVerb(Model m)
 {
     model = m;
 }
 public ServerUploadLimiterService(Model model)
 {
     this.model = model;
 }
Example #18
0
 public ShareInfoService(Model m)
 {
     model = m;
 }
Example #19
0
 public DownloadQueueController(DownloadQueueViewModel vm, Model model)
 {
     this.vm = vm;
     this.model = model;
 }