public XmlDocument GenerateUploadManifest(string hash, XmlDocument AppendTo) { if (AppendTo == null) { AppendTo = new XmlDocument(); XmlDeclaration Dec = AppendTo.CreateXmlDeclaration("1.0", "utf-8", String.Empty); XmlElement mainNode = AppendTo.CreateElement("files"); XmlElement child = AppendTo.CreateElement("file"); XmlAttribute md5 = AppendTo.CreateAttribute("md5"); md5.Value = hash; child.Attributes.Append(md5); mainNode.AppendChild(child); XmlElement root = AppendTo.DocumentElement; AppendTo.InsertBefore(Dec, root); AppendTo.AppendChild(mainNode); } else { XmlNode child = AppendTo.CreateNode(XmlNodeType.Element, "file", String.Empty); XmlAttribute md5 = AppendTo.CreateAttribute("md5"); md5.Value = hash; child.Attributes.Append(md5); AppendTo.ChildNodes[1].AppendChild(child); } return(AppendTo); }
/// <summary> /// Creates a Loop (Closed Spline) path through a given set of points. /// </summary> /// <param name="AppendTo">Spline should be appended to this path. If null, a new path will be created.</param> /// <param name="Points">Points between which the loop will be created.</param> /// <returns>Loop path.</returns> public static SKPath CreateLoop(SKPath AppendTo, params SKPoint[] Points) { int i, c = Points.Length; if (c == 0) { throw new ArgumentException("No points provided.", nameof(Points)); } if (AppendTo is null) { AppendTo = new SKPath(); AppendTo.MoveTo(Points[0]); } else { SKPoint P = AppendTo.LastPoint; if (P.X != Points[0].X || P.Y != Points[0].Y) { AppendTo.LineTo(Points[0]); } } if (c == 1) { return(AppendTo); } float[] V = new float[c]; for (i = 0; i < c; i++) { V[i] = Points[i].X; } GetCubicBezierCoefficients(V, out float[] Ax, out float[] Bx); for (i = 0; i < c; i++) { V[i] = Points[i].Y; } GetCubicBezierCoefficients(V, out float[] Ay, out float[] By); for (i = 0; i < c - 1; i++) { AppendTo.CubicTo(Ax[i], Ay[i], Bx[i], By[i], Points[i + 1].X, Points[i + 1].Y); } AppendTo.CubicTo(Ax[i], Ay[i], Bx[i], By[i], Points[0].X, Points[0].Y); AppendTo.Close(); return(AppendTo); }
/// <summary> /// Creates a Spline path through a given set of points. /// </summary> /// <param name="AppendTo">Spline should be appended to this path. If null, a new path will be created.</param> /// <param name="Points">Points between which the spline will be created.</param> /// <returns>Spline path.</returns> public static SKPath CreateSpline(SKPath AppendTo, params SKPoint[] Points) { int i, c = Points.Length; if (c == 0) { throw new ArgumentException("No points provided.", nameof(Points)); } if (AppendTo is null) { AppendTo = new SKPath(); AppendTo.MoveTo(Points[0]); } else { AppendTo.LineTo(Points[0]); } if (c == 1) { return(AppendTo); } if (c == 2) { AppendTo.LineTo(Points[1]); return(AppendTo); } double[] V = new double[c]; for (i = 0; i < c; i++) { V[i] = Points[i].X; } GetCubicBezierCoefficients(V, out double[] Ax, out double[] Bx); for (i = 0; i < c; i++) { V[i] = Points[i].Y; } GetCubicBezierCoefficients(V, out double[] Ay, out double[] By); for (i = 0; i < c - 1; i++) { AppendTo.CubicTo((float)Ax[i], (float)Ay[i], (float)Bx[i], (float)By[i], Points[i + 1].X, Points[i + 1].Y); } return(AppendTo); }
protected virtual AccessRights GetMask(IWorkflowActivityContext context) { var mask = AccessRights.None; if (Read.Get(context.GetExecutionContext())) { mask = mask | AccessRights.ReadAccess; } if (Append.Get(context.GetExecutionContext())) { mask = mask | AccessRights.AppendAccess; } if (AppendTo.Get(context.GetExecutionContext())) { mask = mask | AccessRights.AppendToAccess; } if (Read.Get(context.GetExecutionContext())) { mask = mask | AccessRights.ReadAccess; } if (Write.Get(context.GetExecutionContext())) { mask = mask | AccessRights.WriteAccess; } if (Delete.Get(context.GetExecutionContext())) { mask = mask | AccessRights.DeleteAccess; } if (AssignAccess.Get(context.GetExecutionContext())) { mask = mask | AccessRights.AssignAccess; } if (ShareAccess.Get(context.GetExecutionContext())) { mask = mask | AccessRights.ShareAccess; } return(mask); }
public void DeleteGroup(CommandBarGroupDefinition group, AppendTo option = AppendTo.Next) { var definitionsInCurrentGroup = group.Items; var newGroup = option == AppendTo.Next ? GetNextGroup(group) : GetPreviousGroup(group); var definitionsInNewGroup = newGroup.Items; var parent = group.Parent; uint newSortorder = 0; if (option == AppendTo.Next) { newSortorder = group.LastItem?.SortOrder ?? 0; //Add old items after the new inserted ones foreach (var itemDefinition in definitionsInNewGroup.ToList()) { itemDefinition.SortOrder = newSortorder++; } foreach (var itemDefinition in definitionsInCurrentGroup.ToList()) { itemDefinition.Group = newGroup; } } else { foreach (var itemDefinition in definitionsInNewGroup.ToList()) { itemDefinition.SortOrder = newSortorder++; } foreach (var itemDefinition in definitionsInCurrentGroup.ToList()) { itemDefinition.Group = newGroup; itemDefinition.SortOrder = newSortorder++; } } DefinitionHost.ItemGroupDefinitions.Remove(group); RemoveGapsInGroupSortOrder(parent); BuildLogical(parent); }
private static System.Collections.ArrayList AddUniques(IEnumDataset fromTheseDatasets, System.Collections.ArrayList AppendTo = null) { if (AppendTo == null) { AppendTo = new System.Collections.ArrayList(); } IDataset aDs = fromTheseDatasets.Next(); while (aDs != null) { // If this is a FeatureDataset, we need to // Check to see if the dataset is a FeatureClass or a table. This is all we care about if ((aDs.Type == esriDatasetType.esriDTFeatureClass) || (aDs.Type == esriDatasetType.esriDTTable)) { // Cast the DS as an ITable ITable thisTable = aDs as ITable; // Find the Data Source field int fldID = -1; if (thisTable.FindField("DataSourceID") != -1) { fldID = thisTable.FindField("DataSourceID"); } if (thisTable.FindField("DescriptionSourceID") != -1) { fldID = thisTable.FindField("DescriptionSourceID"); } if (thisTable.FindField("DefinitionSourceID") != -1) { fldID = thisTable.FindField("DefinitionSourceID"); } if (fldID == -1) { aDs = fromTheseDatasets.Next(); continue; } IField dsField = thisTable.Fields.get_Field(fldID); // Use the IDataStatistics interface to find unique values IDataStatistics dataStats = new DataStatisticsClass(); dataStats.Cursor = thisTable.Search(null, false); dataStats.Field = dsField.Name; System.Collections.IEnumerator uniqueValues = dataStats.UniqueValues; // Setup for iteration uniqueValues.Reset(); // Add the unique values to the collection try { uniqueValues.MoveNext(); while (uniqueValues.Current != null) { // Only add the value if it isn't already there... if (!AppendTo.Contains(uniqueValues.Current.ToString())) { AppendTo.Add(uniqueValues.Current.ToString()); } uniqueValues.MoveNext(); } } catch (Exception) { return(null); } } // Iterate to the next dataset aDs = fromTheseDatasets.Next(); } return(AppendTo); }
public override void WriteInitializationScript(System.IO.TextWriter writer) { var options = new Dictionary <string, object>(Events); var positionOptions = new Dictionary <string, object>(); if (Position.Bottom != 20) { positionOptions.Add("bottom", Position.Bottom); } if (Position.Right != 20) { positionOptions.Add("right", Position.Right); } if (Position.Top != int.MinValue) { positionOptions.Add("top", Position.Top); } if (Position.Left != int.MinValue) { positionOptions.Add("left", Position.Left); } if (!Position.Pinned) { positionOptions.Add("pinned", Position.Pinned); } if (positionOptions.Count > 0) { options.Add("position", positionOptions); } if (Stacking != NotificationStackingSettings.Default) { options["stacking"] = Stacking; } if (!HideOnClick) { options["hideOnClick"] = HideOnClick; } if (Button) { options["button"] = Button; } if (AllowHideAfter > 0) { options["allowHideAfter"] = AllowHideAfter; } if (AutoHideAfter != 5000) { options["autoHideAfter"] = AutoHideAfter; } if (AppendTo.HasValue()) { options["appendTo"] = AppendTo; } if (Width.HasValue()) { options["width"] = Width; } if (Height.HasValue()) { options["height"] = Height; } var animation = Animation.ToJson(); if (animation.Any()) { if (animation["animation"] is bool) { options["animation"] = false; } else { options["animation"] = animation["animation"]; } } if (Templates.Any()) { options["templates"] = Templates.Select(t => t.Serialize()); } writer.Write(Initializer.Initialize(Selector, "Notification", options)); base.WriteInitializationScript(writer); }