コード例 #1
0
        public void UpdateHeaderFile(IServiceProvider aServiceProvider, bool aAddMode)
        {
            if (aAddMode)
            {
                mHeaderWriter.WriteForAdd(mWriteHeaderPath, mCodePage, mHeaderContent.SortedHeaderResults[DefaultHeaderFile].Count);
            }
            else
            {
                mHeaderWriter.WriteForEdit(mWriteHeaderPath, mCodePage);
            }

            try
            {
                // Replace header file from solution with the temp header file created for editing
                using (var guard = new SilentFileChangerGuard(aServiceProvider, DefaultHeaderFile, true))
                    File.Copy(mWriteHeaderPath, DefaultHeaderFile, true);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Unable to save header file {0}. Reason: {1}", DefaultHeaderFile, ex.Message));
            }
        }