⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cppnetcompilerparameters.cs

📁 c#源代码
💻 CS
📖 第 1 页 / 共 4 页
字号:
					case OptimizeLevel.Deactivated:
//						result.Append("/Od\n");
						break;
					case OptimizeLevel.MaximizeSpeed:
						result.Append("/O2\n");
						break;
					case OptimizeLevel.MinimizeSize:
						result.Append("/O1\n");
						break;
				}
				switch (FloatingPointConsistency) {
					case FloatingPointConsistency.Enhanced:
						result.Append("/Op\n");
						break;
				}
				switch (architecture) {
					case Architecture.Mixed:
						break;
					case Architecture.i386:
						result.Append("/G3\n");
						break;
					case Architecture.i486:
						result.Append("/G4\n");
						break;
					case Architecture.Pentium:
						result.Append("/G5\n");
						break;
					case Architecture.PentiumPRO:
						result.Append("/G6\n");
						break;
					case Architecture.Pentium4:
						result.Append("/G7\n");
						break;
				}
				if (UseGlobalOptimize) {
					result.Append("/Og\n");
				}
//				if (activateSysInternalFunctions) {
//					result.Append("/\n");
//				}
				if (surpressFramePointer) {
					result.Append("/Oy\n");
				}
				if (enableFiberSaveOptimize) {
					result.Append("/GT\n");
				}
				if (optimizeForWindowsExecutable) {
					result.Append("/GA\n");
				}
				switch (InlineFunctionExpansion) {
					case InlineFunctionExpansion.Automatic:
						result.Append("/Ob2\n");
						break;
					case InlineFunctionExpansion.Manual:
						result.Append("/Ob1\n");
						break;
					case InlineFunctionExpansion.Standard:
						break;
				}
				switch (SizeOrSpeedOptimization) {
					case SizeOrSpeedOptimization.Neither:
						break;
					case SizeOrSpeedOptimization.Size:
						result.Append("/Os\n");
						break;
					case SizeOrSpeedOptimization.Speed:
						result.Append("/Ot\n");
						break;
				}
				return result.ToString();
			}
		}
		#endregion
		
		#region Preprocessor Options
		[XmlNodeName("PreProcessorCPPOptions")]
		public class PreProcessorCPPOptions
		{
			[XmlAttribute("additionalDirectives")]
			public string additionalDirectives = "";
			
			[XmlAttribute("ignoreStandardIncludePath")]
			public bool ignoreStandardIncludePath = false;
			
			[XmlAttribute("preProcessorRun")]
			public PreProcessorRun preProcessorRun = PreProcessorRun.No;
			
			[XmlAttribute("keepComments")]
			public bool keepComments = true;
			
			[LocalizedProperty("Pre Processor Directives",
			                   Description = "Specifies additional pre processor directives. (/D[macro])")]
			public string AdditionalDirectives {
				get {
					return additionalDirectives;
				}
				set {
					additionalDirectives = value;
				}
			}
			
			[LocalizedProperty("Ignore standard search paths",
			                   Description = "If true, standard search paths are ignored. (/X)")]
			public bool IgnoreStandardIncludePath {
				get {
					return ignoreStandardIncludePath;
				}
				set {
					ignoreStandardIncludePath = value;
				}
			}
			
			[LocalizedProperty("Pre Processor Run",
			                   Description = "Specifies the pre processor options for this configuration. (/E, /P, /EP)")]
			public PreProcessorRun PreProcessorRun {
				get {
					return preProcessorRun;
				}
				set {
					preProcessorRun = value;
				}
			}
			
			[LocalizedProperty("Keep comments",
			                   Description = "Specifies if comments should be removed from the source code. (/C)")]
			public bool KeepComments {
				get {
					return keepComments;
				}
				set {
					keepComments = value;
				}
			}
			public string GetCommandLineParameters()
			{
				StringBuilder result = new StringBuilder();
				if (IsNotEmpty(additionalDirectives)) {
					AppendList(result, "/D", additionalDirectives);
				}
				if (ignoreStandardIncludePath) {
					result.Append("/X\n");
				}
				switch (preProcessorRun) {
					case PreProcessorRun.No:
						break;
					case PreProcessorRun.WithLineNumbers:
						result.Append("/P\n");
						if (keepComments) {
							result.Append("/C\n");
						}
						break;
					case PreProcessorRun.WithoutLineNumbers:
						result.Append("/EP\n/P\n");
						if (keepComments) {
							result.Append("/C\n");
						}
						break;
				}
				return result.ToString();
			}
		}
		#endregion
		
		#region Code Generation Options
		[XmlNodeName("CodeGenerationCPPOptions")]
		public class CodeGenerationCPPOptions
		{
			[XmlAttribute("activateStringPooling")]
			public bool activateStringPooling = false;
			
			[XmlAttribute("activateMinimalRecompilation")]
			public bool activateMinimalRecompilation = false;
			
			[XmlAttribute("activateCPPExceptions")]
			public bool activateCPPExceptions = true;
			
			[XmlAttribute("observeSmallTypes")]
			public bool observeSmallTypes = false;
			
			[XmlAttribute("runTimeObservation")]
			public RunTimeObservation runTimeObservation = RunTimeObservation.Standard;
			
			[XmlAttribute("runTimeLibrary")]
			public RunTimeLibrary runTimeLibrary = RunTimeLibrary.MultiThreaded;
			
			[XmlAttribute("structMemberAlignment")]
			public StructMemberAlignment structMemberAlignment = StructMemberAlignment.Standard;
			
			[XmlAttribute("bufferOverflowCheck")]
			public bool bufferOverflowCheck = false;
			
			[XmlAttribute("functionLevelLinking")]
			public bool functionLevelLinking = false;
			
			[XmlAttribute("enhancedInstructionSet")]
			public EnhancedInstructionSet enhancedInstructionSet = EnhancedInstructionSet.NotSpecified;
			
			[LocalizedProperty("Activate String Pooling",
			                   Description = "(/GF)")]
			public bool ActivateStringPooling {
				get {
					return activateStringPooling;
				}
				set {
					activateStringPooling = value;
				}
			}
			
			[LocalizedProperty("Activate minimal recompilation",
			                   Description = "(/Gm)")]
			public bool ActivateMinimalRecompilation {
				get {
					return activateMinimalRecompilation;
				}
				set {
					activateMinimalRecompilation = value;
				}
			}
			
			[LocalizedProperty("Activate C++ exceptions",
			                   Description = "(/EHsc)")]
			public bool ActivateCPPExceptions {
				get {
					return activateCPPExceptions;
				}
				set {
					activateCPPExceptions = value;
				}
			}
			
			[LocalizedProperty("Observe small types",
			                   Description = "(/RTCc)")]
			public bool ObserveSmallTypes {
				get {
					return observeSmallTypes;
				}
				set {
					observeSmallTypes = value;
				}
			}
			
			[LocalizedProperty("Full Runtimeobservation",
			                   Description = "(/RTCs, /RTCu, /RTC1)")]
			public RunTimeObservation RunTimeObservation {
				get {
					return runTimeObservation;
				}
				set {
					runTimeObservation = value;
				}
			}
			
			[LocalizedProperty("Runtime library",
			                   Description = "(/MT, /MTd, /MD, /MDd, /ML, /MLd)")]
			public RunTimeLibrary RunTimeLibrary {
				get {
					return runTimeLibrary;
				}
				set {
					runTimeLibrary = value;
				}
			}
			
			[LocalizedProperty("Struct member alignment",
			                   Description = "1, 2, 4, 8 or 16 byte. (/Zp[number])")]
			public StructMemberAlignment StructMemberAlignment {
				get {
					return structMemberAlignment;
				}
				set {
					structMemberAlignment = value;
				}
			}
			
			[LocalizedProperty("Buffer overwflow check",
			                   Description = "(/GS)")]
			public bool BufferOverflowCheck {
				get {
					return bufferOverflowCheck;
				}
				set {
					bufferOverflowCheck = value;
				}
			}
			
			[LocalizedProperty("Activate function level linking",
			                   Description = "(/Gy)")]
			public bool FunctionLevelLinking {
				get {
					return functionLevelLinking;
				}
				set {
					functionLevelLinking = value;
				}
			}
			
			[LocalizedProperty("Activate enhanced instruction set",
			                   Description = "(/arch:SSE, /arch:SSE2)")]
			public EnhancedInstructionSet EnhancedInstructionSet {
				get {
					return enhancedInstructionSet;
				}
				set {
					enhancedInstructionSet = value;
				}
			}
			
			public string GetCommandLineParameters()
			{
				StringBuilder result = new StringBuilder();
				if (activateStringPooling) {
					result.Append("/GF\n");
				}
				if (activateMinimalRecompilation) {
					result.Append("/Gm\n");
				}
				if (activateCPPExceptions) {
					result.Append("/EHsc\n");
				}
			
				if (observeSmallTypes) {
					result.Append("/RTCc\n");
				}
				switch (runTimeObservation) {
					case RunTimeObservation.Both:
						result.Append("/RTCsu\n");
						break;
					case RunTimeObservation.Stack:
						result.Append("/RTCs\n");
						break;
					case RunTimeObservation.UninitializedVariables:
						result.Append("/RTCu\n");
						break;
				}
				switch (runTimeLibrary) {
					case RunTimeLibrary.MultiThreaded:
						result.Append("/MT\n");
						break;
					case RunTimeLibrary.MultiThreadedDebug:
						result.Append("/MTd\n");
						break;
					case RunTimeLibrary.MultiThreadedDLL:
						result.Append("/MD\n");
						break;
					case RunTimeLibrary.MultiThreadedDebugDLL:
						result.Append("/MDd\n");
						break;
					case RunTimeLibrary.SingleThreaded:
						result.Append("/ML\n");
						break;
					case RunTimeLibrary.SingleThreadedDebug:
						result.Append("/MLd\n");
						break;
				}

				switch (structMemberAlignment) {
					case StructMemberAlignment.Standard:
						break;
					case StructMemberAlignment.Byte1:
						result.Append("/Zp1\n");
						break;
					case StructMemberAlignment.Byte2:
						result.Append("/Zp2\n");
						break;
					case StructMemberAlignment.Byte4:
						result.Append("/Zp4\n");
						break;
					case StructMemberAlignment.Byte8:
						result.Append("/Zp8\n");
						break;
					case StructMemberAlignment.Byte16:
						result.Append("/Zp16\n");
						break;
				}

				if (bufferOverflowCheck) {
					result.Append("/GS\n");
				}
				if (functionLevelLinking) {
					result.Append("/Gy\n");
				}
			
				switch (EnhancedInstructionSet) {
					case EnhancedInstructionSet.NotSpecified:
						break;
					case EnhancedInstructionSet.SSE:
						result.Append("/arch:SSE\n");
						break;
					case EnhancedInstructionSet.SSE2:
						result.Append("/arch:SSE2\n");
						break;
				}
				return result.ToString();
			}
		}
		#endregion
		
		#region Language Options
		[XmlNodeName("LanguageCPPOptions")]
		public class LanguageCPPOptions
		{
			[XmlAttribute("deactivateLanuageExtensions")]
			public bool deactivateLanuageExtensions = false;
			
			[XmlAttribute("standardCharTypeIsUnsigned")]
			public bool standardCharTypeIsUnsigned = true;
			
			[XmlAttribute("wchar_tIsBuiltIn")]
			public bool wchar_tIsBuiltIn = false;
			
			[XmlAttribute("forceForScope")]
			public bool forceForScope = false;
			
			[XmlAttribute("addRuntimeTypeInformation")]
			public bool addRuntimeTypeInformation = true;
			
			public bool DeactivateLanuageExtensions {
				get {
					return deactivateLanuageExtensions;
				}
				set {
					deactivateLanuageExtensions = value;
				}
			}
			public bool StandardCharTypeIsUnsigned {
				get {
					return standardCharTypeIsUnsigned;
				}
				set {
					standardCharTypeIsUnsigned = value;
				}
			}
			public bool Wchar_tIsBuiltIn {
				get {
					return wchar_tIsBuiltIn;
				}
				set {
					wchar_tIsBuiltIn = value;
				}
			}
			public bool ForceForScope {
				get {
					return forceForScope;
				}
				set {
					forceForScope = value;
				}
			}
			public bool AddRuntimeTypeInformation {
				get {
					return addRuntimeTypeInformation;
				}
				set {
					addRuntimeTypeInformation = value;
				}
			}
			public string GetCommandLineParameters()
			{
				StringBuilder result = new StringBuilder();
				
				if (deactivateLanuageExtensions) {
					result.Append("/Za\n");
				}
			
				if (standardCharTypeIsUnsigned) { 
					result.Append("/J\n");
				}
			
				if (wchar_tIsBuiltIn) { 
					result.Append("/Zc:wchar_t\n");
				}
			
				if (forceForScope) {
					result.Append("/Zc:forScope\n");
				}
			
				if (addRuntimeTypeInformation) { 
					result.Append("/GR\n");
				}
				
				return result.ToString();
			}
		}
		#endregion
		
		#region PreCompiler Header Options
		[XmlNodeName("PreCompiledHeaderCPPOptions")]
		public class PreCompiledHeaderCPPOptions
		{
			[XmlAttribute("preCompiledHeader")]
			public PreCompiledHeader preCompiledHeader = PreCompiledHeader.DontUsePre;
			
			[XmlAttribute("headerFile")]
			public string headerFile = "Stdafx.H";
			
			[ConvertToRelativePath()]
			[XmlAttribute("preCompiledHeaderFile")]
			public string preCompiledHeaderFile = "";
			
			public PreCompiledHeader PreCompiledHeader {
				get {
					return preCompiledHeader;
				}
				set {
					preCompiledHeader = value;
				}
			}
			public string HeaderFile {
				get {
					return headerFile;
				}
				set {
					headerFile = value;
				}
			}
			public string PreCompiledHeaderFile 
			{
				get 
				{
					return preCompiledHeaderFile;
				}
				set 
				{
					preCompiledHeaderFile = value;
				}
			}
			
			private void AppendHeaderFile(StringBuilder result) 
			{
				if (IsNotEmpty(headerFile)) {
					result.Append("\"");
					result.Append(headerFile);
					result.Append("\"");
				}
				result.Append("\n");
			}
			
			public string GetCreatePreCompiledHeaderParameter()
			{
				StringBuilder result = new StringBuilder();
				result.Append("/Yc");
				AppendHeaderFile(result);
				
				if (IsNotEmpty(preCompiledHeaderFile)) {
					AppendOption(result, "/Fp", preCompiledHeaderFile);
				}
							
				return result.ToString();
			}
			
			public bool PreCompileHeader {
				get {
					return preCompiledHeader == PreCompiledHeader.Create ||
					       preCompiledHeader == PreCompiledHeader.Use;
				}
			}
			
			public string GetCommandLineParameters()
			{
				StringBuilder result = new StringBuilder();
				switch (preCompiledHeader) {
					case PreCompiledHeader.DontUsePre:
						result.Append("/Y-\n");
						break;
					case PreCompiledHeader.Create:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -