internal Sort(LocationField field, SortOrder order, double latitude, double longitude) { SortField = field; Order = order; Latitude = latitude; Longitude = longitude; }
private void ReadTemplate() { try { #region Start reading Xml .vstemplate file XmlDocument templateDoc = new XmlDocument(); templateDoc.Load(templateFileName); XmlNamespaceManager xmlNamespaceManager = new XmlNamespaceManager(templateDoc.NameTable); xmlNamespaceManager.AddNamespace("vstemplns", "http://schemas.microsoft.com/developer/vstemplate/2005"); #endregion #region Set VsTemplate data XmlNodeList templateData = templateDoc.SelectNodes("/vstemplns:VSTemplate/vstemplns:TemplateData", xmlNamespaceManager); foreach (XmlNode xmlNode in templateData[0].ChildNodes) { CommandID valueAsCommandID = null; string valueAsString = null; XmlAttribute xmlPackage = xmlNode.Attributes["Package"]; if (xmlPackage != null) { XmlAttribute xmlId = xmlNode.Attributes["ID"]; Guid guidPackage = new Guid(xmlPackage.Value); if (xmlId != null) { valueAsCommandID = new CommandID(guidPackage, int.Parse(xmlId.Value)); } } else { valueAsString = xmlNode.InnerText; } switch (xmlNode.Name) { case "Name": this.name = valueAsString; this.commandIdName = valueAsCommandID; break; case "Description": this.description = valueAsString; this.commandIdDescription = valueAsCommandID; break; case "Icon": this.icon = valueAsCommandID; if (valueAsString != null) { this.iconFileName = valueAsString; } break; case "CreateNewFolder": this.createNewFolder = bool.Parse(valueAsString); break; case "AppendDefaultFileExtension": this.appendDefaultFileExtension = bool.Parse(valueAsString); break; case "SupportsLanguageDropDown": this.supportsLanguageDropDown = bool.Parse(valueAsString); break; case "SupportsMasterPage": this.supportsMasterPage = bool.Parse(valueAsString); break; case "ProvideDefaultName": this.provideDefaultName = bool.Parse(valueAsString); break; case "SortOrder": this.sortPriority = int.Parse(valueAsString); break; case "ProjectType": this.language = valueAsString; break; case "DefaultName": this.suggestedBaseName = valueAsString; break; case "EnableLocationBrowseButton": this.enableLocationBrowseButton = bool.Parse(valueAsString); break; case "EnableEditOfLocationField": this.enableEditOfLocationField = bool.Parse(valueAsString); break; case "LocationField": this.locationField = (LocationField)Enum.Parse(typeof(LocationField), valueAsString); break; default: break; } } #endregion #region Set vsKind XmlNode projectTypeNode = templateDoc.SelectSingleNode("/vstemplns:VSTemplate/@Type", xmlNamespaceManager); if (projectTypeNode == null) { throw new RecipeFrameworkException(Properties.Resources.Templates_MissingType); } else if (string.Compare(projectTypeNode.InnerText, "Project", true, CultureInfo.InvariantCulture) == 0) { this.vsKind = WizardRunKind.AsNewProject; } else if (string.Compare(projectTypeNode.InnerText, "Item", true, CultureInfo.InvariantCulture) == 0) { this.vsKind = WizardRunKind.AsNewItem; } else if (string.Compare(projectTypeNode.InnerText, "ProjectGroup", true, CultureInfo.InvariantCulture) == 0) { this.vsKind = WizardRunKind.AsMultiProject; } #endregion #region Set Kind string folderName = Path.GetDirectoryName(this.FileName); string[] folders = folderName.Split('\\'); string[] foldersArray = new string[2] { folders[folders.Length - 1], folders[folders.Length - 2] }; foreach (string folder in foldersArray) { if (folder.Equals("Items", StringComparison.InvariantCultureIgnoreCase)) { kind = TemplateKind.ProjectItem; break; } else if (folder.Equals("Projects", StringComparison.InvariantCultureIgnoreCase)) { kind = TemplateKind.Project; if (folders[0].Equals("Solutions")) { } break; } else if (folder.Equals("Solutions", StringComparison.InvariantCultureIgnoreCase)) { kind = TemplateKind.Solution; break; } } #endregion #region Set extension data XmlNode wizardData = templateDoc.SelectSingleNode("/vstemplns:VSTemplate/vstemplns:WizardData", xmlNamespaceManager); if (wizardData == null) { this.extensionData = new VsTemplate.Template(); } else { this.extensionData = this.GetWizardData(wizardData.ChildNodes[0]); } #endregion #region Make sure that the there is an custom UI specified: try { XmlNode wizardUINode = templateDoc.SelectSingleNode( "/vstemplns:VSTemplate/vstemplns:WizardExtension", xmlNamespaceManager); XmlNode wizardAsmNode = wizardUINode.SelectSingleNode( "vstemplns:Assembly", xmlNamespaceManager); XmlNode wizardClassNode = wizardUINode.SelectSingleNode( "vstemplns:FullClassName", xmlNamespaceManager); string extensionFullName = wizardClassNode.InnerText + ", " + wizardAsmNode.InnerText; Type extensionType = ReflectionHelper.LoadType(extensionFullName); if (extensionType == null) { throw new TypeLoadException(extensionFullName); } if (!(typeof(UnfoldTemplate).IsAssignableFrom(extensionType))) { throw new ArgumentException(Properties.Resources.Templates_NoExtension); } } catch { throw new ArgumentException(Properties.Resources.Templates_NoExtension); } #endregion #region Additional Checks CheckTemplateKinds(); CheckTemplateReferences(); #endregion } catch (Exception e) { throw new RecipeFrameworkException( String.Format( CultureInfo.CurrentCulture, Properties.Resources.Templates_InvalidTemplateFile, templateFileName), e); } }
protected override void Serialize(IDictionary <string, object> json) { var dataSource = DataSource.ToJson(); if (dataSource.Any()) { json["dataSource"] = dataSource; } if (Subdomains != null) { json["subdomains"] = Subdomains; } //>> Serialization if (Attribution.HasValue()) { json["attribution"] = Attribution; } if (AutoBind.HasValue) { json["autoBind"] = AutoBind; } if (Extent != null) { json["extent"] = Extent; } if (Key.HasValue()) { json["key"] = Key; } if (LocationField.HasValue()) { json["locationField"] = LocationField; } if (TitleField.HasValue()) { json["titleField"] = TitleField; } if (Opacity.HasValue()) { json["opacity"] = Opacity; } var style = Style.ToJson(); if (style.Any()) { json["style"] = style; } if (UrlTemplateId.HasValue()) { json["urlTemplate"] = UrlTemplateId; } if (Type.HasValue) { json["type"] = Type; } //<< Serialization var tooltip = Tooltip.ToJson(); if (tooltip.Any()) { json["tooltip"] = tooltip; } if (ShapeName.HasValue()) { json["shape"] = ShapeName; } else if (Shape.HasValue) { var shapeName = Shape.ToString(); json["shape"] = shapeName.ToLowerInvariant()[0] + shapeName.Substring(1); } }
public static Sort ByLocation(LocationField field, double latitude, double longitude) { return(new Sort(field, SortOrder.Distcartesian, latitude, longitude)); }
public static Sort ByCartesian(LocationField field, double x, double y) { return(new Sort(field, SortOrder.Distcartesian, x, y)); }