public TypedVariableReferenceExpression(Mono.Cecil.Cil.VariableReference variable)
            : base(variable)
        {
            var type = Type.GetType(variable.VariableType.FullName, true);

            this.ElementType = TypedTransformer.GetElementType(type);
        }
Esempio n. 2
0
		public ILSpyTreeNode CreateNode(Mono.Cecil.Resource resource)
		{
			EmbeddedResource er = resource as EmbeddedResource;
			if (er != null)
				return CreateNode(er.Name, er.GetResourceStream());
			return null;
		}
Esempio n. 3
0
	static string PostStream (Mono.Security.Protocol.Tls.SecurityProtocolType protocol, string url, byte[] buffer)
	{
		Uri uri = new Uri (url);
		string post = "POST " + uri.AbsolutePath + " HTTP/1.0\r\n";
		post += "Content-Type: application/x-www-form-urlencoded\r\n";
		post += "Content-Length: " + (buffer.Length + 5).ToString () + "\r\n";
		post += "Host: " + uri.Host + "\r\n\r\n";
		post += "TEST=";
		byte[] bytes = Encoding.Default.GetBytes (post);

		IPHostEntry host = Dns.Resolve (uri.Host);
		IPAddress ip = host.AddressList [0];
		Socket socket = new Socket (ip.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
		socket.Connect (new IPEndPoint (ip, uri.Port));
		NetworkStream ns = new NetworkStream (socket, false);
		SslClientStream ssl = new SslClientStream (ns, uri.Host, false, protocol);
		ssl.ServerCertValidationDelegate += new CertificateValidationCallback (CertificateValidation);

		ssl.Write (bytes, 0, bytes.Length);
		ssl.Write (buffer, 0, buffer.Length);
		ssl.Flush ();

		StreamReader reader = new StreamReader (ssl, Encoding.UTF8);
		string result = reader.ReadToEnd ();
		int start = result.IndexOf ("\r\n\r\n") + 4;
		start = result.IndexOf ("\r\n\r\n") + 4;
		return result.Substring (start);
	}
Esempio n. 4
0
        public void LoadModule(System.IO.Stream dllStream, System.IO.Stream pdbStream, Mono.Cecil.Cil.ISymbolReaderProvider debugInfoLoader)
        {
            var module = Mono.Cecil.ModuleDefinition.ReadModule(dllStream);
            if (debugInfoLoader != null && pdbStream != null)
            {
                module.ReadSymbols(debugInfoLoader.GetSymbolReader(module, pdbStream));
            }
            if (module.HasAssemblyReferences)
            {
                foreach (var ar in module.AssemblyReferences)
                {
                    if (moduleref.Contains(ar.Name) == false)
                        moduleref.Add(ar.Name);
                    if (moduleref.Contains(ar.FullName) == false)
                        moduleref.Add(ar.FullName);
                }
            }
            //mapModule[module.Name] = module;
            if (module.HasTypes)
            {
                foreach (var t in module.Types)
                {

                    mapType[t.FullName] = new Type_Common_CLRSharp(this, t);

                }
            }

        }
Esempio n. 5
0
        // fd, error
        public static void open(string path, OpenFlags flags, Mono.Unix.Native.FilePermissions mode, Action<FileStream, Exception> callback)
        {
            ThreadPool.QueueUserWorkItem(a =>
            {
                try
                {
                    FileMode fm;
                    FileAccess fa;
                    FileShare fs = FileShare.ReadWrite;

                    if (0 != (flags & OpenFlags.O_CREAT))
                        fm = FileMode.Create;
                    else
                        fm = FileMode.Open;

                    if (0 != (flags & OpenFlags.O_RDWR))
                        fa = FileAccess.ReadWrite;
                    else if (0 != (flags & OpenFlags.O_WRONLY))
                        fa = FileAccess.Write;
                    else
                        fa = FileAccess.Read;

                    var stream = new FileStream(path, fm, fa, fs);
                    Boundary.Instance.ExecuteOnTargetLoop (() => callback (stream, null));
                }
                catch(Exception e)
                {
                    Boundary.Instance.ExecuteOnTargetLoop (() => callback (null, e));
                }
            });
        }
Esempio n. 6
0
 protected async override Task Process(Mono.Net.HttpListenerContext context)
 {
     var writer = new StreamWriter(context.Response.OutputStream);
     writer.Write(string.Empty);
     writer.Flush();
     context.Response.OutputStream.Close();
 }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AssemblyData"/> class.
 /// </summary>
 /// <param name="assembly">The assembly.</param>
 private AssemblyData(Mono.Cecil.AssemblyDefinition assembly)
 {
     if (assembly == null)
         throw new ArgumentNullException("assembly");
     _assemblyDefinition = assembly;
     Refresh();
 }
Esempio n. 8
0
 /// <summary>
 /// 组建被添加到mono的时候
 /// </summary>
 /// <param name="mono"></param>
 public override void OnBeAdded(IMono mono)
 {
     base.OnBeAdded(mono);
     MainCamera          = Camera.main;
     MainCameraTrans     = MainCamera.transform;
     HighlighterRenderer = Mono.GetComponentInChildren <HighlighterRenderer>();
 }
Esempio n. 9
0
        public override void Update()
        {
            if (ControlEnabled && RobotProvider.RobotActive && !Input.GetKey(KeyCode.LeftAlt) && !Input.GetKey(KeyCode.RightAlt))
            {
                if (InputControl.GetMouseButton(0))
                {
                    if (GameObject.Find("ChangeRobotPanel") || GameObject.Find("ChangeFieldPanel"))
                    {
                        ControlEnabled = false;
                    }
                    else
                    {
                        rotationVector.x -= InputControl.GetAxis("Mouse Y") * rotationSpeed;
                        rotationVector.y += Input.GetAxis("Mouse X") * rotationSpeed;
                        ControlEnabled    = true;
                    }
                }

                //Use WASD to move camera position
                positionVector += Input.GetAxis("CameraHorizontal") * Mono.transform.right * transformSpeed * Time.deltaTime;
                positionVector += Input.GetAxis("CameraVertical") * Mono.transform.forward * transformSpeed * Time.deltaTime;

                zoomValue = Mathf.Max(Mathf.Min(zoomValue - InputControl.GetAxis("Mouse ScrollWheel") * scrollWheelSensitivity, 60.0f), 10.0f);

                lagRotVector = CalculateLagVector(lagRotVector, rotationVector, lagResponsiveness);
                lagZoom      = CalculateLagScalar(lagZoom, zoomValue, lagResponsiveness);

                Mono.transform.position   += positionVector;
                positionVector             = Vector3.zero;
                Mono.transform.eulerAngles = lagRotVector;
                Mono.GetComponent <Camera>().fieldOfView = lagZoom;
            }
        }
Esempio n. 10
0
 public ParameterDataProvider(Mono.TextEditor.TextEditor editor, string functionName)
 {
     //this.editor = editor;
     List<CompletionData> cd = editor.GetCompletionMemberData(functionName);
     if(cd!= null)
         list.AddRange(cd);
 }
			public ModuleMetadataInfo(Module module, Mono.Cecil.ModuleDefinition cecilModule)
			{
				this.Module = module;
				this.CecilModule = cecilModule;
				typeRefLoader = new CecilLoader();
				typeRefLoader.SetCurrentModule(cecilModule);
			}
Esempio n. 12
0
        public XSPWorker(Socket client, EndPoint localEP, ApplicationServer server,
			bool secureConnection,
			Mono.Security.Protocol.Tls.SecurityProtocolType SecurityProtocol,
			X509Certificate cert,
			PrivateKeySelectionCallback keyCB,
			bool allowClientCert,
			bool requireClientCert)
        {
            if (secureConnection) {
                ssl = new SslInformation ();
                ssl.AllowClientCertificate = allowClientCert;
                ssl.RequireClientCertificate = requireClientCert;
                ssl.RawServerCertificate = cert.GetRawCertData ();

                netStream = new LingeringNetworkStream (client, true);
                SslServerStream s = new SslServerStream (netStream, cert, requireClientCert, false);
                s.PrivateKeyCertSelectionDelegate += keyCB;
                s.ClientCertValidationDelegate += new CertificateValidationCallback (ClientCertificateValidation);
                stream = s;
            } else {
                netStream = new LingeringNetworkStream (client, false);
                stream = netStream;
            }

            sock = client;
            this.server = server;
            this.remoteEP = (IPEndPoint) client.RemoteEndPoint;
            this.localEP = (IPEndPoint) localEP;
        }
Esempio n. 13
0
        /// <summary>
        ///     Loads library in a platform specific way.
        /// </summary>
        static IntPtr PlatformSpecificLoadLibrary(string libraryPath)
        {
            if (IsWindows)
            {
                return(Windows.LoadLibrary(libraryPath));
            }
            if (IsLinux)
            {
                if (IsMono)
                {
                    return(Mono.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY));
                }
                if (IsNetCore)
                {
                    return(CoreCLR.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY));
                }
                return(Linux.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY));
            }

            if (IsMacOSPlatform)
            {
                return(MacOSX.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY));
            }
            throw new InvalidOperationException("Unsupported platform.");
        }
		protected override Gtk.Window CreateTooltipWindow (Mono.TextEditor.TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item)
		{
			LanguageItemWindow result = new LanguageItemWindow ((ExtensibleTextEditor) editor, modifierState, null, (string)item.Item, null);
			if (result.IsEmpty)
				return null;
			return result;
		}
 public override void ProcessType(Mono.Cecil.TypeDefinition type)
 {
     switch (type.Namespace) {
     case "System.Runtime.Serialization.Json":
         switch (type.Name) {
         case "JsonFormatWriterInterpreter":
             TypeDefinition jwd = GetType ("System.Runtime.Serialization", "System.Runtime.Serialization.Json.JsonWriterDelegator");
             PreserveMethods (jwd);
             break;
         }
         break;
     case "System.Runtime.Serialization":
         // MS referencesource use reflection to call the required methods to serialize each PrimitiveDataContract subclasses
         // this goes thru XmlFormatGeneratorStatics and it's a better candidate (than PrimitiveDataContract) as there are other callers
         switch (type.Name) {
         case "XmlFormatGeneratorStatics":
             TypeDefinition xwd = GetType ("System.Runtime.Serialization", "System.Runtime.Serialization.XmlWriterDelegator");
             PreserveMethods (xwd);
             TypeDefinition xoswc = GetType ("System.Runtime.Serialization", "System.Runtime.Serialization.XmlObjectSerializerWriteContext");
             PreserveMethods (xoswc);
             TypeDefinition xosrc = GetType ("System.Runtime.Serialization", "System.Runtime.Serialization.XmlObjectSerializerReadContext");
             PreserveMethods (xosrc);
             TypeDefinition xrd = GetType ("System.Runtime.Serialization", "System.Runtime.Serialization.XmlReaderDelegator");
             PreserveMethods (xrd);
             break;
         case "CollectionDataContract":
             // ensure the nested type, DictionaryEnumerator and GenericDictionaryEnumerator`2, can be created thru reflection
             foreach (var nt in type.NestedTypes)
                 PreserveConstructors (nt);
             break;
         }
         break;
     }
 }
