private static void SaveEncryptionKey([NotNull] string encryptionKey, [NotNull] Item targetIntegrationItem)
        {
            Assert.ArgumentNotNull(encryptionKey, "encryptionKey");
            Assert.ArgumentNotNull(targetIntegrationItem, "targetIntegrationItem");

            IDTable.Add(EncryptionKeyIDTableEntryPrefix, targetIntegrationItem.ID.ToShortID().ToString(), ID.NewID, ID.Null, encryptionKey);
        }
Ejemplo n.º 2
0
 protected void OnItemSaved(object sender, System.EventArgs args)
 {
     if ((args != null))
     {
         Item item = Event.ExtractParameter(args, 0) as Item;
         Assert.IsNotNull(item, "No item in parameters");
         ID parentID = item.ParentID;
         if (BucketManager.IsItemContainedWithinBucket(item))
         {
             parentID = item.GetParentBucketItemOrParent().ParentID;
         }
         IHasExternalId i = item.GlassCast <IHasExternalId>();
         if (i != null && !string.IsNullOrEmpty(i.ExternalId))
         {
             string prefix = i.TemplateId.GetMatchingPrefix();
             if (IDTable.GetID(prefix, i.ExternalId) == null)
             {
                 IDTable.Add(prefix, i.ExternalId, item.ID, parentID);
             }
         }
         else if (parentID.Equals(RebootConstants.ImageRootID))
         {
             string prefix = RebootConstants.ImageItemPrefix;
             if (IDTable.GetID(prefix, item.Name) == null)
             {
                 IDTable.Add(prefix, item.Name, item.ID, parentID);
             }
         }
     }
 }
Ejemplo n.º 3
0
        private static IDTableEntry UpdateOrCreateIDTableEntry(string prefix, string key, ID id, ID parentId, string customData)
        {
            var keys = IDTable.GetKeys(prefix, id);

            if (keys != null && keys.Length > 0)
            {
                var entry = keys[0];
                if (entry.ParentID == parentId && string.Equals(entry.CustomData, customData))
                {
                    return(entry);
                }
                IDTable.RemoveID(prefix, id);
            }
            return(IDTable.Add(prefix, key, id, parentId, customData));
        }
