Ejemplo n.º 1
0
    private void cmdDrillDownMulti_Click(object sender, EventArgs e)
    {
        DelimitedList dsList;
        string        datasourceList;

        dsList = new DelimitedList();

        //Find all of the thumbnail section controls
        foreach (Control currControl in thumbnails.Controls)
        {
            Members_Reports_Thumbnail_Dashboard_Thumbnail_Section thumbControl;

            thumbControl = (Members_Reports_Thumbnail_Dashboard_Thumbnail_Section)currControl;

            //Build a list of the datasource ids
            if (thumbControl.Selected)
            {
                dsList.Append(thumbControl.DatasourceIdString);
            }
        }

        datasourceList = dsList.ToString();
        if (datasourceList.Length == 0)
        {
            return;
        }

        _log.DebugFormat("Built a data source list of '{0}'", dsList.ToString());

        drillDownMultiple(datasourceList);
    }
        // This method adds the string name of each value set in flags enum T to
        // the delimitedlist.
        //
        // (e.g., MyEnum.Value1 | MyEnum.Value1 -> {"Value1", "Value2"})
        //
        public static void AddFlagsToList <T>(DelimitedList list, T value) // Would be "where T:Enum" if it weren't for CS0702  (danlehen, 05/10/04)
        {
            T[] flags = SplitEnumFlags <T>(value);

            foreach (T flag in flags)
            {
                list.Append(Enum.GetName(typeof(T), value));
            }
        }