Esempio n. 16
0
		public static string GenerateHtml (TextDocument doc, Mono.TextEditor.Highlighting.ISyntaxMode mode, Mono.TextEditor.Highlighting.ColorScheme style, ITextEditorOptions options)
		{

			var htmlText = new StringBuilder ();
			htmlText.AppendLine (@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">");
			htmlText.AppendLine ("<HTML>");
			htmlText.AppendLine ("<HEAD>");
			htmlText.AppendLine ("<META HTTP-EQUIV=\"CONTENT-TYPE\" CONTENT=\"text/html; charset=utf-8\">");
			htmlText.AppendLine ("<META NAME=\"GENERATOR\" CONTENT=\"Mono Text Editor\">");
			htmlText.AppendLine ("</HEAD>");
			htmlText.AppendLine ("<BODY>"); 

			var selection = new TextSegment (0, doc.TextLength);
			int startLineNumber = doc.OffsetToLineNumber (selection.Offset);
			int endLineNumber = doc.OffsetToLineNumber (selection.EndOffset);
			htmlText.AppendLine ("<FONT face = '" + options.Font.Family + "'>");
			bool first = true;
			if (mode is SyntaxMode) {
				SyntaxModeService.StartUpdate (doc, (SyntaxMode)mode, selection.Offset, selection.EndOffset);
				SyntaxModeService.WaitUpdate (doc);
			}

			foreach (var line in doc.GetLinesBetween (startLineNumber, endLineNumber)) {
				if (!first) {
					htmlText.AppendLine ("<BR>");
				} else {
					first = false;
				}

				if (mode == null) {
					AppendHtmlText (htmlText, doc, options, System.Math.Max (selection.Offset, line.Offset), System.Math.Min (line.EndOffset, selection.EndOffset));
					continue;
				}
				int curSpaces = 0;

				foreach (var chunk in mode.GetChunks (style, line, line.Offset, line.Length)) {
					int start = System.Math.Max (selection.Offset, chunk.Offset);
					int end = System.Math.Min (chunk.EndOffset, selection.EndOffset);
					var chunkStyle = style.GetChunkStyle (chunk);
					if (start < end) {
						htmlText.Append ("<SPAN style='");
						if (chunkStyle.FontWeight != Xwt.Drawing.FontWeight.Normal)
							htmlText.Append ("font-weight:" + ((int)chunkStyle.FontWeight) + ";");
						if (chunkStyle.FontStyle != Xwt.Drawing.FontStyle.Normal)
							htmlText.Append ("font-style:" + chunkStyle.FontStyle.ToString ().ToLower () + ";");
						htmlText.Append ("color:" + ((HslColor)chunkStyle.Foreground).ToPangoString () + ";");
						htmlText.Append ("'>");
						AppendHtmlText (htmlText, doc, options, start, end);
						htmlText.Append ("</SPAN>");
					}
				}
			}
			htmlText.AppendLine ("</FONT>");
            htmlText.AppendLine ("</BODY></HTML>");

			if (Platform.IsWindows)
                return GenerateCFHtml (htmlText.ToString ());

			return htmlText.ToString ();
		}
		public TooltipItem GetItem (Mono.TextEditor.TextEditor editor, int offset)
		{
			var doc = IdeApp.Workbench.ActiveDocument;
			if (doc == null || doc.ParsedDocument == null)
				return null;
			var unit = doc.ParsedDocument.GetAst<SyntaxTree> ();
			if (unit == null)
				return null;

			var file = doc.ParsedDocument.ParsedFile as CSharpUnresolvedFile;
			if (file == null)
				return null;
			
			ResolveResult result;
			AstNode node;
			var loc = editor.OffsetToLocation (offset);
			if (!doc.TryResolveAt (loc, out result, out node))
				return null;
			var resolver = new CSharpAstResolver (doc.Compilation, unit, file);
			resolver.ApplyNavigator (new NodeListResolveVisitorNavigator (node), CancellationToken.None);

			int startOffset = offset;
			int endOffset = offset;
			return new TooltipItem (new ToolTipData (unit, result, node, resolver), startOffset, endOffset - startOffset);
		}
