コード例 #1
0
 private static void AddToList(Dictionary.DictionaryItem parent, ref IList<Dictionary.DictionaryItem> list)
 {
     list.Add(parent);
     if (!parent.hasChildren)
         return;
     foreach (var child in parent.Children)
         AddToList(child, ref list);
 }
コード例 #2
0
 public static void SaveToDisk(Dictionary.DictionaryItem item)
 {
     if (item != null)
     {
         XmlDocument xmlDoc = helpers.XmlDoc.CreateDoc();
         xmlDoc.AppendChild(item.ToXml(xmlDoc));
         helpers.XmlDoc.SaveXmlDoc("Dictionary", item.key, xmlDoc);
     }
 }
コード例 #3
0
        public Dictionary<string, string> GetInitAppTreeData(string app, string treeType, bool showContextMenu, bool isDialog, TreeDialogModes dialogMode, string functionToCall, string nodeKey)
        {
            Authorize();

            var treeCtl = new TreeControl()
            {
                ShowContextMenu = showContextMenu,
                IsDialog = isDialog,
                DialogMode = dialogMode,
                App = app,
                TreeType = string.IsNullOrEmpty(treeType) ? "" : treeType, //don't set the tree type unless explicitly set
                NodeKey = string.IsNullOrEmpty(nodeKey) ? "" : nodeKey,
                //StartNodeID = -1, //TODO: set this based on parameters!
                FunctionToCall = string.IsNullOrEmpty(functionToCall) ? "" : functionToCall
            };

            var returnVal = new Dictionary<string, string>();

            if (string.IsNullOrEmpty(treeType))
            {
                //if there's not tree type specified, then render out the tree as per normal with the normal 
                //way of doing things
                returnVal.Add("json", treeCtl.GetJSONInitNode());
            }
            else
            {
                //since 4.5.1 has a bug in it, it ignores if the treeType is specified and will always only render
                //the whole APP not just a specific tree. 
                //this is a work around for this bug until it is fixed (which should be fixed in 4.5.2

                //get the tree that we need to render
                var tree = TreeDefinitionCollection.Instance.FindTree(treeType).CreateInstance();
                tree.ShowContextMenu = showContextMenu;
                tree.IsDialog = isDialog;
                tree.DialogMode = dialogMode;
                tree.NodeKey = string.IsNullOrEmpty(nodeKey) ? "" : nodeKey;
                tree.FunctionToCall = string.IsNullOrEmpty(functionToCall) ? "" : functionToCall;

                //now render it's start node
                var xTree = new XmlTree();

                //we're going to hijack the node name here to make it say content/media
                var node = tree.RootNode;
                if (node.Text.Equals("[FilteredContentTree]")) node.Text = ui.GetText("content");
                else if (node.Text.Equals("[FilteredMediaTree]")) node.Text = ui.GetText("media");
                xTree.Add(node);

                returnVal.Add("json", xTree.ToString());
            }

            returnVal.Add("app", app);
            returnVal.Add("js", treeCtl.JSCurrApp);

            return returnVal;
        }
コード例 #4
0
ファイル: MyStartupHandler.cs プロジェクト: drphrozen/DicToJs
 public static void DictionaryItemChanged(Dictionary.DictionaryItem sender, EventArgs e)
 {
     foreach (var language in Language.GetAllAsList())
     {
         var path = Path.Combine(umbraco.IO.IOHelper.MapPath(umbraco.IO.SystemDirectories.Scripts, false), string.Format("uDictionary-{0}.js", language.CultureAlias));
         using (var stream = File.CreateText(path))
         {
             WriteJavascriptDictionary(stream, language);
         }
     }
 }
 private void AddToList(Dictionary.DictionaryItem item, ref List<Dictionary.DictionaryItem> list)
 {
     list.Add(item);
     if (!item.hasChildren)
     {
         return;
     }
     foreach (Dictionary.DictionaryItem child in item.Children)
     {
         AddToList(child, ref list);
     }
 }
コード例 #6
0
 private void SetupDictionaryChildren(Dictionary.DictionaryItem item, int level)
 {
     Dictionary.DictionaryItem[] children = item.Children;
     IOrderedEnumerable<Dictionary.DictionaryItem> orderedEnumerable = children.OrderBy(c => c.key);
     if (children.Count() > 0)
     {
         foreach (Dictionary.DictionaryItem child in orderedEnumerable)
         {
             string name = child.key;
             for (int i = 0; i < level; i++)
             {
                 name = "-" + name;
             }
             items.Add(new ListItem(name, child.key));
             SetupDictionaryChildren(child, level + 1);
         }
     }
 }
