Example #1
0
		public ClrVersionValues(ClrVersion clrVersion, uint cor20HeaderRuntimeVersion, ushort tablesHeaderVersion, string runtimeVersion, AssemblyRef corLibRef) {
			this.ClrVersion = clrVersion;
			this.Cor20HeaderRuntimeVersion = cor20HeaderRuntimeVersion;
			this.TablesHeaderVersion = tablesHeaderVersion;
			this.RuntimeVersion = runtimeVersion;
			this.CorLibRef = corLibRef;
		}
Example #2
0
        FilePath GetFxDir(MonoTargetRuntime runtime, ClrVersion version)
        {
            FilePath prefix = runtime.Prefix;

            switch (version)
            {
            case ClrVersion.Net_1_1:
                return(prefix.Combine("lib", "mono", "1.0"));

            case ClrVersion.Net_2_0:
                return(prefix.Combine("lib", "mono", "2.0"));

            case ClrVersion.Net_4_0:
                var net45Path = prefix.Combine("lib", "mono", "4.5");
                if (Directory.Exists(net45Path) && !MonoDevelop.Core.Platform.IsWindows)
                {
                    return(net45Path);
                }
                return(prefix.Combine("lib", "mono", "4.0"));

            case ClrVersion.Net_4_5:
                return(prefix.Combine("lib", "mono", "4.5"));
            }
            throw new InvalidOperationException(string.Format("Unknown runtime version '{0}'", version));
        }
Example #3
0
		public ClrVersionValues(ClrVersion clrVersion, uint cor20HeaderRuntimeVersion, ushort tablesHeaderVersion, string runtimeVersion, AssemblyRef corLibRef) {
			ClrVersion = clrVersion;
			Cor20HeaderRuntimeVersion = cor20HeaderRuntimeVersion;
			TablesHeaderVersion = tablesHeaderVersion;
			RuntimeVersion = runtimeVersion;
			CorLibRef = corLibRef;
		}
Example #4
0
 //TODO: this method is public so that the toolbox service can special-case subclasses of this
 //to unify them into a single type-walk in a single remote process
 /// <param name="type">The <see cref="Type"/> of the item for which a node should be created.</param>
 /// <param name="attribute">The <see cref="ToolboxItemAttribute"/> that was applied to the type.</param>
 /// <param name="attributeCategory"> The node's category as detected from the <see cref="CategoryAttribute"/>.
 /// If it's null or empty, the method will need to infer a value.</param>
 /// <param name="assemblyPath"> If the assembly is a system package, this value will be null. Else, the method will
 /// need to record the full path in the node.</param>
 public abstract ItemToolboxNode GetNode(
     Type type,
     ToolboxItemAttribute attribute,
     string attributeCategory,
     string assemblyPath,
     ClrVersion referencedRuntime
     );
Example #5
0
        static ModuleDef CreateModuleDef(string name, Guid mvid, ClrVersion clrVersion, ModuleDef?existingModule)
        {
            var clrValues = ClrVersionValues.GetValues(clrVersion);

            if (clrValues is null)
            {
                throw new ArgumentNullException(nameof(clrVersion));
            }
            ModuleDef module;

            if (existingModule is null)
            {
                module = new ModuleDefUser(name, mvid, clrValues.CorLibRef);
            }
            else
            {
                module      = existingModule;
                module.Name = name;
                module.Mvid = mvid;
                OverwriteAssembly(module.CorLibTypes.AssemblyRef, clrValues.CorLibRef);
            }
            module.UpdateRowId(module);
            module.RuntimeVersion            = clrValues.RuntimeVersion;
            module.Cor20HeaderRuntimeVersion = clrValues.Cor20HeaderRuntimeVersion;
            module.TablesHeaderVersion       = clrValues.TablesHeaderVersion;
            module.Location = string.Empty;
            return(module);
        }
Example #6
0
        void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver)
        {
            SystemPackage package = new SystemPackage();
            List <string> list    = new List <string>();

            string dir = Path.Combine(prefix, version);

            if (!Directory.Exists(dir))
            {
                return;
            }

            foreach (string assembly in Directory.GetFiles(dir, "*.dll"))
            {
                AddAssembly(assembly, package);
                list.Add(assembly);
            }

            package.Initialize("mono",
                               version,
                               "The Mono runtime",
                               list.ToArray(),
                               ver,
                               false);
            packages.Add(package);
        }
 public PowerShellAgentRunner(AgentRequest request, string workingDirectory, TimeSpan timeout, ClrVersion clrVersion)
 {
     _outputBuilder    = new SynchronizedStringBuilder(new StringBuilder(0x1000));
     _request          = request;
     _workingDirectory = workingDirectory;
     _timeout          = timeout;
     _clrVersion       = clrVersion;
 }
