コード例 #1
0
        private void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (AccountManager != null)
                {
                    if (IsDisposeSafe)
                    {
                        AccountManager.DisposeSafely();
                    }
                    else
                    {
                        AccountManager.Dispose();
                    }
                    AccountManager = null;
                }

                RpcWebClient.IsEnabled = false;

                if (Daemon != null)
                {
                    Daemon.Dispose();
                    Daemon = null;
                }
            }
        }
コード例 #2
0
        internal HeartbeatManager(Namesystem namesystem, BlockManager blockManager, Configuration
                                  conf)
        {
            heartbeatThread   = new Daemon(new HeartbeatManager.Monitor(this));
            this.namesystem   = namesystem;
            this.blockManager = blockManager;
            bool avoidStaleDataNodesForWrite = conf.GetBoolean(DFSConfigKeys.DfsNamenodeAvoidStaleDatanodeForWriteKey
                                                               , DFSConfigKeys.DfsNamenodeAvoidStaleDatanodeForWriteDefault);
            long recheckInterval = conf.GetInt(DFSConfigKeys.DfsNamenodeHeartbeatRecheckIntervalKey
                                               , DFSConfigKeys.DfsNamenodeHeartbeatRecheckIntervalDefault);
            // 5 min
            long staleInterval = conf.GetLong(DFSConfigKeys.DfsNamenodeStaleDatanodeIntervalKey
                                              , DFSConfigKeys.DfsNamenodeStaleDatanodeIntervalDefault);

            // 30s
            if (avoidStaleDataNodesForWrite && staleInterval < recheckInterval)
            {
                this.heartbeatRecheckInterval = staleInterval;
                Log.Info("Setting heartbeat recheck interval to " + staleInterval + " since " + DFSConfigKeys
                         .DfsNamenodeStaleDatanodeIntervalKey + " is less than " + DFSConfigKeys.DfsNamenodeHeartbeatRecheckIntervalKey
                         );
            }
            else
            {
                this.heartbeatRecheckInterval = recheckInterval;
            }
        }
コード例 #3
0
        void DoMaintenance(Daemon daemon)
        {
            if (paused || repopulating_clusters)
            {
                Logging.Info("WordConnector paused");
                daemon.Sleep(1500);
                return;
            }

            try
            {
                EnsureWordIsConnected();
                CheckTheCurrentTextContext();
                daemon.Sleep(1500);
            }

            catch (Exception ex)
            {
                Logging.Error(ex, "There was a problem attaching to Word.");
                DisconnectFromWord();
                daemon.Sleep(1500);
            }

            have_iterated_at_least_once = true;
        }
コード例 #4
0
        private PDFTextExtractor()
        {
            ShutdownableManager.Instance.Register(Shutdown);

            // Get a sensible number of OCR processors
            NUM_OCR_THREADS = ConfigurationManager.Instance.ConfigurationRecord.System_NumOCRProcesses ?? 0;
            if (0 == NUM_OCR_THREADS)
            {
                // use the total number of cores (minus one); assume that all processors
                // report the number of *virtual* cores as twice the number of physical
                // cores (as happens to be the case for most modern consumer Intel and AMD CPUs)
                NUM_OCR_THREADS = Environment.ProcessorCount / 2 - 1;
            }
            // ditto: limit to the number of physical cores in the CPU
            NUM_OCR_THREADS = Math.Min(NUM_OCR_THREADS, Environment.ProcessorCount / 2);
            // and make sure antique or obscure hardware doesn't tease us into
            // arriving at a ZERO thread count:
            NUM_OCR_THREADS = Math.Max(NUM_OCR_THREADS, 1);
#if DEBUG                        // for debugging
            NUM_OCR_THREADS = 1; // force a single thread for ease of debugging the background process
#endif

            Logging.Info("Starting {0} PDFTextExtractor threads", NUM_OCR_THREADS);
            still_running = true;
            threads       = new Daemon[NUM_OCR_THREADS];
            for (int i = 0; i < NUM_OCR_THREADS; ++i)
            {
                threads[i] = new Daemon(daemon_name: "PDFTextExtractor", daemon_index: i);
                threads[i].Start(ThreadEntry);
            }
        }