Ejemplo n.º 3
0
        private string getConnectedDatasourceList(DiagramNode node)
        {
            DelimitedList      list;
            List <DiagramNode> connectedNodes;

            list           = new DelimitedList();
            connectedNodes = new List <DiagramNode>();

            //Make sure we include this node
            connectedNodes.Add(node);

            foreach (DiagramNodeConnection currConnection in _connections)
            {
                if (currConnection.FirstNode == node && !connectedNodes.Contains(currConnection.SecondNode))
                {
                    connectedNodes.Add(currConnection.SecondNode);
                }
                if (currConnection.SecondNode == node && !connectedNodes.Contains(currConnection.FirstNode))
                {
                    connectedNodes.Add(currConnection.FirstNode);
                }
            }

            foreach (DiagramNode currNode in connectedNodes)
            {
                string datasourceString;

                datasourceString = currNode.ConfiguredDatasourceId.ToString();
                if (currNode.SubTypeId != null)
                {
                    datasourceString += "." + currNode.SubTypeId.Value.ToString();
                }

                list.Append(datasourceString);
            }

            return(list.ToString());
        }
        /// <summary>
        /// AppendParameters - Helper routine to append parameters to a param list.
        /// </summary>
        internal static void AppendParameter(
            DelimitedList parameterList,
            McgType type,
            string name,
            string fieldName,
            string propertyName,
            string internalReadName,
            bool isAnimated,
            ParameterType parameterType)
        {
            isAnimated = isAnimated && ((parameterType & ParameterType.SkipAnimations) == 0);

            McgResource resourceType = type as McgResource;

            // We accumulate the parameter(s) in these strings.
            string paramString        = String.Empty;
            string animateParamString = String.Empty;

            if ((parameterType & ParameterType.ManagedParamList) != 0)
            {
                paramString = type.Name + " " + name;

                // Field is animated -- also pass resource by handle.
                if (((resourceType == null) || resourceType.IsValueType) && isAnimated)
                {
                    // Field is animated -- also pass resource by handle.
                    animateParamString = "AnimationClock " + name + "Animations";
                }
            }
            else if ((parameterType & ParameterType.ManagedCallParamList) != 0)
            {
                paramString = name;

                // Field is animated -- also pass resource by handle.
                if (((resourceType == null) || resourceType.IsValueType) && isAnimated)
                {
                    // Field is animated -- also pass resource by handle.
                    animateParamString = name + "Animations";
                }
            }
            else if ((parameterType & ParameterType.RenderDataCallParamList) != 0)
            {
                // Field is a resource that can not be passed by value.
                if (resourceType != null && !resourceType.IsValueType)
                {
                    paramString = "_renderData.AddDependentResource(" + fieldName + ")";
                }
                else
                {
                    paramString = ConvertToValueType(type, name);

                    if (isAnimated)
                    {
                        // Field is animated -- also pass resource by handle.
                        animateParamString = "h" + propertyName + "Animations";
                    }
                }
            }
            else if ((parameterType & ParameterType.ManagedImportsParamList) != 0)
            {
                // If it's not a value type, then we can pass by handle
                if ((resourceType != null) && !resourceType.IsValueType)
                {
                    paramString = DuceHandle.ManagedTypeName + " h" + propertyName;
                }
                else
                {
                    // If it is a value type, we need to know whether we convert it or not
                    if (type.NeedsConvert)
                    {
                        // If it does need a convert, then the import is typed to the
                        // unmanaged value type, because that's what the Convert* method
                        // returns.
                        paramString = type.UnmanagedDataType + " " + name;
                    }
                    else
                    {
                        // Otherwise, we know that this value type does not need a conversion,
                        // and thus should be passed directly as its managed type.
                        paramString = type.ManagedName + " " + name;
                    }

                    // Field is animated -- also pass resource by handle.
                    if (isAnimated)
                    {
                        animateParamString = DuceHandle.ManagedTypeName + " h" + GeneratorMethods.FirstCap(name) + "Animations";
                    }
                }
            }
            else if ((parameterType & ParameterType.UnmanagedParamList) != 0)
            {
                if ((resourceType != null) && !resourceType.IsValueType)
                {
                    paramString = DuceHandle.UnmanagedTypeName + " h" + GeneratorMethods.FirstCap(name);
                }
                else
                {
                    paramString = type.UnmanagedDataType + " " + name;

                    // Field is animated -- also pass resource by handle.
                    if (isAnimated)
                    {
                        animateParamString = DuceHandle.UnmanagedTypeName + " h" + GeneratorMethods.FirstCap(name) + "Animations";
                    }
                }
            }
            else
            {
                Debug.Assert((parameterType & ParameterType.UnmanagedCallParamList) != 0);

                if ((resourceType != null) && !resourceType.IsValueType)
                {
                    paramString = "h" + GeneratorMethods.FirstCap(name);
                }
                else
                {
                    paramString = name;

                    // Field is animated -- also pass resource by handle.
                    if (isAnimated)
                    {
                        animateParamString = "h" + GeneratorMethods.FirstCap(name) + "Animations";
                    }
                }
            }

            // animateParamString should either be Empty or have content - it shouldn't be null
            Debug.Assert(null != animateParamString);


            // Now that we have the parameter(s), we have to decide what to do with them
            if ((parameterType & ParameterType.AssignToMemberVariables) != 0)
            {
                parameterList.Append("this." + paramString + " = " + paramString);

                if (animateParamString.Length != 0)
                {
                    parameterList.Append("this." + animateParamString + " = " + animateParamString);
                }
            }
            else
            {
                parameterList.Append(paramString);

                if (animateParamString.Length != 0)
                {
                    parameterList.Append(animateParamString);
                }
            }
        }
        internal static int AppendStructParameters(
            DelimitedList parameterList,
            PaddedStructData paddedFields,
            int initialPosition,
            bool unmanagedStruct,
            bool kernelAccessibleStruct
            )
        {
            int padSuffix = 0;

            Helpers.CodeGenHelpers.AlignedFieldOffsetHelper alignedFieldHelper = new Helpers.CodeGenHelpers.AlignedFieldOffsetHelper(4, 4);

            foreach (AlignmentEntry alignmentEntry in paddedFields.AlignmentEntries)
            {
                McgField field    = alignmentEntry.Field;
                int      position = initialPosition + alignmentEntry.Offset;

                alignedFieldHelper.MoveToNextEntry(position, alignmentEntry.Size);
                int alignedFieldOffset = alignedFieldHelper.AlignedFieldOffset;

                if (unmanagedStruct)
                {
                    // Insert enough padding to ensure the field is properly aligned
                    foreach (string alignmentField in alignedFieldHelper.AlignmentFields)
                    {
                        parameterList.Append(alignmentField);
                    }
                }

                // This primary if else else block switches between the tree types of entries in the
                // paddedFields alignment list: padding, animation and normal field entries.
                // The offset of each field is stored in "position", which is the padding offset of the
                // entry + the initial position.
                if (field == null)
                {
                    Debug.Assert(alignmentEntry.IsPad);

                    string padIdentifier = "padQuadAlignment" + padSuffix;

                    if (unmanagedStruct)
                    {
                        parameterList.Append("UINT32 " + padIdentifier + ";");
                    }
                    else
                    {
                        parameterList.Append("[FieldOffset(" + alignedFieldOffset + ")] private UInt32 " + padIdentifier);
                    }
                    ++padSuffix;
                }
                else if (alignmentEntry.IsAnimation)
                {
                    if (unmanagedStruct)
                    {
                        parameterList.Append("HMIL_RESOURCE " + "h" + field.PropertyName + "Animations;");
                    }
                    else
                    {
                        parameterList.Append("[FieldOffset(" + alignedFieldOffset + ")] internal DUCE.ResourceHandle h" + field.PropertyName + "Animations");
                    }
                }
                else
                {
                    // This case is a boring, non animate field.

                    bool        constructedParam = false;
                    McgType     type             = field.Type;
                    McgResource resourceType     = type as McgResource;

                    // If it's an McgResource, we have to handle reference types and collections
                    if (resourceType != null)
                    {
                        // Currently, collections are accounted for by storing just their size inline
                        if (resourceType.IsCollection)
                        {
                            if (unmanagedStruct)
                            {
                                parameterList.Append("UINT32 " + field.Name + "Size;");
                            }
                            else
                            {
                                parameterList.Append("[FieldOffset(" + alignedFieldOffset + ")] internal UInt32 " + field.Name + "Size");
                            }
                            constructedParam = true;
                        }
                        // If it's not a collection, is it a reference type?  If so, it's passed by handle.
                        else if (!resourceType.IsValueType)
                        {
                            if (unmanagedStruct)
                            {
                                parameterList.Append("HMIL_RESOURCE " + "h" + field.Name + ";");
                            }
                            else
                            {
                                parameterList.Append("[FieldOffset(" + alignedFieldOffset + ")] internal DUCE.ResourceHandle h" + field.Name);
                            }

                            constructedParam = true;
                        }
                    }

                    // If we haven't yet handled this parameter, we're left with a primitive type,
                    // like a struct or an enum.  At this point, the value will be stored inline.
                    // The only real question left is whether the unmanaged struct matches the managed struct.
                    // If so, the struct is simply stored.  If not, then .NeedsConvert is true, and
                    // the record is of the unmanaged type, even on the managed side of things.
                    if (!constructedParam)
                    {
                        if (type.NeedsConvert)
                        {
                            if (unmanagedStruct)
                            {
                                parameterList.Append(type.BaseUnmanagedType + " " + field.Name + ";");
                            }
                            else
                            {
                                parameterList.Append("[FieldOffset(" + alignedFieldOffset + ")] internal " + type.MarshalUnmanagedType + " " + field.Name);
                            }
                        }
                        else
                        {
                            if (unmanagedStruct)
                            {
                                if (kernelAccessibleStruct)
                                {
                                    McgEnum enumType = type as McgEnum;

                                    if (enumType != null)
                                    {
                                        parameterList.Append(enumType.KernelAccessibleType + " " + field.Name + ";");
                                        constructedParam = true;
                                    }
                                }

                                if (!constructedParam)
                                {
                                    parameterList.Append(type.BaseUnmanagedType + " " + field.Name + ";");
                                }
                            }
                            else
                            {
                                parameterList.Append("[FieldOffset(" + alignedFieldOffset + ")] internal " + type.ManagedName + " " + field.Name);
                            }
                        }
                    }
                }
            }

            if (unmanagedStruct)
            {
                // Insert enough padding to ensure the struct's size falls on a packing boundary
                foreach (string packingField in alignedFieldHelper.NativePackingFields)
                {
                    parameterList.Append(packingField);
                }
            }
            else
            {
                // Insert enough padding to ensure the struct's size falls on a packing boundary
                foreach (string packingField in alignedFieldHelper.ManagedPackingFields)
                {
                    parameterList.Append(packingField);
                }
            }

            return(initialPosition + paddedFields.PaddedSize);
        }