diff --git a/README.md b/README.md index 9e9ffd7..fa8b57b 100644 --- a/README.md +++ b/README.md @@ -5,76 +5,7 @@ A simple program to shorten links ![](https://file.soft98.ir/uploads/mahdi72/2018/10/26_10-zxc.png) -![](https://file.soft98.ir/uploads/mahdi72/2018/11/28_11-Untitled.png) - ## If you know the other shortening service that supports API, let us know! -Any contributions will be accepted - -# Linux and Mac Version -CrossPlatform version Written by DotNet Core
-you can access Linux and Mac version via two way!
-1.Precompiled Binary [Download it from [here](https://github.com/ghost1372/UrlShortener/releases))]
-2.Compile Project on Linux or Mac - -## How to Run downloaded binary on linux or mac? -unzip binary and go to directoy then execute following command: -``` -./UrlShortenerCrossPlatform.dll -``` -#### Simple usage --s is optional argument that is a integer for selecting service (you can find services in help menu)
--l is required argument that is long url you want to shot it. -``` -chmod 777 ./UrlShortenerCrossPlatform -./UrlShortenerCrossPlatform -s 3 -l https://github.com/ghost1372 -``` -## Compile Project on Linux or Mac -First Step: you must install prerequisites library
-Second Step: clone project -``` -git clone https://github.com/ghost1372/UrlShortener.git -cd UrlShortener -cd UrlShortenerCrossPlatform -``` -Third Step: Compile it -``` -dotnet build -c release -``` - - -### Prerequisites for .NET Core on Linux -#### Ubuntu -Ubuntu distributions require the following libraries installed:
- -liblttng-ust0
-libcurl3
-libssl1.0.0
-libkrb5-3
-zlib1g
-libicu52 (for 14.x)
-libicu55 (for 16.x)
-libicu57 (for 17.x)
-libicu60 (for 18.x)
-libunwind8
-libuuid1
- -#### CentOS and Fedora -CentOS distributions require the following libraries installed:
- -lttng-ust
-libcurl
-openssl-libs
-krb5-libs
-libicu
-zlib
-libunwind
-libuuid
- -Fedora users: If your openssl's version >= 1.1, you'll need to install compat-openssl10. - -### Prerequisites for .NET Core on Mac -Download and install the .NET Core SDK from [.NET Downloads](https://www.microsoft.com/net/download/core)). - - +Any contributions will be accepted \ No newline at end of file diff --git a/UrlShortener.sln b/UrlShortener.sln index be8ffca..55001d0 100644 --- a/UrlShortener.sln +++ b/UrlShortener.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.28917.182 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UrlShortener", "UrlShortener\UrlShortener.csproj", "{967892AE-2BEB-44C9-927F-804E75EFC55D}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UrlShortenerCrossPlatform", "UrlShortenerCrossPlatform\UrlShortenerCrossPlatform.csproj", "{FB441283-8B83-4E4E-9438-6500B6DBBC47}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -20,12 +18,6 @@ Global {967892AE-2BEB-44C9-927F-804E75EFC55D}.Debug-Net45|Any CPU.Build.0 = Debug|Any CPU {967892AE-2BEB-44C9-927F-804E75EFC55D}.Release|Any CPU.ActiveCfg = Release|Any CPU {967892AE-2BEB-44C9-927F-804E75EFC55D}.Release|Any CPU.Build.0 = Release|Any CPU - {FB441283-8B83-4E4E-9438-6500B6DBBC47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FB441283-8B83-4E4E-9438-6500B6DBBC47}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FB441283-8B83-4E4E-9438-6500B6DBBC47}.Debug-Net45|Any CPU.ActiveCfg = Debug|Any CPU - {FB441283-8B83-4E4E-9438-6500B6DBBC47}.Debug-Net45|Any CPU.Build.0 = Debug|Any CPU - {FB441283-8B83-4E4E-9438-6500B6DBBC47}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FB441283-8B83-4E4E-9438-6500B6DBBC47}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/UrlShortener/App.xaml.cs b/UrlShortener/App.xaml.cs index 35c6fdf..f9be2af 100644 --- a/UrlShortener/App.xaml.cs +++ b/UrlShortener/App.xaml.cs @@ -1,4 +1,5 @@ -using HandyControl.Data; +using HandyControl.Controls; +using HandyControl.Data; using HandyControl.Tools; using System; using System.Windows; @@ -12,18 +13,32 @@ public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { - GlobalData.Init(); - - if (GlobalData.Config.Skin != SkinType.Default) + if (checkSkinType(InIHelper.ReadValue("Skin")) != SkinType.Default) { - UpdateSkin(GlobalData.Config.Skin); + UpdateSkin(checkSkinType(InIHelper.ReadValue("Skin"))); } + var lang = InIHelper.ReadValue("Lang"); + if (string.IsNullOrEmpty(lang)) + ConfigHelper.Instance.SetLang("fa"); + else + ConfigHelper.Instance.SetLang(lang); + ConfigHelper.Instance.SetSystemVersionInfo(CommonHelper.GetSystemVersionInfo()); base.OnStartup(e); } + internal SkinType checkSkinType(string input) + { + if (input.Equals("Default")) + return SkinType.Default; + else if (input.Equals("Violet")) + return SkinType.Violet; + else + return SkinType.Dark; + } + internal void UpdateSkin(SkinType skin) { Resources.MergedDictionaries.Clear(); diff --git a/UrlShortener/GlobalData.cs b/UrlShortener/GlobalData.cs deleted file mode 100644 index 78f72ae..0000000 --- a/UrlShortener/GlobalData.cs +++ /dev/null @@ -1,49 +0,0 @@ -using HandyControl.Data; -using Newtonsoft.Json; -using System; -using System.IO; - -namespace UrlShortener -{ - internal class GlobalData - { - internal class AppConfig - { - public static readonly string SavePath = $"{AppDomain.CurrentDomain.BaseDirectory}AppConfig.json"; - - public bool TopMost { get; set; } = true; - public bool FirstRun { get; set; } = true; - public bool NotifyIconIsShow { get; set; } = true; - public int ServiceIndex { get; set; } = 0; - public SkinType Skin { get; set; } = SkinType.Violet; - } - public static AppConfig Config { get; set; } - - public static void Save() - { - string json = JsonConvert.SerializeObject(Config); - File.WriteAllText(AppConfig.SavePath, json); - } - - public static void Init() - { - if (File.Exists(AppConfig.SavePath)) - { - try - { - string json = File.ReadAllText(AppConfig.SavePath); - Config = JsonConvert.DeserializeObject(json); - } - catch - { - Config = new AppConfig(); - } - } - else - { - Config = new AppConfig(); - } - } - - } -} diff --git a/UrlShortener/MainWindow.xaml b/UrlShortener/MainWindow.xaml index b4ddc54..8b1ed63 100644 --- a/UrlShortener/MainWindow.xaml +++ b/UrlShortener/MainWindow.xaml @@ -7,6 +7,7 @@ xmlns:enum="clr-namespace:HandyControl.Data;assembly=HandyControl" xmlns:interactivity="clr-namespace:HandyControl.Interactivity;assembly=HandyControl" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:lang="clr-namespace:UrlShortener.Properties.Langs" Width="600" Height="220" NonClientAreaBackground="#3c3c3c" @@ -63,12 +64,12 @@ @@ -76,30 +77,42 @@ - - - - - + + + + + + + + + - - + - - + - - + + + @@ -110,7 +123,7 @@ - + @@ -137,7 +150,7 @@ Background="Transparent" controls:InfoElement.ContentHeight="35" controls:InfoElement.Necessary="True" - controls:InfoElement.Placeholder="Type Url Here..." + controls:InfoElement.Placeholder="{x:Static lang:Lang.TxtUrl}" TextChanged="txtUrl_TextChanged">