コード例 #5
0
        /// <summary>
        /// Is automatically polled while the daemon is alive
        /// </summary>
        /// <param name="daemon"></param>
        void DoMaintenance(Daemon daemon)
        {
            lock (general_task_items)
            {
                for (int i = general_task_items.Count - 1; i >= 0; --i)
                {
                    GeneralTaskItem general_task_item = general_task_items[i];

                    object target = general_task_item.target.Target;
                    if (null != target)
                    {
                        try
                        {
                            general_task_item.method.Invoke(target, new object[] { daemon });
                        }

                        catch (Exception ex)
                        {
                            Logging.Error(ex, "An exception occurred in the GeneralTaskDaemon with GeneralTaskItem {0}", general_task_item.description);
                        }
                    }
                    else
                    {
                        Logging.Info("A GeneralTaskItem has been garbage collected, so throwing it away: {0}", general_task_item.description);
                        general_task_items.RemoveAt(i);
                    }
                }
            }

            daemon.Sleep(10 * 1000);
        }
コード例 #6
0
ファイル: UIManager.cs プロジェクト: qyjbeijing2017/ggj2019
        /// <summary>
        /// 打开某个Ui
        /// </summary>
        /// <param name="panelName">Ui的名字</param>
        /// <param name="push">是否入栈</param>
        /// <param name="value">自定义数值</param>
        public void Open(string panelName, bool push = true, params object[] value)
        {
            if (m_uiDic.ContainsKey(panelName))
            {
                m_uiDic[panelName].show(false, value);
                m_uiDic[panelName].transform.SetAsLastSibling();
                m_uiDic[panelName].gameObject.SetActive(true);

                if (push)
                {
                    if (m_uiStack.Count > 0)
                    {
                        if (m_uiDic.ContainsKey(m_uiStack[m_uiStack.Count - 1]))
                        {
                            m_uiDic[m_uiStack[m_uiStack.Count - 1]].gameObject.SetActive(false);
                        }
                    }
                    m_uiStack.Add(panelName);
                }
            }
            else
            {
                if (ConfigManager.Instance.UIPanelConfigData.ContainsKey(panelName))
                {
                    UIPanelConfig uiData = ConfigManager.Instance.UIPanelConfigData[panelName];
                    if (uiData.Path != string.Empty)
                    {
                        GameObject go = Daemon.Instantiate(Resources.Load(uiData.Path) as GameObject);
                        go.transform.SetParent(Canvas.transform, false);
                        go.SetActive(false);
                        UIBase ui = go.GetComponent <UIBase>();
                        m_uiDic.Add(panelName, ui);

                        ui.show(true, value);
                        ui.gameObject.SetActive(true);
                        ui.transform.SetAsLastSibling();

                        if (push)
                        {
                            if (m_uiStack.Count > 0)
                            {
                                if (m_uiDic.ContainsKey(m_uiStack[m_uiStack.Count - 1]))
                                {
                                    m_uiDic[m_uiStack[m_uiStack.Count - 1]].gameObject.SetActive(false);
                                }
                            }
                            m_uiStack.Add(panelName);
                        }
                    }
                    else
                    {
                        Debug.LogError("UIPath is empty!");
                    }
                }
                else
                {
                    Debug.LogError("The UiPanel is not exist!");
                }
            }
        }
コード例 #7
0
        private void DoMaintenance_OnceOff(Daemon daemon)
        {
            if (daemon.StillRunning)
            {
                // KICK THEM OFF

                try
                {
                    StartupCommandLineParameterChecker.Check();
                }
                catch (Exception ex)
                {
                    Logging.Error(ex, "Exception during StartupCommandLineParameterChecker.Check");
                }

                InitClientUpdater();

                try
                {
                    AlternativeToReminderNotification.CheckIfWeWantToNotify();
                }
                catch (Exception ex)
                {
                    Logging.Error(ex, "Exception during AlternativeToReminderNotification.CheckIfWeWantToNotify");
                }

                try
                {
                    DropboxChecker.DoCheck();
                }
                catch (Exception ex)
                {
                    Logging.Error(ex, "Exception during DropboxChecker.DoCheck");
                }

                try
                {
                    AutoImportFromMendeleyChecker.DoCheck();
                }
                catch (Exception ex)
                {
                    Logging.Error(ex, "Exception during AutoImportFromMendeleyChecker.DoCheck");
                }

                try
                {
                    AutoImportFromEndnoteChecker.DoCheck();
                }
                catch (Exception ex)
                {
                    Logging.Error(ex, "Exception during AutoImportFromEndnoteChecker.DoCheck");
                }

                // hold off: level 1 -> 0
                MaintainableManager.Instance.BumpHoldOffPendingLevel();
            }

            // We only want this to run once
            daemon.Stop();
        }