Esempio n. 18
0
        public void Collect(Mono.Cecil.TypeDefinition td, TypeCollection typeCollection, ConfigBase config)
        {
            if (td.ShouldIgnoreType())
            {
                return;
            }

            // don't duplicate types
            if (typeCollection.Contains(td.FullName))
            {
                return;
            }

            StringBuilder sb = new StringBuilder();
            var indentCount = 0;
            ITypeWriter typeWriter = typeSelector.PickTypeWriter(td, indentCount, typeCollection, config);

            td.Interfaces.Each(item =>
            {
                var foundType = typeCollection.LookupType(item);

                if (foundType == null)
                {
                    //TODO: This reporting a missing type is too early in the process.
                    // typeNotFoundErrorHandler.Handle(item);
                    return;
                }

                var itemWriter = typeSelector.PickTypeWriter(foundType, indentCount, typeCollection, config);
                typeCollection.Add(foundType.Namespace, foundType.Name, itemWriter);

            });

            typeCollection.Add(td.Namespace, td.Name, typeWriter);
        }
			public void AddMember(IUnresolvedEntity entity, Mono.Cecil.MemberReference cecilObject)
			{
				rwLock.EnterWriteLock();
				try {
					uint token = cecilObject.MetadataToken.ToUInt32();
					metadataTokens[entity] = token;
					
					var cecilMethod = cecilObject as Mono.Cecil.MethodDefinition;
					if (cecilMethod != null) {
						IUnresolvedMethod method = (IUnresolvedMethod)entity;
						tokenToMethod[token] = method;
						if (cecilMethod.HasBody) {
							var locals = cecilMethod.Body.Variables;
							if (locals.Count > 0) {
								localVariableTypes[method] = locals.Select(v => typeRefLoader.ReadTypeReference(v.VariableType)).ToArray();
							}
							if (cecilMethod.RVA != 0) {
								// The method was loaded from image - we can free the memory for the body
								// because Cecil will re-initialize it on demand
								cecilMethod.Body = null;
							}
						}
					}
				} finally {
					rwLock.ExitWriteLock();
				}
			}
		public override void ActivateEvent (Mono.Debugger.Event ev)
		{
			if (Process.MainThread.IsStopped)
				ev.Activate (Process.MainThread);
			else
				ThrowNotSupported ("Breakpoints can't be changed while the process is running.");
		}
 public override void VisitTypeDefinitionCollection(Mono.Cecil.TypeDefinitionCollection types)
 {
     if(types.Contains(className))
     {
         VisitTypeDefinition(types[className]);
     }
 }
