Esempio n. 1
0
        /**
         * Registers the resource and property types used by address books,
         * and creates the address book root.
         */

        private static void RegisterTypes()
        {
            IResourceStore      store = Core.ResourceStore;
            IPropTypeCollection props = Core.ResourceStore.PropTypes;

            store.ResourceTypes.Register("AddressBook", "Address Book", "Name", ResourceTypeFlags.Internal | ResourceTypeFlags.NoIndex);
            _propInAddressBook = props.Register("InAddressBook", PropDataType.Link, PropTypeFlags.DirectedLink);
            _propDeepName      = props.Register("DeepName", PropDataType.String);
            props.Register("IsNonExportable", PropDataType.Bool, PropTypeFlags.Internal);
            props.RegisterDisplayName(_propInAddressBook, "In Address Book", "Contains");

            _addressBookRoot = Core.ResourceTreeManager.GetRootForType("AddressBook");
            Core.ResourceTreeManager.SetResourceNodeSort(_addressBookRoot, "Name");

            if (store.ResourceTypes.Exist("AddressBookRoot"))
            {
                IResourceList abRootsOld = store.GetAllResources("AddressBookRoot");
                if (abRootsOld.Count > 0)
                {
                    IResource abRootOld = abRootsOld [0];
                    foreach (IResource res in abRootOld.GetLinksTo(null, "Parent"))
                    {
                        res.SetProp("Parent", _addressBookRoot);
                    }
                    abRootOld.Delete();
                }
            }

            _typesRegistered = true;
        }
Esempio n. 2
0
        internal static void Register()
        {
            IResourceStore      store     = Core.ResourceStore;
            IPropTypeCollection propTypes = store.PropTypes;

            _propUIN                = propTypes.Register("UIN", PropDataType.Int);
            _propNickName           = propTypes.Register("NickName", PropDataType.String);
            _propScreenName         = propTypes.Register("ScreenName", PropDataType.String);
            _propJabberID           = propTypes.Register("JabberID", PropDataType.String);
            _propYahooID            = propTypes.Register("YahooID", PropDataType.String);
            _propFirstMirandaImport = propTypes.Register("FirstMirandaImport", PropDataType.Date);
            _propLastMirandaImport  = propTypes.Register("LastMirandaImport", PropDataType.Date);
            _propFromAccount        = propTypes.Register("FromAccount", PropDataType.Link, PropTypeFlags.Internal);
            _propToAccount          = propTypes.Register("ToAccount", PropDataType.Link, PropTypeFlags.Internal);

            IResource propMirandaAcct = store.FindUniqueResource("PropType", "Name", "MirandaAcct");

            if (propMirandaAcct != null)
            {
                propMirandaAcct.SetProp("Flags", (int)PropTypeFlags.ContactAccount);
                _propMirandaAcct = propMirandaAcct.GetIntProp("ID");
            }
            else
            {
                _propMirandaAcct = store.PropTypes.Register("MirandaAcct", PropDataType.Link, PropTypeFlags.ContactAccount);
            }
            store.PropTypes.RegisterDisplayName(_propMirandaAcct, "Miranda Account");
        }
Esempio n. 3
0
        private void  RegisterPropertyTypes()
        {
            IPropTypeCollection props = Core.ResourceStore.PropTypes;

            SearchRankPropId = props.Register("SearchRank", PropDataType.Double, PropTypeFlags.Virtual);
            props.RegisterDisplayName(SearchRankPropId, "Search Rank");

            SimilarityPropId       = props.Register("Similarity", PropDataType.Double, PropTypeFlags.Virtual);
            ContextPropId          = props.Register("Context", PropDataType.String, PropTypeFlags.Virtual);
            ProximityPropId        = props.Register("Proximity", PropDataType.Int, PropTypeFlags.Virtual);
            ContextHighlightPropId = props.Register("HighlightContext", PropDataType.String, PropTypeFlags.Virtual);

            props.Register(DocumentSectionResource.SectionHelpDescription, PropDataType.String, PropTypeFlags.Internal);
            props.Register("SectionShortName", PropDataType.String, PropTypeFlags.Internal);
            props.Register("SectionOrder", PropDataType.Int, PropTypeFlags.Internal);

            Core.ResourceStore.ResourceTypes.Register(DocumentSectionResource.DocSectionResName, "", ResourceTypeFlags.Internal | ResourceTypeFlags.NoIndex);
            Core.ResourceStore.RegisterUniqueRestriction(DocumentSectionResource.DocSectionResName, Core.Props.Name);

            RegisterDocumentSection(DocumentSection.BodySection, "Full content of the resource", null);
            RegisterDocumentSection(DocumentSection.SubjectSection, "Describes subject (or heading, title) of the e-mail, article, etc", "SU");
            RegisterDocumentSection(DocumentSection.AnnotationSection, "A note added by way of comment or explanation", "AN");
            RegisterDocumentSection(DocumentSection.SourceSection, "Identifies a source of the resource - person, site, server, etc.", "SRC");

            RegisterIndexVersioningTypes();
        }