コード例 #7
0
        protected override void Install(System.Xml.XmlDocument data, StringBuilder log)
        {
            var templateElements = data.SelectNodes("snapshot/templates/template").Cast<XmlElement>().ToArray();
            var existingDocumentTypes = DocumentType.GetAllAsList().ToDictionary(d => d.Alias);
            var documentTypeLookup = new Dictionary<string, DocumentType>();
            foreach (var element in templateElements)
            {
                var alias = element.GetAttribute("alias");
                if (existingDocumentTypes.ContainsKey(alias))
                    new TemplateUpdater(existingDocumentTypes[alias], _connectionString, element).UpdateTemplate(log, documentTypeLookup);
                else
                {
                    new TemplateCreator(_connectionString, element).Process(log, documentTypeLookup);
                    ContentType.RemoveFromDataTypeCache(alias);
                    new TemplateUpdater(DocumentType.GetByAlias(alias), _connectionString, element).UpdateTemplate(log, documentTypeLookup);
                }
                ContentType.RemoveFromDataTypeCache(alias);
                var documentType = DocumentType.GetByAlias(alias);
                documentTypeLookup.Add(DataHelper.GetPath(documentType), documentType);
                existingDocumentTypes.Remove(alias);
            }

            foreach (var element in templateElements)
            {
                var alias = element.GetAttribute("alias");
                ContentType.RemoveFromDataTypeCache(alias);
                var updater = new TemplateUpdater(DocumentType.GetByAlias(alias), _connectionString, element);
                updater.UpdateChildStrucure(log, documentTypeLookup);
                updater.UpdateTabs(log, documentTypeLookup);

            }
            foreach (var element in templateElements)
            {
                var alias = element.GetAttribute("alias");
                ContentType.RemoveFromDataTypeCache(alias);
                var updater = new TemplateUpdater(DocumentType.GetByAlias(alias), _connectionString, element);
                updater.UpdateProperties(log, documentTypeLookup);
            }
        }
コード例 #8
0
        internal void Process(StringBuilder log, Dictionary<string, DocumentType> documentTypeLookup)
        {
            bool requiresSave = false;
            var oldHash = GetHash(_documentType.AllowedChildContentTypeIDs);
            var paths = _element.SelectNodes("allowedChildren/add").Cast<XmlElement>().Select(n => n.InnerText).ToArray();
            var invalidKeys = paths.Where(p => !documentTypeLookup.ContainsKey(p)).ToArray();
            if (invalidKeys.Any())
                throw new ApplicationException("Invalid child structure keys: " + invalidKeys.ToSeparatedString(", "));

            var newElements = paths.Select(p => documentTypeLookup[p].Id).ToArray();
            var newHash = GetHash(newElements);
            if (newHash != oldHash)
            {
                _documentType.AllowedChildContentTypeIDs = newElements;
                requiresSave = true;
                log.AppendLine("SET DT Structure: " + _documentType.Text + " -> " + oldHash + " => " + newHash);
            }

            if (requiresSave)
            {
                _documentType.Save();
                ContentType.RemoveFromDataTypeCache(_documentType.Alias);
            }
        }
