Ejemplo n.º 1
1
 public static String InterpretKey(Microsoft.Xna.Framework.Input.Keys key)
 {
     if (m_CameraControls.ContainsKey(key))
         return m_CameraControls[key];
     else
         return Enum.GetName(key.GetType(), key);
 }
Ejemplo n.º 2
0
            public override object ResolveParameter(ParameterDescriptor descriptor, Microsoft.AspNet.SignalR.Json.IJsonValue value)
            {
                if (value.GetType() == descriptor.ParameterType)
                {
                    return value;
                }

                if (_valueField == null)
                    _valueField = value.GetType().GetField("_value", BindingFlags.Instance | BindingFlags.NonPublic);

                var json = (string)_valueField.GetValue(value);
                using (var reader = new StringReader(json))
                    return _serializer.Deserialize(reader, descriptor.ParameterType);
            }
Ejemplo n.º 3
0
 public static bool CalcIsHidden(Microsoft.AnalysisServices.Design.Script calc)
 {
     //calc.CalculationProperty.Visible doesn't seem to work
     object mdxCodeCalc = calc.GetType().InvokeMember("mdxCodeCalc", System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, calc, null);
     bool bIsHidden = (bool)mdxCodeCalc.GetType().InvokeMember("IsHidden", System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public, null, mdxCodeCalc, null);
     return bIsHidden;
 }
Ejemplo n.º 4
0
 public static IEnumerable<Microsoft.Build.Evaluation.ProjectItem> GetItems(Microsoft.Build.Evaluation.Project project, string name)
 {
     MethodInfo getItems = project.GetType().GetMethod("GetItems", new Type[] { typeof(string) });
     return (IEnumerable<Microsoft.Build.Evaluation.ProjectItem>)getItems.Invoke(project, new object[] { name });
 }
Ejemplo n.º 5
0
 public static IEnumerable<Microsoft.Build.Evaluation.ProjectItem> GetItems(Microsoft.Build.Evaluation.Project project)
 {
     PropertyInfo items = project.GetType().GetProperty("Items");
     return (IEnumerable<Microsoft.Build.Evaluation.ProjectItem>)items.GetValue(project, null);
 }
Ejemplo n.º 6
0
 public static IEnumerable<Microsoft.Build.Evaluation.ProjectItem> GetStaticItemsInOrder(Microsoft.Build.Evaluation.Project project)
 {
     project.ReevaluateIfNecessary();
     PropertyInfo allEvaluatedItems = project.GetType().GetProperty("AllEvaluatedItems");
     return (IEnumerable<Microsoft.Build.Evaluation.ProjectItem>)allEvaluatedItems.GetValue(project, null);
 }
        internal static string GetQueryDefinition(Database d, NamedComponent nc, Microsoft.AnalysisServices.Binding b, List<DataItem> columnsNeeded)
        {
            StringBuilder sQuery = new StringBuilder();
            if (b is DsvTableBinding)
            {
                DsvTableBinding oDsvTableBinding = (DsvTableBinding)b;
                DataSourceView oDSV = d.DataSourceViews[oDsvTableBinding.DataSourceViewID];
                DataTable oTable = oDSV.Schema.Tables[oDsvTableBinding.TableID];

                if (oTable == null)
                {
                    throw new Exception("DSV table " + oDsvTableBinding.TableID + " not found");
                }
                else if (!oTable.ExtendedProperties.ContainsKey("QueryDefinition") && oTable.ExtendedProperties.ContainsKey("DbTableName"))
                {
                    foreach (DataColumn oColumn in oTable.Columns)
                    {
                        bool bFoundColumn = false;
                        if (columnsNeeded == null)
                        {
                            bFoundColumn = true;
                        }
                        else
                        {
                            foreach (DataItem di in columnsNeeded)
                            {
                                if (GetColumnBindingForDataItem(di).TableID == oTable.TableName && GetColumnBindingForDataItem(di).ColumnID == oColumn.ColumnName)
                                {
                                    bFoundColumn = true;
                                }
                            }
                        }
                        if (bFoundColumn)
                        {
                            if (sQuery.Length == 0)
                            {
                                sQuery.Append("select ");
                            }
                            else
                            {
                                sQuery.Append(",");
                            }
                            if (!oColumn.ExtendedProperties.ContainsKey("ComputedColumnExpression"))
                            {
                                sQuery.Append(sq).Append((oColumn.ExtendedProperties["DbColumnName"] ?? oColumn.ColumnName).ToString()).AppendLine(fq);
                            }
                            else
                            {
                                sQuery.Append(oColumn.ExtendedProperties["ComputedColumnExpression"].ToString()).Append(" as ").Append(sq).Append((oColumn.ExtendedProperties["DbColumnName"] ?? oColumn.ColumnName).ToString()).AppendLine(fq);
                            }
                        }
                    }
                    if (sQuery.Length == 0)
                    {
                        throw new Exception("There was a problem constructing the query.");
                    }
                    sQuery.Append("from ");
                    if (oTable.ExtendedProperties.ContainsKey("DbSchemaName")) sQuery.Append(sq).Append(oTable.ExtendedProperties["DbSchemaName"].ToString()).Append(fq).Append(".");
                    sQuery.Append(sq).Append(oTable.ExtendedProperties["DbTableName"].ToString());
                    sQuery.Append(fq).Append(" ").Append(sq).Append(oTable.ExtendedProperties["FriendlyName"].ToString()).AppendLine(fq);
                }
                else if (oTable.ExtendedProperties.ContainsKey("QueryDefinition"))
                {
                    sQuery.AppendLine("select *");
                    sQuery.AppendLine("from (");
                    sQuery.AppendLine(oTable.ExtendedProperties["QueryDefinition"].ToString());
                    sQuery.AppendLine(") x");
                }
                else
                {
                    throw new Exception("Current the code does not support this type of query.");
                }
            }
            else if (b is QueryBinding)
            {
                QueryBinding oQueryBinding = (QueryBinding)b;
                sQuery.Append(oQueryBinding.QueryDefinition);
            }
            else if (b is ColumnBinding)
            {
                ColumnBinding cb = (ColumnBinding)b;
                object parent = cb.Parent;
                DataTable dt = d.DataSourceViews[0].Schema.Tables[cb.TableID];
                if (nc is DimensionAttribute)
                {
                    DimensionAttribute da = (DimensionAttribute)nc;

                    if (da.Parent.KeyAttribute.KeyColumns.Count != 1)
                    {
                        throw new Exception("Attribute " + da.Parent.KeyAttribute.Name + " has a composite key. This is not supported for a key attribute of a dimension.");
                    }

                    string sDsvID = ((DimensionAttribute)nc).Parent.DataSourceView.ID;
                    columnsNeeded.Add(new DataItem(cb.Clone()));
                    columnsNeeded.Add(da.Parent.KeyAttribute.KeyColumns[0]);
                    return GetQueryDefinition(d, nc, new DsvTableBinding(sDsvID, cb.TableID), columnsNeeded);
                }
                else
                {
                    throw new Exception("GetQueryDefinition does not currently support a ColumnBinding on a object of type " + nc.GetType().Name);
                }
            }
            else
            {
                throw new Exception("Not a supported query binding type: " + b.GetType().FullName);
            }

            return sQuery.ToString();
        }
