From 55ffe53e1cb546834bc02c1730b211c89c9741cd Mon Sep 17 00:00:00 2001 From: omonighop Date: Thu, 19 Nov 2020 08:48:56 +0300 Subject: [PATCH] Add project files. --- HarPadRee.sln | 83 ++++++++++++++ HarPadRee/App.xaml | 11 ++ HarPadRee/App.xaml.cs | 45 ++++++++ HarPadRee/AssemblyInfo.cs | 3 + HarPadRee/CustomControls/ExtendedViewCell.cs | 19 ++++ HarPadRee/EncryptHash/Crypto.cs | 24 ++++ HarPadRee/EncryptHash/EncriptionEngine.cs | 47 ++++++++ HarPadRee/FileAccessHelper.cs | 15 +++ HarPadRee/HarPadRee.csproj | 51 +++++++++ HarPadRee/MillagePage.xaml | 34 ++++++ HarPadRee/MillagePage.xaml.cs | 41 +++++++ HarPadRee/Models/Models.cs | 62 ++++++++++ HarPadRee/Pages/AddPage.xaml | 113 +++++++++++++++++++ HarPadRee/Pages/AddPage.xaml.cs | 64 +++++++++++ HarPadRee/Pages/CarPage.xaml | 35 ++++++ HarPadRee/Pages/CarPage.xaml.cs | 35 ++++++ HarPadRee/Pages/CarsPage.xaml | 35 ++++++ HarPadRee/Pages/CarsPage.xaml.cs | 54 +++++++++ HarPadRee/Pages/MainPage.xaml | 109 ++++++++++++++++++ HarPadRee/Pages/MainPage.xaml.cs | 72 ++++++++++++ HarPadRee/Pages/ServicesPage.xaml | 34 ++++++ HarPadRee/Pages/ServicesPage.xaml.cs | 41 +++++++ HarPadRee/ReadMe.txt | 3 + HarPadRee/Repos/AccountsRepository.cs | 49 ++++++++ HarPadRee/Repos/CarRepository.cs | 81 +++++++++++++ HarPadRee/Repos/MillageRepository.cs | 88 +++++++++++++++ HarPadRee/Repos/ServicesRepository.cs | 60 ++++++++++ 27 files changed, 1308 insertions(+) create mode 100644 HarPadRee.sln create mode 100644 HarPadRee/App.xaml create mode 100644 HarPadRee/App.xaml.cs create mode 100644 HarPadRee/AssemblyInfo.cs create mode 100644 HarPadRee/CustomControls/ExtendedViewCell.cs create mode 100644 HarPadRee/EncryptHash/Crypto.cs create mode 100644 HarPadRee/EncryptHash/EncriptionEngine.cs create mode 100644 HarPadRee/FileAccessHelper.cs create mode 100644 HarPadRee/HarPadRee.csproj create mode 100644 HarPadRee/MillagePage.xaml create mode 100644 HarPadRee/MillagePage.xaml.cs create mode 100644 HarPadRee/Models/Models.cs create mode 100644 HarPadRee/Pages/AddPage.xaml create mode 100644 HarPadRee/Pages/AddPage.xaml.cs create mode 100644 HarPadRee/Pages/CarPage.xaml create mode 100644 HarPadRee/Pages/CarPage.xaml.cs create mode 100644 HarPadRee/Pages/CarsPage.xaml create mode 100644 HarPadRee/Pages/CarsPage.xaml.cs create mode 100644 HarPadRee/Pages/MainPage.xaml create mode 100644 HarPadRee/Pages/MainPage.xaml.cs create mode 100644 HarPadRee/Pages/ServicesPage.xaml create mode 100644 HarPadRee/Pages/ServicesPage.xaml.cs create mode 100644 HarPadRee/ReadMe.txt create mode 100644 HarPadRee/Repos/AccountsRepository.cs create mode 100644 HarPadRee/Repos/CarRepository.cs create mode 100644 HarPadRee/Repos/MillageRepository.cs create mode 100644 HarPadRee/Repos/ServicesRepository.cs diff --git a/HarPadRee.sln b/HarPadRee.sln new file mode 100644 index 0000000..79560ec --- /dev/null +++ b/HarPadRee.sln @@ -0,0 +1,83 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HarPadRee.Android", "HarPadRee.Android\HarPadRee.Android.csproj", "{C885C007-B815-476B-9EC1-92DF2C9AE53B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HarPadRee.iOS", "HarPadRee.iOS\HarPadRee.iOS.csproj", "{916F00D6-588B-4960-9650-4CB67BC3EAE9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HarPadRee", "HarPadRee\HarPadRee.csproj", "{B4DC60DC-8557-4F97-B6AC-9E6098D1112C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|iPhone = Debug|iPhone + Debug|iPhoneSimulator = Debug|iPhoneSimulator + Release|Any CPU = Release|Any CPU + Release|iPhone = Release|iPhone + Release|iPhoneSimulator = Release|iPhoneSimulator + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|iPhone.Build.0 = Debug|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|iPhone.Deploy.0 = Debug|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|Any CPU.Build.0 = Release|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|Any CPU.Deploy.0 = Release|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|iPhone.ActiveCfg = Release|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|iPhone.Build.0 = Release|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|iPhone.Deploy.0 = Release|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {C885C007-B815-476B-9EC1-92DF2C9AE53B}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|Any CPU.Deploy.0 = Debug|iPhoneSimulator + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|iPhone.ActiveCfg = Debug|iPhone + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|iPhone.Build.0 = Debug|iPhone + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|iPhone.Deploy.0 = Debug|iPhone + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Debug|iPhoneSimulator.Deploy.0 = Debug|iPhoneSimulator + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|Any CPU.ActiveCfg = Release|iPhone + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|Any CPU.Build.0 = Release|iPhone + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|Any CPU.Deploy.0 = Release|iPhone + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|iPhone.ActiveCfg = Release|iPhone + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|iPhone.Build.0 = Release|iPhone + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|iPhone.Deploy.0 = Release|iPhone + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {916F00D6-588B-4960-9650-4CB67BC3EAE9}.Release|iPhoneSimulator.Deploy.0 = Release|iPhoneSimulator + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|iPhone.Build.0 = Debug|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|iPhone.Deploy.0 = Debug|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|Any CPU.Build.0 = Release|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|Any CPU.Deploy.0 = Release|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|iPhone.ActiveCfg = Release|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|iPhone.Build.0 = Release|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|iPhone.Deploy.0 = Release|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {B4DC60DC-8557-4F97-B6AC-9E6098D1112C}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {19FEF620-594A-4452-AFAB-B2420240C521} + EndGlobalSection +EndGlobal diff --git a/HarPadRee/App.xaml b/HarPadRee/App.xaml new file mode 100644 index 0000000..4155a5d --- /dev/null +++ b/HarPadRee/App.xaml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/HarPadRee/App.xaml.cs b/HarPadRee/App.xaml.cs new file mode 100644 index 0000000..633852f --- /dev/null +++ b/HarPadRee/App.xaml.cs @@ -0,0 +1,45 @@ +using System; +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace HarPadRee +{ + public partial class App : Application + { + string dbPath => FileAccessHelper.GetLocalFilePath("Cars.db3"); + + public static AccountsRepository AccRepo { get; private set; } + public static CarRepository CarRepo { get; private set; } + public static MillageRepository MillageRepo { get; private set; } + public static ServicesRepository ServicesRepo { get; private set; } + + public App() + { + InitializeComponent(); + AccRepo = new AccountsRepository(dbPath); + CarRepo = new CarRepository(dbPath); + MillageRepo = new MillageRepository(dbPath); + ServicesRepo = new ServicesRepository(dbPath); + MainPage = new MainPage(); + } + + protected override void OnStart() + { + if (Application.Current.Properties.ContainsKey("LoggedIn")) + { + if (App.Current.Properties["LoggedIn"].Equals(true)) + { + App.Current.MainPage = new NavigationPage(new CarsPage((int)App.Current.Properties["AccID"])); + } + } + } + + protected override void OnSleep() + { + } + + protected override void OnResume() + { + } + } +} diff --git a/HarPadRee/AssemblyInfo.cs b/HarPadRee/AssemblyInfo.cs new file mode 100644 index 0000000..c859952 --- /dev/null +++ b/HarPadRee/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using Xamarin.Forms.Xaml; + +[assembly: XamlCompilation(XamlCompilationOptions.Compile)] \ No newline at end of file diff --git a/HarPadRee/CustomControls/ExtendedViewCell.cs b/HarPadRee/CustomControls/ExtendedViewCell.cs new file mode 100644 index 0000000..7d239aa --- /dev/null +++ b/HarPadRee/CustomControls/ExtendedViewCell.cs @@ -0,0 +1,19 @@ +using Xamarin.Forms; + +namespace HarPadRee.CustomControls +{ + public class ExtendedViewCell : ViewCell + { + public static readonly BindableProperty SelectedBackgroundColorProperty = + BindableProperty.Create("SelectedBackgroundColor", + typeof(Color), + typeof(ExtendedViewCell), + Color.Default); + + public Color SelectedBackgroundColor + { + get { return (Color)GetValue(SelectedBackgroundColorProperty); } + set { SetValue(SelectedBackgroundColorProperty, value); } + } + } +} \ No newline at end of file diff --git a/HarPadRee/EncryptHash/Crypto.cs b/HarPadRee/EncryptHash/Crypto.cs new file mode 100644 index 0000000..4b2234b --- /dev/null +++ b/HarPadRee/EncryptHash/Crypto.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HarPadRee +{ + public static class Crypto + { + /// + /// hashed the password usng SHA256 + /// + /// returned the hashed password + /// + public static string Hash(string value) + { + return Convert.ToBase64String( + System.Security.Cryptography.SHA256.Create() + .ComputeHash(Encoding.UTF8.GetBytes(value)) + ); + } + } +} diff --git a/HarPadRee/EncryptHash/EncriptionEngine.cs b/HarPadRee/EncryptHash/EncriptionEngine.cs new file mode 100644 index 0000000..f91a6ee --- /dev/null +++ b/HarPadRee/EncryptHash/EncriptionEngine.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; + +namespace HarPadRee +{ + public class EncriptionEngine + { + /// + /// encrypts the string + /// + /// the string to be encrypted + /// encrypted string + public static string Encrypt(string input) + { + byte[] inputArray = UTF8Encoding.UTF8.GetBytes(input); + TripleDESCryptoServiceProvider tripleDES = new TripleDESCryptoServiceProvider(); + tripleDES.Key = UTF8Encoding.UTF8.GetBytes("halw-3hq8-sq2219"); + tripleDES.Mode = CipherMode.ECB; + tripleDES.Padding = PaddingMode.PKCS7; + ICryptoTransform cTransform = tripleDES.CreateEncryptor(); + byte[] resultArray = cTransform.TransformFinalBlock(inputArray, 0, inputArray.Length); + tripleDES.Clear(); + return Convert.ToBase64String(resultArray, 0, resultArray.Length); + } + /// + /// decrypted the string + /// + /// the string to be decrypted + /// decrypted string + public static string Decrypt(string input) + { + byte[] inputArray = Convert.FromBase64String(input); + TripleDESCryptoServiceProvider tripleDES = new TripleDESCryptoServiceProvider(); + tripleDES.Key = UTF8Encoding.UTF8.GetBytes("halw-3hq8-sq2219"); + tripleDES.Mode = CipherMode.ECB; + tripleDES.Padding = PaddingMode.PKCS7; + ICryptoTransform cTransform = tripleDES.CreateDecryptor(); + byte[] resultArray = cTransform.TransformFinalBlock(inputArray, 0, inputArray.Length); + tripleDES.Clear(); + return UTF8Encoding.UTF8.GetString(resultArray); + } + } +} diff --git a/HarPadRee/FileAccessHelper.cs b/HarPadRee/FileAccessHelper.cs new file mode 100644 index 0000000..6dc8c90 --- /dev/null +++ b/HarPadRee/FileAccessHelper.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xamarin.Essentials; + +namespace HarPadRee +{ + class FileAccessHelper + { + public static string GetLocalFilePath(string filename) + { + return System.IO.Path.Combine(FileSystem.AppDataDirectory, filename); + } + } +} diff --git a/HarPadRee/HarPadRee.csproj b/HarPadRee/HarPadRee.csproj new file mode 100644 index 0000000..38b6985 --- /dev/null +++ b/HarPadRee/HarPadRee.csproj @@ -0,0 +1,51 @@ + + + + netstandard2.0 + true + + + + portable + true + + + + + + + + + + + + + + ..\..\..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.ComponentModel.DataAnnotations.dll + + + + + + AddPage.xaml + + + + + + MSBuild:UpdateDesignTimeXaml + + + MSBuild:UpdateDesignTimeXaml + + + MSBuild:UpdateDesignTimeXaml + + + MSBuild:UpdateDesignTimeXaml + + + MSBuild:UpdateDesignTimeXaml + + + \ No newline at end of file diff --git a/HarPadRee/MillagePage.xaml b/HarPadRee/MillagePage.xaml new file mode 100644 index 0000000..49d7c81 --- /dev/null +++ b/HarPadRee/MillagePage.xaml @@ -0,0 +1,34 @@ + + + + + +