Esempio n. 22
0
		bool IActionTextLineMarker.MousePressed (Mono.TextEditor.MonoTextEditor editor, MarginMouseEventArgs args)
		{
			var handler = MousePressed;
			if (handler != null)
				handler (this, new TextEventArgsWrapper (args));
			return false;
		}
Esempio n. 23
0
				private void  InitBlock(Mono.Lucene.Net.Search.StringIndex fcsi, int inclusiveLowerPoint, int inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter enclosingInstance)
				{
					this.fcsi = fcsi;
					this.inclusiveLowerPoint = inclusiveLowerPoint;
					this.inclusiveUpperPoint = inclusiveUpperPoint;
					this.enclosingInstance = enclosingInstance;
				}
Esempio n. 24
0
 /// <summary>
 /// Creates the specified employee.
 /// </summary>
 /// <param name="employee">The employee.</param>
 /// <param name="candidate">The candidate.</param>
 /// <param name="feedback">The feedback.</param>
 /// <returns>IMono&lt;Review&gt;.</returns>
 public static IMono<Review> Create(IMono<Employee> employee, IMono<Candidate> candidate, string feedback)
 {
     return candidate.FlatMap(
         c => employee.FlatMap(
             e => Mono.Just(
                 new Review { Candidate = c, Employee = e, Date = DateTime.Now, Feedback = feedback })));
 }
 public void Then_EmptyVoid_Fused()
 {
     Flux.Range(1, 10).Then(Mono.Empty <Void>())
     .Test(fusionMode: FuseableHelper.ANY)
     .AssertFusionMode(FuseableHelper.ASYNC)
     .AssertResult();
 }
        public ITypeWriter PickTypeWriter(Mono.Cecil.TypeDefinition td, int indentCount, TypeCollection typeCollection, ConfigBase config)
        {
            if (td.IsEnum)
            {
                return new EnumWriter(td, indentCount, typeCollection, config);
            }

            if (td.IsInterface)
            {
                return new InterfaceWriter(td, indentCount, typeCollection, config);
            }

            if (td.IsClass)
            {
                
                if (td.BaseType.FullName == "System.MulticastDelegate" ||
                    td.BaseType.FullName == "System.Delegate")
                {
                    return new DelegateWriter(td, indentCount, typeCollection, config);
                }

                return new ClassWriter(td, indentCount, typeCollection, config);
            }

            throw new NotImplementedException("Could not get a type to generate for:" + td.FullName);
        }
Esempio n. 27
0
		protected UnixSocket (Mono.Unix.UnixEndPoint localEndPoint)
			: base (System.Net.Sockets.AddressFamily.Unix,
			        System.Net.Sockets.SocketType.Stream,
			        System.Net.Sockets.ProtocolType.IP,
			        localEndPoint)
		{
		}
//		Mono.TextEditor.Document document;
//		MonoDevelop.Ide.Gui.Document doc;
//		IParser parser;
//		IResolver resolver;
//		IExpressionFinder expressionFinder;
		
/*		void Init (Mono.TextEditor.Document document)
		{
			
//			parser = ProjectDomService.GetParser (document.FileName, document.MimeType);
//			expressionFinder = ProjectDomService.GetExpressionFinder (document.FileName);
		}*/
		
		
		ProjectDom GetParserContext (Mono.TextEditor.Document document)
		{
			var project = IdeApp.ProjectOperations.CurrentSelectedProject;
			if (project != null)
				return ProjectDomService.GetProjectDom (project);
			return ProjectDom.Empty;
		}
Esempio n. 29
0
		public override void InformMouseHover (Mono.TextEditor.MonoTextEditor editor, Margin margin, MarginMouseEventArgs args)
		{
			if (!(margin is ActionMargin))
				return;
			string toolTip;
			if (unitTest.IsFixture) {
				if (isFailed) {
					toolTip = GettextCatalog.GetString ("NUnit Fixture failed (click to run)");
					if (!string.IsNullOrEmpty (failMessage))
						toolTip += Environment.NewLine + failMessage.TrimEnd ();
				} else {
					toolTip = GettextCatalog.GetString ("NUnit Fixture (click to run)");
				}
			} else {
				if (isFailed) {
					toolTip = GettextCatalog.GetString ("NUnit Test failed (click to run)");
					if (!string.IsNullOrEmpty (failMessage))
						toolTip += Environment.NewLine + failMessage.TrimEnd ();
					foreach (var id in unitTest.TestCases) {
						if (host.IsFailure (unitTest.UnitTestIdentifier, id)) {
							var msg = host.GetMessage (unitTest.UnitTestIdentifier, id);
							if (!string.IsNullOrEmpty (msg)) {
								toolTip += Environment.NewLine + "Test" + id + ":";
								toolTip += Environment.NewLine + msg.TrimEnd ();
							}
						}
					}
				} else {
					toolTip = GettextCatalog.GetString ("NUnit Test (click to run)");
				}

			}
			editor.TooltipText = toolTip;
		}