コード例 #9
0
		/// <summary>
		/// Generates the DataTable for the IPublishedContent
		/// </summary>
		/// <param name="node"></param>
		/// <param name="nodeTypeAliasFilter"> </param>
		/// <returns></returns>
		private static DataTable GenerateDataTable(IPublishedContent node, string nodeTypeAliasFilter = "")
		{
			var firstNode = nodeTypeAliasFilter.IsNullOrWhiteSpace()
			                	? node.Children.Any()
			                	  	? node.Children.ElementAt(0)
			                	  	: null
			                	: node.Children.FirstOrDefault(x => x.DocumentTypeAlias == nodeTypeAliasFilter);
			if (firstNode == null)
				return new DataTable(); //no children found 

			var urlProvider = UmbracoContext.Current.RoutingContext.NiceUrlProvider;

			//use new utility class to create table so that we don't have to maintain code in many places, just one
			var dt = Umbraco.Core.DataTableExtensions.GenerateDataTable(
				//pass in the alias of the first child node since this is the node type we're rendering headers for
				firstNode.DocumentTypeAlias,
				//pass in the callback to extract the Dictionary<string, string> of all defined aliases to their names
				alias => GetPropertyAliasesAndNames(alias),
				//pass in a callback to populate the datatable, yup its a bit ugly but it's already legacy and we just want to maintain code in one place.
				() =>
					{
						//create all row data
						var tableData = Umbraco.Core.DataTableExtensions.CreateTableData();
						//loop through each child and create row data for it
						foreach (var n in node.Children)
						{
							if (!nodeTypeAliasFilter.IsNullOrWhiteSpace())
							{
								if (n.DocumentTypeAlias != nodeTypeAliasFilter)
									continue; //skip this one, it doesn't match the filter
							}

							var standardVals = new Dictionary<string, object>()
								{
									{"Id", n.Id},
									{"NodeName", n.Name},
									{"NodeTypeAlias", n.DocumentTypeAlias},
									{"CreateDate", n.CreateDate},
									{"UpdateDate", n.UpdateDate},
									{"CreatorName", n.CreatorName},
									{"WriterName", n.WriterName},
									{"Url", urlProvider.GetNiceUrl(n.Id)}
								};
							var userVals = new Dictionary<string, object>();
							foreach (var p in from IPublishedContentProperty p in n.Properties where p.Value != null select p)
							{
								userVals[p.Alias] = p.Value;
							}
							//add the row data
							Umbraco.Core.DataTableExtensions.AddRowData(tableData, standardVals, userVals);
						}
						return tableData;
					}
				);
			return dt;
		}
コード例 #10
0
        static void DictionaryItem_Deleting(Dictionary.DictionaryItem sender, EventArgs e)
        {
            lock (_deleteLock)
            {
                if (sender.hasChildren)
                {
                    // we get the delets in a backwards order, so we add all the children of this
                    // node to the list we are not going to delete when we get asked to.
                    // 
                    foreach(Dictionary.DictionaryItem child in sender.Children)
                    {
                        _dChildren.Add(child.id) ; 
                    }
                }

                if (_dChildren.Contains(sender.id))
                {
                    // this is a child of a parent we have already deleted.
                    _dChildren.Remove(sender.id);
                    LogHelper.Debug<uSync>("No Deleteing Dictionary item {0} because we deleted it's parent", ()=> sender.key); 
                }
                else
                {
                    //actually delete 


                    LogHelper.Debug<uSync>("Deleting Dictionary Item {0}", ()=> sender.key);

                    // when you delete a tree, the top gets called before the children. 
                    //             
                    if (!sender.IsTopMostItem())
                    {
                        // if it's not top most, we save it's parent (that will delete)

                        SaveToDisk(GetTop(sender));
                    }
                    else
                    {
                        // it's top we need to delete
                        helpers.XmlDoc.ArchiveFile("Dictionary", sender.key);

                    }
                }
            }
            
            
            

        }
コード例 #11
0
ファイル: TrainerSection.cs プロジェクト: smashraid/Work
 public static TreeRequestParams FromQueryStrings()
 {
     Dictionary<string, string> items = new Dictionary<string, string>();
     foreach (string key in HttpContext.Current.Request.QueryString.Keys)
         items.Add(key, HttpUtility.HtmlEncode(HttpContext.Current.Request.QueryString[key]));
     return TreeRequestParams.FromDictionary(items);
 }
コード例 #12
0
		internal IPublishedContent ConvertFromSearchResult(SearchResult searchResult)
		{
			//TODO: Some fields will not be included, that just the way it is unfortunatley until this is fixed:
			// http://examine.codeplex.com/workitem/10350

			var values = new Dictionary<string, string>(searchResult.Fields);
			//we need to ensure some fields exist, because of the above issue
			if (!new []{"template", "templateId"}.Any(values.ContainsKey)) 
				values.Add("template", 0.ToString());
			if (!new[] { "sortOrder" }.Any(values.ContainsKey))
				values.Add("sortOrder", 0.ToString());
			if (!new[] { "urlName" }.Any(values.ContainsKey))
				values.Add("urlName", "");
			if (!new[] { "nodeType" }.Any(values.ContainsKey))
				values.Add("nodeType", 0.ToString());
			if (!new[] { "creatorName" }.Any(values.ContainsKey))
				values.Add("creatorName", "");
			if (!new[] { "writerID" }.Any(values.ContainsKey))
				values.Add("writerID", 0.ToString());
			if (!new[] { "creatorID" }.Any(values.ContainsKey))
				values.Add("creatorID", 0.ToString());
			if (!new[] { "createDate" }.Any(values.ContainsKey))
				values.Add("createDate", default(DateTime).ToString("yyyy-MM-dd HH:mm:ss"));
			if (!new[] { "level" }.Any(values.ContainsKey))
			{				
				values.Add("level", values["__Path"].Split(',').Length.ToString());
			}


			return new DictionaryPublishedContent(values,
			                              d => d.ParentId != -1 //parent should be null if -1
			                                   	? GetUmbracoMedia(d.ParentId)
			                                   	: null,
			                              //callback to return the children of the current node
			                              d => GetChildrenMedia(d.ParentId),
			                              GetProperty)
				{
					LoadedFromExamine = true
				};
		}