コード例 #8
0
        public void Execute(ISolution solution, ITextControl textControl)
        {
            ISettingsStore store = Shell.Instance.GetComponent <ISettingsStore>();

            // Get the dictionary
            CustomDictionary dictionary =
                _settingsStore.GetIndexedValue <CustomDictionarySettings, string, CustomDictionary>(
                    settings => settings.CustomDictionaries, _dictName);

            if (dictionary == null)
            {
                dictionary = new CustomDictionary()
                {
                    Name = _dictName
                }
            }
            ;

            string words = dictionary.DecodedUserWords.Trim();

            if (words.Length > 0)
            {
                dictionary.DecodedUserWords = words + "\n";
            }
            dictionary.DecodedUserWords += _word;

            IContextBoundSettingsStore boundStore = store.BindToContextTransient(ContextRange.ApplicationWide);

            boundStore.SetIndexedValue <CustomDictionarySettings, string, CustomDictionary>(x => x.CustomDictionaries, _dictName, dictionary);
            SpellCheckManager.Reset(); // Clear the cache.
            solution.SaveSettings();
            Daemon.GetInstance(solution).ForceReHighlight(_documentRange.Document);
        }
コード例 #9
0
 internal virtual void StartMonitor()
 {
     Preconditions.CheckState(lmthread == null, "Lease Monitor already running");
     shouldRunMonitor = true;
     lmthread         = new Daemon(new LeaseManager.Monitor(this));
     lmthread.Start();
 }
コード例 #10
0
ファイル: FluentMediaPlayer.cs プロジェクト: jvert/netdaemon
        /// <inheritdoc/>
        public async Task ExecuteAsync()
        {
            _ = _currentAction ?? throw new NullReferenceException("Missing fluent action type!");

            var executeTask = _currentAction.ActionType switch
            {
                FluentActionType.Play => CallServiceOnAllEntities("media_play"),
                FluentActionType.Pause => CallServiceOnAllEntities("media_pause"),
                FluentActionType.PlayPause => CallServiceOnAllEntities("media_play_pause"),
                FluentActionType.Stop => CallServiceOnAllEntities("media_stop"),
                FluentActionType.Speak => Speak(),
                _ => throw new NotSupportedException($"Action type not supported {_currentAction.ActionType}")
            };

            await executeTask.ConfigureAwait(false);

            // Use local function to get the nice switch statement above:)
            Task Speak()
            {
                foreach (var entityId in EntityIds)
                {
                    var message = _currentAction?.MessageToSpeak ??
                                  throw new NullReferenceException("Message to speak is null or empty!");

                    Daemon.Speak(entityId, message);
                }
                return(Task.CompletedTask);
            }
        }
    }
コード例 #11
0
        private void DoMaintenance_Frequent(Daemon daemon)
        {
            if (ConfigurationManager.Instance.ConfigurationRecord.DisableAllBackgroundTasks)
            {
                Logging.Debug特("Daemons are forced to sleep via Configuration::DisableAllBackgroundTasks");
                return;
            }

            // If this library is busy, skip it for now
            if (Library.IsBusyAddingPDFs)
            {
                Logging.Debug特("DoMaintenance_Frequent: Not daemon processing any library that is busy with adds...");
                return;
            }

            // Check for new syncing
            try
            {
                SyncQueues.Instance.DoMaintenance(daemon);
            }
            catch (Exception ex)
            {
                Logging.Error(ex, "Exception in SyncQueues.Instance.DoMaintenance");
            }
        }
コード例 #12
0
        private void BackgroundThread(object arg)
        {
            Daemon daemon = (Daemon)arg;

            Logging.Debug特("AutoArranger Thread {0} has started", daemon.ManagedThreadId);

            while (!ShutdownableManager.Instance.IsShuttingDown)
            {
                //Utilities.LockPerfTimer l1_clk = Utilities.LockPerfChecker.Start();
                lock (thread_lock)
                {
                    //l1_clk.LockPerfTimerStop();
                    if (daemon != active_thread)
                    {
                        break;
                    }
                }

                DoLayout();

                daemon.Sleep(30);
            }

            Logging.Debug特("AutoArranger Thread {0} has exited", daemon.ManagedThreadId);
        }