Ejemplo n.º 8
0
        private static void VisitFieldReference(Microsoft.Cci.IFieldReference fieldReference, Microsoft.CodeAnalysis.Emit.Context context)
        {
            Debug.Assert(fieldReference != null);

            // Visit containing type
            VisitTypeReference(fieldReference.GetContainingType(context), context);

            // Translate substituted field to original definition
            Microsoft.Cci.ISpecializedFieldReference specializedField = fieldReference.AsSpecializedFieldReference;
            if (specializedField != null)
            {
                fieldReference = specializedField.UnspecializedVersion;
            }

            // Visit field type
            VisitTypeReference(fieldReference.GetType(context), context);
        }
Ejemplo n.º 9
0
        private static void VisitMethodReference(Microsoft.Cci.IMethodReference methodReference, Microsoft.CodeAnalysis.Emit.Context context)
        {
            Debug.Assert(methodReference != null);

            // Visit containing type
            VisitTypeReference(methodReference.GetContainingType(context), context);

            // Visit generic arguments if any
            Microsoft.Cci.IGenericMethodInstanceReference genericInstance = methodReference.AsGenericMethodInstanceReference;
            if (genericInstance != null)
            {
                foreach (var arg in genericInstance.GetGenericArguments(context))
                {
                    VisitTypeReference(arg, context);
                }
                methodReference = genericInstance.GetGenericMethod(context);
            }

            // Translate substituted method to original definition
            Microsoft.Cci.ISpecializedMethodReference specializedMethod = methodReference.AsSpecializedMethodReference;
            if (specializedMethod != null)
            {
                methodReference = specializedMethod.UnspecializedVersion;
            }

            // Visit parameter types
            VisitParameters(methodReference.GetParameters(context), context);

            if (methodReference.AcceptsExtraArguments)
            {
                VisitParameters(methodReference.ExtraParameters, context);
            }

            // Visit return value type
            VisitTypeReference(methodReference.GetType(context), context);
            if (methodReference.ReturnValueIsModified)
            {
                foreach (var typeModifier in methodReference.ReturnValueCustomModifiers)
                {
                    VisitTypeReference(typeModifier.GetModifier(context), context);
                }
            }
        }
Ejemplo n.º 10
0
 public static Microsoft.AnalysisServices.Common.ERDiagram GetTabularERDiagramFromSandboxEditor(Microsoft.AnalysisServices.Common.SandboxEditor editor)
 {
     Microsoft.AnalysisServices.Common.DiagramDisplay diagramDisplay = (Microsoft.AnalysisServices.Common.DiagramDisplay)editor.GetType().InvokeMember("GetCurrentDiagramDisplay", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.NonPublic, null, editor, new object[] { });
     Microsoft.AnalysisServices.Common.ERDiagram diagram = null;
     if (diagramDisplay != null)
     {
         diagram = diagramDisplay.Diagram as Microsoft.AnalysisServices.Common.ERDiagram;
     }
     return diagram;
 }
Ejemplo n.º 11
0
 public virtual void RegisterLanguageService(Microsoft.VisualStudio.IntegrationHelper.LanguageService languageService){
   if (languageService == null) throw new ArgumentNullException();
   languageService.SetSite(this);
   ((IServiceContainer)this).AddService(languageService.GetType(), languageService, true);
   int lcid = this.GetProviderLocale();
   languageService.scLanguageService.culture = lcid == 0 ? CultureInfo.InvariantCulture : new CultureInfo(lcid);
 }