Example #8
0
		public static ClrVersionValues GetValues(ClrVersion clrVersion) {
			switch (clrVersion) {
			case ClrVersion.CLR10: return CLR10;
			case ClrVersion.CLR11: return CLR11;
			case ClrVersion.CLR20: return CLR20;
			case ClrVersion.CLR40: return CLR40;
			default: return null;
			}
		}
Example #9
0
		public static ModuleDef CreateModule(string name, Guid mvid, ClrVersion clrVersion, ModuleKind kind, ModuleDef existingModule = null) {
			var module = CreateModuleDef(name, mvid, clrVersion, existingModule);
			module.Kind = kind;
			module.Characteristics = Characteristics._32BitMachine | Characteristics.ExecutableImage;
			if (kind == ModuleKind.Dll || kind == ModuleKind.NetModule)
				module.Characteristics |= Characteristics.Dll;
			module.DllCharacteristics = DllCharacteristics.TerminalServerAware | DllCharacteristics.NoSeh | DllCharacteristics.NxCompat | DllCharacteristics.DynamicBase;
			return module;
		}
Example #10
0
		internal TargetFramework (TargetFrameworkMoniker id)
		{
			this.id = id;
			this.name = id.Profile == null
				? string.Format ("{0} {1}", id.Identifier, id.Version)
				: string.Format ("{0} {1} {2} Profile", id.Identifier, id.Version, id.Profile);
			clrVersion = ClrVersion.Default;
			Assemblies = new AssemblyInfo[0];
		}
Example #11
0
		public static ClrVersionValues GetValues(ClrVersion clrVersion) {
			switch (clrVersion) {
			case ClrVersion.CLR10: return CLR10;
			case ClrVersion.CLR11: return CLR11;
			case ClrVersion.CLR20: return CLR20;
			case ClrVersion.CLR40: return CLR40;
			default: return null;
			}
		}
		public override ItemToolboxNode GetNode (Type t, ToolboxItemAttribute tba, 
		    string attributeCategory, string fullPath, ClrVersion referencedRuntime)
		{
			if (referencedRuntime != ClrVersion.Net_1_1
			    && referencedRuntime != ClrVersion.Net_2_0)
				return null;
			
			bool reflectedRuntime1;
			if (typeof (System.Web.UI.Control).IsAssignableFrom (t))
				reflectedRuntime1 = false;
			else if (CanRuntime1 && SWUControl1.IsAssignableFrom (t))
				reflectedRuntime1 = true;
			else
				return null;
			
			Type toolboxItemType = (tba.ToolboxItemType == null) ? typeof (ToolboxItem) : tba.ToolboxItemType;
			
			//FIXME: fix WebControlToolboxItem so that this isn't necessary
			//right now it's totally broken in mono
			if (typeof (System.Web.UI.Design.WebControlToolboxItem).IsAssignableFrom (toolboxItemType))
				toolboxItemType = typeof (ToolboxItem);
			
			//Create the ToolboxItem. The ToolboxItemToolboxNode will destroy it, but need to
			//be able to extract data from it first.
			ToolboxItem item = (ToolboxItem) Activator.CreateInstance (toolboxItemType, new object[] {t});
			WebFormsToolboxNode node = new WebFormsToolboxNode (item);
			
			//get the default markup for the tag
			string webText = reflectedRuntime1? GetWebText1 (t) : GetWebText (t);
			if (!string.IsNullOrEmpty (webText))
				node.Text = webText;
			
			if (!string.IsNullOrEmpty (attributeCategory))
				node.Category = attributeCategory;
			else if (reflectedRuntime1)
				node.Category = GuessCategory1 (t);
			else
				node.Category = GuessCategory (t);
			
			if (!string.IsNullOrEmpty (fullPath))
				node.Type.AssemblyLocation = fullPath;
			
			//prevent system.web 1.1 from being shown for 2.0 runtime
			if (CanRuntime1 && webAssem1.FullName == t.Assembly.FullName) {
				node.ItemFilters.Add (new ToolboxItemFilterAttribute ("ClrVersion.Net_2_0", ToolboxItemFilterType.Prevent));
			}
			
			//set filters fom supported runtimes
			if (referencedRuntime == MonoDevelop.Core.ClrVersion.Net_1_1) {
				node.ItemFilters.Add (new ToolboxItemFilterAttribute ("ClrVersion.Net_1_1", ToolboxItemFilterType.Require));
			} else if (referencedRuntime == MonoDevelop.Core.ClrVersion.Net_2_0) {
				node.ItemFilters.Add (new ToolboxItemFilterAttribute ("ClrVersion.Net_2_0", ToolboxItemFilterType.Require));
			}
			
			return node;
		}