コード例 #13
0
ファイル: MainWindow.cs プロジェクト: imsinc-inc/imsinc_miner
        /// <summary>
        /// When the form closes, make sure the wallet stops refreshing and all work is saved.
        /// </summary>
        /// <param name="e"></param>
        protected async override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            if (!skipExitWrappers)
            {
                Cursor = Cursors.WaitCursor;
                SetStatus(WalletStatus.Ready, "Exiting...");

                skipExitWrappers = true;
                e.Cancel         = true;

                Progress progess = new Progress();
                progess.Show(this);

                var tf = new TaskFactory();

                progess.SetProgress("Stopping miners", 0);
                await tf.StartNew(() => MinerManager.Exit());


                progess.SetProgress("Stopping wallet", 33);
                await tf.StartNew(() => Wallet.Exit());


                progess.SetProgress("Stopping daemon", 66);
                await tf.StartNew(() => Daemon.Exit());

                Close();
            }
        }
コード例 #14
0
        private void DownloadCompleted(object sender, AsyncCompletedEventArgs e)
        {
            Daemon.DownloadProgressChanged -= DownloadProgressChanged;
            Daemon.DownloadCompleted       -= DownloadCompleted;

            if (e.Error != null)
            {
                var ex      = e.Error;
                var message = string.Format($"Failed to activate support of additional languages: {ex.Message}");
                MessageBox.Show(message, "Error", MessageBoxButton.OK);
                Debug.WriteLine(message + "\n" + ex.StackTrace);
                Close();
                return;
            }

            if (!canceled)
            {
                ProgressBar.Visibility      = Visibility.Collapsed;
                CompletedMessage.Visibility = Visibility.Visible;

                Daemon.Start();
                Settings.IsActivateMoreEnabled = true;
                callback?.DynamicInvoke();
            }

            OkButton.IsEnabled = true;
            OkButton.Focus();
        }
コード例 #15
0
        public InvalidateOnMaximumMethodArgumentsChange(Lifetime lifetime, Daemon daemon, ISettingsStore settingsStore)
        {
            var maxArguments =
                settingsStore.Schema.GetScalarEntry((CleanCodeSettings s) => s.TooManyMethodArgumentsMaximum);

            settingsStore.AdviseChange(lifetime, maxArguments, daemon.Invalidate);
        }
コード例 #16
0
        private void DoMaintenance(Daemon daemon)
        {
#if false
            if (Common.Configuration.ConfigurationManager.Instance.ConfigurationRecord.DisableAllBackgroundTasks)
            {
                daemon.Sleep(60 * 1000);
                return;
            }
#endif

            if (paused || repopulating_clusters)
            {
                Logging.Info("WordConnector paused");
                return;
            }

            try
            {
                EnsureWordIsConnected();
                CheckTheCurrentTextContext();
            }
            catch (Exception ex)
            {
                Logging.Error(ex, "There was a problem attaching to Word.");
                DisconnectFromWord();
            }

            have_iterated_at_least_once = true;
        }
コード例 #17
0
ファイル: Program.cs プロジェクト: MZhoume/IoTFinalProj
        public static void Main(string[] args)
        {
            _manager = ServiceLocator.GetService <DBManager>();
            _sensor  = ServiceLocator.GetService <ISensors, Sensors>();

            _manager.Execute("DELETE FROM Items");
            foreach (var id in _manager.Query <ItemId>("SELECT * FROM ItemIds"))
            {
                _manager.Execute("UPDATE ItemIds SET DaysInStock = 0 WHERE Id = @Id", new { Id = id.Id });
            }

            #region initialize

            double refreshTime = 8000;

            Daemon.Create(refreshTime, (s, e) =>
            {
                Console.WriteLine("Getting sensor data...");
                var readouts = _sensor.GetSensorData();

                if (Math.Abs(readouts[0].Humidity) < 0.01 ||
                    Math.Abs(readouts[0].Temperature) < 0.01 ||
                    Math.Abs(readouts[1].Humidity) < 0.01 ||
                    Math.Abs(readouts[1].Temperature) < 0.01 ||
                    readouts[0].Weight > 1000 ||
                    readouts[1].Weight > 1000)
                {
                    return;
                }

                for (int i = 0; i < 2; i++)
                {
                    var itemid      = _manager.Query <ItemId>("SELECT * FROM ItemIds WHERE Id = @Id", new { Id = i + 1 }).FirstOrDefault();
                    var weight      = readouts[i].Weight;
                    var humidity    = readouts[i].Humidity;
                    var temperature = readouts[i].Temperature;
                    var price       = itemid.FullPrice - (itemid.FullPrice - itemid.PriceThreshold) / itemid.DaysAlive * itemid.DaysInStock;
                    _manager.Execute("INSERT INTO Items (ItemId, Weight, Humidity, Temperature, Price) VALUES (@Id, @W, @H, @T, @P)", new { Id = i + 1, W = weight, H = humidity, T = temperature, P = price });
                }
            }, true, false);

            Daemon.Create(3 * refreshTime, (s, e) =>
            {
                var itemIds = _manager.Query <ItemId>("SELECT * FROM ItemIds");
                foreach (var id in itemIds)
                {
                    _manager.Execute("UPDATE ItemIds SET DaysInStock = @D WHERE Id = @Id", new { D = id.DaysInStock + 1, Id = id.Id });
                }
            }, true, false);

            #endregion

            using (var host = new NancyHost(new Uri("http://localhost:80")))
            {
                host.Start();
                Console.WriteLine("Running... on port 80");
                Console.ReadLine();
            }
        }