Ejemplo n.º 4
0
        internal IDTableEntry Add(string prefix, string key, ID id, ID parentId)
        {
            var idTableIdKey = new IdTableIdKey(prefix, id.Guid);

            var tableEntry = new IDTableEntry(prefix, key, id, parentId, "");

            if (!_idById.ContainsKey(idTableIdKey))
            {
                _idById.Add(idTableIdKey, new List <IDTableEntry> {
                    tableEntry
                });
            }

            var idTableStringKey = new IdTableStringKey(prefix, key);

            if (!_idByKey.ContainsKey(idTableStringKey))
            {
                _idByKey[idTableStringKey] = tableEntry;
            }

            return(IDTable.Add(prefix, key, id, parentId));
        }
        /// <summary>
        /// This is processor of pipeline uiDeleteItems.
        /// This processor is deleting data in SharePoint.
        /// </summary>
        /// <param name="args">
        /// The args         .
        /// </param>
        public void Execute(ClientPipelineArgs args)
        {
            if (!string.IsNullOrEmpty(args.Parameters[CancelationKey]))
            {
                return;
            }

            using (new SynchDisabler())
            {
                Assert.ArgumentNotNull(args, "args");
                Assert.ArgumentNotNull(args, "args");
                Database database = GetDatabase(args);

                ListString list = new ListString(args.Parameters["items"], '|');
                using (new TaskContext("DeleteSharepointItems pipeline"))
                {
                    foreach (string id in list)
                    {
                        if (args.Parameters[id] != null && ID.IsID(id))
                        {
                            ItemDefinition itemDfenition = database.DataManager.DataSource.GetItemDefinition(new ID(id));
                            if (itemDfenition == null)
                            {
                                Log.Audit(this, "Delete SharePoint item: {0}", new[]
                                {
                                    args.Parameters[id + "uniqueId"]
                                });
                                if (ID.IsID(args.Parameters[id]))
                                {
                                    IDTable.Add("SPIF_DELETE", args.Parameters[id], ID.NewID, ID.Null, args.Parameters[id + "uniqueId"]);
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
 protected void OnItemSaved(object sender, System.EventArgs args)
 {
     if ((args != null))
     {
         Item item = Event.ExtractParameter(args, 0) as Item;
         Assert.IsNotNull(item, "No item in parameters");
         if (!item.TemplateID.Equals(RebootConstants.ModelTemplateId))
         {
             return;
         }
         ID parentID = item.ParentID;
         if (BucketManager.IsItemContainedWithinBucket(item))
         {
             parentID = item.GetParentBucketItemOrParent().ParentID;
         }
         string       prefix       = item.TemplateID.ToString();
         string       key          = item.Name;
         IDTableEntry idTableEntry = IDTable.GetID(prefix, key);
         if (idTableEntry == null)
         {
             IDTable.Add(prefix, key, item.ID, parentID);
         }
     }
 }
Ejemplo n.º 7
0
        public override IDList GetChildIDs(ItemDefinition itemDefinition, CallContext context)
        {
            if (this.CanProcessParent(itemDefinition.ID, context))
            {
                context.Abort();

                var idList   = new IDList();
                ID  parentId = itemDefinition.ID;

                var database   = context.DataManager.Database;
                var actualItem = database.GetItem(parentId);

                var values = this.DataProviderDamHelper.ProcessingParentFieldNames.ToDictionary(fieldName => fieldName, fieldName => actualItem[fieldName]);

                var keyList = this.DataProviderDamHelper.GetChildKeys(values);

                var keys = keyList as string[] ?? keyList.ToArray();
                if (!keys.Any())
                {
                    return(new IDList());
                }

                foreach (var key in keys)
                {
                    if (string.IsNullOrEmpty(key))
                    {
                        continue;
                    }

                    var keyString = key + "|" + parentId.ToShortID();

                    IDTableEntry idEntry = IDTable.GetID(this.IdTablePrefix,
                                                         keyString);
                    ID newID;
                    if (idEntry == null)
                    {
                        var itemName = this.DataProviderDamHelper.GetItemName(key);

                        if (itemName == "Undefined")
                        {
                            continue;
                        }

                        newID = ID.NewID;
                        IDTable.Add(this.IdTablePrefix,
                                    keyString,
                                    newID, parentId, ItemUtil.ProposeValidItemName(Path.GetFileNameWithoutExtension(itemName)));
                    }
                    else
                    {
                        newID = idEntry.ID;
                    }
                    idList.Add(newID);
                }

                context.DataManager.Database.Caches.DataCache.Clear();

                return(idList);
            }

            return(base.GetChildIDs(itemDefinition, context));
        }
Ejemplo n.º 8
0
 static KnownQuests()
 {
     Known.Add(new QuestInfo(Daily10));
     Known.Add(new QuestInfo(Trans3));
     Known.Add(new QuestInfo(CV3));
     Known.Add(new QuestInfo(Trans5));
     Known.Add(new QuestInfo(Map2));
     Known.Add(new QuestInfo(SS6));
     Known.Add(new QuestInfo(new[] {
         MissionAPart1,
         MissionAPart2,
         MissionAPart3,
         MissionAPart4
     }, 1));
     Known.Add(new QuestInfo(MissionI));
     Known.Add(new QuestInfo(Trans20));
     Known.Add(new QuestInfo(MissionRo));
     Known.Add(new QuestInfo(SS15));
     Known.Add(new QuestInfo(Map3));
     Known.Add(new QuestInfo(Map4));
     Known.Add(new QuestInfo(Map1_5M));
     Known.Add(new QuestInfo(Map1_5W));
     Known.Add(new QuestInfo(Practice3));
     Known.Add(new QuestInfo(Practice5));
     Known.Add(new QuestInfo(Practice7));
     Known.Add(new QuestInfo(Practice20));
     Known.Add(new QuestInfo(Repair));
     Known.Add(new QuestInfo(Charge));
     Known.Add(new QuestInfo(Destroy));
     Known.Add(new QuestInfo(Expedition3));
     Known.Add(new QuestInfo(Expedition10));
     Known.Add(new QuestInfo(Expedition30));
     Known.Add(new QuestInfo(ExpeditionTokyo));
     Known.Add(new QuestInfo(PowerUp15));
 }
 public IDTableEntry Add(string prefix, string key, ID id)
 {
     return(IDTable.Add(prefix, key, id));
 }
 public IDTableEntry Add(string prefix, string key, ID id, ID parentID, string customData, TimeSpan slidingExpiration)
 {
     return(IDTable.Add(prefix, key, id, parentID, customData, slidingExpiration));
 }
 public IDTableEntry Add(string prefix, string key, ID id, ID parentID, string customData)
 {
     return(IDTable.Add(prefix, key, id, parentID, customData));
 }
 public IDTableEntry Add(string prefix, string key, ID id, ID parentID)
 {
     return(IDTable.Add(prefix, key, id, parentID));
 }
Ejemplo n.º 13
0
        public void Read(ref EndianReader er, bool PC, ref uint Magic, ref uint[] BspsMagic)
        {
            IndexMagic = er.ReadUInt32();

            Magic = (IndexMagic - ((er.Position - 4) + 40));            //(PC ? 40 : 36)));

            StartingID         = er.ReadUInt32();
            Unknown2           = er.ReadInt32();
            TagCount           = er.ReadUInt32();
            VertexObjectCount  = er.ReadInt32();
            VertexOffset       = er.ReadInt32();
            IndecesOffsetCount = er.ReadInt32();
            IndecesOffset      = er.ReadInt32();
            if (PC)
            {
                Unknown3 = er.ReadInt32();
            }
            er.ReadUInt32();

            TagsOffset = er.Position;

            // Load tag item data
            IndexItems = new MapIndexItem[TagCount];
            uint sbsp_offset = 0;

            for (uint x = 0; x < IndexItems.Length; x++)
            {
                IndexItems[x] = new MapIndexItem();
                IndexItems[x].Read(ref er, x, Magic);
                IDTable.Add(IndexItems[x].ID, IndexItems[x]);

                // load scnr's bsps block header
                if (x == 0)
                {
                    uint temp_pos = er.Position;

                    er.Seek(this[0].MetaOffset + 1444, System.IO.SeekOrigin.Begin);
                    BspsMagic   = new uint[er.ReadUInt32()];
                    sbsp_offset = er.ReadUInt32() - Magic;

                    er.Seek(temp_pos, System.IO.SeekOrigin.Begin);
                }

                if (Core.TAG.TestTag(IndexItems[x].TagClass, Core.TagGroups.sbsp.Tag))
                {
                    uint temp_pos = er.Position;

                    // I swear I'm going to kill VS with its BS about converting "long to unit"
                    // when there IS NO F*****G LONG!
                    er.Seek(sbsp_offset + (uint)(bspCount * 32), System.IO.SeekOrigin.Begin);
                    IndexItems[x].MetaOffset  = er.ReadUInt32();
                    IndexItems[x].MetaSize    = er.ReadUInt32();
                    BspsMagic[bspCount]       = er.ReadUInt32() - IndexItems[x].MetaOffset;
                    IndexItems[x].MetaOffset += 24;
                    IndexItems[x].BSPIndex    = bspCount;
                    ++bspCount;

                    er.Seek(temp_pos, System.IO.SeekOrigin.Begin);
                }
            }

            // Load tag strings
            for (int x = 0; x < IndexItems.Length; x++)
            {
                IndexItems[x].FileName = er.ReadCString();
            }
        }
Ejemplo n.º 14
0
 protected virtual void AddToTable(string prefix, string sharepointGUID, ID parentID)
 {
     IDTable.Add(prefix, ID.NewID.ToString(), ID.NewID, parentID, sharepointGUID);
 }