internal bool GetVstoAddInData(bool scanManagedInterfaces, bool scanRemote, ref bool isUncPath, ref bool isHttpPath) { bool flag = true; string[] assemblyDetails = (string[])null; this.assemblyPath = (string)null; this.vstoRuntime = (string)null; this.assemblyVersion = Resources.NOT_APPLICABLE; this.addInType = Resources.ADDIN_TYPE_VSTO; this.assemblyName = (string)null; this.clrVersion = (string)null; this.supportedInterfaces = (string)null; string str = string.Empty; if (this.manifestPath.EndsWith(".manifest")) { this.assemblyPath = this.manifestPath.Substring(0, this.manifestPath.LastIndexOf(".manifest")); this.vstoRuntime = "2005 SE"; } else if (this.manifestPath.EndsWith(".vsto|vstolocal")) { this.vstoRuntime = "2008"; this.clsid = Resources.NOT_APPLICABLE; this.assemblyPath = this.manifestPath.Substring(0, this.manifestPath.LastIndexOf(".vsto|vstolocal")) + ".dll"; } else if (this.manifestPath.EndsWith(".vsto")) { this.vstoRuntime = "2008"; this.clsid = Resources.NOT_APPLICABLE; string[] clickOnceInfo = ManifestReader.GetClickOnceInfo(ref this.manifestPath, scanRemote, ref isUncPath, ref isHttpPath); this.assemblyPath = clickOnceInfo[0]; this.assemblyVersion = clickOnceInfo[1]; } if (File.Exists(this.assemblyPath)) { assemblyDetails = AssemblyScanner.GetAssemblyInfo(this.assemblyPath, this.hostName, true); } if (assemblyDetails != null && assemblyDetails.Length > 1) { this.assemblyName = assemblyDetails[0]; this.clrVersion = assemblyDetails[1]; this.supportedInterfaces = !scanManagedInterfaces ? (string)null : this.GetSupportedInterfaces(assemblyDetails); } else { flag = false; this.assemblyName = (string)null; this.clrVersion = (string)null; this.supportedInterfaces = (string)null; } return(flag); }
internal static string[] GetClickOnceInfo(ref string manifestPath, bool scanRemote, ref bool isUncPath, ref bool isHttpPath) { string[] strArray = new string[2]; string str1 = string.Empty; string baseDir = string.Empty; string str2 = string.Empty; XmlDocument deployDoc = new XmlDocument(); if (manifestPath == null || manifestPath.Length == 0) { throw new ArgumentException(Resources.EMPTY_MANIFESTPATH); } try { Uri uri = new Uri(manifestPath); bool flag; if (uri.IsLoopback) { flag = ManifestReader.GetManifestFromLocalPath(deployDoc, ref manifestPath, out baseDir); } else if (uri.IsUnc) { isUncPath = true; flag = scanRemote && ManifestReader.GetManifestFromUncPath(deployDoc, ref manifestPath, out baseDir); } else if (uri.Host != null && uri.Host.Length > 0) { isHttpPath = true; flag = scanRemote && ManifestReader.GetManifestFromHttpUrlPath(manifestPath, deployDoc, out baseDir); } else { flag = false; } if (flag) { XmlNamespaceManager nsmgr = new XmlNamespaceManager(deployDoc.NameTable); nsmgr.AddNamespace("asmv1", "urn:schemas-microsoft-com:asm.v1"); nsmgr.AddNamespace("def", "urn:schemas-microsoft-com:asm.v2"); XmlNode xmlNode1 = (XmlNode)deployDoc.DocumentElement; XmlNode xmlNode2 = xmlNode1.SelectSingleNode("/asmv1:assembly/def:dependency/def:dependentAssembly", nsmgr); XmlNode xmlNode3 = xmlNode1.SelectSingleNode("/asmv1:assembly/def:dependency/def:dependentAssembly/def:assemblyIdentity", nsmgr); string path2_1 = xmlNode2.Attributes["codebase"].Value; string path2_2 = xmlNode3.Attributes["name"].Value; str2 = xmlNode3.Attributes["version"].Value; if (isHttpPath) { string str3 = (baseDir + path2_1).Replace("\\", "/"); str1 = str3.Substring(0, str3.LastIndexOf(".manifest")) + ".deploy"; } else { str1 = Path.Combine(Path.GetDirectoryName(Path.Combine(baseDir, path2_1)), path2_2) + ".deploy"; } } else { str1 = (string)null; str2 = (string)null; } } catch (Exception ex) { Globals.AddException(ex); } strArray[0] = str1; strArray[1] = str2; return(strArray); }