Exemplo n.º 1
0
        /// <summary>
        /// Loads a C# assembly by location, creates a shadow-copy and generates debug database (mdb).
        /// </summary>
        /// <param name="assemblyPath"></param>
        public Assembly LoadAssembly(string assemblyPath)
        {
#if !(RELEASE && RELEASE_DISABLE_CHECKS)
            if (assemblyPath == null)
            {
                throw new ArgumentNullException("assemblyPath");
            }
            if (assemblyPath.Length < 1)
            {
                throw new ArgumentException("string cannot be empty!", "assemblyPath");
            }
#endif

            var tempDirectory = ProjectSettings.TempDirectory;
            var newPath       = Path.Combine(tempDirectory, Path.GetFileName(assemblyPath));

            TryCopyFile(assemblyPath, ref newPath);

#if !RELEASE
            if (CVar.Get("mono_generateMdbIfPdbIsPresent").IVal != 0)
            {
                GenerateDebugDatabaseForAssembly(assemblyPath);

                var mdbFile = assemblyPath + ".mdb";
                if (File.Exists(mdbFile))                 // success
                {
                    var newMdbPath = Path.Combine(tempDirectory, Path.GetFileName(mdbFile));
                    TryCopyFile(mdbFile, ref newMdbPath);
                }
            }
#endif

            var assembly = Assembly.LoadFrom(newPath);
            if (ProcessedAssemblies.Any(x => x.FullName == assembly.FullName))
            {
                return(null);
            }

            ProcessedAssemblies.Add(assembly);
            return(assembly);
        }
Exemplo n.º 2
0
 public CVarItem(string varname, string[] values)
     : base(varname)
 {
     Values = values;
     cvar   = CVar.Get(varname);
 }