private static Assembly DoLoadGeneratedAssembly(Assembly assembly, ApplicationModel <Qi4CS.Core.SPI.Instance.ApplicationSPI> model, EventHandler <AssemblyLoadingArgs> loadingEvt)
        {
            var args = new AssemblyLoadingArgs(assembly.FullName, Qi4CSGeneratedAssemblyAttribute.GetGeneratedAssemblyName(assembly));

            loadingEvt.InvokeEventIfNotNull(evt => evt(model, args));

            var an = args.Qi4CSGeneratedAssemblyName;

            if (args.Version != null)
            {
                an += ", Version=" + args.Version;
            }

            if (!String.IsNullOrEmpty(args.Culture))
            {
                an += ", Culture=" + args.Culture;
            }

            if (!args.PublicKey.IsNullOrEmpty())
            {
                an += ", PublicKey=" + StringConversions.ByteArray2HexStr(args.PublicKey);
            }
            else if (!args.PublicKeyToken.IsNullOrEmpty())
            {
                an += ", PublicKeyToken=" + StringConversions.ByteArray2HexStr(args.PublicKeyToken);
            }

            return(Assembly.Load(
#if WINDOWS_PHONE_APP
                       new AssemblyName(
#endif
                       an
#if WINDOWS_PHONE_APP
                       )
#endif
                       ));
        }
Esempio n. 2
0
 /// <inheritdoc />
 public override String ToString()
 {
     // mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
     return(Utils.EscapeSomeString(this._name) +
            ASSEMBLY_NAME_ELEMENTS_SEPARATOR + ' ' + VERSION + ASSEMBLY_NAME_ELEMENT_VALUE_SEPARATOR + this._majorVersion + VERSION_SEPARATOR + this._minorVersion + VERSION_SEPARATOR + this._buildNumber + VERSION_SEPARATOR + this._revision +
            ASSEMBLY_NAME_ELEMENTS_SEPARATOR + ' ' + CULTURE + ASSEMBLY_NAME_ELEMENT_VALUE_SEPARATOR + (this._culture == null || this._culture.Trim().Length == 0 ? NEUTRAL_CULTURE : this._culture) +
            (this._publicKey == null ? "" :
             ("" + ASSEMBLY_NAME_ELEMENTS_SEPARATOR + ' ' + (((AssemblyFlags)this._flags).IsFullPublicKey() ? PUBLIC_KEY : PUBLIC_KEY_TOKEN) + ASSEMBLY_NAME_ELEMENT_VALUE_SEPARATOR + StringConversions.ByteArray2HexStr(this._publicKey, 0, this._publicKey.Length, false))
            ));
 }