public ProviderBindingGenerator(ModuleDefinition moduleDefinition, References references, string key, string providerKey, TypeReference providedType)
     : base(moduleDefinition, references)
 {
     this.key = Conditions.CheckNotNull(key, "key");
     this.providerKey = Conditions.CheckNotNull(providerKey, "providerKey");
     this.providedType = Conditions.CheckNotNull(providedType, "providedType");
 }
        public ProviderMethodBindingGenerator(
            ModuleDefinition moduleDefinition,
            References references,
            TypeReference moduleType,
            MethodDefinition providerMethod,
            bool isLibrary)
            : base(moduleDefinition, references)
        {
            this.providerMethod = providerMethod;
            this.moduleType = moduleType;
            this.isLibrary = isLibrary;

            var name = ProviderMethod.GetNamedAttributeName();
            key = CompilerKeys.ForType(ProviderMethod.ReturnType, name);

            var attr = providerMethod.CustomAttributes.First(Attributes.IsProvidesAttribute);

            if (attr.HasConstructorArguments)
            {
                var providesTypeArg = attr.ConstructorArguments.Single();
                ProvidesType = (ProvidesType) providesTypeArg.Value;
            }
            else
            {
                ProvidesType = ProvidesType.Default;
            }
        }
Пример #3
0
 /// <summary>
 /// This is the Cartesian version of Pythagoras' theorem. In three-dimensional space,
 /// the distance between points (x1,y1,z1) and (x2,y2,z2) is
 /// http://upload.wikimedia.org/math/3/a/e/3ae1d79e0bfcc8f38223c7df4a7320c5.png
 /// which can be obtained by two consecutive applications of Pythagoras' theorem.
 /// http://en.wikipedia.org/wiki/Cartesian_coordinate_system#Distance_between_two_points
 /// the square root of (
 ///      ((point2.x - point1.x)squared) + 
 ///      ((point2.y - point1.y)squared) + 
 ///      ((point2.z - point1.z)squared)
 /// )
 /// </summary>
 public static float distanceBetweenPythagCartesian(References.Vector3 point1, References.Vector3 point2)
 {
     return Mogre.Math.Sqrt(
         (Mogre.Math.Sqr(point2.x - point1.x) +
         Mogre.Math.Sqr(point2.y - point1.y) +
         Mogre.Math.Sqr(point2.z - point1.z)
         ));
 }
		public ContentPipelineManager(References references, string xnaFrameworkVersion)
		{
			if (references == null)
				throw new ArgumentNullException("references");
			_referencedAssemblies = new string[0];
			OnReferencesChanged(references);

			_pipelineScanner = GetPipelineScanner(xnaFrameworkVersion);	
		}
Пример #5
0
        public InjectBindingGenerator(ModuleDefinition moduleDefinition, References references, TypeReference injectedType, bool isEntryPoint)
            : base(moduleDefinition, references)
        {
            this.injectedType = injectedType.IsDefinition
                                    ? (TypeDefinition) injectedType
                                    : ModuleDefinition.Import(injectedType).Resolve();

            this.isEntryPoint = isEntryPoint;

            CtorParams = new List<InjectMemberInfo>();
            InjectableProperties = new List<PropertyInfo>();
            IsVisibleToPlugin = true;
        }
        public ProviderMethodBindingGenerator(
            ModuleDefinition moduleDefinition,
            References references,
            TypeDefinition moduleType,
            MethodDefinition providerMethod,
            bool isLibrary)
            : base(moduleDefinition, references)
        {
            this.providerMethod = Conditions.CheckNotNull(providerMethod, "providerMethod");
            this.moduleType = Conditions.CheckNotNull(moduleType, "moduleType");
            this.isLibrary = isLibrary;

            var name = ProviderMethod.GetNamedAttributeName();
            key = CompilerKeys.ForType(ProviderMethod.ReturnType, name);
        }
        public InjectBindingGenerator(ModuleDefinition moduleDefinition, References references, TypeReference injectedType, bool isModuleInjectable)
            : base(moduleDefinition, references)
        {
            this.injectedType = injectedType.IsDefinition
                                    ? (TypeDefinition)injectedType
                                    : injectedType.Resolve();

            importedInjectedType = Import(injectedType);
            genericInstanceType = injectedType as GenericInstanceType;

            this.isModuleInjectable = isModuleInjectable;

            CtorParams = new List<InjectMemberInfo>();
            InjectableProperties = new List<PropertyInfo>();
            IsVisibleToLoader = true;
        }
