Ejemplo n.º 1
0
        public void SetupMetadata(CST.Global global)
        {
            NumWarnings = 0;
            NumErrors   = 0;

            Global = global;

            if (tracerStream != null)
            {
                Tracer = new CST.CSTWriter(global, CST.WriterStyle.Debug, tracerStream);
            }

            Validity = new ValidityContext(this);

            GenericEnumeratorTypeConstructorRef = MkRef(Constants.GenericEnumeratorTypeConstructorName);
            JSContextRef   = MkRef(Constants.JSContextName);
            JSObjectRef    = MkRef(Constants.JSObjectName);
            JSPropertyRef  = MkRef(Constants.JSPropertyName);
            JSExceptionRef = MkRef(Constants.JSExceptionName);

            GlobalMapping   = new GlobalMapping(this);
            AttributeHelper = new AttributeHelper(this);
            InteropManager  = new InteropManager(this);
            JSTHelpers      = new JSTHelpers(this);
            InlinedMethods  = new InlinedMethodCache(this);
            Traces          = new Traces(this);
        }
Ejemplo n.º 2
0
 public MethodTransform(
     NamingRulesManager namingRules,
     Logger logger,
     GroupRegistry groupRegistry,
     MarshalledElementFactory factory,
     GlobalNamespaceProvider globalNamespace,
     InteropManager interopManager)
     : base(namingRules, logger)
 {
     this.groupRegistry   = groupRegistry;
     this.factory         = factory;
     this.globalNamespace = globalNamespace;
     this.interopManager  = interopManager;
     signatureTransform   = new InteropSignatureTransform(globalNamespace, logger);
 }
Ejemplo n.º 3
0
        private async void ShowUri(Setting setting)
        {
            var uri = setting.Uri;

            if (uri.Scheme == "ms-appx" && uri.AbsoluteUri.LastIndexOf(".md") > 0)
            {
                var content = await InteropManager.Read(uri);

                var child = new MarkdownTextBlock {
                    Text = content
                };
                var scroller = new ScrollViewer {
                    Content = child
                };
                await ShowDetails(scroller);
            }
            else
            {
                await InteropManager.LaunchUri(setting.Uri);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Close of LibVlc and VlcControls instance
        /// </summary>
        public static void CloseAll()
        {
            if (HandleManager != null)
            {
                var mediaBases = new MediaBase[HandleManager.MediasHandles.Count];
                HandleManager.MediasHandles.Keys.CopyTo(mediaBases, 0);
                foreach (MediaBase mediaBase in mediaBases)
                {
                    mediaBase.Dispose();
                }

                if (HandleManager.MediaPlayerHandles != null)
                {
                    var mediaPlayers = new IVlcControl[HandleManager.MediaPlayerHandles.Count];
                    HandleManager.MediaPlayerHandles.Keys.CopyTo(mediaPlayers, 0);

                    foreach (IVlcControl mediaPlayerHandle in mediaPlayers)
                    {
                        mediaPlayerHandle.Dispose();
                    }
                    HandleManager.MediaPlayerHandles.Clear();
                }
                if (InteropManager != null)
                {
                    InteropManager.ReleaseInstance.Invoke(HandleManager.LibVlcHandle);
                }
                HandleManager.LibVlcHandle = IntPtr.Zero;
            }
            ErrorHandling = null;
            if (InteropManager == null)
            {
                return;
            }
            InteropManager.Dispose();
            InteropManager = null;
            IsInitialized  = false;
        }
Ejemplo n.º 5
0
        private async void ShowDetails(Setting setting)
        {
            var details = InteropManager.LaunchDetails(setting.Details);

            await ShowDetails(details);
        }
Ejemplo n.º 6
0
        public void Setup(AssemblyNode mscorlib, AssemblyNode jsTypes, AssemblyNode rewriteAssembly)
        {
            NumWarnings = 0;
            NumErrors   = 0;

            MsCorLib = mscorlib;

            AssemblyDelaySignAttributeType = GetType(mscorlib, "System.Reflection", "AssemblyDelaySignAttribute");

            VoidType                       = GetType(mscorlib, "System", "Void");
            ObjectType                     = GetType(mscorlib, "System", "Object");
            StringType                     = GetType(mscorlib, "System", "String");
            IntType                        = GetType(mscorlib, "System", "Int32");
            BooleanType                    = GetType(mscorlib, "System", "Boolean");
            MethodBaseType                 = GetType(mscorlib, "System.Reflection", "MethodBase");
            RuntimeTypeHandleType          = GetType(mscorlib, "System", "RuntimeTypeHandle");
            NullableTypeConstructor        = GetType(mscorlib, "System", "Nullable`1");
            CompilerGeneratedAttributeType = GetType
                                                 (mscorlib, "System.Runtime.CompilerServices", "CompilerGeneratedAttribute");
            DllImportAttributeType = GetType(mscorlib, "System.Runtime.InteropServices", "DllImportAttribute");

            TypeType                       = GetType(mscorlib, "System", "Type");
            Type_GetMethodMethod           = GetMethod(TypeType, "GetMethod", StringType, TypeType.GetArrayType(1));
            Type_GetMemberMethod           = GetMethod(TypeType, "GetMember", StringType);
            Type_GetConstructorMethod      = GetMethod(TypeType, "GetConstructor", TypeType.GetArrayType(1));
            Type_GetTypeFromHandleMethod   = GetMethod(TypeType, "GetTypeFromHandle", RuntimeTypeHandleType);
            Type_GetGenericArgumentsMethod = GetMethod(TypeType, "GetGenericArguments");
            Type_MakeArrayTypeMethod       = GetMethod(TypeType, "MakeArrayType");
            Type_MakeGenericTypeMethod     = GetMethod(TypeType, "MakeGenericType", TypeType.GetArrayType(1));

            InteropTypes   = new InteropTypes(this);
            InteropManager = new InteropManager(this);

            IgnoreAttributeType           = GetType(jsTypes, Constants.JSTypesIL2JSNS, "IgnoreAttribute");
            InteropAttributeType          = GetType(jsTypes, Constants.JSTypesInteropNS, "InteropAttribute");
            NamingAttributeType           = GetType(jsTypes, Constants.JSTypesInteropNS, "NamingAttribute");
            ImportAttributeType           = GetType(jsTypes, Constants.JSTypesInteropNS, "ImportAttribute");
            ImportKeyAttributeType        = GetType(jsTypes, Constants.JSTypesInteropNS, "ImportKeyAttribute");
            ExportAttributeType           = GetType(jsTypes, Constants.JSTypesInteropNS, "ExportAttribute");
            NotExportedAttributeType      = GetType(jsTypes, Constants.JSTypesInteropNS, "NotExportedAttribute");
            InteropGeneratedAttributeType = GetType(jsTypes, Constants.JSTypesIL2JSNS, "InteropGeneratedAttribute");

            JSTypes = jsTypes;

            JSContextType = GetType(jsTypes, Constants.JSTypesInteropNS, "JSContext");

            InteropContextManagerType = GetType(jsTypes, Constants.JSTypesManagedInteropNS, "InteropContextManager");
            InteropContextManager_GetDatabaseMethod         = GetMethod(InteropContextManagerType, "get_Database");
            InteropContextManager_GetCurrentRuntimeMethod   = GetMethod(InteropContextManagerType, "get_CurrentRuntime");
            InteropContextManager_GetRuntimeForObjectMethod = GetMethod
                                                                  (InteropContextManagerType, "GetRuntimeForObject", ObjectType);

            InteropDatabaseType = GetType(jsTypes, Constants.JSTypesManagedInteropNS, "InteropDatabase");
            InteropDatabase_RegisterRootExpression     = GetMethod(InteropDatabaseType, "RegisterRootExpression", StringType);
            InteropDatabase_RegisterDelegateShimMethod = GetMethod
                                                             (InteropDatabaseType, "RegisterDelegateShim", TypeType);
            InteropDatabase_RegisterTypeMethod = GetMethod
                                                     (InteropDatabaseType,
                                                     "RegisterType",
                                                     TypeType,
                                                     IntType,
                                                     StringType,
                                                     StringType,
                                                     IntType,
                                                     BooleanType,
                                                     BooleanType,
                                                     BooleanType);
            InteropDatabase_RegisterExportMethod = GetMethod
                                                       (InteropDatabaseType, "RegisterExport", MethodBaseType, BooleanType, StringType);

            SimpleMethodBaseType = GetType(jsTypes, Constants.JSTypesManagedInteropNS, "SimpleMethodBase");

            SimpleMethodInfoType  = GetType(jsTypes, Constants.JSTypesManagedInteropNS, "SimpleMethodInfo");
            SimpleMethodInfo_Ctor = GetConstructor
                                        (SimpleMethodInfoType, BooleanType, StringType, TypeType, TypeType.GetArrayType(1), TypeType);

            SimpleConstructorInfoType  = GetType(jsTypes, Constants.JSTypesManagedInteropNS, "SimpleConstructorInfo");
            SimpleConstructorInfo_Ctor = GetConstructor(SimpleConstructorInfoType, TypeType, TypeType.GetArrayType(1));

            RuntimeType = GetType(jsTypes, Constants.JSTypesManagedInteropNS, "Runtime");
            Runtime_CompleteConstructionMethod = GetMethod
                                                     (RuntimeType, "CompleteConstruction", SimpleMethodBaseType, ObjectType, JSContextType);
            Runtime_CallImportedMethodMethod = GetMethod
                                                   (RuntimeType, "CallImportedMethod", SimpleMethodBaseType, StringType, ObjectType.GetArrayType(1));

            UniversalDelegateType          = GetType(jsTypes, Constants.JSTypesManagedInteropNS, "UniversalDelegate");
            UniversalDelegate_InvokeMethod = GetUniqueMethod(UniversalDelegateType, "Invoke");

            MethodBase_GetGenericArgumentsMethod = GetMethod(MethodBaseType, "GetGenericArguments");

            ModuleType = GetType(rewriteAssembly, "", "<Module>");
            foreach (var member in ModuleType.Members)
            {
                var cctor = member as StaticInitializer;
                if (cctor != null)
                {
                    ModuleCCtorMethod = cctor;
                }
            }
        }