Esempio n. 30
0
        /// <summary>
        /// Generates a proxy that forwards all virtual method calls
        /// to a single <see cref="IInterceptor"/> instance.
        /// </summary>
        /// <param name="originalBaseType">The base class of the type being constructed.</param>
        /// <param name="baseInterfaces">The list of interfaces that the new type must implement.</param>
        /// <param name="module">The module that will hold the brand new type.</param>
        /// <param name="targetType">The <see cref="TypeDefinition"/> that represents the type to be created.</param>
        public override void Construct(Type originalBaseType, IEnumerable<Type> baseInterfaces, ModuleDefinition module, Mono.Cecil.TypeDefinition targetType)
        {
            var interfaces = new HashSet<Type>(baseInterfaces);

            if (!interfaces.Contains(typeof(ISerializable)))
                interfaces.Add(typeof(ISerializable));

            var serializableInterfaceType = module.ImportType<ISerializable>();
            if (!targetType.Interfaces.Contains(serializableInterfaceType))
                targetType.Interfaces.Add(serializableInterfaceType);

            // Create the proxy type
            base.Construct(originalBaseType, interfaces, module, targetType);

            // Add the Serializable attribute
            targetType.IsSerializable = true;

            var serializableCtor = module.ImportConstructor<SerializableAttribute>();
            var serializableAttribute = new CustomAttribute(serializableCtor);
            targetType.CustomAttributes.Add(serializableAttribute);

            ImplementGetObjectData(originalBaseType, baseInterfaces, module, targetType);
            DefineSerializationConstructor(module, targetType);

            var interceptorType = module.ImportType<IInterceptor>();
            var interceptorGetterProperty = (from PropertyDefinition m in targetType.Properties
                                          where m.Name == "Interceptor" && m.PropertyType == interceptorType
                                          select m).First();
        }
		public override void CopyFrom (Mono.Debugging.Evaluation.EvaluationContext gctx)
		{
			base.CopyFrom (gctx);
			MdbEvaluationContext ctx = (MdbEvaluationContext) gctx;
			thread = ctx.thread;
			frame = ctx.frame;
		}
Esempio n. 32
0
        public CustomAttribute InjectCustomAttribute(Mono.Cecil.ICustomAttributeProvider target, CustomAttribute attribute)
        {
            if(module == null)
                throw new ArgumentNullException("module");
            if(target == null)
                throw new ArgumentNullException("target");
            if(attribute == null)
                throw new ArgumentNullException("attribute");

            TypeReference attributeType = ReferenceOrInjectType(attribute.AttributeType);

            // no context required as attributes cannot be generic
            MethodReference constructor = ReferenceOrInjectMethod(attribute.Constructor);

            CustomAttribute newAttribute;

            if((newAttribute = Helper.GetCustomAttribute(target.CustomAttributes, attribute)) != null)
                return newAttribute;

            newAttribute = new CustomAttribute(constructor);//, attr.GetBlob());

            target.CustomAttributes.Add(newAttribute);

            CopyCustomAttributeArguments(attribute.ConstructorArguments, newAttribute.ConstructorArguments);

            CopyCustomAttributeNamedArguments(attribute.Fields, newAttribute.Fields);

            CopyCustomAttributeNamedArguments(attribute.Properties, newAttribute.Properties);

            return newAttribute;
        }
		public override void EnableEvent (Mono.Debugger.Event ev, bool enable)
		{
			if (enable)
				ev.Activate (Process.MainThread);
			else
				ev.Deactivate (Process.MainThread);
		}
Esempio n. 34
0
			AstType ConvertToType (Mono.CSharp.Expression typeName)
			{
				if (typeName is TypeExpression) {
					var typeExpr = (Mono.CSharp.TypeExpression)typeName;
					return new PrimitiveType (typeExpr.GetSignatureForError (), Convert (typeExpr.Location));
				}
				
				if (typeName is Mono.CSharp.QualifiedAliasMember) {
					var qam = (Mono.CSharp.QualifiedAliasMember)typeName;
					// TODO: Overwork the return type model - atm we don't have a good representation
					// for qualified alias members.
					return new SimpleType (qam.Name, Convert (qam.Location));
				}
				
				if (typeName is MemberAccess) {
					MemberAccess ma = (MemberAccess)typeName;
					
					var memberType = new MonoDevelop.CSharp.Ast.MemberType ();
					memberType.AddChild (ConvertToType (ma.LeftExpression), MonoDevelop.CSharp.Ast.MemberType.TargetRole);
					memberType.MemberName = ma.Name;
					
					AddTypeArguments (ma, memberType);
					return memberType;
				}
				
				if (typeName is SimpleName) {
					var sn = (SimpleName)typeName;
					var result = new SimpleType (sn.Name, Convert (sn.Location));
					AddTypeArguments (sn, result);
					return result;
				}
				
				if (typeName is ComposedCast) {
					var cc = (ComposedCast)typeName;
					var baseType = ConvertToType (cc.Left);
					var result = new ComposedType () { BaseType = baseType };
					
					if (cc.Spec.IsNullable) {
						result.HasNullableSpecifier = true;
					} else if (cc.Spec.IsPointer) {
						result.PointerRank++;
					} else {
						var location = LocationsBag.GetLocations (cc.Spec);
						var spec = new ArraySpecifier () { Dimensions = cc.Spec.Dimension - 1 };
						spec.AddChild (new CSharpTokenNode (Convert (cc.Spec.Location), 1), FieldDeclaration.Roles.LBracket);
						if (location != null)
							spec.AddChild (new CSharpTokenNode (Convert (location[0]), 1), FieldDeclaration.Roles.RBracket);
						
						result.ArraySpecifiers = new ArraySpecifier[] {
							spec
						};
					}
					return result;
				}
				
				System.Console.WriteLine ("Error while converting :" + typeName + " - unknown type name");
				System.Console.WriteLine (Environment.StackTrace);
				return new SimpleType ("unknown");
			}
