public void Prepare(GameObject owner)
        {
            if (!BindTarget)
            {
                Debug.LogError($"Binding target is null, Path : {Path} Property : {BindTargetProp}, Owner: {owner.name}");
                return;
            }

            m_propertyInfo = BindTargetProp == "SetActive" ? null : BindTarget.GetType().GetProperty(BindTargetProp);
            watchCallback  = SetPropertyValue;
        }
Exemplo n.º 2
0
        public override bool Start()
        {
            // Grab list of media folders, initialize the scan queue
            IList <Folder> mediaFolders = Injection.Kernel.Get <IFolderRepository>().MediaFolders();

            this.scanQueue = new DelayedOperationQueue();
            this.scanQueue.startQueue();
            this.scanQueue.queueOperation(new OrphanScanOperation(0));

            IntPtr[] paths = new IntPtr[mediaFolders.Count];
            int      i     = 0;

            foreach (Folder folder in mediaFolders)
            {
                // Launch the folder scan operation
                this.scanQueue.queueOperation(new FolderScanning.FolderScanOperation(folder.FolderPath, 0));

                paths[i] = Marshal.StringToHGlobalAnsi(folder.FolderPath);
                i++;
            }

            fsEventsCallback = new WatchCallback(FSEventsCallback);

            this.fsEventsThread = new Thread(() => { WatchPaths(paths, mediaFolders.Count, 5.0, fsEventsCallback); });
            this.fsEventsThread.Start();

            /*
             * // Disabled until new web services in place - MDL, 11/11/13
             *
             * // Queue the musicbrainz scan after the folder scan
             * this.scanQueue.queueOperation(new MusicBrainzScanOperation(0));
             *
             * // Queue the artist thumbnail downloader
             * this.scanQueue.queueOperation(new ArtistThumbnailDownloadOperation(0));
             */

            // Report if no media folders in configuration
            if (mediaFolders.Count == 0)
            {
                logger.Warn("No media folders defined, FileManager service cannot find any media");
            }

            // Collect garbage now to conserve resources
            GC.Collect();

            return(true);
        }
Exemplo n.º 3
0
        public override bool Start()
        {
            // Grab list of media folders, initialize the scan queue
            IList<Folder> mediaFolders = Injection.Kernel.Get<IFolderRepository>().MediaFolders();
            this.scanQueue = new DelayedOperationQueue();
            this.scanQueue.startQueue();
            this.scanQueue.queueOperation(new OrphanScanOperation(0));

            IntPtr[] paths = new IntPtr[mediaFolders.Count];
            int i = 0;
            foreach (Folder folder in mediaFolders)
            {
                // Launch the folder scan operation
                this.scanQueue.queueOperation(new FolderScanning.FolderScanOperation(folder.FolderPath, 0));

                paths[i] = Marshal.StringToHGlobalAnsi(folder.FolderPath);
                i++;
            }

            fsEventsCallback = new WatchCallback(FSEventsCallback);

            this.fsEventsThread = new Thread(() => { WatchPaths(paths, mediaFolders.Count, 5.0, fsEventsCallback); });
            this.fsEventsThread.Start();

            /*
            // Disabled until new web services in place - MDL, 11/11/13

            // Queue the musicbrainz scan after the folder scan
            this.scanQueue.queueOperation(new MusicBrainzScanOperation(0));

            // Queue the artist thumbnail downloader
            this.scanQueue.queueOperation(new ArtistThumbnailDownloadOperation(0));
            */

            // Report if no media folders in configuration
            if (mediaFolders.Count == 0)
            {
                logger.Warn("No media folders defined, FileManager service cannot find any media");
            }

            // Collect garbage now to conserve resources
            GC.Collect();

            return true;
        }
Exemplo n.º 4
0
 public static extern void WatchPaths(IntPtr[] paths, int numberOfPaths, double latency, [MarshalAs(UnmanagedType.FunctionPtr)] WatchCallback callback);