コード例 #18
0
 void DoMaintenance_FlushDocuments(Daemon daemon)
 {
     if (period_flush.Expired)
     {
         period_flush.Signal();
         FlushDocuments();
     }
 }
コード例 #19
0
        public async Task <MessageResult> TryStop()
        {
            var messageResult = await Daemon.Stop();

            await Runner.TryStop();

            return(messageResult);
        }
コード例 #20
0
ファイル: IpfsGui.cs プロジェクト: rectsuly/ipfs-gui
 public void Initialize()
 {
     SystemTray.Initialize(this);
     if (UserConfig.Default.Autostart)
     {
         Daemon.Start();
     }
 }
コード例 #21
0
ファイル: KeyManager.cs プロジェクト: orf53975/hadoop.net
 internal BlockKeyUpdater(KeyManager _enclosing, long sleepInterval)
 {
     this._enclosing    = _enclosing;
     daemon             = new Daemon(this);
     this.sleepInterval = sleepInterval;
     KeyManager.Log.Info("Update block keys every " + StringUtils.FormatTime(sleepInterval
                                                                             ));
 }
コード例 #22
0
        public static void TestHarness()
        {
            Daemon  daemon  = new Daemon("Test");
            Library library = Library.GuestInstance;

            AITagManager ai_tag_manager = new AITagManager(library);

            ai_tag_manager.Regenerate();
        }
コード例 #23
0
        private void Window_ContentRendered(object sender, EventArgs args)
        {
            ProgressBar.Visibility      = Visibility.Visible;
            CompletedMessage.Visibility = Visibility.Collapsed;

            Daemon.DownloadProgressChanged += DownloadProgressChanged;
            Daemon.DownloadCompleted       += DownloadCompleted;
            Daemon.Install();
        }
コード例 #24
0
ファイル: DelugeRPC.cs プロジェクト: fuzeman/DelugeRPC.NET
		public SSLConnector Connect(string host, int port)
		{
			SSLConnector conn = (SSLConnector)Reactor.ConnectSSL(host, port, _factory, null);

			Daemon = new Daemon(_factory);
			Core = new Core(_factory);

			return conn;
		}
コード例 #25
0
ファイル: Program.cs プロジェクト: Cougar/HomeAutomation
    static void Main(string[] args)
    {
        bool error = false;
        if (args.Length != 2) {
            Console.WriteLine("Syntax: program.exe <port> <baudrate>");
            Console.WriteLine("port        - can be in form of /dev/ttyS0 or com2 or /udp/ipaddress/port");
            Console.WriteLine("baudrate    - any baudrate like 19200 (for udp baudrate could be any number)");
            Console.WriteLine("");
            Console.WriteLine("example: program.exe /dev/ttyUSB0 19200");
            Console.WriteLine("example: program.exe /udp/192.168.0.10/1100 0");
            error = true;
            return;
        }

        if (!error) {
            //Console.WriteLine("arg0: " + args[0] + "\n");
            argPort = args[0];
            argBaud = Int32.Parse(args[1]);
        }

        if (!error) {
            if (DEBUG_LEVEL>0) {
                Console.WriteLine("canDaemon");
                Console.WriteLine("Commands:");
                //Console.WriteLine("reset - reset communication.");
                Console.WriteLine("exit  - exit program");
                Console.WriteLine("");
                Thread.Sleep(1000);
            }

            sc = new SerialConnection();
            try {
                sc.setConfiguration(argBaud, System.IO.Ports.Parity.None, argPort, System.IO.Ports.StopBits.One, 8, false);
            }
            catch (Exception e) { Console.WriteLine("Error: " + e.Message); }
            if (!sc.open()) {
                Console.WriteLine("Error opening port to target");
                //... här ska man testa om igen...

            } else {

                d = new Daemon(sc);
                tcps = new TcpServer(1200);
                d.addServer(tcps);

                Thread t = new Thread(d.thread);
                t.Start();

                string instr;
                do {
                    //Console.Write("> ");
                    instr = Console.ReadLine().ToLower();
                } while (parseInput(instr));
                d.stop();
            }
        }
    }