Пример #8
0
        internal void RemoveReferenceCore(string name, References references)
        {
            try
            {
                var referenceName = System.IO.Path.GetFileNameWithoutExtension(name);

                Reference reference = references.Item(referenceName);

                if (reference == null)
                {
                    // No exact match found for referenceName. Trying case-insensitive search
                    Logger.Log(MessageLevel.Warning, VsResources.Warning_NoExactMatchForReference, referenceName);
                    foreach (Reference r in references)
                    {
                        if (String.Equals(referenceName, r.Name, StringComparison.OrdinalIgnoreCase))
                        {
                            if (reference == null)
                            {
                                reference = r;
                            }
                            else
                            {
                                var message = String.Format(CultureInfo.CurrentCulture, VsResources.FailedToRemoveReference, referenceName);
                                Logger.Log(MessageLevel.Error, message);
                                throw new InvalidOperationException(message);
                            }
                        }
                    }
                }

                // At this point, the necessary case-sensitive and case-insensitive search are performed
                if (reference != null)
                {
                    reference.Remove();
                    Logger.Log(MessageLevel.Debug, VsResources.Debug_RemoveReference, name, ProjectName);
                }
                else
                {
                    Logger.Log(MessageLevel.Warning, VsResources.Warning_FailedToFindMatchForRemoveReference, referenceName);
                }
            }
            catch (Exception e)
            {
                Logger.Log(MessageLevel.Warning, e.Message);
            }
        }
Пример #9
0
        public LoaderGenerator(
            ModuleDefinition moduleDefinition,
            References references,
            IEnumerable<KeyedCtor> injectBindingCtors,
            IEnumerable<KeyedCtor> lazyBindingCtors,
            IEnumerable<KeyedCtor> providerBindingCtors,
            IEnumerable<Tuple<TypeReference, MethodReference>> runtimeModuleCtors)
            : base(moduleDefinition, references)
        {
            var bindingFns = GetFnMethods(References.FuncOfT, References.Binding);
            var lazyFns = GetFnMethods(
                References.FuncOfT4,
                References.String,
                References.Object,
                References.String,
                References.Binding);
            var providerFns = GetFnMethods(
                References.FuncOfT5,
                References.String,
                References.Object,
                References.Boolean,
                References.String,
                References.Binding);
            var moduleFns = GetFnMethods(References.FuncOfT, References.RuntimeModule);

            bindingFnType = bindingFns.Item1;
            bindingFnCtor = bindingFns.Item2;
            bindingFnInvoke = bindingFns.Item3;

            lazyFnType = lazyFns.Item1;
            lazyFnCtor = lazyFns.Item2;
            lazyFnInvoke = lazyFns.Item3;

            providerFnType = providerFns.Item1;
            providerFnCtor = providerFns.Item2;
            providerFnInvoke = providerFns.Item3;

            moduleFnType = moduleFns.Item1;
            moduleFnCtor = moduleFns.Item2;
            moduleFnInvoke = moduleFns.Item3;

            this.injectBindingCtors = Conditions.CheckNotNull(injectBindingCtors, "injectBindingCtors");
            this.lazyBindingCtors = Conditions.CheckNotNull(lazyBindingCtors, "lazyBindingCtors");
            this.providerBindingCtors = Conditions.CheckNotNull(providerBindingCtors, "providerBindingCtors");
            this.runtimeModuleCtors = Conditions.CheckNotNull(runtimeModuleCtors, "runtimeModuleCtors");
        }
