当前位置: 首页>>代码示例>>C#>>正文


C# PlgxPluginInfo.GetAbsPath方法代码示例

本文整理汇总了C#中KeePass.Plugins.PlgxPluginInfo.GetAbsPath方法的典型用法代码示例。如果您正苦于以下问题:C# PlgxPluginInfo.GetAbsPath方法的具体用法?C# PlgxPluginInfo.GetAbsPath怎么用?C# PlgxPluginInfo.GetAbsPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KeePass.Plugins.PlgxPluginInfo的用法示例。


在下文中一共展示了PlgxPluginInfo.GetAbsPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Compile

		private static string Compile(string strTmpRoot, PlgxPluginInfo plgx,
			string strBuildPre, string strBuildPost)
		{
			if(strTmpRoot == null) { Debug.Assert(false); return null; }

			RunBuildCommand(strBuildPre, UrlUtil.EnsureTerminatingSeparator(
				strTmpRoot, false), null);

			PlgxCsprojLoader.LoadDefault(strTmpRoot, plgx);

			List<string> vCustomRefs = new List<string>();
			foreach(string strIncRefAsm in plgx.IncludedReferencedAssemblies)
			{
				string strSrcAsm = plgx.GetAbsPath(UrlUtil.ConvertSeparators(
					strIncRefAsm));
				string strCached = PlgxCache.AddCacheFile(strSrcAsm, plgx);
				if(string.IsNullOrEmpty(strCached))
					throw new InvalidOperationException();
				vCustomRefs.Add(strCached);
			}

			CompilerParameters cp = plgx.CompilerParameters;
			cp.OutputAssembly = UrlUtil.EnsureTerminatingSeparator(strTmpRoot, false) +
				UrlUtil.GetFileName(PlgxCache.GetCacheFile(plgx, false, false));
			cp.GenerateExecutable = false;
			cp.GenerateInMemory = false;
			cp.IncludeDebugInformation = false;
			cp.TreatWarningsAsErrors = false;
			cp.ReferencedAssemblies.Add(WinUtil.GetExecutable());
			foreach(string strCustomRef in vCustomRefs)
				cp.ReferencedAssemblies.Add(strCustomRef);

			CompileEmbeddedRes(plgx);
			PrepareSourceFiles(plgx);

			string[] vCompilers;
			Version vClr = Environment.Version;
			int iClrMajor = vClr.Major, iClrMinor = vClr.Minor;
			if((iClrMajor >= 5) || ((iClrMajor == 4) && (iClrMinor >= 5)))
			{
				vCompilers = new string[] {
					null,
					"v4.5",
					"v4", // Suggested in CodeDomProvider.CreateProvider doc
					"v4.0", // Suggested in community content of the above
					"v4.0.30319", // Deduced from file system
					"v3.5"
				};
			}
			else if(iClrMajor == 4) // 4.0
			{
				vCompilers = new string[] {
					null,
					"v4", // Suggested in CodeDomProvider.CreateProvider doc
					"v4.0", // Suggested in community content of the above
					"v4.0.30319", // Deduced from file system
					"v4.5",
					"v3.5"
				};
			}
			else // <= 3.5
			{
				vCompilers = new string[] {
					null,
					"v3.5",
					"v4", // Suggested in CodeDomProvider.CreateProvider doc
					"v4.0", // Suggested in community content of the above
					"v4.0.30319", // Deduced from file system
					"v4.5"
				};
			}

			CompilerResults cr = null;
			StringBuilder sbCompilerLog = new StringBuilder();
			bool bCompiled = false;
			for(int iCmp = 0; iCmp < vCompilers.Length; ++iCmp)
			{
				if(CompileAssembly(plgx, out cr, vCompilers[iCmp]))
				{
					bCompiled = true;
					break;
				}

				if(cr != null)
					AppendCompilerResults(sbCompilerLog, vCompilers[iCmp], cr);
			}

			if(!bCompiled)
			{
				if(Program.CommandLineArgs[AppDefs.CommandLineOptions.Debug] != null)
					SaveCompilerResults(plgx, sbCompilerLog);

				throw new InvalidOperationException();
			}

			Program.TempFilesPool.Add(cr.PathToAssembly);

			Debug.Assert(cr.PathToAssembly == cp.OutputAssembly);
			string strCacheAsm = PlgxCache.AddCacheAssembly(cr.PathToAssembly, plgx);

//.........这里部分代码省略.........
开发者ID:riking,项目名称:go-keepass2,代码行数:101,代码来源:PlgxPlugin.cs

示例2: ReadCompile

        private static void ReadCompile(XmlNode xn, PlgxPluginInfo plgx)
        {
            XmlNode xnInc = xn.Attributes.GetNamedItem(XnnInclude);
            if((xnInc == null) || string.IsNullOrEmpty(xnInc.Value)) { Debug.Assert(false); return; }

            plgx.SourceFiles.Add(plgx.GetAbsPath(xnInc.Value)); // Converts separators
        }
开发者ID:haro-freezd,项目名称:KeePass,代码行数:7,代码来源:PlgxCsprojLoader.cs

示例3: Compile

        private static string Compile(string strTmpRoot, PlgxPluginInfo plgx,
            string strBuildPre, string strBuildPost)
        {
            if(strTmpRoot == null) { Debug.Assert(false); return null; }

            RunBuildCommand(strBuildPre, UrlUtil.EnsureTerminatingSeparator(
                strTmpRoot, false), null);

            PlgxCsprojLoader.LoadDefault(strTmpRoot, plgx);

            List<string> vCustomRefs = new List<string>();
            foreach(string strIncRefAsm in plgx.IncludedReferencedAssemblies)
            {
                string strSrcAsm = plgx.GetAbsPath(UrlUtil.ConvertSeparators(
                    strIncRefAsm));
                string strCached = PlgxCache.AddCacheFile(strSrcAsm, plgx);
                if(string.IsNullOrEmpty(strCached))
                    throw new InvalidOperationException();
                vCustomRefs.Add(strCached);
            }

            CompilerParameters cp = plgx.CompilerParameters;
            cp.OutputAssembly = UrlUtil.EnsureTerminatingSeparator(strTmpRoot,
                false) + UrlUtil.GetFileName(PlgxCache.GetCacheFile(plgx.FileUuid,
                false, false));
            cp.GenerateExecutable = false;
            cp.GenerateInMemory = false;
            cp.IncludeDebugInformation = false;
            cp.TreatWarningsAsErrors = false;
            cp.ReferencedAssemblies.Add(WinUtil.GetExecutable());
            foreach(string strCustomRef in vCustomRefs)
                cp.ReferencedAssemblies.Add(strCustomRef);

            CompileEmbeddedRes(plgx);
            PrepareSourceFiles(plgx);

            string[] vCompilers = new string[] {
                null, "v3.5",
                "v4", // Suggested in CodeDomProvider.CreateProvider doc
                "v4.0" // Apparently works for most people
            };

            CompilerResults cr = null;
            bool bCompiled = false;
            for(int iCmp = 0; iCmp < vCompilers.Length; ++iCmp)
            {
                if(CompileAssembly(plgx, ref cr, vCompilers[iCmp]))
                {
                    bCompiled = true;
                    break;
                }
            }

            if(!bCompiled)
            {
                if(Program.CommandLineArgs[
                    AppDefs.CommandLineOptions.SavePluginCompileRes] != null)
                    SaveCompilerResults(plgx, cr);

                throw new InvalidOperationException();
            }

            Program.TempFilesPool.Add(cr.PathToAssembly);

            Debug.Assert(cr.PathToAssembly == cp.OutputAssembly);
            string strCacheAsm = PlgxCache.AddCacheAssembly(cr.PathToAssembly, plgx);

            RunBuildCommand(strBuildPost, UrlUtil.EnsureTerminatingSeparator(
                strTmpRoot, false), UrlUtil.GetFileDirectory(strCacheAsm, true, false));

            return strCacheAsm;
        }
开发者ID:amiryal,项目名称:keepass2,代码行数:72,代码来源:PlgxPlugin.cs

示例4: ReadEmbeddedRes

        private static void ReadEmbeddedRes(XmlNode xn, PlgxPluginInfo plgx)
        {
            XmlNode xnInc = xn.Attributes.GetNamedItem(XnnInclude);
            if((xnInc == null) || string.IsNullOrEmpty(xnInc.Value)) { Debug.Assert(false); return; }

            string strResSrc = plgx.GetAbsPath(xnInc.Value); // Converts separators
            plgx.EmbeddedResourceSources.Add(strResSrc);
        }
开发者ID:haro-freezd,项目名称:KeePass,代码行数:8,代码来源:PlgxCsprojLoader.cs

示例5: Compile

		private static string Compile(string strTmpRoot, PlgxPluginInfo plgx,
			string strBuildPre, string strBuildPost)
		{
			if(strTmpRoot == null) { Debug.Assert(false); return null; }

			RunBuildCommand(strBuildPre, UrlUtil.EnsureTerminatingSeparator(
				strTmpRoot, false), null);

			PlgxCsprojLoader.LoadDefault(strTmpRoot, plgx);

			List<string> vCustomRefs = new List<string>();
			foreach(string strIncRefAsm in plgx.IncludedReferencedAssemblies)
			{
				string strSrcAsm = plgx.GetAbsPath(UrlUtil.ConvertSeparators(
					strIncRefAsm));
				string strCached = PlgxCache.AddCacheFile(strSrcAsm, plgx);
				if(string.IsNullOrEmpty(strCached))
					throw new InvalidOperationException();
				vCustomRefs.Add(strCached);
			}

			CompilerParameters cp = plgx.CompilerParameters;
			cp.OutputAssembly = UrlUtil.EnsureTerminatingSeparator(strTmpRoot,
				false) + UrlUtil.GetFileName(PlgxCache.GetCacheFile(plgx.FileUuid,
				false, false));
			cp.GenerateExecutable = false;
			cp.GenerateInMemory = false;
			cp.IncludeDebugInformation = false;
			cp.TreatWarningsAsErrors = false;
			cp.ReferencedAssemblies.Add(WinUtil.GetExecutable());
			foreach(string strCustomRef in vCustomRefs)
				cp.ReferencedAssemblies.Add(strCustomRef);

			CompileEmbeddedRes(plgx);
			PrepareSourceFiles(plgx);

			CompilerResults cr;
			if(!CompileAssembly(plgx, out cr, null))
				if(!CompileAssembly(plgx, out cr, "v3.5"))
					throw new InvalidOperationException();

			Program.TempFilesPool.Add(cr.PathToAssembly);

			Debug.Assert(cr.PathToAssembly == cp.OutputAssembly);
			string strCacheAsm = PlgxCache.AddCacheAssembly(cr.PathToAssembly, plgx);

			RunBuildCommand(strBuildPost, UrlUtil.EnsureTerminatingSeparator(
				strTmpRoot, false), UrlUtil.GetFileDirectory(strCacheAsm, true, false));

			return strCacheAsm;
		}
开发者ID:ComradeP,项目名称:KeePass-2.x,代码行数:51,代码来源:PlgxPlugin.cs


注:本文中的KeePass.Plugins.PlgxPluginInfo.GetAbsPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。