Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
~lucidiot | 8fefcb9ab9 | |
~lucidiot | 3ee3b87ea8 | |
~lucidiot | 5163c2db09 | |
~lucidiot | 083a2da17d | |
~lucidiot | bea2191404 |
|
@ -34,6 +34,8 @@ namespace ToeCracker {
|
|||
listBox.Items.AddRange(words);
|
||||
listBox.Dock = DockStyle.Fill;
|
||||
listBox.ContextMenuStrip = this.wordContextMenuStrip;
|
||||
// Double-clicking a word is equivalent to right click -> Look Up
|
||||
listBox.DoubleClick += lookUpToolStripMenuItem_Click;
|
||||
page.Controls.Add(listBox);
|
||||
this.tabControl.TabPages.Add(page);
|
||||
}
|
||||
|
@ -45,7 +47,7 @@ namespace ToeCracker {
|
|||
private void Search(string query) {
|
||||
this.Enabled = false;
|
||||
|
||||
Dictionary<string, string[]> results = new Dictionary<string,string[]>();
|
||||
Dictionary<string, string[]> results = new Dictionary<string, string[]>();
|
||||
try {
|
||||
results = Thesaurus.Search(query);
|
||||
} catch (WebException e) {
|
||||
|
@ -88,7 +90,16 @@ namespace ToeCracker {
|
|||
if (this.tabControl.SelectedTab.Controls.Count == 0)
|
||||
return null;
|
||||
|
||||
return (string)((ListBox)this.tabControl.SelectedTab.Controls[0]).SelectedItem;
|
||||
string word = (string)((ListBox)this.tabControl.SelectedTab.Controls[0]).SelectedItem;
|
||||
if (word == null)
|
||||
return null;
|
||||
|
||||
// Ignore empty lines and subgroups. Subgroups are represented as "-- ANTONYMS --"
|
||||
word = word.Trim();
|
||||
if (word == String.Empty || word.StartsWith("-- "))
|
||||
return null;
|
||||
|
||||
return word;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +109,8 @@ namespace ToeCracker {
|
|||
|
||||
private void searchButton_Click(object sender, EventArgs e) {
|
||||
string query = this.searchTextBox.Text.Trim();
|
||||
if (query.Length > 0) this.Search(query);
|
||||
if (query.Length > 0)
|
||||
this.Search(query);
|
||||
}
|
||||
|
||||
private void wordContextMenuStrip_Opening(object sender, CancelEventArgs e) {
|
||||
|
|
|
@ -30,6 +30,6 @@ using System.Resources;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||
|
|
|
@ -78,6 +78,15 @@ namespace ToeCracker.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to antonyms.
|
||||
/// </summary>
|
||||
internal static string Antonyms {
|
||||
get {
|
||||
return ResourceManager.GetString("Antonyms", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to noun.
|
||||
/// </summary>
|
||||
|
@ -105,6 +114,15 @@ namespace ToeCracker.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to related terms.
|
||||
/// </summary>
|
||||
internal static string RelatedTerms {
|
||||
get {
|
||||
return ResourceManager.GetString("RelatedTerms", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to An error occurred while fetching data from the thesaurus:.
|
||||
/// </summary>
|
||||
|
@ -132,6 +150,15 @@ namespace ToeCracker.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to similar terms.
|
||||
/// </summary>
|
||||
internal static string SimilarTerms {
|
||||
get {
|
||||
return ResourceManager.GetString("SimilarTerms", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to sounds kind of like.
|
||||
/// </summary>
|
||||
|
|
|
@ -125,6 +125,10 @@
|
|||
<value>adverbe</value>
|
||||
<comment>Word group for synonyms of an adverb.</comment>
|
||||
</data>
|
||||
<data name="Antonyms" xml:space="preserve">
|
||||
<value>antonymes</value>
|
||||
<comment>Word subgroup for antonyms of a word with the same grammatical function.</comment>
|
||||
</data>
|
||||
<data name="Noun" xml:space="preserve">
|
||||
<value>nom</value>
|
||||
<comment>Word group for synonyms of a noun.</comment>
|
||||
|
@ -137,6 +141,10 @@
|
|||
<value>Erreur de lecture XML</value>
|
||||
<comment>Title of the dialog box where the parsing error is shown.</comment>
|
||||
</data>
|
||||
<data name="RelatedTerms" xml:space="preserve">
|
||||
<value>termes liés</value>
|
||||
<comment>Word subgroup for terms related to a word with the same grammatical function.</comment>
|
||||
</data>
|
||||
<data name="RequestError" xml:space="preserve">
|
||||
<value>Une erreur s'est produite lors de la requête au thésaurus :</value>
|
||||
<comment>Error message shown when an HTTP request fails. Further details are given below this message.</comment>
|
||||
|
@ -149,6 +157,10 @@
|
|||
<value>rime avec</value>
|
||||
<comment>Word group for words that rhyme with this word.</comment>
|
||||
</data>
|
||||
<data name="SimilarTerms" xml:space="preserve">
|
||||
<value>termes similaires</value>
|
||||
<comment>Word subgroup for terms similar to a word with the same grammatical function.</comment>
|
||||
</data>
|
||||
<data name="SoundsLike" xml:space="preserve">
|
||||
<value>sonne comme</value>
|
||||
<comment>Word group for words that "sound kind of like" this word.</comment>
|
||||
|
|
|
@ -125,6 +125,10 @@
|
|||
<value>adverb</value>
|
||||
<comment>Word group for synonyms of an adverb.</comment>
|
||||
</data>
|
||||
<data name="Antonyms" xml:space="preserve">
|
||||
<value>antonyms</value>
|
||||
<comment>Word subgroup for antonyms of a word with the same grammatical function.</comment>
|
||||
</data>
|
||||
<data name="Noun" xml:space="preserve">
|
||||
<value>noun</value>
|
||||
<comment>Word group for synonyms of a noun.</comment>
|
||||
|
@ -137,6 +141,10 @@
|
|||
<value>XML parsing error</value>
|
||||
<comment>Title of the dialog box where the parsing error is shown.</comment>
|
||||
</data>
|
||||
<data name="RelatedTerms" xml:space="preserve">
|
||||
<value>related terms</value>
|
||||
<comment>Word subgroup for terms related to a word with the same grammatical function.</comment>
|
||||
</data>
|
||||
<data name="RequestError" xml:space="preserve">
|
||||
<value>An error occurred while fetching data from the thesaurus:</value>
|
||||
<comment>Error message shown when an HTTP request fails. Further details are given below this message.</comment>
|
||||
|
@ -149,6 +157,10 @@
|
|||
<value>rhymes with</value>
|
||||
<comment>Word group for words that rhyme with this word.</comment>
|
||||
</data>
|
||||
<data name="SimilarTerms" xml:space="preserve">
|
||||
<value>similar terms</value>
|
||||
<comment>Word subgroup for terms similar to a word with the same grammatical function.</comment>
|
||||
</data>
|
||||
<data name="SoundsLike" xml:space="preserve">
|
||||
<value>sounds kind of like</value>
|
||||
<comment>Word group for words that "sound kind of like" this word.</comment>
|
||||
|
|
|
@ -24,9 +24,12 @@ namespace ToeCracker {
|
|||
Dictionary<string, string> tr = new Dictionary<string, string>();
|
||||
tr["adjective"] = Properties.Resources.Adjective;
|
||||
tr["adverb"] = Properties.Resources.Verb;
|
||||
tr["antonyms"] = Properties.Resources.Antonyms;
|
||||
tr["noun"] = Properties.Resources.Noun;
|
||||
tr["sounds kind of like"] = Properties.Resources.SoundsLike;
|
||||
tr["related terms"] = Properties.Resources.RelatedTerms;
|
||||
tr["rhymes with"] = Properties.Resources.RhymesWith;
|
||||
tr["similar terms"] = Properties.Resources.SimilarTerms;
|
||||
tr["sounds kind of like"] = Properties.Resources.SoundsLike;
|
||||
tr["verb"] = Properties.Resources.Verb;
|
||||
return tr;
|
||||
}
|
||||
|
@ -82,9 +85,10 @@ namespace ToeCracker {
|
|||
}
|
||||
|
||||
/*
|
||||
* We can now iterate on the nodes inside of the <div>. We can expect three types of tags:
|
||||
* We can now iterate on the nodes inside of the <div>. We can expect four types of tags:
|
||||
* - <h2>, which contains the word we just searched and that we can ignore
|
||||
* - <h3>, the beginning of a new word group
|
||||
* - <h4>, a subgroup within the word group
|
||||
* - <ul>, listing words inside a new group.
|
||||
* We will ignore any other tags to stay flexible.
|
||||
*/
|
||||
|
@ -110,6 +114,16 @@ namespace ToeCracker {
|
|||
words.Clear();
|
||||
}
|
||||
groupName = node.InnerText;
|
||||
} else if (node.Name.ToLowerInvariant() == "h4") {
|
||||
// We will represent subgroups by adding an empty word (an empty line in the display),
|
||||
// and format the group name in uppercase with dashes: "-- ANTONYMS --"
|
||||
if (groupName == null)
|
||||
throw new XmlException("Unexpected subgroup name with no group name.");
|
||||
words.Add("");
|
||||
string title = node.InnerText.ToLowerInvariant();
|
||||
if (Translations.ContainsKey(title))
|
||||
title = Translations[title];
|
||||
words.Add(String.Format("-- {0} --", title.ToUpperInvariant()));
|
||||
} else if (node.Name.ToLowerInvariant() == "ul") {
|
||||
if (groupName == null)
|
||||
throw new XmlException("Unexpected word list with no group name.");
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
|
@ -49,6 +49,17 @@
|
|||
"PrivateKeyFile" = "8:"
|
||||
"TimeStampServer" = "8:"
|
||||
"InstallerBootstrapper" = "3:2"
|
||||
"BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
|
||||
{
|
||||
"Enabled" = "11:TRUE"
|
||||
"PromptEnabled" = "11:TRUE"
|
||||
"PrerequisitesLocation" = "2:1"
|
||||
"Url" = "8:"
|
||||
"ComponentsUrl" = "8:"
|
||||
"Items"
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
"Release"
|
||||
{
|
||||
|
@ -65,6 +76,22 @@
|
|||
"PrivateKeyFile" = "8:"
|
||||
"TimeStampServer" = "8:"
|
||||
"InstallerBootstrapper" = "3:2"
|
||||
"BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
|
||||
{
|
||||
"Enabled" = "11:TRUE"
|
||||
"PromptEnabled" = "11:TRUE"
|
||||
"PrerequisitesLocation" = "2:1"
|
||||
"Url" = "8:"
|
||||
"ComponentsUrl" = "8:"
|
||||
"Items"
|
||||
{
|
||||
"{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Net.Framework.2.0"
|
||||
{
|
||||
"Name" = "8:Microsoft .NET Framework 2.0"
|
||||
"ProductCode" = "8:Microsoft.Net.Framework.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"Deployable"
|
||||
|
@ -169,14 +196,14 @@
|
|||
{
|
||||
"Name" = "8:Microsoft Visual Studio"
|
||||
"ProductName" = "8:ToeCracker"
|
||||
"ProductCode" = "8:{7A1878DF-8182-421A-8A8B-A4FD162670AB}"
|
||||
"PackageCode" = "8:{C8D5EC58-8C45-4993-AA6D-14454A3E91A9}"
|
||||
"ProductCode" = "8:{2D88F860-56CA-46BC-825F-81A046A51EA7}"
|
||||
"PackageCode" = "8:{2BD88898-948F-4C55-A394-8201D5CAE490}"
|
||||
"UpgradeCode" = "8:{AC1B2D70-1B4B-40FA-8AAA-F2879E036552}"
|
||||
"RestartWWWService" = "11:FALSE"
|
||||
"RemovePreviousVersions" = "11:TRUE"
|
||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||
"InstallAllUsers" = "11:FALSE"
|
||||
"ProductVersion" = "8:1.0.0"
|
||||
"ProductVersion" = "8:1.1.0"
|
||||
"Manufacturer" = "8:lucidiot"
|
||||
"ARPHELPTELEPHONE" = "8:"
|
||||
"ARPHELPLINK" = "8:https://tildegit.org/lucidiot/NullPointerUploader/issues/"
|
||||
|
@ -293,7 +320,7 @@
|
|||
{
|
||||
"Name" = "8:ToeCracker"
|
||||
"Arguments" = "8:"
|
||||
"Description" = "8:"
|
||||
"Description" = "8:GUI client for the Big Huge Labs thesaurus."
|
||||
"ShowCmd" = "3:1"
|
||||
"IconIndex" = "3:32512"
|
||||
"Transitive" = "11:FALSE"
|
||||
|
@ -826,7 +853,7 @@
|
|||
}
|
||||
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_CA508E4529B24E149E311CFD65DAC0DA"
|
||||
{
|
||||
"SourcePath" = "8:..\\ToeCracker\\obj\\Debug\\ToeCracker.exe"
|
||||
"SourcePath" = "8:..\\ToeCracker\\obj\\Release\\ToeCracker.exe"
|
||||
"TargetName" = "8:"
|
||||
"Tag" = "8:"
|
||||
"Folder" = "8:_E04ABEE3382348A6BD4B8A070E1E2DCF"
|
||||
|
|
Loading…
Reference in New Issue