Beispiel #1
0
        public void UpdateResourceFiles(IServiceProvider aServiceProvider)
        {
            mRcFileWriter.WriteData(mRcFileContent, mTempRcFile);
            mHeaderFileWriter.WriteFile(mRcFileContent, DefaultHeaderFile, mTempHeaderFile);

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

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

            try
            {
                // Replace RC file from solution with the temp RC file created for editing
                using (var guard = new SilentFileChangerGuard(aServiceProvider, RcFile.FilePath, true))
                    File.Copy(mWriteRCPath, RcFile.FilePath, true);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Unable to save RC file {0}. Reason: {1}", RcFile, ex.Message));
            }
        }
        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));
            }
        }