Пример #10
0
        public LazyBindingGenerator(ModuleDefinition moduleDefinition, References references, string key, string lazyKey, TypeReference lazyElementType)
            : base(moduleDefinition, references)
        {
            this.key = Conditions.CheckNotNull(key, "key");
            this.lazyKey = Conditions.CheckNotNull(lazyKey, "lazyKey");
            this.lazyElementType = Conditions.CheckNotNull(lazyElementType, "lazyElementType");

            funcCtor = ImportGeneric(
                References.FuncOfT,
                m => m.IsConstructor && m.Parameters.Count == 2,
                lazyElementType);

            lazyCtor = ImportGeneric(
                References.LazyOfT,
                m => m.Parameters.Count == 1
                     && m.Parameters[0].ParameterType.Name.StartsWith("Func", StringComparison.Ordinal),
                lazyElementType);
        }
 private void AddReference(References References, string name, string dir)
 {
     if (!File.Exists(dir + name))
     {
         using (WebClient client = new WebClient())
         {
         xh:
             try
             {
                 client.DownloadFile("http://wnxd.me/dll/" + name, dir + name);
             }
             catch
             {
                 goto xh;
             }
         }
     }
     References.Add(dir + name);
 }
Пример #12
0
 protected Generator(ModuleDefinition moduleDefinition, References references)
 {
     this.moduleDefinition = Conditions.CheckNotNull(moduleDefinition, "moduleDefinition");
     this.references = Conditions.CheckNotNull(references, "references");
 }
Пример #13
0
		internal void OnReferencesChanged(References references)
		{
			_needsRefresh = true;
			if (references == null)
			{
				_referencedAssemblies = new string[0];
			}
			else
			{
				_referencedAssemblies = new string[references.Count];
				int num = 0;
				try
				{
					foreach (Reference reference in references)
					{
						_referencedAssemblies[num++] = reference.Path;
					}
				}
				catch
				{
					_referencedAssemblies = new string[0];
					throw;
				}
			}
		}
Пример #14
0
 private void broadcastPlayerLocationAllExcept(string Endpoint, References.Vector3 loc)
 {
     Event outevent = new Event();
     outevent._Keyword = KeyWord.TONGITS_PLAYERLOCATION_UPDATE;
     outevent._IntendedRecipients = EventTransfer.SERVERTOCLIENT;
     outevent._Memories = new Memories();
     outevent._Memories.Add(new Memory("", KeyWord.CARTESIAN_X, (loc.x.ToString())));
     outevent._Memories.Add(new Memory("", KeyWord.CARTESIAN_Y, (loc.y.ToString())));
     outevent._Memories.Add(new Memory("", KeyWord.CARTESIAN_Z, (loc.z.ToString())));
     sendMessageAllUsersExcept(outevent, Endpoint);
 }
Пример #15
0
    /// <summary>
    /// initializes this script.
    /// </summary>
    void Begin()
    {
        refs = gameObject.GetComponent <References>();

        if (GameObject.Find("Panel_Game").gameObject != null)
        {
            gamePanel = GameObject.Find("Panel_Game").gameObject;
        }
        else
        {
            Debug.Log("Panel_Game is disabled in the heirarchy, Please re-Enable!");
        }

        if(GameObject.Find("Panel_PlayAgain").gameObject != null)
        {
            playAgainPanel = GameObject.Find("Panel_PlayAgain").gameObject;
        }
        else
        {
            Debug.Log("Panel_PlayAgain is disabled in the heirarchy, Please re-Enable!");
        }

        playAgainPanel.SetActive(false);
        gamePanel.SetActive(false);
    }
Пример #16
0
    public static void AddProjectReferencesPathsIntoHost(References references, MetadataReaderHost host) {
      Contract.Requires(host != null);

      if (references == null) return;
      
      for (int i = 1; i <= references.Count; i++) {
        var tempRef = references.Item(i);
        if (tempRef == null) continue;

        var refPath = tempRef.Path;
        if (!String.IsNullOrEmpty(refPath)) {
          var refDir = Path.GetDirectoryName(refPath);
          if (refDir != null) {
            host.AddLibPath(refDir);
            var referenceAssemblyPath = Path.Combine(refDir, "CodeContracts");
            if (System.IO.Directory.Exists(referenceAssemblyPath))
              host.AddLibPath(referenceAssemblyPath);

          }
        }
      }
    }
 public ReferenceCollectionNodeFactory(References references)
 {
     _references = references;
 }
Пример #18
0
 private void Awake()
 {
     Instance = this;
 }
