private static List <List <CustomPropertyNameCellsPair> > __GetListOfCpPairLists( ShapeIDPairs shapeidpairs, List <List <CustomPropertyCells> > listof_listof_cpcells) { if (listof_listof_cpcells.Count != shapeidpairs.Count) { throw new Exceptions.InternalAssertionException(); } var listof_listof_cppairs = new List <List <CustomPropertyNameCellsPair> >(shapeidpairs.Count); var shape_indices = System.Linq.Enumerable.Range(0, shapeidpairs.Count); foreach (int i in shape_indices) { var shape = shapeidpairs[i].Shape; var listof_cpnames = CustomPropertyHelper.GetNames(shape); var listof_cpcells = listof_listof_cpcells[i]; int num_cps = listof_cpnames.Count; var cp_indices = Enumerable.Range(0, num_cps); var listof_cppairs = new List <CustomPropertyNameCellsPair>(num_cps); foreach (int cprow in cp_indices) { int shapeid = shapeidpairs[i].ShapeID; var cppair = new CustomPropertyNameCellsPair(shapeid, cprow, listof_cpnames[cprow], listof_cpcells[cprow]); listof_cppairs.Add(cppair); } listof_listof_cppairs.Add(listof_cppairs); } return(listof_listof_cppairs); }
private static List <CustomPropertyDictionary> create_dic(IList <IVisio.Shape> shapes, List <int> shapeids, List <List <CustomPropertyCells> > customprops_per_shape) { var customprops_dic = new List <CustomPropertyDictionary>(shapeids.Count); if (customprops_per_shape.Count != shapeids.Count) { throw new InternalAssertionException(); } for (int shape_index = 0; shape_index < shapeids.Count; shape_index++) { var shape = shapes[shape_index]; var customprops_for_shape = customprops_per_shape[shape_index]; var prop_names = CustomPropertyHelper.GetNames(shape); if (customprops_for_shape.Count != prop_names.Count) { throw new InternalAssertionException(); } var dic = new CustomPropertyDictionary(prop_names.Count); for (int prop_index = 0; prop_index < prop_names.Count; prop_index++) { string prop_name = prop_names[prop_index]; dic[prop_name] = customprops_for_shape[prop_index]; } customprops_dic.Add(dic); } return(customprops_dic); }
// ---------------------------------------- // ---------------------------------------- // ---------------------------------------- // ---------------------------------------- private static List <CustomPropertyNameCellsPair> __GetPairs(IVisio.Shape shape, VASS.CellValueType type) { var shape_custprop_cells = CustomPropertyCells.GetCells(shape, type); var shape_custprop_names = CustomPropertyHelper.GetNames(shape); int shapeid = shape.ID16; var list = __CreateListofPairs(shape_custprop_names, shape_custprop_cells, shapeid); return(list); }
/// <summary> /// Gets all the custom properties defined on a shape /// </summary> /// <remarks> /// If there are no custom properties then null will be returned</remarks> /// <param name="shape"></param> /// <returns>A list of custom properties</returns> public static CustomPropertyDictionary Get(IVisio.Shape shape) { var prop_names = CustomPropertyHelper.GetNames(shape); var dic = new CustomPropertyDictionary(prop_names.Count); var cells = CustomPropertyCells.GetCells(shape); for (int prop_index = 0; prop_index < prop_names.Count(); prop_index++) { string prop_name = prop_names[prop_index]; dic[prop_name] = cells[prop_index]; } return(dic); }
public static List <CustomPropertyDictionary> Get(IVisio.Page page, IList <IVisio.Shape> shapes) { if (page == null) { throw new ArgumentNullException(nameof(page)); } if (shapes == null) { throw new ArgumentNullException(nameof(shapes)); } var shapeids = shapes.Select(s => s.ID).ToList(); var customprops_dic = new List <CustomPropertyDictionary>(shapeids.Count); var customprops_per_shape = CustomPropertyCells.GetCells(page, shapeids); if (customprops_per_shape.Count != shapeids.Count) { throw new InternalAssertionException(); } for (int shape_index = 0; shape_index < shapeids.Count; shape_index++) { var shape = shapes[shape_index]; var customprops_for_shape = customprops_per_shape[shape_index]; var prop_names = CustomPropertyHelper.GetNames(shape); if (customprops_for_shape.Count != prop_names.Count) { throw new InternalAssertionException(); } var dic = new CustomPropertyDictionary(prop_names.Count); for (int prop_index = 0; prop_index < prop_names.Count(); prop_index++) { string prop_name = prop_names[prop_index]; dic[prop_name] = customprops_for_shape[prop_index]; } customprops_dic.Add(dic); } return(customprops_dic); }