Esempio n. 4
0
        private void RegisterIndexVersioningTypes()
        {
            IPropTypeCollection props = Core.ResourceStore.PropTypes;

            _needDiscard = !File.Exists(OMEnv.TokenTreeFileName);
//            _needDiscard = !props.Exist( "InTextIndex" ) || !File.Exists( OMEnv.TokenTreeFileName );
//            DocInIndexProp = props.Register( "InTextIndex", PropDataType.Bool, PropTypeFlags.Internal );

            //  The resource (single and unique) of this type keeps the current version of the
            //  text index. It has the single property "TextIndexVersion" (see below).
            Core.ResourceStore.ResourceTypes.Register("TextIndexVersion", "Name",
                                                      ResourceTypeFlags.Internal | ResourceTypeFlags.NoIndex);

            //  This property keeps the current version of the text index (do not mix it with
            //  the version of text index format. Each time the index is rebuilt, the value of this
            //  property is increased by 1, thus invalidating all resource which reference to the
            //  older version of the index through their "InTextIndexVersion" property (see below).
            TextIndexVersionProp = props.Register("TextIndexVersion", PropDataType.Int, PropTypeFlags.Internal);

            //  Property "InTextIndexVersion" keeps the version of text index in which the
            //  resource was indexed. If the value of this property is less than current version of
            //  the index (in the "TextIndexVersion" property, see above), then this resource will be
            //  reindexed.
            DocInVersionIndexProp = props.Register("InTextIndexVersion", PropDataType.Int, PropTypeFlags.Internal);

            //  Delete the old property.
            if (props.Exist("InTextIndex"))
            {
                props.Delete(props["InTextIndex"].Id);
            }

            //  Load the current version of the index. In the case of the very first loading
            //  (when switching to the new versioning scheme) version is set to 1 and written back
            //  to the ResourceStore.
            IResourceList versions = Core.ResourceStore.FindResourcesWithProp(null, TextIndexVersionProp);

            if (versions.Count == 0)
            {
                _indexVersionRes = Core.ResourceStore.BeginNewResource("TextIndexVersion");
                _indexVersionRes.SetProp(TextIndexVersionProp, 1);
                _indexVersionRes.EndUpdate();
            }
            else
            {
                _indexVersionRes = versions[0];
            }
            _indexVersion = _indexVersionRes.GetIntProp(TextIndexVersionProp);
        }
Esempio n. 5
0
        private void RegisterTypes()
        {
            IResourceStore          store    = Core.ResourceStore;
            IResourceTypeCollection resTypes = store.ResourceTypes;

            resTypes.Register(_Note, "Note", "Subject", ResourceTypeFlags.Normal, this);

            IPropTypeCollection propTypes = store.PropTypes;

            _propLastUpdated = propTypes.Register("LastUpdated", PropDataType.Date, PropTypeFlags.Internal);
        }
Esempio n. 6
0
        private void RegisterTypes()
        {
            IResourceTypeCollection resTypes = Core.ResourceStore.ResourceTypes;

            resTypes.Register("Weblink", "Web Bookmark", "Name", ResourceTypeFlags.NoIndex, this);
            resTypes["Weblink"].DisplayName = "Web Bookmark";
            resTypes.Register("Folder", "Name", ResourceTypeFlags.Internal | ResourceTypeFlags.NoIndex);
            IPropTypeCollection propTypes = Core.ResourceStore.PropTypes;

            _propURL         = propTypes.Register("URL", PropDataType.String);
            _propParent      = propTypes.Register("Parent", PropDataType.Link, PropTypeFlags.DirectedLink);
            _propETag        = propTypes.Register("ETag", PropDataType.String, PropTypeFlags.Internal);
            _propLastUpdated = propTypes.Register("LastUpdated", PropDataType.Date, PropTypeFlags.Internal);
            _propUpdateFreq  = propTypes.Register("UpdateFreq", PropDataType.Int, PropTypeFlags.Internal);
            _propIsUnread    = propTypes.Register("IsUnread", PropDataType.Bool);
            _propContent     = propTypes.Register("Content", PropDataType.Blob, PropTypeFlags.Internal);
            _propBookmarkId  = propTypes.Register("BookmarkId", PropDataType.String, PropTypeFlags.Internal);
            _propChangesLog  = propTypes.Register("ChangesLog", PropDataType.StringList, PropTypeFlags.Internal);
            _propFaviconUrl  = propTypes.Register("FaviconUrl", PropDataType.String, PropTypeFlags.Internal);
            _propInvisible   = propTypes.Register("Invisible", PropDataType.Bool, PropTypeFlags.Internal);
            if (propTypes.Exist("Path"))
            {
                propTypes.Delete(propTypes["Path"].Id);
            }
            if (propTypes.Exist("IsIEFavoritesRoot"))
            {
                IResource ieRoot = Core.ResourceStore.FindUniqueResource("Folder", "IsIEFavoritesRoot", true);
                if (ieRoot != null)
                {
                    ieRoot.SetProp(Core.Props.Name, ieRoot.DisplayName);
                    ieRoot.DisplayName = "";
                }
                propTypes.Delete(propTypes["IsIEFavoritesRoot"].Id);
            }
            if (propTypes.Exist("IsMozillaRoot"))
            {
                IResource mozillaRoot = Core.ResourceStore.FindUniqueResource("Folder", "IsMozillaRoot", true);
                if (mozillaRoot != null)
                {
                    _bookmarkService.DeleteFolder(mozillaRoot);
                }
                propTypes.Delete(propTypes["IsMozillaRoot"].Id);
            }
        }
Esempio n. 7
0
        private void RegisterTypes()
        {
            IPropTypeCollection propTypes = Core.ResourceStore.PropTypes;

            _propLastSynchUpdate = propTypes.Register("LastSynchronizeDate", PropDataType.Date, PropTypeFlags.Internal, this);
        }