コード例 #13
0
 void DictionaryItem_Saving(Dictionary.DictionaryItem sender, EventArgs e)
 {
     var host = Environment.MachineName;
     if (sender.key != "TempRefreshCache")
     {
         LogHelper.Info(typeof (PublishEvent), "Host " + host + " received a saving dictionary - old api event");
         LogHelper.Info(typeof (PublishEvent),
             "Host " + host + " requesting cache update due to saving of dictionary item " + sender.id);
         SqlBackedServerInstanceService.Instance.Publish(host, sender.id, "Dictionary");
     }
     else
     {
         LogHelper.Info(typeof(PublishEvent), "Host " + host + " skipped saving refresh cache dictionary item");
     }
 }
コード例 #14
0
        /// <summary>
        /// Saves the editor control value.
        /// </summary>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void DataEditorControl_OnSave(EventArgs e)
        {
            SaveEventArgs eventArgs = new SaveEventArgs();
            FireBeforeSave(eventArgs);

            if(eventArgs.Cancel) return;

            string fileUrl = string.Empty;
            string containerName = string.Empty;
            var postedFile = this.m_Control.PostedFile;

            if(postedFile != null)
            {
                Factory factory = new Factory(m_Control.Options.Username, this.m_Control.Options.ApiKey);

                if (!string.IsNullOrEmpty(ContainerName))
                {
                    //Get containerName from private ContainerName, which is set by a beforesave event.
                    containerName = ContainerName;
                }
                else if(!string.IsNullOrEmpty(m_Control.Options.DefaultContainer))
                {
                    //Get default container name from prevalues.
                    containerName = m_Control.Options.DefaultContainer;
                }
                else if (!string.IsNullOrEmpty(m_Control.Options.DefaultContainerAlias))
                {
                    //Get containerName by posted container name via prevalue default alias.
                    string defaultAlias = m_Control.Options.DefaultContainerAlias.AddDefaultAlias();
                    NameValueCollection form = HttpContext.Current.Request.Form;
                    foreach (string s in form.AllKeys.Where(s => s.Contains(defaultAlias)))
                    {
                        containerName = form.Get(s);
                    }
                }
                //Check if the Container Name was actually set along the way before trying to upload
                if (!string.IsNullOrEmpty(containerName))
                {
                    //upload file to container
                    factory.PutItemInContainer(containerName, postedFile.InputStream, postedFile.FileName);
                    //get the url of the file in CDN
                    fileUrl = factory.GetCdnUriForItem(containerName, postedFile.FileName);
                }
            }

            var dictionary = new Dictionary<string, string>
                                 {
                                     {"FileUrl", string.IsNullOrEmpty(fileUrl) ? m_Control.FileUrl : fileUrl},
                                     {"ContainerName", containerName}
                                 };

            // save the value of the control depending on whether a new file is uploaded););
            this.Data.Value = dictionary.SerializeToJson();

            FireAfterSave(eventArgs);
        }
コード例 #15
0
        private static IEnumerable<KeyValuePair<PropertyInfo, DocumentTypePropertyAttribute>> GetPropertiesWithAttributes(IReflect type)
        {
            var privateOrPublicInstanceProperties = type.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            var propertiesWithPropertyAttributes = privateOrPublicInstanceProperties.Where(propertyInfo => HasAttribute(propertyInfo, typeof(DocumentTypePropertyAttribute)));

            var propertyAttributeMapping = new Dictionary<PropertyInfo, DocumentTypePropertyAttribute>();

            foreach (var property in propertiesWithPropertyAttributes)
            {
                var propertyAttribute = (DocumentTypePropertyAttribute)property.GetCustomAttributes(true).SingleOrDefault(attribute => attribute is DocumentTypePropertyAttribute);
                if (propertyAttribute != null && !propertyAttributeMapping.ContainsKey(property))
                {
                    propertyAttributeMapping.Add(property, propertyAttribute);
                }
            }
            return propertyAttributeMapping;
        }
