Skip to content
This repository was archived by the owner on Jun 29, 2023. It is now read-only.

Commit 1e09b5b

Browse files
Merge pull request #6 from InvisibleManVPN/invisibleman
Invisible Man VPN version 1.7
2 parents a0d0e85 + 629e026 commit 1e09b5b

5 files changed

Lines changed: 50 additions & 15 deletions

File tree

Invisible Man/Invisible Man.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@
228228
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
229229
</EmbeddedResource>
230230
<None Include="packages.config" />
231-
<None Include="Properties\app.manifest" />
231+
<None Include="Properties\app.manifest">
232+
<SubType>Designer</SubType>
233+
</None>
232234
<None Include="Properties\Settings.settings">
233235
<Generator>SettingsSingleFileGenerator</Generator>
234236
<LastGenOutput>Settings.Designer.cs</LastGenOutput>

Invisible Man/InvisibleManCore.cs

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,23 @@ public ServerInformation(string serverName, string countryImage, string serverAd
2929
this.password = password;
3030
}
3131
}
32+
33+
class Message
34+
{
35+
public string content { get; set; }
36+
public string link { get; set; }
37+
38+
public Message(string content, string link)
39+
{
40+
this.content = content;
41+
this.link = link;
42+
}
43+
}
3244

3345
class InvisibleManCore
3446
{
3547
// Initialize
36-
public static int bundleIdentifier = 3;
48+
public static int bundleIdentifier = 4;
3749
public static int index = 0;
3850
public static bool isSelectServer = false;
3951

@@ -290,12 +302,13 @@ public async Task<string> CheckForUpdatesVPN()
290302
/// <summary>
291303
/// Check the server to message
292304
/// </summary>
293-
public async Task<string> CheckForMessage()
305+
public async Task<Message> CheckForMessage()
294306
{
295307
try
296308
{
297309
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
298310
var url = "https://invisiblemanvpn.github.io/index.html";
311+
299312
HttpClient httpClient = new HttpClient();
300313
string html = await httpClient.GetStringAsync(url);
301314

@@ -306,16 +319,21 @@ public async Task<string> CheckForMessage()
306319
.Equals("Message")).ToList();
307320
HtmlAttribute contentHtmlAttribute = htmlNodeList[0].Attributes["content"];
308321

309-
string[] message = contentHtmlAttribute.Value.Split('|');
310-
int messageTime = Convert.ToInt32(message[0]);
311-
string messageContent = message[1];
322+
string[] messageString = contentHtmlAttribute.Value.Split('|');
323+
int messageTime = Convert.ToInt32(messageString[0]);
324+
string messageContent = messageString[1];
325+
string messageLink = null;
326+
if (messageString.Length == 3)
327+
messageLink = messageString[2];
328+
329+
Message message = new Message(messageContent, messageLink);
312330

313331
await Task.Delay(messageTime * 1000);
314-
return messageContent;
332+
return message;
315333
}
316334
catch(Exception)
317335
{
318-
return "FailedToConnect";
336+
return new Message("FailedToConnect", null);
319337
}
320338
}
321339
}

Invisible Man/MainWindow.xaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,10 @@
299299
<ColumnDefinition Width="*"></ColumnDefinition>
300300
<ColumnDefinition Width="35"></ColumnDefinition>
301301
</Grid.ColumnDefinitions>
302-
303-
<Label x:Name="LabelMessage" Grid.Column="0" Padding="0" HorizontalAlignment="Center" VerticalAlignment="Center" Content="Message content" FontFamily="{StaticResource SegoeUI}" FontWeight="Normal" FontSize="13" Foreground="Black"></Label>
302+
303+
<Grid x:Name="GridMessageContent" Grid.Column="0" Background="{StaticResource BackgroundGrayLight}" PreviewMouseDown="GridMessageContent_PreviewMouseDown">
304+
<Label x:Name="LabelMessage" Grid.Column="0" Padding="0" HorizontalAlignment="Center" VerticalAlignment="Center" Content="Message content (Click here)" FontFamily="{StaticResource SegoeUI}" FontWeight="Normal" FontSize="13" Foreground="Black"></Label>
305+
</Grid>
304306
<Viewbox x:Name="ButtonCloseMessage" Width="25" Height="25" HorizontalAlignment="Left" Grid.Column="1" Cursor="Hand" PreviewMouseDown="ButtonCloseMessage_PreviewMouseDown" >
305307
<Canvas Width="24" Height="24" Background="{StaticResource BackgroundGrayLight}">
306308
<Path Data="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" Fill="{StaticResource BackgroundRedDark}" />

Invisible Man/MainWindow.xaml.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public partial class MainWindow : Window
4040
// Notify icon
4141
private System.Windows.Forms.NotifyIcon notifyIcon = new System.Windows.Forms.NotifyIcon();
4242

43+
// Message link
44+
private static string messageLink = null;
45+
4346
public MainWindow()
4447
{
4548
InitializeComponent();
@@ -228,13 +231,17 @@ await Dispatcher.BeginInvoke(new Action(delegate
228231
private async void messageBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
229232
{
230233
InvisibleManCore invisibleManCore = new InvisibleManCore();
231-
string message = await invisibleManCore.CheckForMessage();
234+
Message message = await invisibleManCore.CheckForMessage();
232235

233236
await Dispatcher.BeginInvoke(new Action(delegate
234237
{
235-
if (message != "FailedToConnect")
238+
if (message.content != "FailedToConnect")
236239
{
237-
LabelMessage.Content = message;
240+
LabelMessage.Content = message.content;
241+
messageLink = message.link;
242+
if(!string.IsNullOrEmpty(messageLink))
243+
GridMessageContent.Cursor = Cursors.Hand;
244+
238245
GridMessage.Visibility = System.Windows.Visibility.Visible;
239246

240247
// Run the animation
@@ -567,5 +574,11 @@ private void ChangeServer()
567574
// Do nothing!
568575
}
569576
}
577+
578+
private void GridMessageContent_PreviewMouseDown(object sender, MouseButtonEventArgs e)
579+
{
580+
if(!string.IsNullOrEmpty(messageLink))
581+
Process.Start(messageLink);
582+
}
570583
}
571584
}

Invisible Man/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("1.5.0.0")]
55-
[assembly: AssemblyFileVersion("1.5.0.0")]
54+
[assembly: AssemblyVersion("1.7.0.0")]
55+
[assembly: AssemblyFileVersion("1.7.0.0")]

0 commit comments

Comments
 (0)