GitCommands.GitModule.GetFileContents C# (CSharp) Method

GetFileContents() public method

public GetFileContents ( GitCommands.GitItemStatus file ) : string
file GitCommands.GitItemStatus
return string
        public string GetFileContents(GitItemStatus file)
        {
            var contents = new StringBuilder();

            string currentContents = GetFileContents(file.Name);
            if (currentContents != null)
                contents.Append(currentContents);

            if (file.OldName != null)
            {
                string oldContents = GetFileContents(file.OldName);
                if (oldContents != null)
                    contents.Append(oldContents);
            }

            return contents.Length > 0 ? contents.ToString() : null;
        }

Same methods

GitModule::GetFileContents ( string path ) : string

Usage Example

        private static string GetChangedFileText(GitModule module, GitItemStatus file)
        {
            var changes = module.GetCurrentChanges(file.Name, file.OldName, file.IsStaged, "-U1000000", module.FilesEncoding);

            if (changes != null)
                return changes.Text;

            var content = module.GetFileContents(file);

            if (content != null)
                return content;

            return File.ReadAllText(Path.Combine(module.WorkingDir, file.Name));
        }
All Usage Examples Of GitCommands.GitModule::GetFileContents
GitModule