コード例 #16
0
ファイル: ContentType.cs プロジェクト: elrute/Triphulcas
        protected internal void FlushAllFromCache()
        {
            Cache.ClearCacheByKeySearch("UmbracoContentType");
            Cache.ClearCacheByKeySearch("ContentType_PropertyTypes_Content");

            //clear the property datatype cache used by razor
            _propertyTypeCache = new Dictionary<Tuple<string, string>, Guid>();

            ClearVirtualTabs();
        }
コード例 #17
0
        private void DeleteItem(Dictionary.DictionaryItem d)
        {
            var id = d.id;

            d.delete();

            var notFound = false;
            try
            {
                var check = new Dictionary.DictionaryItem(id);
            }
            catch (ArgumentException)
            {
                notFound = true;
            }
            Assert.IsTrue(notFound, "The item with key " + d.key + " still exists!");

            //check with sql that the language text is gone
            var count = Application.SqlHelper.ExecuteScalar<int>("SELECT COUNT(*) FROM cmsLanguageText WHERE uniqueId=@uniqueId",
                Application.SqlHelper.CreateParameter("@uniqueId", d.UniqueId));
            Assert.AreEqual(0, count);
        }
コード例 #18
0
		internal IPublishedContent ConvertFromSearchResult(SearchResult searchResult)
		{
			//NOTE: Some fields will not be included if the config section for the internal index has been 
            //mucked around with. It should index everything and so the index definition should simply be:
            // <IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/" />
			

			var values = new Dictionary<string, string>(searchResult.Fields);
			//we need to ensure some fields exist, because of the above issue
			if (!new []{"template", "templateId"}.Any(values.ContainsKey)) 
				values.Add("template", 0.ToString());
			if (!new[] { "sortOrder" }.Any(values.ContainsKey))
				values.Add("sortOrder", 0.ToString());
			if (!new[] { "urlName" }.Any(values.ContainsKey))
				values.Add("urlName", "");
			if (!new[] { "nodeType" }.Any(values.ContainsKey))
				values.Add("nodeType", 0.ToString());
			if (!new[] { "creatorName" }.Any(values.ContainsKey))
				values.Add("creatorName", "");
			if (!new[] { "writerID" }.Any(values.ContainsKey))
				values.Add("writerID", 0.ToString());
			if (!new[] { "creatorID" }.Any(values.ContainsKey))
				values.Add("creatorID", 0.ToString());
			if (!new[] { "createDate" }.Any(values.ContainsKey))
				values.Add("createDate", default(DateTime).ToString("yyyy-MM-dd HH:mm:ss"));
			if (!new[] { "level" }.Any(values.ContainsKey))
			{				
				values.Add("level", values["__Path"].Split(',').Length.ToString());
			}


			var content = new DictionaryPublishedContent(values,
			                                      d => d.ParentId != -1 //parent should be null if -1
				                                           ? GetUmbracoMedia(d.ParentId)
				                                           : null,
			                                      //callback to return the children of the current node
			                                      d => GetChildrenMedia(d.Id),
			                                      GetProperty,
			                                      true);
		    return PublishedContentModelFactory.CreateModel(content);
		}
コード例 #19
0
 void DictionaryItem_Deleting(Dictionary.DictionaryItem sender, EventArgs e)
 {
     var host = Environment.MachineName;
     LogHelper.Info(typeof(PublishEvent), "Host " + host + " received a deleting dictionary - old api event");
     LogHelper.Info(typeof(PublishEvent), "Host " + host + " requesting cache update due to deleting of dictionary item " + sender.id);
     SqlBackedServerInstanceService.Instance.Publish(host, sender.id, "Dictionary");
 }
コード例 #20
0
 static void DictionaryItem_Saving(Dictionary.DictionaryItem sender, EventArgs e)
 {
     SaveToDisk(GetTop(sender));
 }
