~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/AssemblyContext.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2010-02-02 11:39:59 UTC
  • mfrom: (1.4.4 upstream)
  • mto: (1.5.1 sid)
  • mto: This revision was merged to the branch mainline in revision 47.
  • Revision ID: james.westby@ubuntu.com-20100202113959-n3u848nfj35yyd03
* New upstream release
* debian/control:
  + Standards version 3.8.4 (no changes needed)
* debian/patches/remove_support_for_non_debian_functionality.patch,
  debian/patches/remove_support_for_soft_debugger.patch,
  debian/patches/remove_support_for_moonlight.patch,
  debian/rules:
  + Split patch into two pieces, to make it easier to enable either
    SDB or Moonlight support with a rebuild
* debian/monodevelop-moonlight.install,
  debian/monodevelop-debugger-sdb.install,
  debian/control:
  + Create packaging data for the Soft Debugger addin and Moonlight addin -
    and comment them out of debian/control as we can't provide them on
    Debian for now

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
// THE SOFTWARE.
26
26
 
27
27
using System;
 
28
using System.Linq;
28
29
using System.IO;
29
30
using System.Reflection;
30
31
using System.Collections.Generic;
280
281
                        if (fasm != null)
281
282
                                return fullname;
282
283
                        
283
 
                        // Try to find a newer version of the same assembly
284
 
                        
 
284
                        // Try to find a newer version of the same assembly, preferring framework assemblies
285
285
                        if (fx == null) {
286
 
                                foreach (SystemAssembly asm in FindNewerAssembliesSameName (fullname))
287
 
                                        if (package == null || asm.Package.Name == package)
288
 
                                                return asm.FullName;
289
 
                                return null;
 
286
                                string best = null;
 
287
                                foreach (SystemAssembly asm in FindNewerAssembliesSameName (fullname)) {
 
288
                                        if (package == null || asm.Package.Name == package) {
 
289
                                                if (asm.Package.IsFrameworkPackage)
 
290
                                                        return asm.FullName;
 
291
                                                else
 
292
                                                        best = asm.FullName;
 
293
                                        }
 
294
                                }
 
295
                                return best;
290
296
                        }
291
297
                        
292
298
                        string bestMatch = null;
293
299
                        foreach (SystemAssembly asm in FindNewerAssembliesSameName (fullname)) {
294
 
                                if (fx.Id == asm.Package.TargetFramework) {
295
 
                                        if (package == null || asm.Package.Name == package)
296
 
                                                return asm.FullName;
297
 
                                }
298
 
                                if (fx.IsCompatibleWithFramework (asm.Package.TargetFramework)) {
 
300
                                if (asm.Package.IsFrameworkPackage) {
 
301
                                        if (fx.IsExtensionOfFramework (asm.Package.TargetFramework))
 
302
                                                if (package == null || asm.Package.Name == package)
 
303
                                                        return asm.FullName;
 
304
                                } else if (fx.IsCompatibleWithFramework (asm.Package.TargetFramework)) {
299
305
                                        if (package != null && asm.Package.Name == package)
300
306
                                                return asm.FullName;
301
307
                                        bestMatch = asm.FullName;
334
340
                        if (asm != null)
335
341
                                return asm.Location;
336
342
                        
337
 
                        if (assemblyName == "mscorlib" || assemblyName.StartsWith ("mscorlib,"))
338
 
                                return typeof(object).Assembly.Location;
339
 
                        
340
343
                        return null;
341
344
                }
342
345
                
407
410
                        if (asm == null)
408
411
                                return null;
409
412
                        
410
 
                        //if the asm isn't a framework asm, we don't upgrade it automatically
411
 
                        if (!asm.Package.IsFrameworkPackage) {
 
413
                        var fxAsms = asm.AllSameName ().Where (a => a.Package.IsFrameworkPackage);
 
414
                        
 
415
                        //if the asm is not a framework asm, we don't upgrade it automatically
 
416
                        if (!fxAsms.Any ()) {
412
417
                                // Return null if the package is not compatible with the requested version
413
418
                                if (fx.IsCompatibleWithFramework (asm.Package.TargetFramework))
414
419
                                        return asm;
415
420
                                else
416
421
                                        return null;
417
422
                        }
418
 
                        if (fx.IsExtensionOfFramework (asm.Package.TargetFramework))
419
 
                                return asm;
 
423
                        
 
424
                        foreach (var fxAsm in fxAsms) {
 
425
                                if (fx.IsExtensionOfFramework (fxAsm.Package.TargetFramework))
 
426
                                        return fxAsm;
 
427
                        }
420
428
 
421
429
                        // We have to find the assembly with the same name in the target fx
422
 
                        string fname = Path.GetFileName ((string) asm.Location);
 
430
                        string fname = Path.GetFileName ((string) fxAsms.First ().Location);
423
431
                        
424
 
                        foreach (KeyValuePair<string, SystemAssembly> pair in assemblyFullNameToAsm) {
425
 
                                SystemAssembly fxAsm = pair.Value;
426
 
                                do {
427
 
                                        SystemPackage rpack = fxAsm.Package;
 
432
                        foreach (var pair in assemblyFullNameToAsm) {
 
433
                                foreach (var fxAsm in pair.Value.AllSameName ()) {
 
434
                                        var rpack = fxAsm.Package;
428
435
                                        if (rpack.IsFrameworkPackage && fx.IsExtensionOfFramework (rpack.TargetFramework) && Path.GetFileName (fxAsm.Location) == fname)
429
436
                                                return fxAsm;
430
 
                                        fxAsm = fxAsm.NextSameName;
431
 
                                } while (fxAsm != null);
 
437
                                }
432
438
                        }
433
439
                        return null;
434
440
                }