public BlobViewModel(GithubService githubService, INavigationService navigationService, string username, string repo, string sha, string path) { Path = path; RepoName = String.Format("{0}/{1}", username, repo); githubService.Load(new Blob(username, repo, sha), b => { byte[] encodedDataAsBytes = Convert.FromBase64String(b.Content); String content = Encoding.UTF8.GetString(encodedDataAsBytes, 0, encodedDataAsBytes.Length); TextFile = content.Split('\n'); HeaderSignature type = new ContentGuesser().GuessType(path, encodedDataAsBytes); if (type != null) Console.Out.WriteLine(type.SignatureName); }); }
public BlobViewModel(GithubService githubService, INavigationService navigationService, string username, string repo, string sha, string path) { Path = path; RepoName = String.Format("{0}/{1}", username, repo); githubService.Load(new BlobRequest(username, repo, sha), b => { var encodedDataAsBytes = Convert.FromBase64String(b.Content); var content = Encoding.UTF8.GetString(encodedDataAsBytes, 0, encodedDataAsBytes.Length); TextFile = content.Split('\n'); var type = new ContentGuesser().GuessType(path, encodedDataAsBytes); if (type != null) { Console.Out.WriteLine(type.SignatureName); } }); }