예제 #1
0
        /*
         * Method:  ITypeLibImporterNotifySink.ResolveRef
         *
         * Implementation of ITypeLibImporterNotifySink.ResolveRef - this method is called by the NDP type lib converter
         * to resolve dependencies.
         * We should never return null here - it's not documented as the proper way of failing dependency resolution.
         * Instead, we use an exception to abort the conversion process.
         */
        Assembly ITypeLibImporterNotifySink.ResolveRef(object objTypeLib)
        {
            // get attributes for our dependent typelib
            ITypeLib typeLib = (ITypeLib)objTypeLib;

            ComReference.GetTypeLibAttrForTypeLib(ref typeLib, out TYPELIBATTR attr);

            // call our callback to do the dirty work for us
            if (!ResolverCallback.ResolveComClassicReference(attr, base.OutputDirectory, null, null, out ComReferenceWrapperInfo wrapperInfo))
            {
                if (!Silent)
                {
                    Log.LogWarningWithCodeFromResources("ResolveComReference.FailedToResolveDependentComReference", attr.guid, attr.wMajorVerNum, attr.wMinorVerNum);
                }

                throw new ComReferenceResolutionException();
            }

            Debug.Assert(wrapperInfo.assembly != null, "Successfully resolved assembly cannot be null!");
            if (wrapperInfo.assembly == null)
            {
                throw new ComReferenceResolutionException();
            }

            if (!Silent)
            {
                Log.LogMessageFromResources(MessageImportance.Low, "ResolveComReference.ResolvedDependentComReference",
                                            attr.guid, attr.wMajorVerNum, attr.wMinorVerNum, wrapperInfo.path);
            }

            Debug.Assert(wrapperInfo.assembly != null, "Expected a non-null wrapperInfo.assembly. It should have been loaded in GenerateWrapper if it was going to be necessary.");
            return(wrapperInfo.assembly);
        }
예제 #2
0
 public TextResolverForm(ResolverCallback callback, string name = null, string content = null)
 {
     InitializeComponent();
     OnAccepted = callback;
     if (!string.IsNullOrEmpty(name))
     {
         nameTextBox.Text = name;
     }
     if (!string.IsNullOrEmpty(content))
     {
         contentTextBox.Text = content;
     }
 }
예제 #3
0
 /// <summary>
 /// Alustaa uuden instanssin jossa luokka nimen voi alustaa.
 /// </summary>
 /// <param name="scriptArguments">Argumentit jotka annetaan scriptille kun se luodaan. Arvo voi olla null.</param>
 /// <param name="depencyObject">Depency olio jota tarvitaan callbackissa. Arvo voi olla null.</param>
 /// <param name="scriptResolvedCallback">Callback joka suoritetaan kun scripti on luotu. Arvo voi olla null.</param>
 public ParallelScriptBuilder(string scriptName, string className, object[] scriptArguments = null, object depencyObject = null, ResolverCallback scriptResolvedCallback = null)
     : base(scriptName, className, scriptArguments)
 {
     DepencyObject          = depencyObject;
     ScriptResolvedCallback = scriptResolvedCallback;
 }