Ejemplo n.º 1
0
        public static string GetPackUriFromType(Type type, OpcReferencedTypeStrategy strategy, string extension)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type", "The Type is null.");
            }

            string referencedAssembly = GetReferencedAssembly(type, strategy);

            return((new StringBuilder())
                   .AppendFormat("pack://application:,,,/{0};component/Subfolder/{1}.{2}",
                                 referencedAssembly, type.Name, extension).ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the referenced assembly.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="strategy">The strategy.</param>
        public static string GetReferencedAssembly(Type type, OpcReferencedTypeStrategy strategy)
        {
            if (type == null)
            {
                return(null);
            }

            switch (strategy)
            {
            case OpcReferencedTypeStrategy.FromAssemblyFileName:
                return(Path.GetFileName(type.Assembly.Location)
                       .Replace(".dll", string.Empty));

            case OpcReferencedTypeStrategy.FromTypeFullName:
                return(type.FullName
                       .Replace("." + type.Name, string.Empty));
            }

            throw new ArgumentException("The ReferencedTypeStrategy is not here.");
        }
Ejemplo n.º 3
0
 public static string GetPackUriFromType(Type type, OpcReferencedTypeStrategy strategy)
 {
     return(OpcUtility.GetPackUriFromType(type, strategy, "xaml"));
 }