Пример #19
0
        private static void AddReferences(Project instantProject, References references)
        {
            foreach (Reference reference in references)
            {
                if (reference.SourceProject == null)
                {
                    if (Path.GetFileName (reference.Path) == "mscorlib.dll")
                        continue; // mscorlib is added automatically

                    instantProject.References.Add (reference.Path);
                }
                else
                {
                    instantProject.References.Add (GetOutputPath (reference.SourceProject));
                    AddReferences (instantProject, ((VSProject)reference.SourceProject.Object).References);
                }
            }
        }
Пример #20
0
 private void AddDependency(ItemReference itemRef, XmlNode context, XmlNode reference, ItemReference masterRef)
 {
   _dependencies.Add(itemRef);
   if (context != null)
   {
     References refs;
     if (!_allDependencies.TryGetValue(itemRef, out refs))
     {
       refs = new References();
       _allDependencies.Add(itemRef, refs);
     }
     refs.AddReferences(reference, context, masterRef);
   }
 }
Пример #21
0
 /// <summary>
 /// Called by References once it is done gathering all neccessary information
 /// Starts the game
 /// </summary>
 void Begin()
 {
     //Gets a link to the references script
     refs = gameObject.GetComponent<References>();
     //Starts the game
     StartGame();
 }
        private void RenderArchives(Compilation c, IHTMLElement parent, Action<string> UpdateLocation)
        {
            var AllTypes = default(IHTMLDiv);

            var AllTypesNamespaceLookup = new Dictionary<string, IHTMLDiv>();

            var GetAllTypesNamespaceContainer = default(Func<string, IHTMLDiv>);

            GetAllTypesNamespaceContainer =
                (Namespace) =>
                {
                    var ParentNamespace = Namespace.TakeUntilLastIfAny(".");

                    var ParentContainer = AllTypes;

                    if (ParentNamespace != Namespace)
                    {
                        ParentContainer = GetAllTypesNamespaceContainer(ParentNamespace);
                    }

                    if (!AllTypesNamespaceLookup.ContainsKey(Namespace))
                    {
                        AllTypesNamespaceLookup[Namespace] = AddNamespace(ParentContainer, null, Namespace.SkipUntilLastIfAny("."), UpdateLocation);
                    }

                    return AllTypesNamespaceLookup[Namespace];
                };

            {
                var tr = new TreeNode(() => new VistaTreeNodePage());

                tr.Text = "Class Viewer";
                tr.Element.ClosedImage = new ClassViewer();
                tr.Container.AttachTo(parent);

                var div = new IHTMLDiv().AttachTo(parent);

                div.style.fontFamily = ScriptCoreLib.JavaScript.DOM.IStyle.FontFamilyEnum.Verdana;


                var i = new References().AttachTo(div);

                i.style.verticalAlign = "middle";
                i.style.marginRight = "0.5em";

                new IHTMLSpan { innerText = "All Types" }.AttachTo(div);

                var children = new IHTMLDiv().AttachTo(parent);

                children.style.paddingLeft = "1em";

                AllTypes = children;
            }

            var LoadActionList = new List<Action<Action>>();

            var Archives = c.GetArchives();

            foreach (var Archive in Archives)
            {
                Console.WriteLine(new { Archive.Name });

            }

            // lets not freeze our browser:P
            foreach (var item in Archives.ToArray())
            {
                var div = new IHTMLDiv().AttachTo(parent);

                div.style.fontFamily = ScriptCoreLib.JavaScript.DOM.IStyle.FontFamilyEnum.Verdana;


                var i = new References().AttachTo(div);

                i.style.verticalAlign = "middle";
                i.style.marginRight = "0.5em";

                new IHTMLSpan { innerText = item.Name }.AttachTo(div);

                var children = new IHTMLDiv().AttachTo(parent);

                children.style.paddingLeft = "1em";

                Console.WriteLine("before RenderAssemblies");
                RenderAssemblies(item, children, GetAllTypesNamespaceContainer, UpdateLocation, LoadActionList.Add);
                Console.WriteLine("after RenderAssemblies");
            }


            Console.WriteLine("before LoadActionList");
            LoadActionList.ForEach(
                (Current, Next) =>
                {
                    Console.WriteLine("before LoadActionList Next");
                    Current(Next);
                    Console.WriteLine("after LoadActionList Next");
                }
            );
        }