Example #13
0
		internal TargetFramework (string id)
		{
			Index = FrameworkCount++;
			this.id = id;
			this.name = id;
			clrVersion = ClrVersion.Default;
			Assemblies = new AssemblyInfo[0];
			compatibleFrameworks.Add (id);
			extendedFrameworks.Add (id);
		}
Example #14
0
        internal TargetFramework(TargetFrameworkMoniker id)
        {
            this.id   = id;
            this.name = id.Profile == null
                                ? string.Format("{0} {1}", id.Identifier, id.Version)
                                : string.Format("{0} {1} {2} Profile", id.Identifier, id.Version, id.Profile);

            clrVersion = ClrVersion.Default;
            Assemblies = new AssemblyInfo[0];
        }
 internal TargetFramework(string id)
 {
     Index      = FrameworkCount++;
     this.id    = id;
     this.name  = id;
     clrVersion = ClrVersion.Default;
     Assemblies = new AssemblyInfo[0];
     compatibleFrameworks.Add(id);
     extendedFrameworks.Add(id);
 }
        internal static string GetClrVersion(ClrVersion v)
        {
            switch (v)
            {
            case ClrVersion.Net_1_1: return("v1.1.4322");

            case ClrVersion.Net_2_0: return("v2.0.50727");

            case ClrVersion.Net_4_0: return("v4.0.30319");
            }
            return(null);
        }
Example #17
0
        public static ModuleDef CreateModule(string name, Guid mvid, ClrVersion clrVersion, ModuleKind kind, ModuleDef existingModule = null)
        {
            var module = CreateModuleDef(name, mvid, clrVersion, existingModule);

            module.Kind            = kind;
            module.Characteristics = Characteristics._32BitMachine | Characteristics.ExecutableImage;
            if (kind == ModuleKind.Dll || kind == ModuleKind.NetModule)
            {
                module.Characteristics |= Characteristics.Dll;
            }
            module.DllCharacteristics = DllCharacteristics.TerminalServerAware | DllCharacteristics.NoSeh | DllCharacteristics.NxCompat | DllCharacteristics.DynamicBase;
            return(module);
        }
Example #18
0
        internal static string GetClrVersion(ClrVersion v)
        {
            switch (v)
            {
            case ClrVersion.Net_1_1: return("v1.1.4322");

            case ClrVersion.Net_2_0: return("v2.0.50727");

            case ClrVersion.Net_4_5:                     // The 4_5 binaries have the same version as the NET_4_0 binaries
            case ClrVersion.Net_4_0: return("v4.0.30319");
            }
            return(null);
        }
		FilePath GetFxDir (MonoTargetRuntime runtime, ClrVersion version)
		{
			FilePath prefix = runtime.Prefix;
			switch (version) {
			case ClrVersion.Net_1_1:
				return prefix.Combine ("lib", "mono", "1.0");
			case ClrVersion.Net_2_0:
				return prefix.Combine ("lib", "mono", "2.0");
			case ClrVersion.Net_4_0:
				return prefix.Combine ("lib", "mono", "4.0");
			}
			throw new InvalidOperationException (string.Format ("Unknown runtime version '{0}'", version));
		}
        internal static string GetClrVersion(ClrVersion v)
        {
            switch (v)
            {
            case ClrVersion.Net_1_1: return("v1.1.4322");

            case ClrVersion.Net_2_0: return("v2.0.50727");

            case ClrVersion.Clr_2_1: return("v2.1");

            case ClrVersion.Net_4_0: return("v4.0.20506");
            }
            return("?");
        }
Example #21
0
 public void Initialize(string name,
                        string version,
                        string description,
                        string[] assemblies,
                        ClrVersion targetVersion,
                        bool isInternal)
 {
     this.isInternal    = isInternal;
     this.name          = name;
     this.version       = version;
     this.assemblies    = assemblies;
     this.description   = description;
     this.targetVersion = targetVersion;
 }
