GetService() 공개 메소드

public GetService ( uint id ) : OpService
id uint
리턴 OpService
예제 #1
0
        public InternalsForm(CoreUI ui)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            UI = ui;
            Core = ui.Core;

            Boards = Core.GetService(ServiceIDs.Board) as BoardService;
            Mail = Core.GetService(ServiceIDs.Mail) as MailService;
            Profiles = Core.GetService(ServiceIDs.Profile) as ProfileService;

            Text = "Internals (" + Core.Network.GetLabel() + ")";

            treeStructure.Nodes.Add( new StructureNode("", new ShowDelegate(ShowNone), null));

            // core
                // identity
                // networks (global/operation)
                    // cache
                    // logs
                    // routing
                    // search
                    // store
                    // tcp
                // Components
                    // Link
                    // Location
                    // ...
                // rudp
                    // sessions[]

            // core
            StructureNode coreNode = new StructureNode("Core", new ShowDelegate(ShowCore), null);

            // identity
            coreNode.Nodes.Add( new StructureNode(".Identity", new ShowDelegate(ShowIdentity), null));

            // networks
            if(Core.Context.Lookup != null)
                LoadNetwork(coreNode.Nodes, "Lookup", Core.Context.Lookup.Network);

            LoadNetwork(coreNode.Nodes, "Organization", Core.Network);

            // components
            StructureNode componentsNode = new StructureNode("Components", new ShowDelegate(ShowNone), null);
            LoadComponents(componentsNode);
            coreNode.Nodes.Add(componentsNode);

            treeStructure.Nodes.Add(coreNode);
            coreNode.Expand();
        }
예제 #2
0
        void OpBootstrap()
        {
            OpCore lookup = Core.Context.Lookup;

            // find operation nodes through global net at expanding intervals
            // called from operation network's bootstrap
            if (lookup != null &&
                Core.User.Settings.OpAccess != AccessType.Secret &&
                lookup.Network.Responsive)
            {
                LookupearchInterval.Timer();

                if (Core.TimeNow > NextLookupSearch)
                {
                    NextLookupSearch = LookupearchInterval.NextTry;

                    Network.UpdateLog("general", "Looking for " + Core.User.Settings.Operation);

                    lookup.RunInCoreAsync(delegate()
                    {
                        LookupService service = lookup.GetService(ServiceIDs.Lookup) as LookupService;
                        service.LookupCache.Search(Network.OpID, null, Search_FoundLookup);
                    });
                }
            }

            TryWebCache();

            TryIPCache();
        }
예제 #3
0
        public AcceptFileForm(OpCore core, DhtClient client, SharedFile share)
        {
            InitializeComponent();

            Core = core;
            Sharing = core.GetService(ServiceIDs.Share) as ShareService;

            TheFile = share;
            Source = client;

            DescriptionLabel.Text = core.GetName(client.UserID) + " wants to send you a file";

            NameLabel.Text = TheFile.Name;

            SizeLabel.Text = Utilities.ByteSizetoDecString(TheFile.Size);
        }
예제 #4
0
파일: NetView.cs 프로젝트: RoelofSol/DeOps
        private bool IsTracked(OpCore core)
        {
            bool found = false;

            // storage
            StorageService storage = core.GetService(ServiceIDs.Storage) as StorageService;

            if (!found && storage != null)
                if (storage.FileMap.SafeContainsKey(TrackHashID))
                    found = true;

            // link
            if(!found)
                core.Trust.TrustMap.LockReading(delegate()
                {
                    foreach (OpTrust trust in core.Trust.TrustMap.Values)
                        if (trust.Loaded && Utilities.MemCompare(trust.File.Header.FileHash, TrackHash))
                        {
                            found = true;
                            break;
                        }
                });

            // profile
            ProfileService profiles = core.GetService(ServiceIDs.Profile) as ProfileService;

            if (!found && profiles != null)
                profiles.ProfileMap.LockReading(delegate()
                {
                    foreach (OpProfile profile in profiles.ProfileMap.Values)
                        if (Utilities.MemCompare(profile.File.Header.FileHash, TrackHash))
                        {
                            found = true;
                            break;
                        }
                });

            // mail
            MailService mail = core.GetService(ServiceIDs.Mail) as MailService;

            if (!found && mail != null)
            {
                foreach (CachedPending pending in mail.PendingMap.Values)
                    if (Utilities.MemCompare(pending.Header.FileHash, TrackHash))
                        return true;

                foreach (List<CachedMail> list in mail.MailMap.Values)
                    foreach (CachedMail cached in list)
                        if (Utilities.MemCompare(cached.Header.FileHash, TrackHash))
                        {
                            found = true;
                            break;
                        }
            }

            // board
            BoardService boards = core.GetService(ServiceIDs.Board) as BoardService;

            if (!found && boards != null)
                boards.BoardMap.LockReading(delegate()
                {
                    foreach (OpBoard board in boards.BoardMap.Values)
                        if (!found)
                            board.Posts.LockReading(delegate()
                            {
                                foreach (OpPost post in board.Posts.Values)
                                    if (Utilities.MemCompare(post.Header.FileHash, TrackHash))
                                    {
                                        found = true;
                                        break;
                                    }
                            });
                });

            return found;
        }