コード例 #1
0
ファイル: Application.cs プロジェクト: jazmatician/BizArk3
        /// <summary>
        /// Gets the path to the temporary directory for this application. This is a subdirectory off of the system temp directory.
        /// </summary>
        /// <returns></returns>
        public static string GetTempPath()
        {
            string tempPath = Path.GetTempPath();

            if (!ExeName.IsEmpty())
            {
                tempPath = Path.Combine(tempPath, ExeName);
            }

            if (!Directory.Exists(tempPath))
            {
                Directory.CreateDirectory(tempPath);
            }

            return(tempPath);
        }
コード例 #2
0
        /// <summary>
        /// Validates this instance.
        /// </summary>
        /// <returns>True iff there are no validation errors</returns>
        private bool Validate()
        {
            validationErrors.Clear();

            if (!Directory.Exists(SelectedPath))
            {
                validationErrors.Add("SelectedPath", "The selected folder does not exist.");
            }

            if (ExeName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
            {
                validationErrors.Add("ExeName", "The file name is invalid.");
            }

            // Forces the bindings to be reassesed so we can handle validation
            this.RaisePropertyChanged(string.Empty);

            return(validationErrors.Count == 0);
        }
コード例 #3
0
ファイル: CscTask.cs プロジェクト: yaoyunzhe/nant
        /// <summary>
        /// Writes the compiler options to the specified <see cref="TextWriter" />.
        /// </summary>
        /// <param name="writer"><see cref="TextWriter" /> to which the compiler options should be written.</param>
        protected override void WriteOptions(TextWriter writer)
        {
            // causes the compiler to specify the full path of the file in which
            // an error was found
            WriteOption(writer, "fullpaths");

            // the base address for the DLL
            if (BaseAddress != null)
            {
                WriteOption(writer, "baseaddress", BaseAddress);
            }

            // If mcs is the compiler and the specified McsSdk version is specified, append the new
            // -sdk: option to the argument list.
            if (PlatformHelper.IsMono)
            {
                if (ExeName.Equals("mcs", StringComparison.InvariantCultureIgnoreCase) && _mcsSdk > 0)
                {
                    WriteOption(writer, "sdk", _mcsSdk.ToString());
                }
            }

            // XML documentation
            if (DocFile != null)
            {
                if (SupportsDocGeneration)
                {
                    WriteOption(writer, "doc", DocFile.FullName);
                }
                else
                {
                    Log(Level.Warning, ResourceUtils.GetString("String_CompilerDoesNotSupportXmlDoc"),
                        Project.TargetFramework.Description);
                }
            }

            // langversion
            if (LangVersion != null)
            {
                if (SupportsLangVersion)
                {
                    WriteOption(writer, "langversion", LangVersion);
                }
                else
                {
                    Log(Level.Warning, ResourceUtils.GetString("String_CompilerDoesNotSupportLangVersion"),
                        Project.TargetFramework.Description);
                }
            }

            // platform
            if (Platform != null)
            {
                if (SupportsPlatform)
                {
                    WriteOption(writer, "platform", Platform);
                }
                else
                {
                    Log(Level.Warning, ResourceUtils.GetString("String_CompilerDoesNotSupportPlatform"),
                        Project.TargetFramework.Description);
                }
            }

            // win32res
            if (Win32Res != null)
            {
                WriteOption(writer, "win32res", Win32Res.FullName);
            }

            // handle debug builds.
            switch (DebugOutput)
            {
            case DebugOutput.None:
                break;

            case DebugOutput.Enable:
                WriteOption(writer, "debug");
                WriteOption(writer, "define", "DEBUG");
                WriteOption(writer, "define", "TRACE");
                break;

            case DebugOutput.Full:
                WriteOption(writer, "debug");
                break;

            case DebugOutput.PdbOnly:
                WriteOption(writer, "debug", "pdbonly");
                break;

            default:
                throw new BuildException(string.Format(CultureInfo.InvariantCulture,
                                                       ResourceUtils.GetString("NA2011"), DebugOutput), Location);
            }

            if (FileAlign > 0)
            {
                WriteOption(writer, "filealign", FileAlign.ToString(CultureInfo.InvariantCulture));
            }

            if (NoStdLib)
            {
                WriteOption(writer, "nostdlib");
            }

            if (Checked)
            {
                WriteOption(writer, "checked");
            }

            if (Unsafe)
            {
                WriteOption(writer, "unsafe");
            }

            if (Optimize)
            {
                WriteOption(writer, "optimize");
            }

            if (WarningLevel != null)
            {
                WriteOption(writer, "warn", WarningLevel);
            }

            if (Codepage != null)
            {
                WriteOption(writer, "codepage", Codepage);
            }

            if (NoConfig && !Arguments.Contains("/noconfig"))
            {
                Arguments.Add(new Argument("/noconfig"));
            }
        }