Example #22
0
        public static ClrVersionValues GetValues(ClrVersion clrVersion)
        {
            switch (clrVersion)
            {
            case ClrVersion.CLR10: return(CLR10);

            case ClrVersion.CLR11: return(CLR11);

            case ClrVersion.CLR20: return(CLR20);

            case ClrVersion.CLR40: return(CLR40);

            default: return(null);
            }
        }
        public override void Load(XmlElement element)
        {
            clrVersion = ClrVersion.Default;
            try {
                clrVersion = (ClrVersion)Enum.Parse(typeof(ClrVersion), element.GetAttribute("ClrVersion"), true);
            } catch (ArgumentException) {
                new InvalidOperationException("Invalid value for ClrVersion condition in template.");
            }

            condition = ClrVersionCondition.None;
            try {
                condition = (ClrVersionCondition)Enum.Parse(typeof(ClrVersionCondition), element.GetAttribute("Condition"), true);
            } catch (ArgumentException) {
                new InvalidOperationException("Invalid value for ClrVersionCondition condition in template.");
            }
        }
		public override void Load (XmlElement element)
		{
			clrVersion = ClrVersion.Default;
			try {
				clrVersion = (ClrVersion) Enum.Parse (typeof (ClrVersion), element.GetAttribute ("ClrVersion"), true);
			} catch (ArgumentException) {
				new InvalidOperationException ("Invalid value for ClrVersion condition in template.");
			}
			
			condition = ClrVersionCondition.None;
			try {
				condition = (ClrVersionCondition) Enum.Parse (typeof (ClrVersionCondition), element.GetAttribute ("Condition"), true);
			} catch (ArgumentException) {
				new InvalidOperationException ("Invalid value for ClrVersionCondition condition in template.");
			}
		}
Example #25
0
        FilePath GetFxDir(MonoTargetRuntime runtime, ClrVersion version)
        {
            FilePath prefix = runtime.Prefix;

            switch (version)
            {
            case ClrVersion.Net_1_1:
                return(prefix.Combine("lib", "mono", "1.0"));

            case ClrVersion.Net_2_0:
                return(prefix.Combine("lib", "mono", "2.0"));

            case ClrVersion.Net_4_0:
                return(prefix.Combine("lib", "mono", "4.0"));
            }
            throw new InvalidOperationException(string.Format("Unknown runtime version '{0}'", version));
        }
		FilePath GetFxDir (MonoTargetRuntime runtime, ClrVersion version)
		{
			FilePath prefix = runtime.Prefix;
			switch (version) {
			case ClrVersion.Net_1_1:
				return prefix.Combine ("lib", "mono", "1.0");
			case ClrVersion.Net_2_0:
				return prefix.Combine ("lib", "mono", "2.0");
			case ClrVersion.Net_4_0:
				var net45Path = prefix.Combine ("lib", "mono", "4.5");
				if (Directory.Exists (net45Path) && !MonoDevelop.Core.Platform.IsWindows) return net45Path;
				return prefix.Combine ("lib", "mono", "4.0");
			case ClrVersion.Net_4_5:
				return prefix.Combine ("lib", "mono", "4.5");
			}
			throw new InvalidOperationException (string.Format ("Unknown runtime version '{0}'", version));
		}
Example #27
0
		static ModuleDef CreateModuleDef(string name, Guid mvid, ClrVersion clrVersion, ModuleDef existingModule) {
			var clrValues = ClrVersionValues.GetValues(clrVersion);
			ModuleDef module;
			if (existingModule == null)
				module = new ModuleDefUser(name, mvid, clrValues.CorLibRef);
			else {
				module = existingModule;
				module.Name = name;
				module.Mvid = mvid;
				OverwriteAssembly(module.CorLibTypes.AssemblyRef, clrValues.CorLibRef);
			}
			module.UpdateRowId(module);
			module.RuntimeVersion = clrValues.RuntimeVersion;
			module.Cor20HeaderRuntimeVersion = clrValues.Cor20HeaderRuntimeVersion;
			module.TablesHeaderVersion = clrValues.TablesHeaderVersion;
			module.Location = string.Empty;
			return module;
		}