コード例 #26
0
	public void Awake() {
		if(main == null) {
			main = this;
			GameObject.DontDestroyOnLoad(this.gameObject);
		} else {
			System.GC.Collect();
			GameObject.Destroy(this.gameObject);
		}
	}
コード例 #27
0
        private NotificationManager()
        {
            //  register for shutdown
            ShutdownableManager.Instance.Register(DoShutdown);

            //  kick off our thread
            daemon = new Daemon("NotificationManager");
            daemon.Start(StartDaemon, null);
        }
コード例 #28
0
        private DelugedConnectionService(string hostname, int port)
        {
            DelugeRPCProtocol protocol = CreateConnection(hostname, port);

            Daemon = new Daemon(protocol);

            _hostname = hostname;
            _port     = port;
        }
コード例 #29
0
        private static bool ProcessCliCommands(string[] args)
        {
            var daemon        = new Daemon(Global, TerminateService);
            var interpreter   = new CommandInterpreter(Console.Out, Console.Error);
            var executionTask = interpreter.ExecuteCommandsAsync(
                args,
                new MixerCommand(daemon));

            return(executionTask.GetAwaiter().GetResult());
        }
        private void OnDeactivateClicked(object sender, RoutedEventArgs e)
        {
            if (Daemon.IsRunning)
            {
                Daemon.Stop();
            }
            Settings.IsActivateMoreEnabled = false;

            UpdateActiveMoreControls();
        }
コード例 #31
0
        private void WithSetup(IDropClient dropClient, Action <Daemon, DropEtwListener> action, Client apiClient = null)
        {
            var    etwListener  = ConfigureEtwLogging();
            string moniker      = Program.IpcProvider.RenderConnectionString(Program.IpcProvider.CreateNewMoniker());
            var    daemonConfig = new DaemonConfig(VoidLogger.Instance, moniker: moniker, enableCloudBuildIntegration: false);
            var    dropConfig   = new DropConfig(string.Empty, null);
            var    daemon       = new Daemon(UnixParser.Instance, daemonConfig, dropConfig, Task.FromResult(dropClient), client: apiClient);

            action(daemon, etwListener);
        }
コード例 #32
0
        private void DoMaintenance_Infrequent(Daemon daemon)
        {
            Logging.Debug特("DoMaintenance_Infrequent START");

            if (ConfigurationManager.Instance.ConfigurationRecord.DisableAllBackgroundTasks)
            {
                Logging.Debug特("Daemons are forced to sleep via Configuration::DisableAllBackgroundTasks");
                return;
            }

            // If this library is busy, skip it for now
            if (Library.IsBusyAddingPDFs)
            {
                Logging.Debug特("DoMaintenance_Infrequent: Not daemon processing any library that is busy with adds...");
                return;
            }

            if (!ConfigurationManager.IsEnabled("BuildSearchIndex"))
            {
                Logging.Debug特("DoMaintenance_Infrequent::IncrementalBuildIndex: Breaking out of processing loop due to BuildSearchIndex=false");
                return;
            }

            foreach (var web_library_detail in WebLibraryManager.Instance.WebLibraryDetails_WorkingWebLibraries)
            {
                Library library = web_library_detail.Xlibrary;

                if (library == null || !library.LibraryIsLoaded)
                {
                    continue;
                }

                try
                {
                    metadata_extraction_daemon.DoMaintenance(web_library_detail, () =>
                    {
                        try
                        {
                            library.LibraryIndex?.IncrementalBuildIndex(web_library_detail);
                        }
                        catch (Exception ex)
                        {
                            Logging.Error(ex, "Exception in LibraryIndex.IncrementalBuildIndex()");
                        }
                    });
                }
                catch (Exception ex)
                {
                    Logging.Error(ex, "Exception in metadata_extraction_daemon");
                }
            }

            Logging.Debug特("DoMaintenance_Infrequent END");
        }
