Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jalal Jaleh authored and Jalal Jaleh committed Jan 27, 2023
1 parent 15794a9 commit aeb195f
Show file tree
Hide file tree
Showing 21 changed files with 812 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Shecan-Desktop.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shecan-Desktop", "Shecan-Desktop\Shecan-Desktop.csproj", "{0D1FE30B-E0DF-42CA-A19F-1A9FFF69223C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0D1FE30B-E0DF-42CA-A19F-1A9FFF69223C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D1FE30B-E0DF-42CA-A19F-1A9FFF69223C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D1FE30B-E0DF-42CA-A19F-1A9FFF69223C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D1FE30B-E0DF-42CA-A19F-1A9FFF69223C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E822CF0F-069B-4A1A-A71C-AE3565369E48}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions Shecan-Desktop/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
9 changes: 9 additions & 0 deletions Shecan-Desktop/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="Shecan_Desktop.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Shecan_Desktop"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
17 changes: 17 additions & 0 deletions Shecan-Desktop/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace Shecan_Desktop
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
48 changes: 48 additions & 0 deletions Shecan-Desktop/Configuration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Newtonsoft.Json;
using Shecan_Desktop.utilities;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Shecan_Desktop
{

internal class Configuration
{

public const string _path = @"config.json";
public static ConfigurationModel Config { get; private set; }
public async static Task<ConfigurationModel> Load()
{
if (Config is null)
{
ConfigurationModel config;

if (File.Exists(_path) is false)
{
var isConnected = await new ConnectionManager()
.IsConnectedToShecanAsync();

config = new ConfigurationModel()
{
IsEnabled = isConnected
};
Save(config);
}

var data = File.ReadAllText(_path);
Config = JsonConvert.DeserializeObject<ConfigurationModel>(data);
}
return Config;
}
public static void Save(ConfigurationModel config = null)
{
var data = JsonConvert.SerializeObject(config ?? Config);
File.WriteAllText(_path, data);
}
}
}
25 changes: 25 additions & 0 deletions Shecan-Desktop/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Window x:Class="Shecan_Desktop.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Shecan_Desktop"
mc:Ignorable="d"
Title="شکن" Height="225" Width="573" ResizeMode="NoResize" Icon="/assets/schecan-icon.png" WindowStartupLocation="CenterScreen">
<Grid>
<Image Margin="187,10,10,0" Source="/assets/logo_title.png" Height="113" VerticalAlignment="Top"/>
<Grid Margin="0,0,0,33" Background="#FFFFEECA" Height="26" VerticalAlignment="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="68"/>
</Grid.ColumnDefinitions>
<Label Content="وضعیت: " FlowDirection="RightToLeft" Grid.Column="1" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold"/>
<Label x:Name="LabelStatus" Content="در حال بررسی .. " FlowDirection="RightToLeft" VerticalContentAlignment="Center" Margin="156,0,0,0" />
</Grid>
<Button x:Name="BtnAction" Content="در حال بررسی .." Margin="10,90,441,0" FlowDirection="RightToLeft" BorderBrush="#FFFFDB8B" FontWeight="Bold" Height="29" VerticalAlignment="Top" Background="{x:Null}" FontSize="11"/>
<Label x:Name="LabelCopyRight" Content="- Copyright Jalal Jaleh 2023" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="164" Foreground="#FFC5C5C5" FontFamily="Consolas" Height="21" FontSize="10" MouseDown="LabelCopyright_MouseDown" Cursor="Hand" Margin="2,0,0,2"/>
<Label x:Name="LabelShecan" Content="| وب سایت شکن" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="92" Height="28" FontSize="10" MouseDown="LabelShecan_MouseDown" Cursor="Hand" Foreground="#FF906262"/>
<Label x:Name="LabelDeveloper" Content="توسعه دهنده" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="65" Height="28" FontSize="10" MouseDown="LabelDeveloper_MouseDown" Cursor="Hand" RenderTransformOrigin="0.607,1.695" Foreground="#FF906262" Margin="0,0,87,0"/>

</Grid>
</Window>
94 changes: 94 additions & 0 deletions Shecan-Desktop/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Shecan_Desktop
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{

public MainWindow()
{
InitializeComponent();

this.BtnAction.IsEnabled= false;
this.BtnAction.Click += BtnAction_Click;

this.Loaded += MainWindow_Initialized;
this.MouseDown += MainWindow_MouseDown;
}

private void MainWindow_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
this.DragMove();
}

private async void MainWindow_Initialized(object sender, EventArgs e)
{
await Configuration.Load();
RefreshStatus();

this.BtnAction.IsEnabled = true;
}

void RefreshStatus()
{
if (Configuration.Config.IsEnabled)
{
this.LabelStatus.Content = "سرویس شکن با موفقیت متصل است. !";
this.BtnAction.Content = "غیر فعال کردن";
}
else
{
this.LabelStatus.Content = "شکن فعال نیست.";
this.BtnAction.Content = "فعال کردن";
}
}
private void BtnAction_Click(object sender, RoutedEventArgs e)
{
if (!Configuration.Config.IsEnabled)
{
NetworkManager.SetDNS("178.22.122.100", "185.51.200.2");
Configuration.Config.IsEnabled = true;
}
else
{
NetworkManager.UnsetDNS();
Configuration.Config.IsEnabled = false;
}
Configuration.Save();
RefreshStatus();
}

private void LabelCopyright_MouseDown(object sender, MouseButtonEventArgs e)
{
Process.Start("https://jalaljaleh.github.io/");
}

private void LabelShecan_MouseDown(object sender, MouseButtonEventArgs e)
{
Process.Start("https://shecan.ir/");
}

private void LabelDeveloper_MouseDown(object sender, MouseButtonEventArgs e)
{
Process.Start("https://github.com/jalaljaleh");
}
}
}
55 changes: 55 additions & 0 deletions Shecan-Desktop/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Shecan-Desktop")]
[assembly: AssemblyDescription("Shecan is an anti-sanction service offered by a group of researchers in Iran. It allows you to use a different DNS server and have a transparent proxy for the whitelisted domains.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Jaleh")]
[assembly: AssemblyProduct("Shecan-Desktop")]
[assembly: AssemblyCopyright("Copyright © Jalal Jaleh 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.

//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]


[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]


// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
71 changes: 71 additions & 0 deletions Shecan-Desktop/Properties/Resources.Designer.cs

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

Loading

0 comments on commit aeb195f

Please sign in to comment.