Skip to content

Commit

Permalink
RELEASE PREVIEW HUB + TRANSLATOR
Browse files Browse the repository at this point in the history
- More changes on code
- Added translator integration on Chat
- Added translation configuration in Settings tab
  • Loading branch information
JOSE MEDRANO authored and JOSE MEDRANO committed Oct 18, 2012
1 parent 1be987b commit 1c7fa3c
Show file tree
Hide file tree
Showing 19 changed files with 1,413 additions and 161 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/XBSlink.suo
/XBSlink.userprefs
XBSlink/obj
XBSlink.Android/
XBSlink/bin
/*.suo
/*.userprefs
30 changes: 10 additions & 20 deletions XBSlink.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XBSlink", "XBSlink\XBSlink.csproj", "{60AED2EE-9511-4FC0-BE50-DC440E4EF254}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpPcap", "SharpPcap\SharpPcap.csproj", "{24262E52-1304-4A25-8F73-A3B06E40592E}"
Expand All @@ -9,8 +9,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PacketDotNet", "PacketDotNe
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Nat", "Mono.Nat\Mono.Nat.csproj", "{F5D74163-145F-47BF-83DC-D0E07249C6CA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XBSlink.Android", "XBSlink.Android\XBSlink.Android.csproj", "{F10FF62B-280C-4202-AD28-B874BFA35AB7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -19,14 +17,6 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{60AED2EE-9511-4FC0-BE50-DC440E4EF254}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60AED2EE-9511-4FC0-BE50-DC440E4EF254}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60AED2EE-9511-4FC0-BE50-DC440E4EF254}.Debug|x86.ActiveCfg = Debug|x86
{60AED2EE-9511-4FC0-BE50-DC440E4EF254}.Debug|x86.Build.0 = Debug|x86
{60AED2EE-9511-4FC0-BE50-DC440E4EF254}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60AED2EE-9511-4FC0-BE50-DC440E4EF254}.Release|Any CPU.Build.0 = Release|Any CPU
{60AED2EE-9511-4FC0-BE50-DC440E4EF254}.Release|x86.ActiveCfg = Release|x86
{60AED2EE-9511-4FC0-BE50-DC440E4EF254}.Release|x86.Build.0 = Release|x86
{24262E52-1304-4A25-8F73-A3B06E40592E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{24262E52-1304-4A25-8F73-A3B06E40592E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{24262E52-1304-4A25-8F73-A3B06E40592E}.Debug|x86.ActiveCfg = Debug|Any CPU
Expand All @@ -39,20 +29,20 @@ Global
{55ABBA4C-AAF9-4726-A592-0C92436CEC92}.Release|Any CPU.ActiveCfg = Release|Any CPU
{55ABBA4C-AAF9-4726-A592-0C92436CEC92}.Release|Any CPU.Build.0 = Release|Any CPU
{55ABBA4C-AAF9-4726-A592-0C92436CEC92}.Release|x86.ActiveCfg = Release|Any CPU
{60AED2EE-9511-4FC0-BE50-DC440E4EF254}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60AED2EE-9511-4FC0-BE50-DC440E4EF254}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60AED2EE-9511-4FC0-BE50-DC440E4EF254}.Debug|x86.ActiveCfg = Debug|x86
{60AED2EE-9511-4FC0-BE50-DC440E4EF254}.Debug|x86.Build.0 = Debug|x86
{60AED2EE-9511-4FC0-BE50-DC440E4EF254}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60AED2EE-9511-4FC0-BE50-DC440E4EF254}.Release|Any CPU.Build.0 = Release|Any CPU
{60AED2EE-9511-4FC0-BE50-DC440E4EF254}.Release|x86.ActiveCfg = Release|x86
{60AED2EE-9511-4FC0-BE50-DC440E4EF254}.Release|x86.Build.0 = Release|x86
{F5D74163-145F-47BF-83DC-D0E07249C6CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F5D74163-145F-47BF-83DC-D0E07249C6CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F5D74163-145F-47BF-83DC-D0E07249C6CA}.Debug|x86.ActiveCfg = Debug|Any CPU
{F5D74163-145F-47BF-83DC-D0E07249C6CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F5D74163-145F-47BF-83DC-D0E07249C6CA}.Release|Any CPU.Build.0 = Release|Any CPU
{F5D74163-145F-47BF-83DC-D0E07249C6CA}.Release|x86.ActiveCfg = Release|Any CPU
{F10FF62B-280C-4202-AD28-B874BFA35AB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F10FF62B-280C-4202-AD28-B874BFA35AB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F10FF62B-280C-4202-AD28-B874BFA35AB7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{F10FF62B-280C-4202-AD28-B874BFA35AB7}.Debug|x86.ActiveCfg = Debug|Any CPU
{F10FF62B-280C-4202-AD28-B874BFA35AB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F10FF62B-280C-4202-AD28-B874BFA35AB7}.Release|Any CPU.Build.0 = Release|Any CPU
{F10FF62B-280C-4202-AD28-B874BFA35AB7}.Release|Any CPU.Deploy.0 = Release|Any CPU
{F10FF62B-280C-4202-AD28-B874BFA35AB7}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
226 changes: 152 additions & 74 deletions XBSlink/Form1.Designer.cs

Large diffs are not rendered by default.

94 changes: 57 additions & 37 deletions XBSlink/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,23 +196,18 @@ public void initializateXlinkKaiUdpServer()

void XlinkServer_XlinkConsoleJoinCloud(xlink_msg udp_msg, string CloudName, string CloudPassword)
{
//WriteHeader(udp_msg, "[XLINK/JOINCLOUD] :" + udp_msg.data_msg);

Invoke((MethodInvoker)delegate
{
textBox_CloudName.Text = CloudName;
textBox_CloudPassword.Text = CloudPassword;
JoinChannel(CloudName, CloudPassword);
});

JoinChannel(CloudName, CloudPassword);
}

void JoinChannel(string CloudName, string CloudPassword)
{
LeaveChannel();
var encontrado = cloudlist.findCloud(CloudName);
if (encontrado != null)
join_cloud(CloudName, encontrado.max_nodes.ToString(), CloudPassword);
Invoke((MethodInvoker)delegate
{
LeaveChannel();
var encontrado = cloudlist.findCloud(CloudName);
if (encontrado != null)
join_cloud(CloudName, encontrado.max_nodes.ToString(), CloudPassword);
});
}

void XlinkServer_XlinkConsoleLogin(xlink_msg udp_msg)
Expand Down Expand Up @@ -249,13 +244,6 @@ void udp_listener_PmMessage(xbs_node_message_msgpm udp_msg)
GetSendMessagePM(udp_msg.sender.nickname, udp_msg.message_string, false);
}


void udp_listener_DeleteNode(string NickName)
{
Console.WriteLine("[ENGINE/LEAVEUSER]" + NickName);
udp_xlink_server.XBS_LeaveUser(null, NickName);
}

void udp_listener_AddNode(string NickName, string client_version, string last_ping_delay_ms)
{
Console.WriteLine("[ENGINE/ADDUSER] : " + NickName + " VERSION: " + client_version + " PING: " + last_ping_delay_ms);
Expand Down Expand Up @@ -433,6 +421,8 @@ private void initWithRegistryValues()
updateNATIPPoolListView();
}

comboBox_DefaultTranslationLang.Text = s.REG_DEFAULT_TRANSLATION_LANG;

comboBox_captureDevice.Text = s.REG_CAPTURE_DEVICE_NAME;
comboBox_localIP.Text = s.REG_LOCAL_IP;
textBox_local_Port.Text = s.REG_LOCAL_PORT.ToString();
Expand Down Expand Up @@ -503,6 +493,9 @@ private void saveRegistryValues()
s.REG_SHOW_NEWS_FEED = checkBox_showNewsFeed.Checked;
s.REG_NEWS_FEED_URI = textBox_newsFeedUri.Text;
s.REG_NEWS_FEED_SWITCH_TO_TAB = checkBox_switchToNewsTab.Checked;
s.REG_DEFAULT_TRANSLATION_LANG = comboBox_DefaultTranslationLang.Text;


s.Save();
}

Expand Down Expand Up @@ -591,17 +584,15 @@ private void resume_start_engine()
if (udp_listener != null)
{
udp_listener.AddNode -= udp_listener_AddNode;
udp_listener.DeleteNode -= udp_listener_DeleteNode;
udp_listener.ChatMessage -= udp_listener_ChatMessage;
udp_listener.PmMessage -= udp_listener_PmMessage;
}

udp_listener = new xbs_udp_listener(internal_ip, UInt16.Parse(textBox_local_Port.Text), node_list);

udp_listener.AddNode += udp_listener_AddNode;
udp_listener.DeleteNode += udp_listener_DeleteNode;
udp_listener.ChatMessage += udp_listener_ChatMessage;
udp_listener.PmMessage +=udp_listener_PmMessage;
udp_listener.PmMessage +=udp_listener_PmMessage;
}
catch (Exception e)
{
Expand Down Expand Up @@ -1446,9 +1437,10 @@ public void loadCloudList()
initCloudListView();
foreach (xbs_cloud cloud in clouds)
{
//Sending Clouds to consoles


if (udp_xlink_server.IsConsoleLogged)
udp_xlink_server.XBS_ChannelCreate(null,cloud.name, cloud.node_count, cloud.isPrivate, cloud.max_nodes);

ListViewItem lv_item = new ListViewItem(cloud.name);
lv_item.SubItems.Add(cloud.node_count.ToString());
lv_item.SubItems.Add(cloud.max_nodes.ToString());
Expand Down Expand Up @@ -1505,18 +1497,22 @@ public bool join_cloud(string CloudName, string MaxNodes, string Password)

public bool join_cloud(string CloudList, string CloudName, string MaxNodes, string Password)
{
var ret = cloudlist.JoinOrCreateCloud(CloudList, CloudName, MaxNodes, Password, node_list.local_node.ip_public, node_list.local_node.port_public, node_list.local_node.nickname, xbs_upnp.isPortReachable, xbs_settings.xbslink_version);
if (ret)
{
toolTip2.Show("joined " + textBox_CloudName.Text, button_CloudJoin, 0, -20, 2000);
button_CloudLeave.Enabled = true;
button_CloudJoin.Enabled = false;
textBox_CloudName.Enabled = false;
textBox_CloudMaxNodes.Enabled = false;
textBox_CloudPassword.Enabled = false;
switch_tab = tabPage_info;
}
return ret;


var ret = cloudlist.JoinOrCreateCloud(CloudList, CloudName, MaxNodes, Password, node_list.local_node.ip_public, node_list.local_node.port_public, node_list.local_node.nickname, xbs_upnp.isPortReachable, xbs_settings.xbslink_version);
if (ret)
{
toolTip2.Show("joined " + textBox_CloudName.Text, button_CloudJoin, 0, -20, 2000);
button_CloudLeave.Enabled = true;
button_CloudJoin.Enabled = false;
textBox_CloudName.Enabled = false;
textBox_CloudMaxNodes.Enabled = false;
textBox_CloudPassword.Enabled = false;
switch_tab = tabPage_info;
}
return ret;


}

private bool join_cloud()
Expand Down Expand Up @@ -2198,6 +2194,30 @@ private void listBox_chatUserList_DoubleClick(object sender, EventArgs e)
AddPrivateChat(listBox_chatUserList.SelectedItem.ToString(), true);
}



private void textBox_chatMessages_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
if (textBox_chatMessages.SelectedText != "")
{
toolTip1.Show(
Translator.TranslatorEngine.TranslateText(textBox_chatMessages.SelectedText, comboBox_DefaultTranslationLang.Text),
textBox_chatMessages);
}

}
}

private void textBox_chatMessages_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
textBox_chatMessages.SelectedText = "";
}
}



}
Expand Down
2 changes: 1 addition & 1 deletion XBSlink/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
<value>153, 36</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>58</value>
<value>101</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
Expand Down
22 changes: 17 additions & 5 deletions XBSlink/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions XBSlink/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,8 @@
<Setting Name="REG_NEWS_FEED_SWITCH_TO_TAB" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="REG_DEFAULT_TRANSLATION_LANG" Type="System.String" Scope="User">
<Value Profile="(Default)">English</Value>
</Setting>
</Settings>
</SettingsFile>
4 changes: 4 additions & 0 deletions XBSlink/XBSlink.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@
<DependentUpon>ExceptionMessage.cs</DependentUpon>
</Compile>
<Compile Include="Options.cs" />
<Compile Include="translator\parsers\StringParser.cs" />
<Compile Include="translator\TranslatorEngine.cs" />
<Compile Include="translator\web\WebResourceProvider.cs" />
<Compile Include="xbs_cloud.cs" />
<Compile Include="xlink\xlink_delegates.cs" />
<Compile Include="Settings.cs" />
Expand Down Expand Up @@ -239,6 +242,7 @@
<Content Include="warning_16.png" />
<Content Include="XBSlink.ico" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
3 changes: 3 additions & 0 deletions XBSlink/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@
<setting name="REG_NEWS_FEED_SWITCH_TO_TAB" serializeAs="String">
<value>True</value>
</setting>
<setting name="REG_DEFAULT_TRANSLATION_LANG" serializeAs="String">
<value>English</value>
</setting>
</XBSlink.Properties.Settings>
</userSettings>
</configuration>
Loading

0 comments on commit 1c7fa3c

Please sign in to comment.