コード例 #33
0
        public async override System.Threading.Tasks.Task RunTaskAsync()
        {
            try {
                LoadResourceCaseMap();

                assemblyMap.Load(Path.Combine(WorkingDirectory, AssemblyIdentityMapFile));

                proguardRuleOutputTemp = GetTempFile();

                await this.WhenAll(ManifestFiles, ProcessManifest);

                ProcessOutput();
                // now check for
                foreach (var kvp in apks)
                {
                    string currentResourceOutputFile = kvp.Key;
                    bool   aaptResult = Daemon.JobSucceded(kvp.Value);
                    LogDebugMessage($"Processing {currentResourceOutputFile} JobId: {kvp.Value} Exists: {File.Exists (currentResourceOutputFile)} JobWorked: {aaptResult}");
                    if (!string.IsNullOrEmpty(currentResourceOutputFile))
                    {
                        var tmpfile = currentResourceOutputFile + ".bk";
                        // aapt2 might not produce an archive and we must provide
                        // and -o foo even if we don't want one.
                        if (File.Exists(tmpfile))
                        {
                            if (aaptResult)
                            {
                                LogDebugMessage($"Copying {tmpfile} to {currentResourceOutputFile}");
                                MonoAndroidHelper.CopyIfZipChanged(tmpfile, currentResourceOutputFile);
                            }
                            File.Delete(tmpfile);
                        }
                        // Delete the archive on failure
                        if (!aaptResult && File.Exists(currentResourceOutputFile))
                        {
                            LogDebugMessage($"Link did not succeed. Deleting {currentResourceOutputFile}");
                            File.Delete(currentResourceOutputFile);
                        }
                    }
                }
                if (!string.IsNullOrEmpty(ProguardRuleOutput))
                {
                    MonoAndroidHelper.CopyIfChanged(proguardRuleOutputTemp, ProguardRuleOutput);
                }
            } finally {
                lock (tempFiles) {
                    foreach (var temp in tempFiles)
                    {
                        File.Delete(temp);
                    }
                    tempFiles.Clear();
                }
            }
        }
コード例 #34
0
ファイル: DelugeRPC.cs プロジェクト: fuzeman/DelugeRPC.NET
        private void _ConnectAsyncCallback(IConnector connector, object callbackState)
        {
            if (!(callbackState is object[])) throw new ArgumentException();

            object[] states = (object[])callbackState;
            ConnectAsyncCallback callback = states[0] as ConnectAsyncCallback;
            object state = states[2];

            Daemon = new Daemon(_factory);
            Core = new Core(_factory);
            callback(connector, state);
        }
コード例 #35
0
ファイル: FormColours.cs プロジェクト: Epidal/Ostara
		void SetComboColours(Owf.Controls.Office2007ColorPicker fg, Owf.Controls.Office2007ColorPicker bg, Daemon src, Daemon dest) {
			var k = new Key(src, dest);
			fg.Color = Pairs[k].Item1;
			bg.Color = Pairs[k].Item2;
		}
 public InvalidateOnMaximumMethodArgumentsChange(Lifetime lifetime, Daemon daemon, ISettingsStore settingsStore)
 {
     var maxArguments =
         settingsStore.Schema.GetScalarEntry((CleanCodeSettings s) => s.TooManyMethodArgumentsMaximum);
     settingsStore.AdviseChange(lifetime, maxArguments, daemon.Invalidate);
 }
コード例 #37
0
 public ConfigureDaemons WithHeapSize(Daemon daemon, int megabytes)
 {
     args.Add("--" + daemon.ToString().ToLower() + "-heap-size=" + megabytes);
     return this;
 }
コード例 #38
0
 /// <summary>
 /// Specify additional Java opts to be included when the daemon starts.
 /// </summary>
 /// <param name="daemon">The daemon to add opts to.</param>
 /// <param name="opts">Additional Java command line arguments.</param>
 public void AddOpts(Daemon daemon, String opts)
 {
     args.Add("--" + daemon.ToString().ToLower(CultureInfo.InvariantCulture) + "-opts=\"" + opts + "\"");
 }
