public IContentWriter GetContentWriter(string path) { var info = PathInfo.UncheckedFileFromPath(path); if (info != null) { if (new RepoInfo(info.Org, info.Repo).Exists().Resolve()) { var writer = new HttpFileWriter(async(data) => { if (await info.Exists()) { await Static.Client.Repository.Content.UpdateFile( info.Org, info.Repo, info.FilePath, new UpdateFileRequest(string.Concat("Update ", info.Name), System.Text.Encoding.UTF8.GetString(data), info.Sha)); } else { await Static.Client.Repository.Content.CreateFile( info.Org, info.Repo, info.FilePath, new CreateFileRequest(string.Concat("Add ", info.Name), System.Text.Encoding.UTF8.GetString(data))); } PathInfo.PathInfoCache.Remove(info.VirtualPath); PathInfo.PathInfoCache.Remove(GetParentPath(path, null)); }); return(writer); } } return(null); }
public IContentWriter GetContentWriter(string path) { var info = PathInfo.UncheckedFileFromPath(path); if (info != null) { if (new RepoInfo(info.Org, info.Repo).Exists().Resolve()) { var writer = new HttpFileWriter(async (data) => { if (await info.Exists()) { await Static.Client.Repository.Content.UpdateFile( info.Org, info.Repo, info.FilePath, new UpdateFileRequest(string.Concat("Update ", info.Name), System.Text.Encoding.UTF8.GetString(data), info.Sha)); } else { await Static.Client.Repository.Content.CreateFile( info.Org, info.Repo, info.FilePath, new CreateFileRequest(string.Concat("Add ", info.Name), System.Text.Encoding.UTF8.GetString(data))); } PathInfo.PathInfoCache.Remove(info.VirtualPath); PathInfo.PathInfoCache.Remove(GetParentPath(path, null)); }); return writer; } } return null; }