System.Xml.Serialization.Compiler.GetTempAssemblyPath C# (CSharp) Method

GetTempAssemblyPath() static private method

static private GetTempAssemblyPath ( string baseDir, Assembly assembly, string defaultNamespace ) : string
baseDir string
assembly System.Reflection.Assembly
defaultNamespace string
return string
        internal static string GetTempAssemblyPath(string baseDir, Assembly assembly, string defaultNamespace)
        {
            if (assembly.IsDynamic)
            {
                throw new InvalidOperationException(SR.XmlPregenAssemblyDynamic);
            }

            try
            {
                if (baseDir != null && baseDir.Length > 0)
                {
                    // check that the dirsctory exists
                    if (!Directory.Exists(baseDir))
                    {
                        throw new UnauthorizedAccessException(SR.Format(SR.XmlPregenMissingDirectory, baseDir));
                    }
                }
                else
                {
                    baseDir = Path.GetTempPath();
                    // check that the dirsctory exists
                    if (!Directory.Exists(baseDir))
                    {
                        throw new UnauthorizedAccessException(SR.XmlPregenMissingTempDirectory);
                    }
                }
                if (baseDir.EndsWith("\\", StringComparison.Ordinal))
                    baseDir += GetTempAssemblyName(assembly.GetName(), defaultNamespace);
                else
                    baseDir += "\\" + GetTempAssemblyName(assembly.GetName(), defaultNamespace);
            }
            finally
            {
            }

            return baseDir + ".dll";
        }