コード例 #39
0
 /// <summary>
 /// Specify additional Java opts to be included when the daemon starts.
 /// </summary>
 /// <param name="daemon">The daemon to add opts to.</param>
 /// <param name="opts">Additional Java command line arguments.</param>
 public void AddOpts(Daemon daemon, String opts)
 {
     args.Add("--" + daemon.ToString().ToLowerInvariant() + "-opts=\"" + opts + "\"");
 }
 public InvalidateOnExcessiveIndentationChange(Lifetime lifetime, Daemon daemon, ISettingsStore settingsStore)
 {
     var maxDepth = settingsStore.Schema.GetScalarEntry((CleanCodeSettings s) => s.ExcessiveIndentationMaximum);
     settingsStore.AdviseChange(lifetime, maxDepth, daemon.Invalidate);
 }
 public InvalidateOnMinimumMethodNameLenghtChange(Lifetime lifetime, Daemon daemon, ISettingsStore settingsStore)
 {
     var minMethodNameLenght = settingsStore.Schema.GetScalarEntry((CleanCodeSettings s) => s.MethodNameNotMeaningfulMinimumEnabled);
     settingsStore.AdviseChange(lifetime, minMethodNameLenght, daemon.Invalidate);
 }
 public DisposableFunctionAnalysisInvalidateOnSettingsChange(Lifetime lifetime, Daemon daemon,
     ISettingsStore settingsStore)
 {
     var thresholdEntry = settingsStore.Schema.GetScalarEntry((DisposePluginSettings s) => s.MaxLevel);
     settingsStore.AdviseChange(lifetime, thresholdEntry, daemon.Invalidate);
 }
コード例 #43
0
 public InvalidateOnMaximumMethodsPerClass(Lifetime lifetime, Daemon daemon, ISettingsStore settingsStore)
 {
     var maxDepth = settingsStore.Schema.GetScalarEntry((CleanCodeSettings s) => s.ClassTooBigMaximum);
     settingsStore.AdviseChange(lifetime, maxDepth, daemon.Invalidate);
 }
コード例 #44
0
 public ConfigureDaemons WithOpts(Daemon daemon, String opts)
 {
     args.Add("--" + daemon.ToString().ToLower() + "-opts=\"" + opts + "\"");
     return this;
 }
 public ComplexityAnalysisInvalidateOnThresholdChange(Lifetime lifetime, Daemon.Daemon daemon, ISettingsStore settingsStore)
 {
   SettingsScalarEntry thresholdEntry = settingsStore.Schema.GetScalarEntry((ComplexityAnalysisSettings s) => s.Threshold);
   settingsStore.AdviseChange(lifetime, thresholdEntry, daemon.Invalidate);
 }
 public InvalidateOnMaximumDependenciesChange(Lifetime lifetime, Daemon daemon, ISettingsStore settingsStore)
 {
     var maxParams = settingsStore.Schema.GetScalarEntry((CleanCodeSettings s) => s.TooManyDependenciesMaximum);
       settingsStore.AdviseChange(lifetime, maxParams, daemon.Invalidate);
 }
コード例 #47
0
 public InvalidateOnMaximumChainedCalls(Lifetime lifetime, Daemon daemon, ISettingsStore settingsStore)
 {
     var maxDepth = settingsStore.Schema.GetScalarEntry((CleanCodeSettings s) => s.TooManyChainedReferencesMaximum);
     settingsStore.AdviseChange(lifetime, maxDepth, daemon.Invalidate);
 }
コード例 #48
0
 /// <summary>
 /// Set the heap size of a daemon.
 /// </summary>
 /// <param name="daemon">The deamon to configure.</param>
 /// <param name="megabytes">The requested heap size of the daemon.</param>
 public void AddHeapSize(Daemon daemon, int megabytes)
 {
     args.Add("--" + daemon.ToString().ToLower(CultureInfo.InvariantCulture) + "-heap-size=" + megabytes);
 }
 public InjectionHappyDetectorInvalidateOnMaximumArgumentsChange(Lifetime lifetime, Daemon daemon, ISettingsStore settingsStore)
 {
     SettingsScalarEntry maxParams = settingsStore.Schema.GetScalarEntry((InjectionHappyDetectorSettings s) => s.MaximumParameters);
       settingsStore.AdviseChange(lifetime, maxParams, daemon.Invalidate);
 }
コード例 #50
0
 public InvalidateOnMaximumLinesChange(Lifetime lifetime, Daemon daemon, ISettingsStore settingsStore)
 {
     var maxLines = settingsStore.Schema.GetScalarEntry((CleanCodeSettings s) => s.MethodTooLongMaximum);
     settingsStore.AdviseChange(lifetime, maxLines, daemon.Invalidate);
 }