コード例 #21
0
		internal IPublishedContent ConvertFromXPathNavigator(XPathNavigator xpath)
		{
			if (xpath == null) throw new ArgumentNullException("xpath");

			var values = new Dictionary<string, string> {{"nodeName", xpath.GetAttribute("nodeName", "")}};
			if (!UmbracoSettings.UseLegacyXmlSchema)
			{
				values.Add("nodeTypeAlias", xpath.Name);
			}
			
			var result = xpath.SelectChildren(XPathNodeType.Element);
			//add the attributes e.g. id, parentId etc
			if (result.Current != null && result.Current.HasAttributes)
			{
				if (result.Current.MoveToFirstAttribute())
				{
					//checking for duplicate keys because of the 'nodeTypeAlias' might already be added above.
					if (!values.ContainsKey(result.Current.Name))
					{
						values.Add(result.Current.Name, result.Current.Value);	
					}
					while (result.Current.MoveToNextAttribute())
					{
						if (!values.ContainsKey(result.Current.Name))
						{
							values.Add(result.Current.Name, result.Current.Value);
						}						
					}
					result.Current.MoveToParent();
				}
			}
			//add the user props
			while (result.MoveNext())
			{
				if (result.Current != null && !result.Current.HasAttributes)
				{
					string value = result.Current.Value;
					if (string.IsNullOrEmpty(value))
					{
						if (result.Current.HasAttributes || result.Current.SelectChildren(XPathNodeType.Element).Count > 0)
						{
							value = result.Current.OuterXml;
						}
					}
					values.Add(result.Current.Name, value);
				}
			}

			return new DictionaryPublishedContent(values, 
				d => d.ParentId != -1 //parent should be null if -1
					? GetUmbracoMedia(d.ParentId) 
					: null,
				//callback to return the children of the current node based on the xml structure already found
				d => GetChildrenMedia(d.ParentId, xpath),
				GetProperty);
		}
コード例 #22
0
        private static Dictionary.DictionaryItem GetTop(Dictionary.DictionaryItem item)
        {
            if (!item.IsTopMostItem())
            {
                LogHelper.Debug<uSync>("is Top Most [{0}]", ()=> item.IsTopMostItem());
                try
                {
                    if (item.Parent != null)
                    {
                        LogHelper.Debug<uSync>("parent [{0}]", () => item.Parent.key);
                        return GetTop(item.Parent);
                    }
                }
                catch (ArgumentException aex)
                {
                    LogHelper.Info<uSync>("Argument Exception - basically Parent is Null");
                }
            }

            return item; 

        }
コード例 #23
0
ファイル: WikiFile.cs プロジェクト: ClaytonWang/OurUmbraco
        /// <summary>
        /// Gets all wiki files for all nodes
        /// </summary>
        /// <returns></returns>
        public static Dictionary<int, IEnumerable<WikiFile>> CurrentFiles(IEnumerable<int> nodeIds)
        {
            var wikiFiles = new Dictionary<int, List<WikiFile>>();

            //we can only have 2000 (actually 2100) SQL parameters used at once, so we need to group them
            var nodeBatches = nodeIds.InGroupsOf(2000);

            foreach (var nodeBatch in nodeBatches)
            {
                foreach (var result in ApplicationContext.Current.DatabaseContext.Database.Query<dynamic>("SELECT * FROM wikiFiles WHERE nodeId IN (@nodeIds)", new { nodeIds = nodeBatch }))
                {
                    var file = new WikiFile
                    {
                        Id = result.id,
                        Path = result.path,
                        Name = result.name,
                        FileType = result.type,
                        RemovedBy = result.removedBy,
                        CreatedBy = result.createdBy,
                        NodeVersion = result.version,
                        NodeId = result.nodeId,
                        CreateDate = result.createDate,
                        DotNetVersion = result.dotNetVersion,
                        Downloads = result.downloads,
                        Archived = result.archived,
                        Verified = result.verified,
                        Versions = GetVersionsFromString(result.umbracoVersion)
                    };

                    file.Version = file.Versions.Any()
                        ? GetVersionsFromString(result.umbracoVersion)[0]
                        : UmbracoVersion.DefaultVersion();

                    if (wikiFiles.ContainsKey(result.nodeId))
                    {
                        var list = wikiFiles[result.nodeId];
                        list.Add(file);
                    }
                    else
                    {
                        wikiFiles.Add(result.nodeId, new List<WikiFile>(new[] { file }));
                    }
                }
            }

            return wikiFiles.ToDictionary(x => x.Key, x => (IEnumerable<WikiFile>)x.Value);
        }
コード例 #24
0
ファイル: TrainerSection.cs プロジェクト: smashraid/Work
 public static TreeRequestParams FromDictionary(Dictionary<string, string> items)
 {
     TreeRequestParams treeRequestParams = new TreeRequestParams();
     treeRequestParams.m_params = items;
     return treeRequestParams;
 }