1 /* 2 KeePass Password Safe - The Open-Source Password Manager 3 Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de> 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 */ 19 20 using System; 21 using System.Collections.Generic; 22 using System.Text; 23 using System.Diagnostics; 24 using System.CodeDom; 25 using System.CodeDom.Compiler; 26 using System.IO; 27 28 using KeePass.Resources; 29 30 using KeePassLib; 31 using KeePassLib.Utility; 32 33 namespace KeePass.Plugins 34 { 35 public enum PlgxProjectType 36 { 37 CSharp, 38 VisualBasic 39 } 40 41 public sealed class PlgxPluginInfo 42 { 43 public bool Compiling { get; set; } 44 public bool AllowCached { get; set; } 45 public bool AllowCompile { get; set; } 46 47 private TextWriter m_twLog = null; 48 public TextWriter LogStream 49 { 50 get { return m_twLog; } 51 set { m_twLog = value; } 52 } 53 54 private PlgxProjectType m_pt = PlgxProjectType.CSharp; 55 public PlgxProjectType ProjectType 56 { 57 get { return m_pt; } 58 set { m_pt = value; } 59 } 60 61 private PwUuid m_uuid = PwUuid.Zero; 62 public PwUuid FileUuid 63 { 64 get { return m_uuid; } 65 set 66 { 67 if(value == null) throw new ArgumentNullException("value"); 68 m_uuid = value; 69 } 70 } 71 72 private string m_strBaseFileName = string.Empty; 73 public string BaseFileName 74 { 75 get { return m_strBaseFileName; } 76 set 77 { 78 if(value == null) throw new ArgumentNullException("value"); 79 m_strBaseFileName = value; 80 } 81 } 82 83 private string m_strCsproj = string.Empty; 84 public string CsprojFilePath 85 { 86 get { return m_strCsproj; } 87 set 88 { 89 if(value == null) throw new ArgumentNullException("value"); 90 m_strCsproj = value; 91 } 92 } 93 94 private CompilerParameters m_cp = new CompilerParameters(); 95 public CompilerParameters CompilerParameters 96 { 97 get { return m_cp; } 98 set 99 { 100 if(value == null) throw new ArgumentNullException("value"); 101 m_cp = value; 102 } 103 } 104 105 private List<string> m_vFiles = new List<string>(); 106 public List<string> SourceFiles 107 { 108 get { return m_vFiles; } 109 set 110 { 111 if(value == null) throw new ArgumentNullException("value"); 112 m_vFiles = value; 113 } 114 } 115 116 private List<string> m_vIncRefAsms = new List<string>(); 117 public List<string> IncludedReferencedAssemblies 118 { 119 get { return m_vIncRefAsms; } 120 set 121 { 122 if(value == null) throw new ArgumentNullException("value"); 123 m_vIncRefAsms = value; 124 } 125 } 126 127 private List<string> m_vEmbeddedRes = new List<string>(); 128 public List<string> EmbeddedResourceSources 129 { 130 get { return m_vEmbeddedRes; } 131 set 132 { 133 if(value == null) throw new ArgumentNullException("value"); 134 m_vEmbeddedRes = value; 135 } 136 } 137 138 private List<string> m_vVbImports = new List<string>(); 139 public List<string> VbImports 140 { 141 get { return m_vVbImports; } 142 set 143 { 144 if(value == null) throw new ArgumentNullException("value"); 145 m_vVbImports = value; 146 } 147 } 148 PlgxPluginInfo(bool bCompiling, bool bAllowCached, bool bAllowCompile)149 public PlgxPluginInfo(bool bCompiling, bool bAllowCached, bool bAllowCompile) 150 { 151 this.Compiling = bCompiling; 152 this.AllowCached = bAllowCached; 153 this.AllowCompile = bAllowCompile; 154 } 155 GetAbsPath(string strRelPath)156 public string GetAbsPath(string strRelPath) 157 { 158 Debug.Assert(!string.IsNullOrEmpty(this.CsprojFilePath)); 159 return UrlUtil.MakeAbsolutePath(this.CsprojFilePath, 160 UrlUtil.ConvertSeparators(strRelPath)); 161 } 162 } 163 } 164