示例#1
0
        public override void WriteMergedFile(string absolutePathBase)
        {
            if (CalculateMergedFile() == false)
            {
                throw new WriteOutException(string.Format("Could not create the merged file for file \"{0}\". It has conflicts.", RelativeFilePath));
            }

            if (!MergedFile.HasContents)
            {
                // This occurs when the user analyses the files, then deletes the existing files on disk, then tries to write the files to disk
                if (!File.Exists(MergedFile.FilePath))
                {
                    WriteNewGenFile(absolutePathBase);
                    return;
                }
                else
                {
                    throw new WriteOutException("The Merged File does not have any contents. Has the file been analysed?");
                }
            }
            string filePath = Path.Combine(absolutePathBase, RelativeFilePath);

            Directory.CreateDirectory(Path.GetDirectoryName(filePath));
            string text = Common.Utility.StandardizeLineBreaks(MergedFile.GetContents(), Environment.NewLine);

            File.WriteAllText(filePath, text, Encoding);
        }
        public override void WriteMergedFile(string absolutePathBase)
        {
            if (!MergedFile.HasContents)
            {
                throw new WriteOutException("The Merged File does not have any contents. Has the file been analysed?");
            }

            string filePath = Path.Combine(absolutePathBase, RelativeFilePath);
            string dir      = Path.GetDirectoryName(filePath);

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

            File.WriteAllBytes(Path.Combine(absolutePathBase, RelativeFilePath), MergedFile.GetContents());
        }