Esempio n. 35
0
        public override void VisitTypeDefinition(Mono.Cecil.TypeDefinition type)
        {
            if (!ShouldBeRenamed(type))
                return;

            logVisitingMember(type);
            RenameDefinition(type);
        }
Esempio n. 36
0
 /// <summary>
 /// To the authenticated.
 /// </summary>
 /// <param name="request">The request.</param>
 /// <returns>Map to the authenticated.</returns>
 private Func <User, IMono <AuthenticatedUser> > ToAuthenticated(Credential request)
 {
     return(user => user is null || !BCrypt.EnhancedVerify(request.Password, user.Password)
                        ? Mono.Error <AuthenticatedUser>(
                new ArgumentException("the user or the password are invalid"))
                        : Mono.Just(
                new AuthenticatedUser(user.Name, user.LastName, user.Email, this.Token(user))));
 }
Esempio n. 37
0
        /// <summary>
        /// Loads symbol in a platform specific way.
        /// </summary>
        /// <param name="symbolName"></param>
        /// <returns></returns>
        private IntPtr LoadSymbol(string symbolName)
        {
            IntPtr pResult = IntPtr.Zero;

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) /* PlatformApis.IsWindows */
            {
                int    ErrCode  = 0;
                string errorMsg = "";

                // See http://stackoverflow.com/questions/10473310 for background on this.
                if (Environment.Is64BitProcess) /* PlatformApis.Is64Bit */
                {
                    pResult = Windows.GetProcAddress(this.handle, symbolName);
                    if (pResult == IntPtr.Zero)
                    {
                        ErrCode  = Marshal.GetLastWin32Error();
                        errorMsg = Windows.GetLastErrMsg((uint)ErrCode);
                        Console.WriteLine("Error while loading function: " + symbolName + "\n\t" + errorMsg);
                    }
                    return(pResult);
                }
                else
                {
                    // Yes, we could potentially predict the size... but it's a lot simpler to just try
                    // all the candidates. Most functions have a suffix of @0, @4 or @8 so we won't be trying
                    // many options - and if it takes a little bit longer to fail if we've really got the wrong
                    // library, that's not a big problem. This is only called once per function in the native library.
                    symbolName = "_" + symbolName + "@";
                    for (int stackSize = 0; stackSize < 128; stackSize += 4)
                    {
                        pResult = Windows.GetProcAddress(this.handle, symbolName + stackSize);
                        if (pResult != IntPtr.Zero)
                        {
                            return(pResult);
                        }
                    }
                    // Fail.
                    return(IntPtr.Zero);
                }
            }
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                if (InteropRuntimeConfig.IsRunningOnMono) /* PlatformApis.IsMono */
                {
                    return(Mono.dlsym(this.handle, symbolName));
                }
                if (RuntimeInformation.FrameworkDescription.StartsWith(".NET Core")) /* PlatformApis.IsNetCore */
                {
                    return(CoreCLR.dlsym(this.handle, symbolName));
                }
                return(Linux.dlsym(this.handle, symbolName));
            }
            if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))  /* PlatformApis.IsMacOSX */
            {
                return(MacOSX.dlsym(this.handle, symbolName));
            }
            throw new InvalidOperationException("Unsupported platform.");
        }
Esempio n. 38
0
    public override void Exit()
    {
        var AttackProcessGenarator = Mono.GetComponent <AttackGenerator>();

        if (AttackProcessGenarator != null)
        {
            Object.Destroy(AttackProcessGenarator);
        }
    }
Esempio n. 39
0
 protected override void OnBattleLoadedScene()
 {
     base.OnBattleLoadedScene();
     TerrainGridSystem            = TerrainGridSystem.instance;
     TerrainGridSystem.cameraMain = Mono.GetComponentInChildren <Camera>();
     OnSetTerrainGridSystem();
     TerrainGridSystem.GenerateMap();
     CloseMap();
 }
Esempio n. 40
0
    public override void Exit()
    {
        Debug.Log("Patrol-Exit");
        var PatrolProcessGenarator = Mono.GetComponent <PatrolGenerator>();

        if (PatrolProcessGenarator != null)
        {
            Object.Destroy(PatrolProcessGenarator);
        }
    }
Esempio n. 41
0
        /// <summary>
        /// The Create instance.
        /// </summary>
        /// <param name="server">the server name.</param>
        /// <returns>The config.</returns>
        public static IMono <Config> Create(string server)
        {
            var validator  = new ConfigValidator();
            var config     = new Config(server);
            var validation = validator.Validate(config);

            return(validation.IsValid
                       ? Mono.Just(config)
                       : Mono.Error <Config>(new ArgumentException(string.Join(", ", validation.Errors))));
        }
Esempio n. 42
0
 public override void OnBeAdded(IMono mono)
 {
     base.OnBeAdded(mono);
     Animator = Mono.GetComponentInChildren <Animator>();
     if (Animator == null)
     {
         CLog.Error("错误 该对象没有Animator" + Mono.name);
     }
     SourceAnimator = Animator.runtimeAnimatorController;
 }
Esempio n. 43
0
        public override void Init()
        {
            targetPosition = target.transform.position;

            Mono.transform.position = targetPosition + targetOffset;
            Mono.transform.rotation = Quaternion.Euler(rotationVector);

            Mono.GetComponent <Camera>().orthographic     = true;
            Mono.GetComponent <Camera>().orthographicSize = orthoSize;
        }
Esempio n. 44
0
        public void Initialize()
        {
            var repositoryMock = new Mock <IUserRepository>();

            repositoryMock.Setup(r => r.Save(It.IsAny <IMono <User> >())).Returns(Mono.Just(new User()));
            var userRepository = repositoryMock.Object;
            var command        = new CreateUserHandler(userRepository);

            this.context.Command = command;
        }
Esempio n. 45
0
 public override void OnBeAdded(IMono mono)
 {
     base.OnBeAdded(mono);
     VoiceAudioSource              = Mono.EnsureComponet <AudioSource>();
     VoiceAudioSource.playOnAwake  = false;
     VoiceAudioSource.rolloffMode  = AudioRolloffMode.Linear;
     VoiceAudioSource.spatialBlend = 1.0f;
     VoiceAudioSource.minDistance  = 1.0f;
     VoiceAudioSource.maxDistance  = DefaultMaxDistance;
 }
Esempio n. 46
0
    public override void Exit()
    {
        Debug.Log("Chase-Exit");
        var ChaseProcessGenarator = Mono.GetComponent <ChaseGenerator>();

        if (ChaseProcessGenarator == null)
        {
            return;
        }
        Object.Destroy(ChaseProcessGenarator);
    }
Esempio n. 47
0
        static void Init()
        {
            if (GameObject.Find("[MonoBehaviour]") != null)
            {
                return;
            }
            var go = new GameObject();

            go.name = "[MonoBehaviour]";
            mono    = go.AddComponent <Mono>();
            Object.DontDestroyOnLoad(go);
        }
Esempio n. 48
0
 private void OnAwake()
 {
     Mono.InitCmpts();
     Resource.InitCmpts();
     Scene.InitCmpts();
     Debugs.InitCmpts();
     MsgMechain.InitCmpts();
     Pool.InitCmpts();
     DB.InitCmpts();
     Audio.InitCmpts();
     UI.InitCmpts();
 }
Esempio n. 49
0
 private void OnDestroy()
 {
     Mono.ShutDown();
     MsgMechain.ShutDown();
     Resource.ShutDown();
     Debugs.ShutDown();
     DB.ShutDown();
     UI.ShutDown();
     Audio.ShutDown();
     Scene.ShutDown();
     Pool.ShutDown();
     Debugs.ShutDown();
 }
Esempio n. 50
0
        public void Mono_ScansArray_DoNotThrow(int inputLength)
        {
            var zeros = new double[inputLength];
            var audio = new Mono(
                zeros,
                new AudioProcessingSettings()
            {
                HistoryLengthSamples = 512
            });

            Assert.DoesNotThrowAsync(
                () => audio.ScanAsync(new Progress <string>(), new Progress <double>()));
        }
Esempio n. 51
0
        /// <summary>
        /// Loads symbol in a platform specific way.
        /// </summary>
        /// <param name="symbolName"></param>
        /// <returns></returns>
        private IntPtr LoadSymbol(string symbolName)
        {
            if (PlatformApis.IsWindows)
            {
                // See http://stackoverflow.com/questions/10473310 for background on this.

                //if (PlatformApis.Is64Bit)
                //{
                //    return Windows.GetProcAddress(this.handle, symbolName);
                //}
                //else
                //{
                //    // Yes, we could potentially predict the size... but it's a lot simpler to just try
                //    // all the candidates. Most functions have a suffix of @0, @4 or @8 so we won't be trying
                //    // many options - and if it takes a little bit longer to fail if we've really got the wrong
                //    // library, that's not a big problem. This is only called once per function in the native library.
                //    symbolName = "_" + symbolName + "@";
                //    for (int stackSize = 0; stackSize < 128; stackSize += 4)
                //    {
                //        IntPtr candidate = Windows.GetProcAddress(this.handle, symbolName + stackSize);
                //        if (candidate != IntPtr.Zero)
                //        {
                //            return candidate;
                //        }
                //    }
                //    // Fail.
                //    return IntPtr.Zero;
                //}

                // VLFD.dll 比较特殊
                // 虽然是32位的,但符号和64位相同
                return(Windows.GetProcAddress(this.handle, symbolName));
            }
            if (PlatformApis.IsLinux)
            {
                if (PlatformApis.IsMono)
                {
                    return(Mono.dlsym(this.handle, symbolName));
                }
                if (PlatformApis.IsNetCore)
                {
                    return(CoreCLR.dlsym(this.handle, symbolName));
                }
                return(Linux.dlsym(this.handle, symbolName));
            }
            if (PlatformApis.IsMacOSX)
            {
                return(MacOSX.dlsym(this.handle, symbolName));
            }
            throw new InvalidOperationException("Unsupported platform.");
        }
Esempio n. 52
0
 public void Close()
 {
     if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
     {
         if (this.handle != IntPtr.Zero)
         {
             Windows.FreeLibrary(this.handle);
             this.handle = IntPtr.Zero;
         }
     }
     else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
     {
         if (InteropRuntimeConfig.IsRunningOnMono)
         {
             if (this.handle != IntPtr.Zero)
             {
                 Mono.dlclose(this.handle);
                 this.handle = IntPtr.Zero;
             }
         }
         else if (RuntimeInformation.FrameworkDescription.StartsWith(".NET Core"))
         {
             if (this.handle != IntPtr.Zero)
             {
                 CoreCLR.dlclose(this.handle);
                 this.handle = IntPtr.Zero;
             }
         }
         else
         {
             if (this.handle != IntPtr.Zero)
             {
                 Linux.dlclose(this.handle);
                 this.handle = IntPtr.Zero;
             }
         }
     }
     else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
     {
         if (this.handle != IntPtr.Zero)
         {
             MacOSX.dlclose(this.handle);
             this.handle = IntPtr.Zero;
         }
     }
     else
     {
         throw new InvalidOperationException("Unsupported platform.");
     }
     bLibOpen = false;
 }