Example #28
0
        void UpdateClrVersion()
        {
            ClrVersion clrVersion = Module.ClrVersion.Unknown;

            if (cor20HeaderRuntimeVersion != null && !cor20HeaderRuntimeVersion.HasError && cor20HeaderRuntimeVersion.Value != null &&
                tablesHeaderVersion != null && !tablesHeaderVersion.HasError && tablesHeaderVersion.Value != null)
            {
                var clrValues = ClrVersionValues.Find(cor20HeaderRuntimeVersion.Value.Value, tablesHeaderVersion.Value.Value, RuntimeVersion);
                if (clrValues != null)
                {
                    clrVersion = clrValues.ClrVersion;
                }
            }
            if (clrVersionVM != null)
            {
                clrVersionVM.SelectedItem = clrVersion;
            }
        }
        public override bool ShouldEnableFor(Project proj, string creationPath)
        {
            if (condition == ClrVersionCondition.None)
            {
                return(true);
            }

            DotNetProject dnp = proj as DotNetProject;

            if (dnp != null)
            {
#pragma warning disable CS0618 // Type or member is obsolete
                ClrVersion pver = dnp.TargetFramework.ClrVersion;
#pragma warning restore CS0618 // Type or member is obsolete
                switch (condition)
                {
                case ClrVersionCondition.Equal:
                    return(pver == clrVersion);

                case ClrVersionCondition.NotEqual:
                    return(pver != clrVersion);

                case ClrVersionCondition.GreaterThan:
                    return(pver > clrVersion);

                case ClrVersionCondition.GreaterThanOrEqual:
                    return(pver >= clrVersion);

                case ClrVersionCondition.LessThan:
                    return(pver < clrVersion);

                case ClrVersionCondition.LessThanOrEqual:
                    return(pver <= clrVersion);
                }
            }

            return(false);
        }
        public override bool ShouldEnableFor(Project proj, string creationPath)
        {
            if (condition == ClrVersionCondition.None)
            {
                return(true);
            }

            DotNetProject dnp = proj as DotNetProject;

            if (dnp != null)
            {
                ClrVersion pver = dnp.TargetFramework.ClrVersion;
                switch (condition)
                {
                case ClrVersionCondition.Equal:
                    return(pver == clrVersion);

                case ClrVersionCondition.NotEqual:
                    return(pver != clrVersion);

                case ClrVersionCondition.GreaterThan:
                    return(pver > clrVersion);

                case ClrVersionCondition.GreaterThanOrEqual:
                    return(pver >= clrVersion);

                case ClrVersionCondition.LessThan:
                    return(pver < clrVersion);

                case ClrVersionCondition.LessThanOrEqual:
                    return(pver <= clrVersion);
                }
            }

            return(false);
        }
