Automated code cleanup.

This commit is contained in:
Andrey Shabarshov 2022-03-15 17:09:54 +00:00
parent 621f36e223
commit 316800c8d7
33 changed files with 71 additions and 119 deletions

View File

@ -1,8 +1,4 @@
using System; namespace QRBee.Core.Data
using System.Collections.Generic;
using System.Text;
namespace QRBee.Core.Data
{ {
public record RegistrationResponse public record RegistrationResponse
{ {

View File

@ -1,8 +1,4 @@
using System; namespace QRBee.Core.Security
using System.Collections.Generic;
using System.Text;
namespace QRBee.Core.Security
{ {
public class ReadableCertificateRequest public class ReadableCertificateRequest
{ {

View File

@ -1,9 +1,8 @@
using System; using Android;
using Android;
using Android.App; using Android.App;
using Android.Content.PM; using Android.Content.PM;
using Android.Runtime;
using Android.OS; using Android.OS;
using Android.Runtime;
using Android.Support.V4.Content; using Android.Support.V4.Content;
using AndroidX.Core.App; using AndroidX.Core.App;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -11,6 +10,7 @@ using Plugin.Fingerprint;
using QRBee.Core.Security; using QRBee.Core.Security;
using QRBee.Droid.Services; using QRBee.Droid.Services;
using QRBee.Services; using QRBee.Services;
using System;
namespace QRBee.Droid namespace QRBee.Droid
{ {

View File

@ -1,7 +1,6 @@
using System.Reflection; using Android.App;
using System.Runtime.CompilerServices; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Android.App;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information

View File

@ -1,10 +1,9 @@
using System; using QRBee.Core.Security;
using System;
using System.IO; using System.IO;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Text; using System.Text;
using Javax.Xml.Transform;
using QRBee.Core.Security;
namespace QRBee.Droid.Services namespace QRBee.Droid.Services
{ {

View File

@ -1,8 +1,8 @@
using System; using QRBee.Core.Security;
using System;
using System.IO;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Text; using System.Text;
using System.IO;
using QRBee.Core.Security;
namespace QRBee.Droid.Services namespace QRBee.Droid.Services
{ {

View File

@ -13,7 +13,7 @@ namespace QRBee.Droid.Services
//password based encryption, it's probably safe enough as long as //password based encryption, it's probably safe enough as long as
//it is truly uncommon. Also too much work to alter this answer otherwise. //it is truly uncommon. Also too much work to alter this answer otherwise.
// Never use salt like this // Never use salt like this
private static byte[] _salt = System.Text.Encoding.UTF8.GetBytes("wÑÏU4)MÓvcvsª"); private static readonly byte[] _salt = System.Text.Encoding.UTF8.GetBytes("wÑÏU4)MÓvcvsª");
/// <summary> /// <summary>
/// Encrypt the given string using AES. The string can be decrypted using /// Encrypt the given string using AES. The string can be decrypted using

View File

@ -1,6 +1,6 @@
using System.Threading.Tasks; using Newtonsoft.Json;
using Newtonsoft.Json;
using QRBee.Services; using QRBee.Services;
using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
[assembly: Dependency(typeof(QRBee.Droid.Services.LocalSettings))] [assembly: Dependency(typeof(QRBee.Droid.Services.LocalSettings))]

View File

@ -1,5 +1,5 @@
using System.Threading.Tasks; using QRBee.Services;
using QRBee.Services; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
using ZXing.Mobile; using ZXing.Mobile;

View File

@ -1,9 +1,7 @@
using QRBee.Services; using Microsoft.Extensions.DependencyInjection;
using QRBee.Views; using QRBee.Services;
using System;
using Microsoft.Extensions.DependencyInjection;
using QRBee.Core.Security;
using QRBee.ViewModels; using QRBee.ViewModels;
using System;
using Xamarin.Forms; using Xamarin.Forms;
namespace QRBee namespace QRBee
@ -22,7 +20,7 @@ namespace QRBee
} }
protected static IServiceProvider ServiceProvider { get; set; } protected static IServiceProvider ServiceProvider { get; set; }
void SetupServices(Action<IServiceCollection> addPlatformServices = null) private void SetupServices(Action<IServiceCollection> addPlatformServices = null)
{ {
var services = new ServiceCollection(); var services = new ServiceCollection();

View File

@ -1,7 +1,4 @@
using QRBee.ViewModels; using QRBee.Views;
using QRBee.Views;
using System;
using System.Collections.Generic;
using Xamarin.Forms; using Xamarin.Forms;
namespace QRBee namespace QRBee

View File

@ -1,6 +1,4 @@
using System; namespace QRBee.Models
namespace QRBee.Models
{ {
public class Item public class Item
{ {

View File

@ -1,5 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace QRBee.Services namespace QRBee.Services

View File

@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace QRBee.Services namespace QRBee.Services

View File

@ -1,7 +1,4 @@
using System; using System.Threading.Tasks;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace QRBee.Services namespace QRBee.Services
{ {

View File

@ -8,7 +8,7 @@ namespace QRBee.Services
{ {
public class MockDataStore : IDataStore<Item> public class MockDataStore : IDataStore<Item>
{ {
readonly List<Item> items; private readonly List<Item> items;
public MockDataStore() public MockDataStore()
{ {

View File

@ -12,14 +12,14 @@ namespace QRBee.ViewModels
{ {
public IDataStore<Item> DataStore => DependencyService.Get<IDataStore<Item>>(); public IDataStore<Item> DataStore => DependencyService.Get<IDataStore<Item>>();
bool isBusy = false; private bool isBusy = false;
public bool IsBusy public bool IsBusy
{ {
get { return isBusy; } get { return isBusy; }
set { SetProperty(ref isBusy, value); } set { SetProperty(ref isBusy, value); }
} }
string title = string.Empty; private string title = string.Empty;
public string Title public string Title
{ {
get { return title; } get { return title; }

View File

@ -1,9 +1,8 @@
using System; using QRBee.Core.Data;
using System.Text;
using QRBee.Core.Data;
using QRBee.Core.Security; using QRBee.Core.Security;
using QRBee.Services; using QRBee.Services;
using QRBee.Views; using System;
using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace QRBee.ViewModels namespace QRBee.ViewModels

View File

@ -1,8 +1,7 @@
using System.Linq; using Plugin.Fingerprint;
using QRBee.Views;
using Plugin.Fingerprint;
using Plugin.Fingerprint.Abstractions; using Plugin.Fingerprint.Abstractions;
using QRBee.Services; using QRBee.Services;
using QRBee.Views;
using Xamarin.Forms; using Xamarin.Forms;
namespace QRBee.ViewModels namespace QRBee.ViewModels

View File

@ -1,10 +1,9 @@
using System; using QRBee.Core.Data;
using System.Linq;
using System.Net.Http;
using System.Text;
using QRBee.Core.Data;
using QRBee.Core.Security; using QRBee.Core.Security;
using QRBee.Services; using QRBee.Services;
using System;
using System.Net.Http;
using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace QRBee.ViewModels namespace QRBee.ViewModels
@ -85,12 +84,14 @@ namespace QRBee.ViewModels
// the HttpClient object is constructed in a shared project. // the HttpClient object is constructed in a shared project.
public HttpClientHandler GetInsecureHandler() public HttpClientHandler GetInsecureHandler()
{ {
var handler = new HttpClientHandler(); var handler = new HttpClientHandler
handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => {
ServerCertificateCustomValidationCallback = (message, cert, chain, errors) =>
{ {
if (cert.Issuer.Equals("CN=localhost")) if (cert.Issuer.Equals("CN=localhost"))
return true; return true;
return errors == System.Net.Security.SslPolicyErrors.None; return errors == System.Net.Security.SslPolicyErrors.None;
}
}; };
return handler; return handler;
} }

View File

@ -1,12 +1,11 @@
using System; using QRBee.Core.Data;
using System.Linq;
using System.Net.Http;
using System.Text.RegularExpressions;
using QRBee.Core;
using QRBee.Core.Data;
using QRBee.Core.Security; using QRBee.Core.Security;
using QRBee.Services; using QRBee.Services;
using QRBee.Views; using QRBee.Views;
using System;
using System.Linq;
using System.Net.Http;
using System.Text.RegularExpressions;
using Xamarin.Forms; using Xamarin.Forms;
namespace QRBee.ViewModels namespace QRBee.ViewModels
@ -192,12 +191,14 @@ namespace QRBee.ViewModels
// the HttpClient object is constructed in a shared project. // the HttpClient object is constructed in a shared project.
public HttpClientHandler GetInsecureHandler() public HttpClientHandler GetInsecureHandler()
{ {
var handler = new HttpClientHandler(); var handler = new HttpClientHandler
handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => {
ServerCertificateCustomValidationCallback = (message, cert, chain, errors) =>
{ {
if (cert.Issuer.Equals("CN=localhost")) if (cert.Issuer.Equals("CN=localhost"))
return true; return true;
return errors == System.Net.Security.SslPolicyErrors.None; return errors == System.Net.Security.SslPolicyErrors.None;
}
}; };
return handler; return handler;
} }

View File

@ -1,6 +1,4 @@
using System; using QRBee.ViewModels;
using QRBee.Services;
using QRBee.ViewModels;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Xaml; using Xamarin.Forms.Xaml;

View File

@ -1,9 +1,4 @@
using QRBee.ViewModels; using QRBee.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Xaml; using Xamarin.Forms.Xaml;

View File

@ -1,5 +1,5 @@
using Xamarin.Forms.Xaml; using QRBee.ViewModels;
using QRBee.ViewModels; using Xamarin.Forms.Xaml;
namespace QRBee.Views namespace QRBee.Views
{ {

View File

@ -1,9 +1,4 @@
using System; using QRBee.ViewModels;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using QRBee.ViewModels;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Xaml; using Xamarin.Forms.Xaml;

View File

@ -1,7 +1,5 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using MongoDB.Driver;
using QRBee.Api.Services; using QRBee.Api.Services;
using QRBee.Core;
using QRBee.Core.Data; using QRBee.Core.Data;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 // For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

View File

@ -1,5 +1,4 @@
using System.Security.Cryptography.X509Certificates; using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.Attributes;
namespace QRBee.Api.Services.Database namespace QRBee.Api.Services.Database
{ {

View File

@ -1,7 +1,5 @@
using System.Security.Cryptography.X509Certificates; using Microsoft.Extensions.Options;
using Microsoft.Extensions.Options;
using MongoDB.Driver; using MongoDB.Driver;
using QRBee.Api.Controllers;
namespace QRBee.Api.Services.Database namespace QRBee.Api.Services.Database
{ {

View File

@ -1,5 +1,4 @@
using MongoDB.Bson; using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.Attributes;
using QRBee.Core.Data; using QRBee.Core.Data;
namespace QRBee.Api.Services.Database namespace QRBee.Api.Services.Database

View File

@ -1,7 +1,4 @@
using System.Security.Cryptography.X509Certificates; using QRBee.Core.Data;
using Microsoft.AspNetCore.Mvc;
using QRBee.Core;
using QRBee.Core.Data;
namespace QRBee.Api.Services namespace QRBee.Api.Services
{ {

View File

@ -1,13 +1,11 @@
using System.Globalization; using QRBee.Api.Services.Database;
using System.Runtime.CompilerServices; using QRBee.Core.Data;
using QRBee.Core.Security;
using System.Globalization;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using QRBee.Api.Services.Database;
using QRBee.Core;
using QRBee.Core.Data;
using QRBee.Core.Security;
namespace QRBee.Api.Services namespace QRBee.Api.Services
{ {

View File

@ -1,9 +1,7 @@
using System; using QRBee.Core.Security;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using QRBee.Core.Security;
namespace QRBee.Api.Services namespace QRBee.Api.Services
{ {

View File

@ -1,7 +1,7 @@
using System.Security.Cryptography; using QRBee.Core.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Text; using System.Text;
using QRBee.Core.Security;
namespace QRBee.Api.Services namespace QRBee.Api.Services
{ {