public void ReturnAListOfTheUsersGists_WhenTheUsersIdIsValid() { var expectedGist = new Gist(1); IEnumerable<Gist> gists = gistApi.Get(); Assert.AreEqual(expectedGist.Identity, gists.First().Identity); }
public void ReturnTheSpecifiedGist_WhenTheGistIdentityIsValid_AndTheGistBelongsToTheCurrentUser() { const int gistIdentity = 1; var expectedGist = new Gist(gistIdentity); Gist gist = gistApi.Get(gistIdentity); Assert.AreEqual(expectedGist.Identity, gist.Identity); }
public static async Task <Gist> GistStrategyArchive(string name) { Gist gist = (await GistStrategyFindByName(name)).SingleOrDefault(); if (gist == null) { throw new Exception(new { gist = name, message = "Not found" } +""); } var newGist = new GistUpdate(); gist.Files.ForEach((file, i) => newGist.Files.Add(file.Key, new GistFileUpdate { NewFileName = file.Key.Replace(prefix, prefix_), Content = file.Value.Content })); return(await ClientFactory().Gist.Edit(gist.Id, newGist)); }
private void SelectFileInGist(Gist gist, string filename = null) { var node = tvGists.Nodes.Find(gist.Id + "/" + (!string.IsNullOrEmpty(tbGistName.Text) ? tbGistName.Text : gist.Files.First().Key), true); if (node.Length > 0) { BeginInvoke((Action) delegate { node[0].EnsureVisible(); tvGists.Select(); tvGists.SelectedNode = node[0]; }); } }
public static bool GetGistContents(string filePath, Gist gist, out string text, out MemoryStream stream) { var base64FilePath = filePath + Base64Modifier; foreach (var entry in gist.Files) { var file = entry.Value; var isMatch = entry.Key == filePath || entry.Key == base64FilePath; if (!isMatch) { continue; } // GitHub can truncate Gist and return partial content if ((string.IsNullOrEmpty(file.Content) || file.Content.Length < file.Size) && file.Truncated) { file.Content = file.Raw_Url.GetStringFromUrl( requestFilter: req => req.UserAgent = nameof(GitHubGateway)); } text = file.Content; if (entry.Key == filePath) { if (filePath.EndsWith(Base64Modifier)) { stream = MemoryStreamFactory.GetStream(FromBase64String(entry.Key, text)); text = null; } else { var bytesMemory = MemoryProvider.Instance.ToUtf8(text.AsSpan()); stream = MemoryProvider.Instance.ToMemoryStream(bytesMemory.Span); } return(true); } if (entry.Key == base64FilePath) { stream = MemoryStreamFactory.GetStream(FromBase64String(entry.Key, text)); text = null; return(true); } } text = null; stream = null; return(false); }
private GistItemViewModel CreateGistItemViewModel(Gist gist) { var title = (gist.Owner == null) ? "Anonymous" : gist.Owner.Login; var description = string.IsNullOrEmpty(gist.Description) ? "Gist " + gist.Id : gist.Description; var imageUrl = (gist.Owner == null) ? null : gist.Owner.AvatarUrl; if (gist.Files.Count > 0) { title = gist.Files.First().Key; } return(new GistItemViewModel(title, imageUrl, description, gist.UpdatedAt, _ => { var vm = this.CreateViewModel <GistViewModel>(); vm.Init(gist.Id, gist); NavigateTo(vm); })); }
public GistEditViewController(Gist gist) : base(UITableViewStyle.Grouped, true) { Title = "Edit Gist"; _originalGist = gist; _model = new GistUpdate(); _model.Description = gist.Description; if (gist.Files != null) { foreach (var f in gist.Files) { _model.Files.Add(f.Key, new GistFileUpdate { Content = f.Value.Content }); } } }
public static bool GetGistContents(string filePath, Gist gist, out string text, out MemoryStream stream) { var base64FilePath = filePath + "|base64"; foreach (var entry in gist.Files) { var file = entry.Value; var isMatch = entry.Key == filePath || entry.Key == base64FilePath; if (!isMatch) { continue; } if (string.IsNullOrEmpty(file.Content) && file.Truncated) { file.Content = file.Raw_Url.GetStringFromUrl( requestFilter: req => req.UserAgent = nameof(GitHubGateway)); } text = file.Content; if (entry.Key == filePath) { var bytesMemory = MemoryProvider.Instance.ToUtf8(text.AsSpan()); //TODO: replace with MemoryProvider.Instance.ToMemoryStream() stream = MemoryStreamFactory.GetStream(bytesMemory.ToArray()); return(true); } if (entry.Key == base64FilePath) { stream = MemoryStreamFactory.GetStream(Convert.FromBase64String(text)); text = null; return(true); } } text = null; stream = null; return(false); }
public void RendersGistWithoutFile() { TestExecutionContext context = new TestExecutionContext(); TestDocument document = new TestDocument(); KeyValuePair <string, string>[] args = new KeyValuePair <string, string>[] { new KeyValuePair <string, string>(null, "abc"), new KeyValuePair <string, string>(null, "def") }; Gist shortcode = new Gist(); // When IShortcodeResult result = shortcode.Execute(args, null, document, context); // Then using (TextReader reader = new StreamReader(result.Stream)) { reader.ReadToEnd().ShouldBe( "<script src=\"//gist.github.com/def/abc.js\" type=\"text/javascript\"></script>"); } }
private List <Item> EnsureItemsAreLoaded() { if (string.IsNullOrWhiteSpace(_gistId)) { List <Item> emptyItems = new List <Item>(); var gist = CreateGist(emptyItems); return(emptyItems); } try { Gist gist = LoadGist(); string jsonContents = gist.Files["todolist.json"].Content; var items = JsonConvert.DeserializeObject <List <JsonItem> >(jsonContents); return(items.Cast <Item>().ToList()); } catch (Octokit.NotFoundException) { List <Item> emptyItems = new List <Item>(); var gist = CreateGist(emptyItems); return(emptyItems); } }
private Gist RenameFileInGist(Gist gist, GistFile file) { var fileContent = PluginBase.GetCurrentFileText(); var editingGist = new UpdatedGist(); if (gist.Description != tbDescription.Text) { editingGist.Description = tbDescription.Text; } editingGist.Files = new Dictionary <string, UpdatedFile> { { file.Filename, new UpdatedFile { Filename = tbGistName.Text, Content = fileContent } } }; var bytes = Encoding.UTF8.GetBytes(JsonSerializer.SerializeToString(editingGist)); var responseGist = Utils.SendJsonRequest <Gist>($"{Main.ApiUrl}/gists/{gist.Id}?access_token={Main.Token}", WebRequestMethod.Patch, null, bytes); gists[gist.Id] = responseGist; return(responseGist); }
private void FSI_Button_Click(object sender, RoutedEventArgs e) { var watch = Stopwatch.StartNew(); Gist gist = new Gist(); GistContainer gistcontainer = new GistContainer(); System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; gist.LMgist("D:/Codes/Petrel 2015 Plugin/LMgistPlugin1/Tester1/Resources/demo1.jpg", ref gistcontainer, 1); gist.LMgist("D:/Codes/Petrel 2015 Plugin/LMgistPlugin1/Tester1/Resources/demo3.jpg", ref gistcontainer, 2); System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; watch.Stop(); var elapsedSec = watch.ElapsedMilliseconds / 1000.0; Console.Write("Distance13 : {0} elapsed time: {1}", gist.FindDistance(gistcontainer), elapsedSec); using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"D:/Codes/Petrel 2015 Plugin/LMgistPlugin1/Tester1/Resources/result.txt", true)) { file.WriteLine("Distance13 : {0} elapsed time: {1}", gist.FindDistance(gistcontainer), elapsedSec); } //gist.Print2DArray(gistcontainer.refImage, gistcontainer.refImageRows, gistcontainer.refImageCols); //gist.Print2DArray(gistcontainer.secondImage, gistcontainer.secondImageRows, gistcontainer.secondImageCols); Console.ReadKey(); }
public static string GetGistName(Gist gist) { var firstNamedFile = GetFirstNamed(gist); return(firstNamedFile == null ? "gist:" + gist.Id : firstNamedFile.Filename); }
public static GistFile GetFirstNamed(Gist gist) { var result = gist.Files.FirstOrDefault(g => !g.Key.StartsWith("gistfile")); return(result.Key != null ? result.Value : null); }
public static string GetTreeViewKey(Gist gist, GistFile file) { return(gist.Id + "/" + file.Filename); }
private string GetEmbedContent(Gist gist, string source) { var template = _gistConfig.Value.EmbedTemplate[source]; return(string.Format(template, gist.Owner.Login, gist.Id)); }
public static string GetTreeViewKey(Gist gist, GistFile file) { return gist.Id + "/" + file.Filename; }
private Gist UpdateOrCreateFileInGist(Gist gist) { var fileContent = PluginBase.GetCurrentFileText(); var editingGist = new UpdatedGist(); if (gist.Description != tbDescription.Text) editingGist.Description = tbDescription.Text; editingGist.Files = new Dictionary<string, UpdatedFile>() { { tbGistName.Text, new UpdatedFile { Content = fileContent }} }; var bytes = Encoding.UTF8.GetBytes(JsonSerializer.SerializeToString<UpdatedGist>(editingGist)); var responseGist = Utils.SendJsonRequest<Gist>(string.Format("{0}/gists/{1}?access_token={2}", Main.ApiUrl, gist.Id, Main.Token), WebRequestMethod.Patch, null, bytes); Gists[gist.Id] = responseGist; return responseGist; }
public GistVirtualFiles(Gist gist, IGistGateway gateway) : this(gist.Id, gateway) => InitGist(gist);
public static string GetGistName(Gist gist) { var firstNamedFile = GetFirstNamed(gist); return firstNamedFile == null ? "gist:" + gist.Id : firstNamedFile.Filename; }
public void ParseUrl(string url) { Gist.ParseIdFromUrl(url).Should().Be(5731704); }
public static string Strategy(this Gist gist) { return(gist.Files.Select(file => CleanStrategyName(file.Key)).First()); }
public static async void PutNewJsonGists(string json) { var token = ""; try { StreamReader sr = new StreamReader("token.txt"); token = sr.ReadLine(); sr.Close(); } catch (Exception ex) { MessageBox.Show("nie znaleziono pliku token.txt, nie można zaktualizować planu na gist"); throw ex; } string idTimetable = "1f97642898f77f65550ff551eca089ca";; //timetable.json string idTimetableDate = "db635e765ddfb8b0405d680ac49c6d50";; //timetable_date.json var github = new GitHubClient(new Octokit.ProductHeaderValue("Parserv2")); async Task <bool> sendPatch(string content, string id, string filename) { var basicAuth = new Credentials("silvernetgroup", token); github.Credentials = basicAuth; GistUpdate gistUpdate = new GistUpdate() { Description = "" }; gistUpdate.Files.Add(filename, new GistFileUpdate() { Content = content }); try { Gist g = await github.Gist.Edit(id, gistUpdate); } catch (Exception ex) { return(false); } return(true); } if (await sendPatch(json, idTimetable, "timetable.json")) { MessageBox.Show("Timetable updated"); } else { MessageBox.Show("Nie zaktualizowano planu"); } // To get correct format of date string dynamic deserializedJson = JsonConvert.DeserializeObject(json); DateTime date = deserializedJson.Date; if (await sendPatch(JsonConvert.SerializeObject(date), idTimetableDate, "timetable_date.json")) { MessageBox.Show("Date updated " + date.ToString()); } else { MessageBox.Show("Nie zaktualizowano daty"); } }
public UploadResult UploadText(Stream stream, string fileName) { TextUploader textUploader = null; switch (Info.TaskSettings.TextDestination) { case TextDestination.Pastebin: PastebinSettings settings = Program.UploadersConfig.PastebinSettings; if (string.IsNullOrEmpty(settings.TextFormat)) { settings.TextFormat = Info.TaskSettings.AdvancedSettings.TextFormat; } textUploader = new Pastebin(ApiKeys.PastebinKey, settings); break; case TextDestination.PastebinCA: textUploader = new Pastebin_ca(ApiKeys.PastebinCaKey, new PastebinCaSettings { TextFormat = Info.TaskSettings.AdvancedSettings.TextFormat }); break; case TextDestination.Paste2: textUploader = new Paste2(new Paste2Settings { TextFormat = Info.TaskSettings.AdvancedSettings.TextFormat }); break; case TextDestination.Slexy: textUploader = new Slexy(new SlexySettings { TextFormat = Info.TaskSettings.AdvancedSettings.TextFormat }); break; case TextDestination.Pastee: textUploader = new Pastee { Lexer = Info.TaskSettings.AdvancedSettings.TextFormat }; break; case TextDestination.Paste_ee: textUploader = new Paste_ee(Program.UploadersConfig.Paste_eeUserAPIKey); break; case TextDestination.Gist: textUploader = new Gist(); break; case TextDestination.CustomTextUploader: if (Program.UploadersConfig.CustomUploadersList.IsValidIndex(Program.UploadersConfig.CustomTextUploaderSelected)) { textUploader = new CustomTextUploader(Program.UploadersConfig.CustomUploadersList[Program.UploadersConfig.CustomTextUploaderSelected]); } break; } if (textUploader != null) { PrepareUploader(textUploader); return(textUploader.UploadText(stream, fileName)); } return(null); }
public GistVirtualFiles(Gist gist) : this(gist.Id) => InitGist(gist);
public static GistFile GetFirstNamed(Gist gist) { var result = gist.Files.FirstOrDefault(g => !g.Key.StartsWith("gistfile")); return result.Key != null ? result.Value : null; }
public static string[] Names(this Gist gist) { return(gist.Files.Select(file => file.Key).Take(1).ToArray()); }
private void PCG_Button_Click(object sender, RoutedEventArgs e) { Gist gist = new Gist(); FolderBrowserDialog infbd = new FolderBrowserDialog(); // Set the help text description for the FolderBrowserDialog. infbd.Description = "Select Input image directory"; DialogResult result = infbd.ShowDialog(); FolderBrowserDialog outfbd = new FolderBrowserDialog(); outfbd.Description = "Select Output directory to save the image gist"; DialogResult result1 = outfbd.ShowDialog(); gist.defaultOutputDirectory = outfbd.SelectedPath; gist.defaultOutputDirectory = gist.defaultOutputDirectory + "\\"; this.defaultOutputDirectory = gist.defaultOutputDirectory; string[] files = Directory.GetFiles(infbd.SelectedPath); string[] imageExtensionList = { ".jpg", ".jpeg", ".png", ".bmp" }; //first create gistdata for every image files foreach (string path in files) { if (File.Exists(path) && (hasExtension(System.IO.Path.GetExtension(path), imageExtensionList))) { gist.LMgist(path); } } //Now for every .metadata file, update the corresponding gistdata in defaultOutputDirectory string[] gistdatafiles = Directory.GetFiles(outfbd.SelectedPath); for (int i = 0; i < gistdatafiles.Length; i++) { gistdatafiles[i] = gistdatafiles[i].Replace(defaultOutputDirectory, ""); } foreach (string path in files) { if (File.Exists(path) && System.IO.Path.GetExtension(path).Equals(".metadata", StringComparison.OrdinalIgnoreCase)) { string folder = System.IO.Path.GetDirectoryName(path); folder = folder + "\\"; string metadataFilenameOnly = path.Replace(folder, "").Replace(".metadata", ""); string jfilename = defaultOutputDirectory + metadataFilenameOnly; if (File.Exists(jfilename) /*&& gistdatafiles.Contains(metadataFilenameOnly)*/) { string metadatatext = System.IO.File.ReadAllText(@path); var jsonMeta = JsonConvert.SerializeObject(metadatatext, Formatting.Indented); string json = File.ReadAllText(@defaultOutputDirectory + metadataFilenameOnly); dynamic jsonObj = Newtonsoft.Json.JsonConvert.DeserializeObject(json); jsonObj["metadata"] = jsonMeta; string output = Newtonsoft.Json.JsonConvert.SerializeObject(jsonObj, Newtonsoft.Json.Formatting.Indented); File.WriteAllText(@jfilename, output); } } } // Recurse into subdirectories of this directory. string[] subdirectoryEntries = Directory.GetDirectories(infbd.SelectedPath); foreach (string subdirectory in subdirectoryEntries) { gist.ProcessDirectory(subdirectory, gist); } Console.WriteLine("Done precomputing"); }
private void FSI_Button_Click(object sender, RoutedEventArgs e) { Gist gist = new Gist(); var refgistdata = new GistData(); //System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Title = "Locate the file to compare"; DialogResult result = openFileDialog1.ShowDialog(); // Show the dialog. if (result == System.Windows.Forms.DialogResult.OK) // Test result. { string refImage = openFileDialog1.FileName; Image i = new Image(); BitmapImage src = new BitmapImage(); src.BeginInit(); src.UriSource = new Uri(refImage, UriKind.Relative); src.CacheOption = BitmapCacheOption.OnLoad; src.EndInit(); i.Source = src; i.Stretch = Stretch.Uniform; //int q = src.PixelHeight; // Image loads here sp0.Children.Clear(); // clear previous image sp0.Children.Add(i); gist.defaultOutputDirectory = defaultOutputDirectory; System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; gist.LMgist(refImage, true); refgistdata = gist.refImgGistData; globalrefgistdata = refgistdata; //save it for KNN Console.WriteLine("Done reading reference"); //Now compare refImage with precomputed gists FolderBrowserDialog infbd = new FolderBrowserDialog(); infbd.Description = "Select the directory that contains precomputed Image gists"; DialogResult result1 = infbd.ShowDialog(); if (result1 == System.Windows.Forms.DialogResult.OK) // Test result1. { string[] files = Directory.GetFiles(infbd.SelectedPath); List <GistData> gistdataforSort = new List <GistData>(); foreach (string path in files) { if (File.Exists(path)) { // This path is a file var gistdata = gist.JsonRead(path); var distance = gist.FindDistance(refgistdata, gistdata); var gistdataWithoutValue = new GistData(distance, gistdata.filename, gistdata.metadata); gistdataforSort.Add(gistdataWithoutValue); using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"D:/result.txt", true)) { file.WriteLine("{0} {1} {2}", distance, gistdata.filename, gistdata.metadata); } Console.WriteLine("D= {0} File= {1}", gist.FindDistance(refgistdata, gistdata), gistdata.filename); } else { Console.WriteLine("{0} is not a valid file or directory.", path); } } Console.WriteLine("Done FSI"); globalgistdatalist = gistdataforSort.OrderBy(o => o.distance).ToList(); //Now load the files in the stack panel for (int j = 0; j < globalgistdatalist.Count; j++) { if (j > 0) { if (globalgistdatalist[j].filename == globalgistdatalist[j - 1].filename && globalgistdatalist[j].distance == globalgistdatalist[j - 1].distance) { continue; } } Image img = new Image(); BitmapImage source = new BitmapImage(); source.BeginInit(); source.UriSource = new Uri(globalgistdatalist[j].filename, UriKind.Relative); source.CacheOption = BitmapCacheOption.OnLoad; source.DecodePixelWidth = 200; source.DecodePixelHeight = 200; source.EndInit(); img.Source = source; img.Stretch = Stretch.UniformToFill; int qq = source.PixelHeight; // Image loads here System.Windows.Controls.ToolTip tooltip = new System.Windows.Controls.ToolTip(); tooltip.Content = globalgistdatalist[j].metadata; img.ToolTip = tooltip; //sp1.Children.Add(img); //lv1.Items.Add(img); //imgrid.Source = source; //System.Windows.Controls.CheckBox checkbox = new System.Windows.Controls.CheckBox(); //checkbox.HorizontalAlignment = HorizontalAlignment.Left; //checkbox.VerticalAlignment = VerticalAlignment.Bottom; System.Windows.Controls.RadioButton radio1like = new System.Windows.Controls.RadioButton(); System.Windows.Controls.RadioButton radio2dislike = new System.Windows.Controls.RadioButton(); radio1like.VerticalAlignment = VerticalAlignment.Bottom; radio1like.Content = "Yes"; radio2dislike.VerticalAlignment = VerticalAlignment.Bottom; radio2dislike.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; radio2dislike.Content = "No"; var grid = new Grid(); grid.Children.Add(img); grid.Children.Add(radio1like); grid.Children.Add(radio2dislike); lv1.Items.Add(grid); //if (checkbox.IsChecked == true) //{ // globalgistdatalist[j].IsSimilar = 1; // imgrid.Source = source; //} //else // globalgistdatalist[j].IsSimilar = -1; if (radio1like.IsChecked == true) { globalgistdatalist[j].IsSimilar = 1; } else if (radio2dislike.IsChecked == true) { globalgistdatalist[j].IsSimilar = -1; } Console.WriteLine("FSI: " + globalgistdatalist[j].filename + " " + globalgistdatalist[j].IsSimilar + " distance :" + globalgistdatalist[j].distance); } } System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
public GistViewModel Init(string id, Gist gist = null) { Id = id; Gist = gist; return(this); }
public void ClearGist() => gistCache = null;
protected override void Seed(DbInventarisContext context) { // creation startupobjects Brouwerij rockaBeery = new Brouwerij { Naam = "Rock a Beery" }; Brouwerij duvel = new Brouwerij { Naam = "Duvel" }; Hop saaz = new Hop { Naam = "Saaz", Alfa = 5.1m, Omschrijving = "Courant gebruikte aromahop." }; Mout pilsmout = new Mout { Ebc = 5, MaximumStorting = 100, Naam = "Pilsmout", Omschrijving = "Meest gebruikte mout in verschillende bierstijlen." }; Gist gist = new Gist { Verpakking = Verpakking.Smackpack, Naam = "Whyeast", Omschrijving = "Westmalle" }; Gist gist2 = new Gist { Verpakking = Verpakking.Zakje, Naam = "T-58", Omschrijving = "korrelgist alle biertype" }; Overige overige1 = new Overige { Naam = "Kristalsuiker", Omschrijving = "ook voor in de koffie." }; Overige overige2 = new Overige { Naam = "Koriander", Omschrijving = "Ook lekker in nen curry" }; User bernd = new User { UserName = "******", Brouwerij = rockaBeery, Email = "*****@*****.**", FirstName = "Bernd", LastName = "Vertommen" }; User jimmy = new User { UserName = "******", Brouwerij = rockaBeery, Email = "*****@*****.**", FirstName = "Jimmy", LastName = "Henderickx" }; User kobe = new User { UserName = "******", Brouwerij = rockaBeery, Email = "*****@*****.**", FirstName = "Kobe", LastName = "Vercauteren" }; Aankoop aankoop2 = new Aankoop { Aankoopdatum = new DateTime(2015, 01, 10), Artikel = pilsmout, Hoeveelheid = 1, Prijs = 12.95m, User = bernd }; Aankoop aankoop4 = new Aankoop { Aankoopdatum = new DateTime(2014, 01, 15), Artikel = saaz, Hoeveelheid = 1, Prijs = 3.05m, User = kobe }; Aankoop aankoop6 = new Aankoop { Aankoopdatum = new DateTime(2015, 01, 03), Artikel = pilsmout, Hoeveelheid = 2, Prijs = 22.6m, User = jimmy }; // adding objects to dbSet context.Brouwerijen.Add(rockaBeery); context.Brouwerijen.Add(duvel); context.Artikels.Add(saaz); context.Artikels.Add(pilsmout); context.Artikels.Add(gist); context.Artikels.Add(gist2); context.Artikels.Add(overige1); context.Artikels.Add(overige2); context.Users.Add(bernd); context.Users.Add(kobe); context.Users.Add(jimmy); context.Aankopen.Add(aankoop2); context.Aankopen.Add(aankoop4); context.Aankopen.Add(aankoop6); context.SaveChanges(); // saving dbSet(s) to Database }
public GistVirtualFiles(Gist gist, string accessToken) : this(gist.Id, accessToken) => InitGist(gist);
public Gist GetGist(bool refresh = false) => gistCache != null && !refresh ? gistCache : (gistCache = Gateway.GetGist(GistId));
private void InitGist(Gist gist) { gistCache = gist; LastRefresh = gist.Updated_At.GetValueOrDefault(DateTime.UtcNow); }
private void SelectFileInGist(Gist gist, string filename = null) { var node = tvGists.Nodes.Find(gist.Id + "/" + (!string.IsNullOrEmpty(tbGistName.Text) ? tbGistName.Text : gist.Files.First().Key), true); if (node != null && node.Length > 0) { BeginInvoke((Action)delegate { node[0].EnsureVisible(); tvGists.Select(); tvGists.SelectedNode = node[0]; }); } }