Example #31
0
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (Path.Expression != null)
            {
                targetCommand.AddParameter("Path", Path.Get(context));
            }

            if (NestedModules.Expression != null)
            {
                targetCommand.AddParameter("NestedModules", NestedModules.Get(context));
            }

            if (Guid.Expression != null)
            {
                targetCommand.AddParameter("Guid", Guid.Get(context));
            }

            if (Author.Expression != null)
            {
                targetCommand.AddParameter("Author", Author.Get(context));
            }

            if (CompanyName.Expression != null)
            {
                targetCommand.AddParameter("CompanyName", CompanyName.Get(context));
            }

            if (Copyright.Expression != null)
            {
                targetCommand.AddParameter("Copyright", Copyright.Get(context));
            }

            if (RootModule.Expression != null)
            {
                targetCommand.AddParameter("RootModule", RootModule.Get(context));
            }

            if (ModuleVersion.Expression != null)
            {
                targetCommand.AddParameter("ModuleVersion", ModuleVersion.Get(context));
            }

            if (Description.Expression != null)
            {
                targetCommand.AddParameter("Description", Description.Get(context));
            }

            if (ProcessorArchitecture.Expression != null)
            {
                targetCommand.AddParameter("ProcessorArchitecture", ProcessorArchitecture.Get(context));
            }

            if (PowerShellVersion.Expression != null)
            {
                targetCommand.AddParameter("PowerShellVersion", PowerShellVersion.Get(context));
            }

            if (ClrVersion.Expression != null)
            {
                targetCommand.AddParameter("ClrVersion", ClrVersion.Get(context));
            }

            if (DotNetFrameworkVersion.Expression != null)
            {
                targetCommand.AddParameter("DotNetFrameworkVersion", DotNetFrameworkVersion.Get(context));
            }

            if (PowerShellHostName.Expression != null)
            {
                targetCommand.AddParameter("PowerShellHostName", PowerShellHostName.Get(context));
            }

            if (PowerShellHostVersion.Expression != null)
            {
                targetCommand.AddParameter("PowerShellHostVersion", PowerShellHostVersion.Get(context));
            }

            if (RequiredModules.Expression != null)
            {
                targetCommand.AddParameter("RequiredModules", RequiredModules.Get(context));
            }

            if (TypesToProcess.Expression != null)
            {
                targetCommand.AddParameter("TypesToProcess", TypesToProcess.Get(context));
            }

            if (FormatsToProcess.Expression != null)
            {
                targetCommand.AddParameter("FormatsToProcess", FormatsToProcess.Get(context));
            }

            if (ScriptsToProcess.Expression != null)
            {
                targetCommand.AddParameter("ScriptsToProcess", ScriptsToProcess.Get(context));
            }

            if (RequiredAssemblies.Expression != null)
            {
                targetCommand.AddParameter("RequiredAssemblies", RequiredAssemblies.Get(context));
            }

            if (FileList.Expression != null)
            {
                targetCommand.AddParameter("FileList", FileList.Get(context));
            }

            if (ModuleList.Expression != null)
            {
                targetCommand.AddParameter("ModuleList", ModuleList.Get(context));
            }

            if (FunctionsToExport.Expression != null)
            {
                targetCommand.AddParameter("FunctionsToExport", FunctionsToExport.Get(context));
            }

            if (AliasesToExport.Expression != null)
            {
                targetCommand.AddParameter("AliasesToExport", AliasesToExport.Get(context));
            }

            if (VariablesToExport.Expression != null)
            {
                targetCommand.AddParameter("VariablesToExport", VariablesToExport.Get(context));
            }

            if (CmdletsToExport.Expression != null)
            {
                targetCommand.AddParameter("CmdletsToExport", CmdletsToExport.Get(context));
            }

            if (DscResourcesToExport.Expression != null)
            {
                targetCommand.AddParameter("DscResourcesToExport", DscResourcesToExport.Get(context));
            }

            if (PrivateData.Expression != null)
            {
                targetCommand.AddParameter("PrivateData", PrivateData.Get(context));
            }

            if (Tags.Expression != null)
            {
                targetCommand.AddParameter("Tags", Tags.Get(context));
            }

            if (ProjectUri.Expression != null)
            {
                targetCommand.AddParameter("ProjectUri", ProjectUri.Get(context));
            }

            if (LicenseUri.Expression != null)
            {
                targetCommand.AddParameter("LicenseUri", LicenseUri.Get(context));
            }

            if (IconUri.Expression != null)
            {
                targetCommand.AddParameter("IconUri", IconUri.Get(context));
            }

            if (ReleaseNotes.Expression != null)
            {
                targetCommand.AddParameter("ReleaseNotes", ReleaseNotes.Get(context));
            }

            if (HelpInfoUri.Expression != null)
            {
                targetCommand.AddParameter("HelpInfoUri", HelpInfoUri.Get(context));
            }

            if (PassThru.Expression != null)
            {
                targetCommand.AddParameter("PassThru", PassThru.Get(context));
            }

            if (DefaultCommandPrefix.Expression != null)
            {
                targetCommand.AddParameter("DefaultCommandPrefix", DefaultCommandPrefix.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
Example #32
0
 /// <summary>
 /// CLRバージョン文字列を取得する。
 /// </summary>
 /// <param name="clrVersion">CLRバージョン。</param>
 /// <returns>CLRバージョン文字列。引数値が無効ならば null 。</returns>
 public static string GetVersionString(this ClrVersion clrVersion) =>
 VersionStrings.TryGetValue(clrVersion, out var s) ? s : null;
		//TODO: this method is public so that the toolbox service can special-case subclasses of this
		//to unify them into a single type-walk in a single remote process
		/// <param name="type">The <see cref="Type"/> of the item for which a node should be created.</param>
		/// <param name="attribute">The <see cref="ToolboxItemAttribute"/> that was applied to the type.</param>
		/// <param name="attributeCategory"> The node's category as detected from the <see cref="CategoryAttribute"/>. 
		/// If it's null or empty, the method will need to infer a value.</param>
		/// <param name="assemblyPath"> If the assembly is a system package, this value will be null. Else, the method will 
		/// need to record the full path in the node.</param>
		public abstract ItemToolboxNode GetNode (
		    Type type,
		    ToolboxItemAttribute attribute,
		    string attributeCategory,
		    string assemblyPath,
		    ClrVersion referencedRuntime
		);
Example #34
0
 public void Initialize(string name,
                        string version,
                        string description,
                        string[] assemblies,
                        ClrVersion targetVersion,
                        bool isInternal)
 {
     this.isInternal = isInternal;
     this.name = name;
     this.version = version;
     this.assemblies = assemblies;
     this.description = description;
     this.targetVersion = targetVersion;
 }
Example #35
0
        void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver)
        {
            SystemPackage package = new SystemPackage();
            List<string> list = new List<string>();

            string dir = Path.Combine(prefix, version);
            if (!Directory.Exists(dir))
            {
                return;
            }

            foreach (string assembly in Directory.GetFiles(dir, "*.dll"))
            {
                AddAssembly(assembly, package);
                list.Add(assembly);
            }

            package.Initialize("mono",
                               version,
                               "The Mono runtime",
                               list.ToArray(),
                               ver,
                               false);
            packages.Add(package);
        }
Example #36
0
 public static ModuleDef CreateNetModule(string name, Guid mvid, ClrVersion clrVersion)
 {
     return(CreateModule(name, mvid, clrVersion, ModuleKind.NetModule));
 }
        public override ItemToolboxNode GetNode(Type t, ToolboxItemAttribute tba,
                                                string attributeCategory, string fullPath, ClrVersion referencedRuntime)
        {
            if (referencedRuntime != ClrVersion.Net_1_1 &&
                referencedRuntime != ClrVersion.Net_2_0)
            {
                return(null);
            }

            bool reflectedRuntime1;

            if (typeof(System.Web.UI.Control).IsAssignableFrom(t))
            {
                reflectedRuntime1 = false;
            }
            else if (CanRuntime1 && SWUControl1.IsAssignableFrom(t))
            {
                reflectedRuntime1 = true;
            }
            else
            {
                return(null);
            }

            Type toolboxItemType = (tba.ToolboxItemType == null) ? typeof(ToolboxItem) : tba.ToolboxItemType;

            //FIXME: fix WebControlToolboxItem so that this isn't necessary
            //right now it's totally broken in mono
            if (typeof(System.Web.UI.Design.WebControlToolboxItem).IsAssignableFrom(toolboxItemType))
            {
                toolboxItemType = typeof(ToolboxItem);
            }

            //Create the ToolboxItem. The ToolboxItemToolboxNode will destroy it, but need to
            //be able to extract data from it first.
            ToolboxItem         item = (ToolboxItem)Activator.CreateInstance(toolboxItemType, new object[] { t });
            WebFormsToolboxNode node = new WebFormsToolboxNode(item);

            //get the default markup for the tag
            string webText = reflectedRuntime1? GetWebText1(t) : GetWebText(t);

            if (!string.IsNullOrEmpty(webText))
            {
                node.Text = webText;
            }

            if (!string.IsNullOrEmpty(attributeCategory))
            {
                node.Category = attributeCategory;
            }
            else if (reflectedRuntime1)
            {
                node.Category = GuessCategory1(t);
            }
            else
            {
                node.Category = GuessCategory(t);
            }

            if (!string.IsNullOrEmpty(fullPath))
            {
                node.Type.AssemblyLocation = fullPath;
            }

            //prevent system.web 1.1 from being shown for 2.0 runtime
            if (CanRuntime1 && webAssem1.FullName == t.Assembly.FullName)
            {
                node.ItemFilters.Add(new ToolboxItemFilterAttribute("ClrVersion.Net_2_0", ToolboxItemFilterType.Prevent));
            }

            //set filters fom supported runtimes
            if (referencedRuntime == MonoDevelop.Core.ClrVersion.Net_1_1)
            {
                node.ItemFilters.Add(new ToolboxItemFilterAttribute("ClrVersion.Net_1_1", ToolboxItemFilterType.Require));
            }
            else if (referencedRuntime == MonoDevelop.Core.ClrVersion.Net_2_0)
            {
                node.ItemFilters.Add(new ToolboxItemFilterAttribute("ClrVersion.Net_2_0", ToolboxItemFilterType.Require));
            }

            return(node);
        }
Example #38
0
        void RunInitialization()
        {
            string versionDir;

            if (Environment.Version.Major == 1)
            {
                versionDir = "1.0";
                currentVersion = ClrVersion.Net_1_1;
            }
            else
            {
                versionDir = "2.0";
                currentVersion = ClrVersion.Net_2_0;
            }

            //Pull up assemblies from the installed mono system.
            string prefix = Path.GetDirectoryName(typeof(int).Assembly.Location);

            if (prefix.IndexOf(Path.Combine("mono", versionDir)) == -1)
                prefix = Path.Combine(prefix, "mono");
            else
                prefix = Path.GetDirectoryName(prefix);

            RegisterSystemAssemblies(prefix, "1.0", ClrVersion.Net_1_1);
            RegisterSystemAssemblies(prefix, "2.0", ClrVersion.Net_2_0);

            string search_dirs = Environment.GetEnvironmentVariable("PKG_CONFIG_PATH");
            string libpath = Environment.GetEnvironmentVariable("PKG_CONFIG_LIBPATH");

            if (String.IsNullOrEmpty(libpath))
            {
                string path_dirs = Environment.GetEnvironmentVariable("PATH");
                foreach (string pathdir in path_dirs.Split(Path.PathSeparator))
                {
                    if (pathdir == null)
                        continue;
                    if (File.Exists(pathdir + Path.DirectorySeparatorChar + "pkg-config"))
                    {
                        libpath = Path.Combine(pathdir, "..");
                        libpath = Path.Combine(libpath, "lib");
                        libpath = Path.Combine(libpath, "pkgconfig");
                        break;
                    }
                }
            }
            search_dirs += Path.PathSeparator + libpath;
            if (search_dirs != null && search_dirs.Length > 0)
            {
                ArrayList scanDirs = new ArrayList();
                foreach (string potentialDir in search_dirs.Split(Path.PathSeparator))
                {
                    if (!scanDirs.Contains(potentialDir))
                        scanDirs.Add(potentialDir);
                }
                foreach (string pcdir in scanDirs)
                {
                    if (pcdir == null)
                        continue;

                    if (Directory.Exists(pcdir))
                    {
                        foreach (string pcfile in Directory.GetFiles(pcdir, "*.pc"))
                        {
                            ParsePCFile(pcfile);
                        }
                    }
                }
            }
        }
        string GetCompilerName(ClrVersion version)
        {
            string fsc;
            if (FSharpLanguageBinding.Properties.fscFileName.Length>0)
                fsc = FSharpLanguageBinding.Properties.fscFileName;
            else {
                switch (version) {
                case ClrVersion.Net_1_1:
                case ClrVersion.Net_2_0:
                    fsc = "fsc.exe";
                    break;
                default:
                    string message = "Cannot handle unknown runtime version ClrVersion.'" + version.ToString () + "'.";
                    LoggingService.LogError (message);
                    throw new Exception (message);
                }
            }

            string compilerName = "";
            if (FSharpLanguageBinding.Properties.addMonoToFSCcall)
                compilerName = "mono ";
            compilerName += Path.Combine (FSharpLanguageBinding.Properties.fscPath, fsc);
            return compilerName;
        }
Example #40
0
 /// <summary>
 /// コンストラクタ。
 /// </summary>
 /// <param name="processClrVersion">操作対象プロセスのCLRバージョン種別。</param>
 protected WpfTalkerBase(ClrVersion processClrVersion) : base(processClrVersion)
 {
 }
Example #41
0
 public OutOfProcessPowerShellDeployAgent(IDeploymentEventRecorder deploymentEventRecorder, ClrVersion clrVersion)
 {
     _deploymentEventRecorder = deploymentEventRecorder;
     _clrVersion = clrVersion;
 }
Example #42
0
		public static ModuleDef CreateNetModule(string name, Guid mvid, ClrVersion clrVersion) {
			return CreateModule(name, mvid, clrVersion, ModuleKind.NetModule);
		}
Example #43
0
 /// <summary>
 /// コンストラクタ。
 /// </summary>
 /// <param name="processClrVersion">操作対象プロセスのCLRバージョン種別。</param>
 protected FormsTalkerBase(ClrVersion processClrVersion) : base(processClrVersion)
 {
 }
Example #44
0
        /// <summary>
        /// コンストラクタ。
        /// </summary>
        /// <param name="processClrVersion">操作対象プロセスのCLRバージョン種別。</param>
        protected TalkerBase(ClrVersion processClrVersion) : base()
        {
            ArgumentValidation.IsEnumDefined(processClrVersion, nameof(processClrVersion));

            this.ProcessClrVersion = processClrVersion;
        }