private void AddAssemblyDependency(Assembly assembly) { if (_linkedAssemblies == null) { _linkedAssemblies = new AssemblySet(); } _linkedAssemblies.Add(assembly); }
internal static AssemblySet GetReferencedAssemblies(Assembly a) { AssemblySet set = new AssemblySet(); foreach (AssemblyName name in a.GetReferencedAssemblies()) { Assembly o = Assembly.Load(name); if (!(o == typeof(string).Assembly)) { set.Add(o); } } return(set); }
private void GetAppStateByParsingGlobalAsax() { using (new ApplicationImpersonationContext()) { if (FileUtil.FileExists(this._appFilename)) { ApplicationFileParser parser = new ApplicationFileParser(); AssemblySet referencedAssemblies = Util.GetReferencedAssemblies(this._theApplicationType.Assembly); referencedAssemblies.Add(typeof(string).Assembly); VirtualPath virtualPath = HttpRuntime.AppDomainAppVirtualPathObject.SimpleCombine("global.asax"); parser.Parse(referencedAssemblies, virtualPath); this._state = new HttpApplicationState(parser.ApplicationObjects, parser.SessionObjects); } } }
private void GetAppStateByParsingGlobalAsax() { using (new ApplicationImpersonationContext()) { // It may not exist if the app is precompiled if (FileUtil.FileExists(_appFilename)) { ApplicationFileParser parser; parser = new ApplicationFileParser(); AssemblySet referencedAssemblies = System.Web.UI.Util.GetReferencedAssemblies( _theApplicationType.Assembly); referencedAssemblies.Add(typeof(string).Assembly); VirtualPath virtualPath = HttpRuntime.AppDomainAppVirtualPathObject.SimpleCombine( applicationFileName); parser.Parse(referencedAssemblies, virtualPath); // Create app state _state = new HttpApplicationState(parser.ApplicationObjects, parser.SessionObjects); } } }
public void Load() { var file = Path.Combine(DataFolder, "preferences.xml"); if (!File.Exists(file)) { DefaultSettings(); } else { var doc = XDocument.Load(file); foreach (var setElement in doc.Elements("preferences").Elements("assemblySets").Elements("set")) { var set = new AssemblySet((string)setElement.Attribute("name")); foreach (var asmElement in setElement.Elements("assembly")) { var asm = new AssemblyData(asmElement.Value); set.Add(asm); } AssemblySets.Add(set); } } }
private void DefaultSettings() { var set = new AssemblySet(); set.Name = string.Format(".Net v{0}", new AssemblyName(typeof(string).Assembly.FullName).Version.ToString()); set.Add(new AssemblyData(typeof(string).Assembly)); set.Add(new AssemblyData(typeof(System.Xml.XmlElement).Assembly)); AssemblySets.Add(set); }