Esempio n. 53
0
        void RegetNode()
        {
            Model       = SelfBaseUnit.Trans;
            bones       = new Dictionary <int, Transform>();
            extendBones = new Dictionary <string, Transform>();
            bones.Clear();
            extendBones.Clear();
            Transform[] trans = Mono.GetComponentsInChildren <Transform>();
            for (int i = 0; i < trans.Length; ++i)
            {
                OnMapNodes(trans[i]);

                if (trans[i].name == BaseConstMgr.STR_Model)
                {
                    Model = trans[i];
                }
            }

            BaseBone[] bonescom = Mono.GetComponentsInChildren <BaseBone>();
            if (bonescom != null)
            {
                foreach (var item in bonescom)
                {
                    int index = (int)item.Type;
                    if (index != -1)
                    {
                        if (bones.ContainsKey(index))
                        {
                            bones[index] = item.Trans;
                        }
                        else
                        {
                            bones.Add(index, item.Trans);
                        }
                    }
                    else
                    {
                        string name = item.ExtendName;
                        if (extendBones.ContainsKey(name))
                        {
                            CLog.Error("ExtenBone 名称重复:{0}", name);
                        }
                        else
                        {
                            extendBones.Add(name, item.Trans);
                        }
                    }
                }
            }
        }
Esempio n. 54
0
 void StartLoader(params ILoader[] loaders)
 {
     if (loaders == null || loaders.Length == 0)
     {
         CLog.Error("错误,没有Loader");
         return;
     }
     foreach (var item in loaders)
     {
         loderList.Add(item);
     }
     IsLoadEnd = false;
     Mono.StartCoroutine(IEnumerator_Load());
 }
Esempio n. 55
0
        /// <summary>
        /// Creates the specified name.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="lastName">The last name.</param>
        /// <param name="email">The email.</param>
        /// <param name="password">The password.</param>
        /// <param name="confirm">The confirm.</param>
        /// <returns>the user.</returns>
        public static IMono <User> Create(string name, string lastName, string email, string password, string confirm)
        {
            if (password != confirm)
            {
                return(Mono.Error <User>(new ArgumentException(nameof(confirm))));
            }

            var user       = new User(name, lastName, email, BCrypt.Net.BCrypt.EnhancedHashPassword(password));
            var validation = new UserValidation();
            var valid      = validation.Validate(user);

            return(!valid.IsValid
                       ? Mono.Error <User>(new ArgumentException(string.Join(", ", valid.Errors)))
                       : Mono.Just(user));
        }
Esempio n. 56
0
        IEnumerator IEnumerator_Load()
        {
            Callback_OnStartLoad?.Invoke();
            for (int i = 0; i < loderList.Count; ++i)
            {
                LoadInfo = loderList[i].GetLoadInfo();
                yield return(Mono.StartCoroutine(loderList[i].Load()));

                Percent = i / loderList.Count;
            }
            Callback_OnLoadEnd?.Invoke(LoadEndType.Success, LoadInfo);
            IsLoadEnd = true;
            Callback_OnAllLoadEnd?.Invoke();
            Callback_OnAllLoadEnd2?.Invoke();
        }
Esempio n. 57
0
        /// <summary>
        /// Default constructor for creating a new instance of hte Layout form
        /// </summary>
        public LayoutForm()
        {
            InitializeComponent();

            if (Mono.IsRunningOnMono())
            {
                // On Mac and possibly other Mono platforms, GdipCreateLineBrushFromRect
                // in gdiplus native lib returns InvalidParameter in Mono file LinearGradientBrush.cs
                // if a StripPanel's Width or Height is 0, so force them to non-0.
                _toolStripContainer1.TopToolStripPanel.Size    = new Size(_toolStripContainer1.TopToolStripPanel.Size.Width, 1);
                _toolStripContainer1.BottomToolStripPanel.Size = new Size(_toolStripContainer1.BottomToolStripPanel.Size.Width, 1);
                _toolStripContainer1.LeftToolStripPanel.Size   = new Size(1, _toolStripContainer1.LeftToolStripPanel.Size.Height);
                _toolStripContainer1.RightToolStripPanel.Size  = new Size(1, _toolStripContainer1.RightToolStripPanel.Size.Height);
            }
        }
Esempio n. 58
0
        /// <summary>
        /// Handles the Click event of the PrintLayout control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void PrintLayoutClick(object sender, EventArgs e)
        {
            // In Mono show the dialog only if printers installed else show error message.
            if (Mono.IsRunningOnMono())
            {
                if (!new PrinterSettings().IsValid)
                {
                    MessageBox.Show(Msg.NoPrintersInstalled, Msg.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            using var layout  = new LayoutForm();
            layout.MapControl = App.Map as Map;
            layout.ShowDialog();
        }
Esempio n. 59
0
 /// <summary>
 /// Loads symbol in a platform specific way.
 /// </summary>
 /// <param name="symbolName"></param>
 /// <returns></returns>
 public IntPtr LoadSymbol(string symbolName)
 {
     if (PlatformApis.IsLinux)
     {
         if (PlatformApis.IsMono)
         {
             return(Mono.dlsym(this.handle, symbolName));
         }
         return(Linux.dlsym(this.handle, symbolName));
     }
     if (PlatformApis.IsMacOSX)
     {
         return(MacOSX.dlsym(this.handle, symbolName));
     }
     throw new InvalidOperationException("Unsupported platform.");
 }
Esempio n. 60
0
        public override void Update()
        {
            if (target != null && target.transform.childCount > 0)
            {
                targetPosition = target.transform.GetChild(0).transform.position;
            }
            else if (target != null)
            {
                targetPosition = target.transform.position;
            }

            Mono.transform.position = targetPosition + targetOffset;
            Mono.transform.rotation = Quaternion.Euler(rotationVector);

            Mono.GetComponent <Camera>().orthographic     = true;
            Mono.GetComponent <Camera>().orthographicSize = orthoSize;
        }