diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 17:17:46 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 17:17:46 +0000 |
| commit | 0440c722a221b8068bbf388c1c0c51f0faff0451 (patch) | |
| tree | 169cbf90c50ff7961db82ecb606c50c2a45a1688 /Gestor.Common | |
| parent | 225aa1499e37faf9d38257caabbadc68d78b427e (diff) | |
| download | gestor-master.tar.gz gestor-master.zip | |
Diffstat (limited to 'Gestor.Common')
132 files changed, 4622 insertions, 0 deletions
diff --git a/Gestor.Common/Gestor.Common.Converters/ApolicePendenteConverter.cs b/Gestor.Common/Gestor.Common.Converters/ApolicePendenteConverter.cs new file mode 100644 index 0000000..066a108 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ApolicePendenteConverter.cs @@ -0,0 +1,28 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class ApolicePendenteConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null || string.IsNullOrEmpty((string)value)) + { + return "PENDENTE DE EMISSÃO"; + } + return value; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ArquivoDigitalToolTipConverter.cs b/Gestor.Common/Gestor.Common.Converters/ArquivoDigitalToolTipConverter.cs new file mode 100644 index 0000000..f53e93a --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ArquivoDigitalToolTipConverter.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Windows.Data; +using System.Windows.Markup; +using Gestor.Model.Domain.Common; + +namespace Gestor.Common.Converters; + +public class ArquivoDigitalToolTipConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null && ((List<IndiceArquivoDigital>)value).Count != 0) + { + return string.Join(Environment.NewLine, ((List<IndiceArquivoDigital>)value).Select((IndiceArquivoDigital v) => v.Descricao)); + } + return ""; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/AtivoConverterColor.cs b/Gestor.Common/Gestor.Common.Converters/AtivoConverterColor.cs new file mode 100644 index 0000000..02d727a --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/AtivoConverterColor.cs @@ -0,0 +1,36 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; +using System.Windows.Media; + +namespace Gestor.Common.Converters; + +public class AtivoConverterColor : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + if (value != null && (bool)value) + { + return (object)new SolidColorBrush((Color)Application.Current.Resources[(object)"AggerBlue"]); + } + return (object)new SolidColorBrush(Colors.Red); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/AtivoVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/AtivoVisibilityConverter.cs new file mode 100644 index 0000000..72bc781 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/AtivoVisibilityConverter.cs @@ -0,0 +1,32 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace Gestor.Common.Converters; + +public class AtivoVisibilityConverter : IMultiValueConverter +{ + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + object obj = values[0]; + if (obj is bool && (bool)obj) + { + return (object)(Visibility)2; + } + if (values[1] == null) + { + return (object)(Visibility)0; + } + if (values[1] is long num && num > 0) + { + return (object)(Visibility)2; + } + return (object)(Visibility)0; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + return null; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/BoolToEyeConverter.cs b/Gestor.Common/Gestor.Common.Converters/BoolToEyeConverter.cs new file mode 100644 index 0000000..4baccf6 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/BoolToEyeConverter.cs @@ -0,0 +1,32 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class BoolToEyeConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) + { + return "Eye"; + } + if (!(bool)value) + { + return "Eye"; + } + return "EyeOff"; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return (value != null && !string.IsNullOrEmpty(value.ToString())) ? int.Parse(value.ToString()) : 0; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/BoolToYesNoConverter.cs b/Gestor.Common/Gestor.Common.Converters/BoolToYesNoConverter.cs new file mode 100644 index 0000000..37dba8d --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/BoolToYesNoConverter.cs @@ -0,0 +1,28 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class BoolToYesNoConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null && (bool)value) + { + return "SIM"; + } + return "NÃO"; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ComissaoColorConverter.cs b/Gestor.Common/Gestor.Common.Converters/ComissaoColorConverter.cs new file mode 100644 index 0000000..7317a5f --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ComissaoColorConverter.cs @@ -0,0 +1,43 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; +using System.Windows.Media; + +namespace Gestor.Common.Converters; + +public class ComissaoColorConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + //IL_0003: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Expected O, but got Unknown + //IL_0054: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Expected O, but got Unknown + if (value != null) + { + if ((int)Math.Round(double.Parse(value.ToString())) >= 0 && (int)Math.Round(double.Parse(value.ToString())) != 0) + { + return (object)new SolidColorBrush(Colors.Red); + } + return (object)new SolidColorBrush((Color)Application.Current.Resources[(object)"AggerBlue"]); + } + return (object)new SolidColorBrush(Colors.Red); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return (value != null && !string.IsNullOrEmpty(value.ToString())) ? int.Parse(value.ToString()) : 0; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ComissaoConverter.cs b/Gestor.Common/Gestor.Common.Converters/ComissaoConverter.cs new file mode 100644 index 0000000..2a8338c --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ComissaoConverter.cs @@ -0,0 +1,24 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class ComissaoConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return ((decimal?)value / (decimal?)100).GetValueOrDefault(); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ComissaoConverterMulti.cs b/Gestor.Common/Gestor.Common.Converters/ComissaoConverterMulti.cs new file mode 100644 index 0000000..2812699 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ComissaoConverterMulti.cs @@ -0,0 +1,62 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using Gestor.Model.Common; + +namespace Gestor.Common.Converters; + +public class ComissaoConverterMulti : IMultiValueConverter +{ + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_00d5: Unknown result type (might be due to invalid IL or missing references) + //IL_00d7: Invalid comparison between Unknown and I4 + //IL_00e1: Unknown result type (might be due to invalid IL or missing references) + //IL_00e3: Invalid comparison between Unknown and I4 + //IL_0084: Unknown result type (might be due to invalid IL or missing references) + //IL_0086: Invalid comparison between Unknown and I4 + if (values[0] == DependencyProperty.UnsetValue && values[1] == DependencyProperty.UnsetValue) + { + return null; + } + if (values[1] == DependencyProperty.UnsetValue) + { + return values[0]; + } + object obj = values[0]; + TipoRepasse val = (TipoRepasse)values[1]; + switch (parameter.ToString().ToLower()) + { + default: + if ((int)val == 1) + { + return "--"; + } + return ((decimal?)obj / (decimal?)100).GetValueOrDefault(); + case "tipovendedorcolumn": + if ((int)val == 3) + { + return "CO-CORRETAGEM"; + } + return obj; + case "formapagamentocolumn": + case "incidenciacolumn": + if ((int)val == 3) + { + return "--"; + } + return obj; + case "pagamentosvalorrepassecolumn": + case "repassevendedor": + return obj; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + return null; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ComparativoColorConverter.cs b/Gestor.Common/Gestor.Common.Converters/ComparativoColorConverter.cs new file mode 100644 index 0000000..235f0a3 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ComparativoColorConverter.cs @@ -0,0 +1,56 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Media; + +namespace Gestor.Common.Converters; + +public class ComparativoColorConverter : IMultiValueConverter +{ + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + if (values[0] == null) + { + return 0; + } + if (values[1] == null) + { + return 0; + } + decimal num = ((!(values[0] is int)) ? ((decimal?)values[0]).GetValueOrDefault() : ((decimal)(int)values[0])); + decimal num2 = ((!(values[1] is int)) ? ((decimal?)values[1]).GetValueOrDefault() : ((decimal)(int)values[1])); + if (num == 0m && num2 == 0m) + { + return Brushes.DarkGoldenrod; + } + if (num == 0m && num2 > 0m) + { + return Brushes.Red; + } + if (num2 == 0m && num > 0m) + { + return Brushes.Green; + } + if (num == 0m && num2 < 0m) + { + return Brushes.Green; + } + if (num2 == 0m && num < 0m) + { + return Brushes.Red; + } + return (num / num2 - 1m > 0m) ? Brushes.Green : Brushes.Red; + } + catch (Exception) + { + return Brushes.Black; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + return null; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ComparativoConverter.cs b/Gestor.Common/Gestor.Common.Converters/ComparativoConverter.cs new file mode 100644 index 0000000..55df688 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ComparativoConverter.cs @@ -0,0 +1,49 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace Gestor.Common.Converters; + +public class ComparativoConverter : IMultiValueConverter +{ + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + if (values[0] == null) + { + return 0; + } + if (values[1] == null) + { + return 0; + } + decimal num = ((!(values[0] is int)) ? ((decimal?)values[0]).GetValueOrDefault() : ((decimal)(int)values[0])); + decimal num2 = ((!(values[1] is int)) ? ((decimal?)values[1]).GetValueOrDefault() : ((decimal)(int)values[1])); + if (num == 0m && num2 == 0m) + { + return 0; + } + if (num == 0m && num2 > 0m) + { + return -1; + } + if (num2 == 0m && num > 0m) + { + return 1; + } + if (num == 0m && num2 < 0m) + { + return 1; + } + if (num2 == 0m && num < 0m) + { + return -1; + } + decimal num3 = ((num2 > 0m) ? num2 : (-num2)); + return (num - num2) / num3; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + return null; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ComparativoPercentualToolTipConverter.cs b/Gestor.Common/Gestor.Common.Converters/ComparativoPercentualToolTipConverter.cs new file mode 100644 index 0000000..4949f85 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ComparativoPercentualToolTipConverter.cs @@ -0,0 +1,26 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace Gestor.Common.Converters; + +public class ComparativoPercentualToolTipConverter : IMultiValueConverter +{ + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + decimal num = (decimal)values[1] * 100m; + return $"VALOR EM {values[0]}: {num}%"; + } + catch (Exception) + { + return ""; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + return null; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ComparativoToolTipConverter.cs b/Gestor.Common/Gestor.Common.Converters/ComparativoToolTipConverter.cs new file mode 100644 index 0000000..a995ab6 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ComparativoToolTipConverter.cs @@ -0,0 +1,19 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace Gestor.Common.Converters; + +public class ComparativoToolTipConverter : IMultiValueConverter +{ + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + string arg = ((!(values[0] is int)) ? "R$" : ""); + return $"VALOR EM {values[0]}: {arg} {values[1]}"; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + return null; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/EnumDescriptionConverter.cs b/Gestor.Common/Gestor.Common.Converters/EnumDescriptionConverter.cs new file mode 100644 index 0000000..70a9094 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/EnumDescriptionConverter.cs @@ -0,0 +1,29 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; +using Gestor.Common.Validation; + +namespace Gestor.Common.Converters; + +public class EnumDescriptionConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is Enum) + { + return ((Enum)value).GetDescription(); + } + return ""; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ExpanderHeaderConverter.cs b/Gestor.Common/Gestor.Common.Converters/ExpanderHeaderConverter.cs new file mode 100644 index 0000000..e6cb7ff --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ExpanderHeaderConverter.cs @@ -0,0 +1,28 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class ExpanderHeaderConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null && (bool)value) + { + return "MENOS INFORMAÇÕES"; + } + return "MAIS INFORMAÇÕES"; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/IdToVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/IdToVisibilityConverter.cs new file mode 100644 index 0000000..ad727b8 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/IdToVisibilityConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class IdToVisibilityConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return (object)(Visibility)((value != null && (int)Math.Round(double.Parse(value.ToString())) != 0) ? 2 : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return (value != null && !string.IsNullOrEmpty(value.ToString())) ? int.Parse(value.ToString()) : 0; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/InativoVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/InativoVisibilityConverter.cs new file mode 100644 index 0000000..87a117d --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/InativoVisibilityConverter.cs @@ -0,0 +1,32 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace Gestor.Common.Converters; + +public class InativoVisibilityConverter : IMultiValueConverter +{ + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + object obj = values[0]; + if (obj is bool && (bool)obj) + { + return (object)(Visibility)0; + } + if (values[1] == null) + { + return (object)(Visibility)2; + } + if (values[1] is long num && num > 0) + { + return (object)(Visibility)0; + } + return (object)(Visibility)2; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + return null; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/InvertedBooleanConverter.cs b/Gestor.Common/Gestor.Common.Converters/InvertedBooleanConverter.cs new file mode 100644 index 0000000..e0d5826 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/InvertedBooleanConverter.cs @@ -0,0 +1,24 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class InvertedBooleanConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return value != null && !(bool)value; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/InvertedBooleanToVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/InvertedBooleanToVisibilityConverter.cs new file mode 100644 index 0000000..30fda38 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/InvertedBooleanToVisibilityConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class InvertedBooleanToVisibilityConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return (object)(Visibility)((value != null && (bool)value) ? 2 : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/InvertedVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/InvertedVisibilityConverter.cs new file mode 100644 index 0000000..aef3395 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/InvertedVisibilityConverter.cs @@ -0,0 +1,26 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class InvertedVisibilityConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + //IL_0004: Unknown result type (might be due to invalid IL or missing references) + return (object)(Visibility)((value != null && (int)(Visibility)value == 0) ? 2 : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/IsInsertedBoolConverter.cs b/Gestor.Common/Gestor.Common.Converters/IsInsertedBoolConverter.cs new file mode 100644 index 0000000..724481a --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/IsInsertedBoolConverter.cs @@ -0,0 +1,24 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class IsInsertedBoolConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return value != null && (long)value != 0; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/IsNotNullBoolConverter.cs b/Gestor.Common/Gestor.Common.Converters/IsNotNullBoolConverter.cs new file mode 100644 index 0000000..069e68e --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/IsNotNullBoolConverter.cs @@ -0,0 +1,24 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class IsNotNullBoolConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return value != null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/MesConverter.cs b/Gestor.Common/Gestor.Common.Converters/MesConverter.cs new file mode 100644 index 0000000..e3b8e80 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/MesConverter.cs @@ -0,0 +1,35 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; +using Gestor.Common.Validation; +using Gestor.Model.Common; + +namespace Gestor.Common.Converters; + +public class MesConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + if (value == null) + { + return ""; + } + if (value is Mes) + { + return ((Enum)(object)(Mes)value).GetDescription(); + } + return ""; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/MultiBoolAndConverter.cs b/Gestor.Common/Gestor.Common.Converters/MultiBoolAndConverter.cs new file mode 100644 index 0000000..51cb583 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/MultiBoolAndConverter.cs @@ -0,0 +1,26 @@ +using System; +using System.Globalization; +using System.Linq; +using System.Windows.Data; + +namespace Gestor.Common.Converters; + +public class MultiBoolAndConverter : IMultiValueConverter +{ + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + return values.All((object value) => (bool)value); + } + catch + { + return false; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + return null; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/NegativoColorConverter.cs b/Gestor.Common/Gestor.Common.Converters/NegativoColorConverter.cs new file mode 100644 index 0000000..9c7abf7 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/NegativoColorConverter.cs @@ -0,0 +1,42 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; +using System.Windows.Media; + +namespace Gestor.Common.Converters; + +public class NegativoColorConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + //IL_0010: Unknown result type (might be due to invalid IL or missing references) + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Expected O, but got Unknown + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + if (value != null && !string.IsNullOrEmpty(value.ToString())) + { + if (value.ToString().Contains("-")) + { + return (object)new SolidColorBrush(Colors.Red); + } + return (object)new SolidColorBrush(Colors.Black); + } + return (object)new SolidColorBrush(Colors.Black); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/NullVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/NullVisibilityConverter.cs new file mode 100644 index 0000000..fb6d8a5 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/NullVisibilityConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class NullVisibilityConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return (object)(Visibility)((value == null) ? 2 : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/NullVisibilityInvertedConverter.cs b/Gestor.Common/Gestor.Common.Converters/NullVisibilityInvertedConverter.cs new file mode 100644 index 0000000..2d4b917 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/NullVisibilityInvertedConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class NullVisibilityInvertedConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return (object)(Visibility)((value != null) ? 2 : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ObjectToStringConverter.cs b/Gestor.Common/Gestor.Common.Converters/ObjectToStringConverter.cs new file mode 100644 index 0000000..2748ce0 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ObjectToStringConverter.cs @@ -0,0 +1,41 @@ +using System; +using System.ComponentModel; +using System.Globalization; +using System.Linq; +using System.Reflection; +using System.Windows.Data; + +namespace Gestor.Common.Converters; + +public class ObjectToStringConverter : IValueConverter +{ + public static readonly ObjectToStringConverter Instance = new ObjectToStringConverter(); + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is Enum @enum) + { + MemberInfo[] member = @enum.GetType().GetMember(@enum.ToString()); + if (member.Length == 0) + { + return @enum.ToString(); + } + object[] customAttributes = member[0].GetCustomAttributes(typeof(DescriptionAttribute), inherit: false); + if (!customAttributes.Any()) + { + return @enum.ToString().Trim(); + } + return ((DescriptionAttribute)customAttributes.ElementAt(0)).Description.Trim(); + } + if (value is DateTime dateTime) + { + return dateTime.ToShortDateString(); + } + return value?.ToString(); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ObjectVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/ObjectVisibilityConverter.cs new file mode 100644 index 0000000..67fbf0f --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ObjectVisibilityConverter.cs @@ -0,0 +1,30 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; +using Gestor.Model.Common; + +namespace Gestor.Common.Converters; + +public class ObjectVisibilityConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + //IL_0004: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Invalid comparison between Unknown and I4 + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0015: Invalid comparison between Unknown and I4 + return (object)(Visibility)((value != null && ((int)(TipoTelefone)value == 10 || (int)(TipoTelefone)value == 11)) ? 2 : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/PagamentoVendedorCorretoraVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/PagamentoVendedorCorretoraVisibilityConverter.cs new file mode 100644 index 0000000..8eb4a0d --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/PagamentoVendedorCorretoraVisibilityConverter.cs @@ -0,0 +1,23 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace Gestor.Common.Converters; + +public class PagamentoVendedorCorretoraVisibilityConverter : IMultiValueConverter +{ + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + if (values[1] is bool && values[0] == null && (bool)values[1]) + { + return (object)(Visibility)2; + } + return (object)(Visibility)0; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + return null; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ParcelaVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/ParcelaVisibilityConverter.cs new file mode 100644 index 0000000..cf0011c --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ParcelaVisibilityConverter.cs @@ -0,0 +1,28 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; +using Gestor.Model.Common; + +namespace Gestor.Common.Converters; + +public class ParcelaVisibilityConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + //IL_0004: Unknown result type (might be due to invalid IL or missing references) + //IL_000a: Invalid comparison between Unknown and I4 + return (object)(Visibility)((value != null && (int)(TipoRecebimento)value == 2) ? 2 : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/PendenciaConverter.cs b/Gestor.Common/Gestor.Common.Converters/PendenciaConverter.cs new file mode 100644 index 0000000..1d24905 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/PendenciaConverter.cs @@ -0,0 +1,29 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; +using Gestor.Common.Helpers; + +namespace Gestor.Common.Converters; + +public class PendenciaConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) + { + return ""; + } + return $"{(Functions.GetNetworkTime().Date - ((DateTime)value).Date).TotalDays:N0} DIAS"; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/PendenciaVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/PendenciaVisibilityConverter.cs new file mode 100644 index 0000000..13876dc --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/PendenciaVisibilityConverter.cs @@ -0,0 +1,30 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; +using Gestor.Common.Helpers; + +namespace Gestor.Common.Converters; + +public class PendenciaVisibilityConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) + { + return ""; + } + return (object)(Visibility)((Functions.GetNetworkTime().Date < (DateTime)value) ? 2 : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/RamoAutoVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/RamoAutoVisibilityConverter.cs new file mode 100644 index 0000000..618c35d --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/RamoAutoVisibilityConverter.cs @@ -0,0 +1,42 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Common.Converters; + +public class RamoAutoVisibilityConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + Documento val = (Documento)value; + object obj; + if (val == null) + { + obj = null; + } + else + { + Controle controle = val.Controle; + obj = ((controle != null) ? controle.Ramo : null); + } + return (object)(Visibility)((obj == null || (((DomainBase)((Documento)value).Controle.Ramo).Id != 5 && ((DomainBase)((Documento)value).Controle.Ramo).Id != 2)) ? 2 : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/RecebidoColorConverter.cs b/Gestor.Common/Gestor.Common.Converters/RecebidoColorConverter.cs new file mode 100644 index 0000000..fb0146a --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/RecebidoColorConverter.cs @@ -0,0 +1,36 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Media; + +namespace Gestor.Common.Converters; + +public class RecebidoColorConverter : IMultiValueConverter +{ + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Expected O, but got Unknown + if (values[1] == null) + { + if ((DateTime)values[0] < DateTime.Today) + { + return (object)new SolidColorBrush(Colors.Red); + } + return (object)new SolidColorBrush(Colors.Black); + } + return (object)new SolidColorBrush(Colors.Green); + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + return null; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/SaldoWeightConverter.cs b/Gestor.Common/Gestor.Common.Converters/SaldoWeightConverter.cs new file mode 100644 index 0000000..51fb8b4 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/SaldoWeightConverter.cs @@ -0,0 +1,27 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class SaldoWeightConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + return (value != null && !(bool)value) ? FontWeights.Regular : FontWeights.Bold; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/SinalColorConverter.cs b/Gestor.Common/Gestor.Common.Converters/SinalColorConverter.cs new file mode 100644 index 0000000..aceadd3 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/SinalColorConverter.cs @@ -0,0 +1,38 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; +using System.Windows.Media; +using Gestor.Model.Common; + +namespace Gestor.Common.Converters; + +public class SinalColorConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0004: Unknown result type (might be due to invalid IL or missing references) + //IL_000a: Invalid comparison between Unknown and I4 + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Expected O, but got Unknown + if (value != null && (int)(Sinal)value == 1) + { + return (object)new SolidColorBrush(Colors.Red); + } + return (object)new SolidColorBrush(Colors.Black); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/StatusExtratoColorConverter.cs b/Gestor.Common/Gestor.Common.Converters/StatusExtratoColorConverter.cs new file mode 100644 index 0000000..e1217f0 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/StatusExtratoColorConverter.cs @@ -0,0 +1,74 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; +using System.Windows.Media; +using Gestor.Model.Common; + +namespace Gestor.Common.Converters; + +public class StatusExtratoColorConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Expected I4, but got Unknown + //IL_0003: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Expected O, but got Unknown + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_0087: Expected O, but got Unknown + //IL_0087: Unknown result type (might be due to invalid IL or missing references) + //IL_008c: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Expected O, but got Unknown + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Expected O, but got Unknown + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00b6: Unknown result type (might be due to invalid IL or missing references) + //IL_00bc: Expected O, but got Unknown + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Expected O, but got Unknown + if (value == null) + { + return (object)new SolidColorBrush(Colors.Black); + } + StatusParcela val = (StatusParcela)value; + switch ((int)val - 1) + { + default: + return (object)new SolidColorBrush(Colors.Black); + case 0: + case 4: + case 9: + case 11: + case 20: + return (object)new SolidColorBrush(Colors.Green); + case 1: + case 2: + case 5: + case 6: + return (object)new SolidColorBrush(Colors.Red); + case 10: + return (object)new SolidColorBrush((Color)Application.Current.Resources[(object)"AggerYellow100"]); + case 7: + return (object)new SolidColorBrush(Colors.Gray); + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return (value != null && !string.IsNullOrEmpty(value.ToString())) ? int.Parse(value.ToString()) : 0; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/StatusParcelaVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/StatusParcelaVisibilityConverter.cs new file mode 100644 index 0000000..64be20d --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/StatusParcelaVisibilityConverter.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; +using Gestor.Model.Common; + +namespace Gestor.Common.Converters; + +public class StatusParcelaVisibilityConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + if (value == null) + { + return (object)(Visibility)2; + } + return (object)(Visibility)((!new List<StatusParcela> + { + (StatusParcela)1, + (StatusParcela)10, + (StatusParcela)12, + (StatusParcela)13 + }.Contains((StatusParcela)value)) ? 2 : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/StatusTarefaVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/StatusTarefaVisibilityConverter.cs new file mode 100644 index 0000000..466515c --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/StatusTarefaVisibilityConverter.cs @@ -0,0 +1,34 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; +using Gestor.Model.Common; + +namespace Gestor.Common.Converters; + +public class StatusTarefaVisibilityConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Invalid comparison between Unknown and I4 + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + bool result = default(bool); + bool num = parameter != null && bool.TryParse(parameter.ToString(), out result) && result; + Visibility val = (Visibility)((value != null && (int)(StatusTarefa)value != 2) ? 2 : 0); + return (object)(Visibility)((!num) ? ((int)val) : (((int)val == 0) ? 2 : 0)); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/StringNullOrEmptyToVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/StringNullOrEmptyToVisibilityConverter.cs new file mode 100644 index 0000000..fa41f0b --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/StringNullOrEmptyToVisibilityConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class StringNullOrEmptyToVisibilityConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return (object)(Visibility)(string.IsNullOrEmpty(value as string) ? 2 : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/TarefaBackgroundColorConverter.cs b/Gestor.Common/Gestor.Common.Converters/TarefaBackgroundColorConverter.cs new file mode 100644 index 0000000..5332312 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/TarefaBackgroundColorConverter.cs @@ -0,0 +1,56 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; +using System.Windows.Media; +using Gestor.Common.Helpers; + +namespace Gestor.Common.Converters; + +public class TarefaBackgroundColorConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Expected O, but got Unknown + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + if (value != null && !((DateTime)value < Functions.GetNetworkTime())) + { + return (object)new SolidColorBrush(Colors.Black); + } + return (object)new SolidColorBrush(ConvertStringToColor("#fc636b")); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } + + public Color ConvertStringToColor(string hex) + { + //IL_0090: Unknown result type (might be due to invalid IL or missing references) + hex = hex.Replace("#", ""); + byte b = byte.MaxValue; + byte b2 = byte.MaxValue; + byte b3 = byte.MaxValue; + byte b4 = byte.MaxValue; + int num = 0; + if (hex.Length == 8) + { + b = byte.Parse(hex.Substring(0, 2), NumberStyles.HexNumber); + num = 2; + } + b2 = byte.Parse(hex.Substring(num, 2), NumberStyles.HexNumber); + b3 = byte.Parse(hex.Substring(num + 2, 2), NumberStyles.HexNumber); + b4 = byte.Parse(hex.Substring(num + 4, 2), NumberStyles.HexNumber); + return Color.FromArgb(b, b2, b3, b4); + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/TemTarefaVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/TemTarefaVisibilityConverter.cs new file mode 100644 index 0000000..c4a4202 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/TemTarefaVisibilityConverter.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; +using Gestor.Model.Domain.Ferramentas; + +namespace Gestor.Common.Converters; + +public class TemTarefaVisibilityConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return (object)(Visibility)((value == null || ((ObservableCollection<Tarefa>)value).Count == 0) ? 2 : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/TipoCriticaConverter.cs b/Gestor.Common/Gestor.Common.Converters/TipoCriticaConverter.cs new file mode 100644 index 0000000..b45f5d3 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/TipoCriticaConverter.cs @@ -0,0 +1,34 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace Gestor.Common.Converters; + +public class TipoCriticaConverter : IMultiValueConverter +{ + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + string text = (string)values[0]; + if (!(text == "0")) + { + if (!(text == "1")) + { + return ""; + } + return (string)values[2]; + } + return (string)values[1]; + } + catch (Exception) + { + return ""; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + return null; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/TipoSinistroConverter.cs b/Gestor.Common/Gestor.Common.Converters/TipoSinistroConverter.cs new file mode 100644 index 0000000..f344ca9 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/TipoSinistroConverter.cs @@ -0,0 +1,39 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using Gestor.Model.Common; + +namespace Gestor.Common.Converters; + +public class TipoSinistroConverter : IMultiValueConverter +{ + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + if (!(values[0] is TipoSinistro val)) + { + return ""; + } + if ((int)val == 0) + { + return "CLIENTE"; + } + object obj = values[1]; + if (obj != null) + { + if (obj is string text) + { + return "TERCEIRO Nº " + text; + } + return ""; + } + return "TERCEIRO"; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + return null; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/TipoTelefoneVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/TipoTelefoneVisibilityConverter.cs new file mode 100644 index 0000000..d857625 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/TipoTelefoneVisibilityConverter.cs @@ -0,0 +1,37 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using Gestor.Model.Common; + +namespace Gestor.Common.Converters; + +public class TipoTelefoneVisibilityConverter : IMultiValueConverter +{ + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Invalid comparison between Unknown and I4 + if (values[0] == null) + { + return (object)(Visibility)2; + } + if (values[0] is TipoTelefone val && (int)val != 3) + { + return (object)(Visibility)2; + } + object obj = values[1]; + if (obj is bool && (bool)obj) + { + return (object)(Visibility)2; + } + return (object)(Visibility)0; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + return null; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/TotalizacaoExpanderConverter.cs b/Gestor.Common/Gestor.Common.Converters/TotalizacaoExpanderConverter.cs new file mode 100644 index 0000000..53f02ac --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/TotalizacaoExpanderConverter.cs @@ -0,0 +1,28 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class TotalizacaoExpanderConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null && (bool)value) + { + return "ESCONDER TOTALIZAÇÃO"; + } + return "MOSTRAR TOTALIZAÇÃO"; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ValorTipoConverter.cs b/Gestor.Common/Gestor.Common.Converters/ValorTipoConverter.cs new file mode 100644 index 0000000..69ee2d1 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ValorTipoConverter.cs @@ -0,0 +1,42 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class ValorTipoConverter : MarkupExtension, IMultiValueConverter +{ + object IMultiValueConverter.Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + if (values == null || values[1] == null || values[0] == DependencyProperty.UnsetValue) + { + return null; + } + if (values[0] != null) + { + string text = values[0].ToString(); + if (!(text == "VALOR")) + { + if (!(text == "PERCENTUAL")) + { + return values[1].ToString(); + } + return ((decimal)values[1]).ToString("p2"); + } + return ((decimal)values[1]).ToString("c2"); + } + return values[1].ToString(); + } + + object[] IMultiValueConverter.ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ZeroToEmptyConverter.cs b/Gestor.Common/Gestor.Common.Converters/ZeroToEmptyConverter.cs new file mode 100644 index 0000000..7d3be65 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ZeroToEmptyConverter.cs @@ -0,0 +1,36 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class ZeroToEmptyConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + if (value is string) + { + return value; + } + if (!(Math.Abs(System.Convert.ToDouble(value)) < 0.01)) + { + return value.ToString(); + } + return ""; + } + return ""; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return (value != null && !string.IsNullOrEmpty(value.ToString())) ? int.Parse(value.ToString()) : 0; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ZeroToVisibilityConverter.cs b/Gestor.Common/Gestor.Common.Converters/ZeroToVisibilityConverter.cs new file mode 100644 index 0000000..21d99b6 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ZeroToVisibilityConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class ZeroToVisibilityConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return (object)(Visibility)((value == null || (int)Math.Round(double.Parse(value.ToString())) == 0) ? 2 : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return (value != null && !string.IsNullOrEmpty(value.ToString())) ? int.Parse(value.ToString()) : 0; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ZeroToVisibilityInvertedConverter.cs b/Gestor.Common/Gestor.Common.Converters/ZeroToVisibilityInvertedConverter.cs new file mode 100644 index 0000000..3680fcc --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ZeroToVisibilityInvertedConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class ZeroToVisibilityInvertedConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return (object)(Visibility)((value != null && (int)Math.Round(double.Parse(value.ToString())) != 0) ? 2 : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return (value != null && !string.IsNullOrEmpty(value.ToString())) ? int.Parse(value.ToString()) : 0; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Converters/ZeroToVisibilityValorConverter.cs b/Gestor.Common/Gestor.Common.Converters/ZeroToVisibilityValorConverter.cs new file mode 100644 index 0000000..4665173 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ZeroToVisibilityValorConverter.cs @@ -0,0 +1,26 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class ZeroToVisibilityValorConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + decimal result; + return (object)(Visibility)((value == null || (!decimal.TryParse(value.ToString(), out result) && decimal.Parse(value.ToString()) <= 0m)) ? 2 : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return (value != null && !string.IsNullOrEmpty(value.ToString())) ? int.Parse(value.ToString()) : 0; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} diff --git a/Gestor.Common/Gestor.Common.Exceptions/AbortException.cs b/Gestor.Common/Gestor.Common.Exceptions/AbortException.cs new file mode 100644 index 0000000..b663568 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Exceptions/AbortException.cs @@ -0,0 +1,11 @@ +using System; + +namespace Gestor.Common.Exceptions; + +public class AbortException : Exception +{ + public AbortException() + : base(string.Empty) + { + } +} diff --git a/Gestor.Common/Gestor.Common.Exceptions/BaseException.cs b/Gestor.Common/Gestor.Common.Exceptions/BaseException.cs new file mode 100644 index 0000000..133229e --- /dev/null +++ b/Gestor.Common/Gestor.Common.Exceptions/BaseException.cs @@ -0,0 +1,16 @@ +using System; + +namespace Gestor.Common.Exceptions; + +public class BaseException : Exception +{ + public BaseException(string message) + : base(message) + { + } + + public BaseException() + : base(string.Empty) + { + } +} diff --git a/Gestor.Common/Gestor.Common.Exceptions/ForbiddenException.cs b/Gestor.Common/Gestor.Common.Exceptions/ForbiddenException.cs new file mode 100644 index 0000000..3d4d41c --- /dev/null +++ b/Gestor.Common/Gestor.Common.Exceptions/ForbiddenException.cs @@ -0,0 +1,16 @@ +using System; + +namespace Gestor.Common.Exceptions; + +public class ForbiddenException : Exception +{ + public ForbiddenException(string message) + : base(message) + { + } + + public ForbiddenException() + : base(string.Empty) + { + } +} diff --git a/Gestor.Common/Gestor.Common.Exceptions/MailingException.cs b/Gestor.Common/Gestor.Common.Exceptions/MailingException.cs new file mode 100644 index 0000000..7d4be1f --- /dev/null +++ b/Gestor.Common/Gestor.Common.Exceptions/MailingException.cs @@ -0,0 +1,14 @@ +namespace Gestor.Common.Exceptions; + +public class MailingException : BaseException +{ + public MailingException(string message) + : base(message) + { + } + + public MailingException() + : base(string.Empty) + { + } +} diff --git a/Gestor.Common/Gestor.Common.Exceptions/PermissionException.cs b/Gestor.Common/Gestor.Common.Exceptions/PermissionException.cs new file mode 100644 index 0000000..e5249f9 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Exceptions/PermissionException.cs @@ -0,0 +1,15 @@ +using System; + +namespace Gestor.Common.Exceptions; + +public class PermissionException : Exception +{ + public PermissionException() + { + } + + public PermissionException(string message) + : base(message) + { + } +} diff --git a/Gestor.Common/Gestor.Common.Exceptions/UnauthorizedException.cs b/Gestor.Common/Gestor.Common.Exceptions/UnauthorizedException.cs new file mode 100644 index 0000000..cd44f5e --- /dev/null +++ b/Gestor.Common/Gestor.Common.Exceptions/UnauthorizedException.cs @@ -0,0 +1,16 @@ +using System; + +namespace Gestor.Common.Exceptions; + +public class UnauthorizedException : Exception +{ + public UnauthorizedException(string message) + : base(message) + { + } + + public UnauthorizedException() + : base(string.Empty) + { + } +} diff --git a/Gestor.Common/Gestor.Common.Exceptions/ValidationException.cs b/Gestor.Common/Gestor.Common.Exceptions/ValidationException.cs new file mode 100644 index 0000000..62df6b2 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Exceptions/ValidationException.cs @@ -0,0 +1,16 @@ +using System; + +namespace Gestor.Common.Exceptions; + +public class ValidationException : Exception +{ + public ValidationException(string message) + : base(message) + { + } + + public ValidationException() + : base(string.Empty) + { + } +} diff --git a/Gestor.Common/Gestor.Common.Helpers/DataBaseParameters.cs b/Gestor.Common/Gestor.Common.Helpers/DataBaseParameters.cs new file mode 100644 index 0000000..3f5c61a --- /dev/null +++ b/Gestor.Common/Gestor.Common.Helpers/DataBaseParameters.cs @@ -0,0 +1,6 @@ +namespace Gestor.Common.Helpers; + +public static class DataBaseParameters +{ + public static bool NovoGestor { get; set; } +} diff --git a/Gestor.Common/Gestor.Common.Helpers/DefaultAttribute.cs b/Gestor.Common/Gestor.Common.Helpers/DefaultAttribute.cs new file mode 100644 index 0000000..552ec99 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Helpers/DefaultAttribute.cs @@ -0,0 +1,13 @@ +using System; + +namespace Gestor.Common.Helpers; + +public class DefaultAttribute : Attribute +{ + public bool DefaultProperty { get; private set; } + + public DefaultAttribute(bool defaultProperty) + { + DefaultProperty = defaultProperty; + } +} diff --git a/Gestor.Common/Gestor.Common.Helpers/EncryptionHelper.cs b/Gestor.Common/Gestor.Common.Helpers/EncryptionHelper.cs new file mode 100644 index 0000000..5b982d0 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Helpers/EncryptionHelper.cs @@ -0,0 +1,77 @@ +using System; +using System.IO; +using System.Security.Cryptography; +using System.Text; + +namespace Gestor.Common.Helpers; + +public static class EncryptionHelper +{ + private static readonly byte[] Salt = new byte[16] + { + 38, 220, 255, 0, 173, 237, 122, 238, 197, 254, + 7, 175, 77, 8, 34, 60 + }; + + private static readonly string EncryptionKey = $"aGG3r{1012}#w3BDz$"; + + public static string Encrypt(this string plain) + { + return Convert.ToBase64String(Encoding.UTF8.GetBytes(plain).EncryptBytes()); + } + + public static byte[] EncryptBytes(this byte[] plainTextBytes) + { + using Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(EncryptionKey, Salt); + using Rijndael rijndael = Rijndael.Create(); + rijndael.Key = rfc2898DeriveBytes.GetBytes(32); + rijndael.IV = rfc2898DeriveBytes.GetBytes(16); + using MemoryStream memoryStream = new MemoryStream(); + using CryptoStream cryptoStream = new CryptoStream(memoryStream, rijndael.CreateEncryptor(), CryptoStreamMode.Write); + cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length); + cryptoStream.FlushFinalBlock(); + return memoryStream.ToArray(); + } + + public static string Decrypt(this string cipher) + { + if (string.IsNullOrEmpty(cipher)) + { + return null; + } + try + { + byte[] array = Convert.FromBase64String(cipher); + if (array.Length < 16) + { + return cipher; + } + byte[] array2 = array.DecryptBytes(); + return (array2 == null) ? cipher : Encoding.UTF8.GetString(array2); + } + catch (Exception) + { + return cipher; + } + } + + public static byte[] DecryptBytes(this byte[] plainTextBytes) + { + try + { + using Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(EncryptionKey, Salt); + using Rijndael rijndael = Rijndael.Create(); + rijndael.Key = rfc2898DeriveBytes.GetBytes(32); + rijndael.IV = rfc2898DeriveBytes.GetBytes(16); + using MemoryStream memoryStream = new MemoryStream(); + using CryptoStream cryptoStream = new CryptoStream(memoryStream, rijndael.CreateDecryptor(), CryptoStreamMode.Write); + cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length); + cryptoStream.FlushFinalBlock(); + return memoryStream.ToArray(); + } + catch (Exception) + { + return null; + } + } +} diff --git a/Gestor.Common/Gestor.Common.Helpers/EnumBindingSourceExtension.cs b/Gestor.Common/Gestor.Common.Helpers/EnumBindingSourceExtension.cs new file mode 100644 index 0000000..67981a6 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Helpers/EnumBindingSourceExtension.cs @@ -0,0 +1,54 @@ +using System; +using System.Windows.Markup; + +namespace Gestor.Common.Helpers; + +public class EnumBindingSourceExtension : MarkupExtension +{ + private Type _enumType; + + public Type EnumType + { + get + { + return _enumType; + } + set + { + if (!(value == _enumType)) + { + if (null != value && !(Nullable.GetUnderlyingType(value) ?? value).IsEnum) + { + throw new ArgumentException("Type must be for an Enum."); + } + _enumType = value; + } + } + } + + public EnumBindingSourceExtension() + { + } + + public EnumBindingSourceExtension(Type enumType) + { + EnumType = enumType; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + if (null == _enumType) + { + throw new InvalidOperationException("The EnumType must be specified."); + } + Type type = Nullable.GetUnderlyingType(_enumType) ?? _enumType; + Array values = Enum.GetValues(type); + if (type == _enumType) + { + return values; + } + Array array = Array.CreateInstance(type, values.Length + 1); + values.CopyTo(array, 1); + return array; + } +} diff --git a/Gestor.Common/Gestor.Common.Helpers/EnumHelper.cs b/Gestor.Common/Gestor.Common.Helpers/EnumHelper.cs new file mode 100644 index 0000000..8b5879c --- /dev/null +++ b/Gestor.Common/Gestor.Common.Helpers/EnumHelper.cs @@ -0,0 +1,115 @@ +using System; +using System.ComponentModel; +using System.Reflection; +using Gestor.Model.Attributes; + +namespace Gestor.Common.Helpers; + +public static class EnumHelper +{ + public static T2 GetAttribute<T, T2>(this T enumValue) where T2 : class + { + string name = Enum.GetName(enumValue.GetType(), enumValue); + try + { + FieldInfo? field = enumValue.GetType().GetField(name); + Type typeFromHandle = typeof(T2); + return Attribute.GetCustomAttribute(field, typeFromHandle) as T2; + } + catch (Exception) + { + return null; + } + } + + public static T ToEnumByOldValue<T>(this string oldValue) + { + Type typeFromHandle = typeof(T); + Type typeFromHandle2 = typeof(OldValueAttribute); + FieldInfo[] fields = typeFromHandle.GetFields(); + foreach (FieldInfo fieldInfo in fields) + { + Attribute? customAttribute = Attribute.GetCustomAttribute(fieldInfo, typeFromHandle2); + OldValueAttribute val = (OldValueAttribute)(object)((customAttribute is OldValueAttribute) ? customAttribute : null); + if (val != null && val.OldValue == oldValue) + { + return (T)fieldInfo.GetValue(null); + } + } + return default(T); + } + + public static string GetOldValue<T>(this T enumValue) + { + OldValueAttribute attribute = enumValue.GetAttribute<T, OldValueAttribute>(); + if (attribute == null) + { + return null; + } + return attribute.OldValue; + } + + public static T ToEnumByOldValue2<T>(this string oldValue) + { + Type typeFromHandle = typeof(T); + Type typeFromHandle2 = typeof(OldValue2Attribute); + FieldInfo[] fields = typeFromHandle.GetFields(); + foreach (FieldInfo fieldInfo in fields) + { + Attribute? customAttribute = Attribute.GetCustomAttribute(fieldInfo, typeFromHandle2); + OldValue2Attribute val = (OldValue2Attribute)(object)((customAttribute is OldValue2Attribute) ? customAttribute : null); + if (val != null && val.OldValue2 == oldValue) + { + return (T)fieldInfo.GetValue(null); + } + } + return default(T); + } + + public static string GetOldValue2<T>(this T enumValue) + { + OldValue2Attribute attribute = enumValue.GetAttribute<T, OldValue2Attribute>(); + if (attribute == null) + { + return null; + } + return attribute.OldValue2; + } + + public static bool? GetDefault<T>(this T enumValue) + { + string name = Enum.GetName(enumValue.GetType(), enumValue); + FieldInfo field = enumValue.GetType().GetField(name); + return ((field == null) ? null : (Attribute.GetCustomAttribute(field, typeof(DefaultAttribute)) as DefaultAttribute))?.DefaultProperty; + } + + public static bool GetHidden<T>(this T enumValue) + { + string name = Enum.GetName(enumValue.GetType(), enumValue); + FieldInfo field = enumValue.GetType().GetField(name); + return ((field == null) ? null : (Attribute.GetCustomAttribute(field, typeof(HiddenAttribute)) as HiddenAttribute)) != null; + } + + public static string Value<T>(this T enumValue) + { + return Convert.ToInt32(enumValue).ToString(); + } + + public static string GetDescription<T>(this T enumValue) + { + string name = Enum.GetName(enumValue.GetType(), enumValue); + if (name == null) + { + return null; + } + FieldInfo field = enumValue.GetType().GetField(name); + return ((field == null) ? null : (Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute))?.Description; + } + + public static int? GetOrder<T>(this T enumValue) + { + string name = Enum.GetName(enumValue.GetType(), enumValue); + FieldInfo field = enumValue.GetType().GetField(name); + return ((field == null) ? null : (Attribute.GetCustomAttribute(field, typeof(OrderAttribute)) as OrderAttribute))?.OrderProperty; + } +} diff --git a/Gestor.Common/Gestor.Common.Helpers/FindVisualChild.cs b/Gestor.Common/Gestor.Common.Helpers/FindVisualChild.cs new file mode 100644 index 0000000..f47fea1 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Helpers/FindVisualChild.cs @@ -0,0 +1,25 @@ +using System.Windows; +using System.Windows.Media; + +namespace Gestor.Common.Helpers; + +public class FindVisualChild +{ + public static childItem Find<childItem>(DependencyObject obj) where childItem : DependencyObject + { + for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) + { + DependencyObject child = VisualTreeHelper.GetChild(obj, i); + if (child != null && child is childItem) + { + return (childItem)(object)child; + } + childItem val = Find<childItem>(child); + if (val != null) + { + return val; + } + } + return default(childItem); + } +} diff --git a/Gestor.Common/Gestor.Common.Helpers/FindVisualChildren.cs b/Gestor.Common/Gestor.Common.Helpers/FindVisualChildren.cs new file mode 100644 index 0000000..5b88c0d --- /dev/null +++ b/Gestor.Common/Gestor.Common.Helpers/FindVisualChildren.cs @@ -0,0 +1,195 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Media; + +namespace Gestor.Common.Helpers; + +public class FindVisualChildren +{ + [CompilerGenerated] + private sealed class _003CFind_003Ed__0<T> : IEnumerable<T>, IEnumerable, IEnumerator<T>, IDisposable, IEnumerator where T : DependencyObject + { + private int _003C_003E1__state; + + private T _003C_003E2__current; + + private int _003C_003El__initialThreadId; + + private DependencyObject depObj; + + public DependencyObject _003C_003E3__depObj; + + private int _003Ci_003E5__2; + + private DependencyObject _003Cchild_003E5__3; + + private IEnumerator<T> _003C_003E7__wrap3; + + T IEnumerator<T>.Current + { + [DebuggerHidden] + get + { + return _003C_003E2__current; + } + } + + object IEnumerator.Current + { + [DebuggerHidden] + get + { + return _003C_003E2__current; + } + } + + [DebuggerHidden] + public _003CFind_003Ed__0(int _003C_003E1__state) + { + this._003C_003E1__state = _003C_003E1__state; + _003C_003El__initialThreadId = Environment.CurrentManagedThreadId; + } + + [DebuggerHidden] + void IDisposable.Dispose() + { + int num = _003C_003E1__state; + if (num == -3 || num == 2) + { + try + { + } + finally + { + _003C_003Em__Finally1(); + } + } + _003Cchild_003E5__3 = null; + _003C_003E7__wrap3 = null; + _003C_003E1__state = -2; + } + + private bool MoveNext() + { + try + { + switch (_003C_003E1__state) + { + default: + return false; + case 0: + _003C_003E1__state = -1; + if (depObj == null) + { + break; + } + _003Ci_003E5__2 = 0; + goto IL_0107; + case 1: + _003C_003E1__state = -1; + goto IL_0090; + case 2: + { + _003C_003E1__state = -3; + goto IL_00d6; + } + IL_0107: + if (_003Ci_003E5__2 >= VisualTreeHelper.GetChildrenCount(depObj)) + { + break; + } + _003Cchild_003E5__3 = VisualTreeHelper.GetChild(depObj, _003Ci_003E5__2); + if (_003Cchild_003E5__3 != null && _003Cchild_003E5__3 is T) + { + _003C_003E2__current = (T)(object)_003Cchild_003E5__3; + _003C_003E1__state = 1; + return true; + } + goto IL_0090; + IL_0090: + _003C_003E7__wrap3 = Find<T>(_003Cchild_003E5__3).GetEnumerator(); + _003C_003E1__state = -3; + goto IL_00d6; + IL_00d6: + if (_003C_003E7__wrap3.MoveNext()) + { + T current = _003C_003E7__wrap3.Current; + _003C_003E2__current = current; + _003C_003E1__state = 2; + return true; + } + _003C_003Em__Finally1(); + _003C_003E7__wrap3 = null; + _003Cchild_003E5__3 = null; + _003Ci_003E5__2++; + goto IL_0107; + } + return false; + } + catch + { + //try-fault + ((IDisposable)this).Dispose(); + throw; + } + } + + bool IEnumerator.MoveNext() + { + //ILSpy generated this explicit interface implementation from .override directive in MoveNext + return this.MoveNext(); + } + + private void _003C_003Em__Finally1() + { + _003C_003E1__state = -1; + if (_003C_003E7__wrap3 != null) + { + _003C_003E7__wrap3.Dispose(); + } + } + + [DebuggerHidden] + void IEnumerator.Reset() + { + throw new NotSupportedException(); + } + + [DebuggerHidden] + IEnumerator<T> IEnumerable<T>.GetEnumerator() + { + _003CFind_003Ed__0<T> _003CFind_003Ed__; + if (_003C_003E1__state == -2 && _003C_003El__initialThreadId == Environment.CurrentManagedThreadId) + { + _003C_003E1__state = 0; + _003CFind_003Ed__ = this; + } + else + { + _003CFind_003Ed__ = new _003CFind_003Ed__0<T>(0); + } + _003CFind_003Ed__.depObj = _003C_003E3__depObj; + return _003CFind_003Ed__; + } + + [DebuggerHidden] + IEnumerator IEnumerable.GetEnumerator() + { + return ((IEnumerable<T>)this).GetEnumerator(); + } + } + + [IteratorStateMachine(typeof(_003CFind_003Ed__0<>))] + public static IEnumerable<T> Find<T>(DependencyObject depObj) where T : DependencyObject + { + //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() + return new _003CFind_003Ed__0<T>(-2) + { + _003C_003E3__depObj = depObj + }; + } +} diff --git a/Gestor.Common/Gestor.Common.Helpers/Functions.cs b/Gestor.Common/Gestor.Common.Helpers/Functions.cs new file mode 100644 index 0000000..b9f88cf --- /dev/null +++ b/Gestor.Common/Gestor.Common.Helpers/Functions.cs @@ -0,0 +1,102 @@ +using System; +using System.Diagnostics; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using Gestor.Common.Validation; + +namespace Gestor.Common.Helpers; + +public class Functions +{ + public static Stopwatch Stopwatch; + + public static DateTime? StartTime; + + public static int Compare(string original, string modified) + { + if (original == null) + { + original = ""; + } + if (modified == null) + { + modified = ""; + } + string text = original.ToLongNullable().ToString(); + if (!string.IsNullOrWhiteSpace(text)) + { + original = text; + } + text = modified.ToLongNullable().ToString(); + if (!string.IsNullOrWhiteSpace(text)) + { + modified = text; + } + int length = original.Length; + int length2 = modified.Length; + int[,] array = new int[length + 1, length2 + 1]; + for (int i = 0; i <= length; i++) + { + array[i, 0] = i; + } + for (int j = 0; j <= length2; j++) + { + array[0, j] = j; + } + for (int k = 1; k <= length; k++) + { + for (int l = 1; l <= length2; l++) + { + int num = ((modified[l - 1] != original[k - 1]) ? 1 : 0); + int[] source = new int[3] + { + array[k - 1, l] + 1, + array[k, l - 1] + 1, + array[k - 1, l - 1] + num + }; + array[k, l] = source.Min(); + if (k > 1 && l > 1 && original[k - 1] == modified[l - 2] && original[k - 2] == modified[l - 1]) + { + array[k, l] = Math.Min(array[k, l], array[k - 2, l - 2] + num); + } + } + } + return array[length, length2]; + } + + public static DateTime GetNetworkTime() + { + try + { + if (StartTime.HasValue) + { + return StartTime.Value.AddMilliseconds(Stopwatch.ElapsedMilliseconds); + } + byte[] array = new byte[48]; + array[0] = 27; + IPEndPoint remoteEP = new IPEndPoint(Dns.GetHostEntry("time.google.com").AddressList.First((IPAddress a) => a.AddressFamily == AddressFamily.InterNetwork), 123); + using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)) + { + socket.Connect(remoteEP); + socket.ReceiveTimeout = 3000; + socket.Send(array); + socket.Receive(array); + socket.Close(); + } + ulong num = ((ulong)array[40] << 24) | ((ulong)array[41] << 16) | ((ulong)array[42] << 8) | array[43]; + ulong num2 = ((ulong)array[44] << 24) | ((ulong)array[45] << 16) | ((ulong)array[46] << 8) | array[47]; + ulong num3 = num * 1000 + num2 * 1000 / 4294967296L; + DateTime value = new DateTime(1900, 1, 1).AddMilliseconds((long)num3).ToLocalTime(); + StartTime = value; + Stopwatch = Stopwatch.StartNew(); + return StartTime.Value; + } + catch (Exception) + { + StartTime = DateTime.Now; + Stopwatch = Stopwatch.StartNew(); + return StartTime.Value; + } + } +} diff --git a/Gestor.Common/Gestor.Common.Helpers/HiddenAttribute.cs b/Gestor.Common/Gestor.Common.Helpers/HiddenAttribute.cs new file mode 100644 index 0000000..c664526 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Helpers/HiddenAttribute.cs @@ -0,0 +1,8 @@ +using System; + +namespace Gestor.Common.Helpers; + +[AttributeUsage(AttributeTargets.All)] +public class HiddenAttribute : Attribute +{ +} diff --git a/Gestor.Common/Gestor.Common.Helpers/HttpHelper.cs b/Gestor.Common/Gestor.Common.Helpers/HttpHelper.cs new file mode 100644 index 0000000..de15cd1 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Helpers/HttpHelper.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Http; + +namespace Gestor.Common.Helpers; + +public static class HttpHelper +{ + public static HttpRequestMessage CreateRequest(this Uri requestUri, HttpMethod httpMethod, Version httpVersion = null) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Expected O, but got Unknown + return new HttpRequestMessage + { + Version = (httpVersion ?? HttpVersion.Version11), + RequestUri = requestUri, + Method = httpMethod + }; + } + + public static FormUrlEncodedContent Encode(this List<KeyValuePair<string, string>> keyValuePairs) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + return new FormUrlEncodedContent((IEnumerable<KeyValuePair<string, string>>)keyValuePairs); + } +} diff --git a/Gestor.Common/Gestor.Common.Helpers/OrderAttribute.cs b/Gestor.Common/Gestor.Common.Helpers/OrderAttribute.cs new file mode 100644 index 0000000..e72f517 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Helpers/OrderAttribute.cs @@ -0,0 +1,14 @@ +using System; + +namespace Gestor.Common.Helpers; + +[AttributeUsage(AttributeTargets.All)] +public class OrderAttribute : Attribute +{ + public int OrderProperty { get; private set; } + + public OrderAttribute(int orderProperty) + { + OrderProperty = orderProperty; + } +} diff --git a/Gestor.Common/Gestor.Common.Helpers/ScrollAnimationBehavior.cs b/Gestor.Common/Gestor.Common.Helpers/ScrollAnimationBehavior.cs new file mode 100644 index 0000000..3af3b0d --- /dev/null +++ b/Gestor.Common/Gestor.Common.Helpers/ScrollAnimationBehavior.cs @@ -0,0 +1,131 @@ +using System; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Media.Animation; + +namespace Gestor.Common.Helpers; + +public static class ScrollAnimationBehavior +{ + public static DependencyProperty VerticalOffsetProperty = DependencyProperty.RegisterAttached("VerticalOffset", typeof(double), typeof(ScrollAnimationBehavior), (PropertyMetadata)new UIPropertyMetadata((object)0.0, new PropertyChangedCallback(OnVerticalOffsetChanged))); + + public static DependencyProperty TimeDurationProperty = DependencyProperty.RegisterAttached("TimeDuration", typeof(TimeSpan), typeof(ScrollAnimationBehavior), new PropertyMetadata((object)new TimeSpan(0, 0, 0, 0, 0))); + + public static DependencyProperty PointsToScrollProperty = DependencyProperty.RegisterAttached("PointsToScroll", typeof(double), typeof(ScrollAnimationBehavior), new PropertyMetadata((object)0.0)); + + public static DependencyProperty IsEnabledProperty = DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(ScrollAnimationBehavior), (PropertyMetadata)new UIPropertyMetadata((object)false, new PropertyChangedCallback(OnIsEnabledChanged))); + + private static double _currentToValue; + + private static Storyboard _storyboard; + + public static void SetTimeDuration(FrameworkElement target, TimeSpan value) + { + ((DependencyObject)target).SetValue(TimeDurationProperty, (object)value); + } + + public static TimeSpan GetTimeDuration(FrameworkElement target) + { + return (TimeSpan)((DependencyObject)target).GetValue(TimeDurationProperty); + } + + public static void SetPointsToScroll(FrameworkElement target, double value) + { + ((DependencyObject)target).SetValue(PointsToScrollProperty, (object)value); + } + + private static void OnVerticalOffsetChanged(DependencyObject target, DependencyPropertyChangedEventArgs e) + { + ScrollViewer val = (ScrollViewer)(object)((target is ScrollViewer) ? target : null); + if (val != null) + { + val.ScrollToVerticalOffset((double)e.NewValue); + } + } + + public static void SetIsEnabled(FrameworkElement target, bool value) + { + ((DependencyObject)target).SetValue(IsEnabledProperty, (object)value); + } + + private static void OnIsEnabledChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) + { + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + ScrollViewer val = (ScrollViewer)(object)((sender is ScrollViewer) ? sender : null); + if (val != null) + { + ((FrameworkElement)val).Loaded += new RoutedEventHandler(ScrollerLoaded); + } + } + + private static void AnimateScroll(ScrollViewer scrollViewer) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Expected O, but got Unknown + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Expected O, but got Unknown + //IL_006c: Unknown result type (might be due to invalid IL or missing references) + //IL_0076: Expected O, but got Unknown + //IL_0093: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Expected O, but got Unknown + DoubleAnimationUsingKeyFrames val = new DoubleAnimationUsingKeyFrames + { + Duration = new Duration(GetTimeDuration((FrameworkElement)(object)scrollViewer)) + }; + val.KeyFrames.Add((DoubleKeyFrame)new EasingDoubleKeyFrame(scrollViewer.VerticalOffset, KeyTime.FromPercent(0.0))); + val.KeyFrames.Add((DoubleKeyFrame)new EasingDoubleKeyFrame(_currentToValue, KeyTime.FromPercent(1.0), (IEasingFunction)new SineEase + { + EasingMode = (EasingMode)1 + })); + _storyboard = new Storyboard(); + ((TimelineGroup)_storyboard).Children.Add((Timeline)(object)val); + Storyboard.SetTarget((DependencyObject)(object)val, (DependencyObject)(object)scrollViewer); + Storyboard.SetTargetProperty((DependencyObject)(object)val, new PropertyPath((object)VerticalOffsetProperty)); + _storyboard.Begin(); + } + + private static void SetEventHandlersForScrollViewer(ScrollViewer scroller) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Expected O, but got Unknown + ((UIElement)scroller).PreviewMouseWheel += new MouseWheelEventHandler(ScrollViewerPreviewMouseWheel); + } + + private static void ScrollerLoaded(object sender, RoutedEventArgs e) + { + SetEventHandlersForScrollViewer((ScrollViewer)((sender is ScrollViewer) ? sender : null)); + } + + private static void ScrollViewerPreviewMouseWheel(object sender, MouseWheelEventArgs e) + { + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Expected O, but got Unknown + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Invalid comparison between Unknown and I4 + double currentToValue = _currentToValue; + double num = e.Delta; + ScrollViewer val = (ScrollViewer)sender; + double num2 = num * 2.0 / 3.0; + if (_storyboard == null || (int)_storyboard.GetCurrentState() == 1) + { + _currentToValue = val.VerticalOffset; + } + _currentToValue = ((num2 > _currentToValue) ? 0.0 : ((_currentToValue - num2 > val.ScrollableHeight) ? val.ScrollableHeight : (_currentToValue - num2))); + if (_currentToValue != val.VerticalOffset && _currentToValue != currentToValue) + { + AnimateScroll(val); + } + ((RoutedEventArgs)e).Handled = true; + } +} diff --git a/Gestor.Common/Gestor.Common.Security/Token.cs b/Gestor.Common/Gestor.Common.Security/Token.cs new file mode 100644 index 0000000..a988d6a --- /dev/null +++ b/Gestor.Common/Gestor.Common.Security/Token.cs @@ -0,0 +1,138 @@ +using System; +using System.IO; +using System.Security.Cryptography; +using System.Text; +using Gestor.Common.Helpers; + +namespace Gestor.Common.Security; + +public class Token +{ + private readonly byte[] _key = new byte[32] + { + 45, 103, 73, 146, 210, 184, 220, 224, 94, 3, + 114, 60, 211, 119, 21, 100, 18, 201, 230, 195, + 119, 252, 73, 208, 209, 39, 222, 48, 47, 142, + 94, 24 + }; + + private readonly byte[] _initializationVector = new byte[16] + { + 95, 17, 151, 243, 209, 243, 119, 80, 63, 252, + 13, 180, 162, 13, 23, 218 + }; + + private static readonly byte[] Salt = new byte[16] + { + 38, 220, 255, 0, 173, 237, 122, 238, 197, 254, + 7, 175, 77, 8, 34, 60 + }; + + public bool VerifyToken(string authHeader) + { + try + { + if (!authHeader.Contains("Token")) + { + return false; + } + string ecryptedText = authHeader.Replace("Token ", ""); + return DefaultDecryption(ecryptedText); + } + catch (Exception) + { + return false; + } + } + + public string DefaultEncryption(long clientId, long providerId) + { + string plainText = $"{providerId}:{Functions.GetNetworkTime().ToUniversalTime().Ticks}"; + return Encrypt(plainText); + } + + public bool DefaultDecryption(string ecryptedText) + { + string[] textDecrypted = Decrypt(ecryptedText).Split(new char[1] { ':' }); + return DefaultVerification(textDecrypted); + } + + public bool DefaultVerification(string[] textDecrypted) + { + if (textDecrypted.Length < 2) + { + return false; + } + return new DateTime(long.Parse(textDecrypted[1]), DateTimeKind.Utc).Date.AddHours(5.0) >= Functions.GetNetworkTime().ToUniversalTime().Date; + } + + public string Encrypt(string plainText) + { + byte[] inArray; + using (AesCryptoServiceProvider aesCryptoServiceProvider = new AesCryptoServiceProvider()) + { + ICryptoTransform transform = aesCryptoServiceProvider.CreateEncryptor(_key, _initializationVector); + using MemoryStream memoryStream = new MemoryStream(); + using CryptoStream stream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Write); + using (StreamWriter streamWriter = new StreamWriter(stream)) + { + streamWriter.Write(plainText); + } + inArray = memoryStream.ToArray(); + } + return Convert.ToBase64String(inArray); + } + + public string Decrypt(string plainText) + { + try + { + byte[] buffer = Convert.FromBase64String(plainText); + string result; + using (AesCryptoServiceProvider aesCryptoServiceProvider = new AesCryptoServiceProvider()) + { + ICryptoTransform transform = aesCryptoServiceProvider.CreateDecryptor(_key, _initializationVector); + using MemoryStream stream = new MemoryStream(buffer); + using CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Read); + using StreamReader streamReader = new StreamReader(stream2); + result = streamReader.ReadToEnd(); + } + return result; + } + catch (Exception) + { + return null; + } + } + + public string AggerEncrypt(string plain) + { + string password = "aGG3r" + Convert.ToString(1012) + "#w3BDz$"; + byte[] bytes = Encoding.UTF8.GetBytes(plain); + Rijndael rijndael = Rijndael.Create(); + Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(password, Salt); + rijndael.Key = rfc2898DeriveBytes.GetBytes(32); + rijndael.IV = rfc2898DeriveBytes.GetBytes(16); + MemoryStream memoryStream = new MemoryStream(); + CryptoStream cryptoStream = new CryptoStream(memoryStream, rijndael.CreateEncryptor(), CryptoStreamMode.Write); + cryptoStream.Write(bytes, 0, bytes.Length); + cryptoStream.Close(); + return Convert.ToBase64String(memoryStream.ToArray()); + } + + public string AggerDecrypt(string cipher) + { + string password = "aGG3r" + Convert.ToString(1012) + "#w3BDz$"; + byte[] array = Convert.FromBase64String(cipher); + Rijndael rijndael = Rijndael.Create(); + Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(password, Salt); + rijndael.Key = rfc2898DeriveBytes.GetBytes(32); + rijndael.IV = rfc2898DeriveBytes.GetBytes(16); + MemoryStream memoryStream = new MemoryStream(); + CryptoStream cryptoStream = new CryptoStream(memoryStream, rijndael.CreateDecryptor(), CryptoStreamMode.Write); + cryptoStream.Write(array, 0, array.Length); + cryptoStream.Close(); + byte[] bytes = memoryStream.ToArray(); + return Encoding.UTF8.GetString(bytes); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/SemValicao.cs b/Gestor.Common/Gestor.Common.Validation/SemValicao.cs new file mode 100644 index 0000000..e551660 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/SemValicao.cs @@ -0,0 +1,12 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class SemValicao : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + return ValidationResult.ValidResult; + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoAno.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoAno.cs new file mode 100644 index 0000000..88c2749 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoAno.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoAno : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (string.IsNullOrWhiteSpace((value ?? "").ToString()) || value.ToString().ValidateAno()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Ano Inválido"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoAnoObrigatorio.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoAnoObrigatorio.cs new file mode 100644 index 0000000..ae52f52 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoAnoObrigatorio.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoAnoObrigatorio : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (value.ToString().ValidateAno()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Ano Inválido"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoCeiObrigatorio.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoCeiObrigatorio.cs new file mode 100644 index 0000000..9ed914d --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoCeiObrigatorio.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoCeiObrigatorio : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (value.ToString().ValidateCei()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"CEI Inválido"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoCep.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoCep.cs new file mode 100644 index 0000000..71a0f0c --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoCep.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoCep : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (string.IsNullOrWhiteSpace((value ?? "").ToString()) || value.ToString().ValidatePostCode()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"CEP Inválido"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoCepObrigatorio.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoCepObrigatorio.cs new file mode 100644 index 0000000..bc08a87 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoCepObrigatorio.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoCepObrigatorio : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (value.ToString().ValidatePostCode()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"CEP Inválido"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoChassi.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoChassi.cs new file mode 100644 index 0000000..dd1df1e --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoChassi.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoChassi : ValidationRule +{ + public override ValidationResult Validate(object chassiNumber, CultureInfo cultureInfo) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (string.IsNullOrWhiteSpace((chassiNumber ?? "").ToString()) || chassiNumber.ToString().ValidateChassi()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Chassi Inválido"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoChassiObrigatorio.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoChassiObrigatorio.cs new file mode 100644 index 0000000..c131126 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoChassiObrigatorio.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoChassiObrigatorio : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (value.ToString().ValidateChassi()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Chassi Inválido"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoData.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoData.cs new file mode 100644 index 0000000..7377557 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoData.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoData : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (string.IsNullOrWhiteSpace((value ?? "").ToString()) || value.ToString().ValidateDate()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Data Inválida"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoDataFutura.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoDataFutura.cs new file mode 100644 index 0000000..6e4ea28 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoDataFutura.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoDataFutura : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (string.IsNullOrWhiteSpace((value ?? "").ToString()) || value.ToString().ValidateFutureDate()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Data Inválida"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoDataMaior.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoDataMaior.cs new file mode 100644 index 0000000..88606a5 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoDataMaior.cs @@ -0,0 +1,27 @@ +using System; +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoDataMaior : ValidationRule +{ + public DateTime BaseDate { get; set; } + + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_0047: Expected O, but got Unknown + //IL_0035: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (!((DateTime)value < BaseDate)) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Data Inválida"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoDataObrigatoria.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoDataObrigatoria.cs new file mode 100644 index 0000000..2606ee3 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoDataObrigatoria.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoDataObrigatoria : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (value.ToString().ValidateDate()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Data Inválida"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoDataPassada.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoDataPassada.cs new file mode 100644 index 0000000..cb5f1ed --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoDataPassada.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoDataPassada : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (string.IsNullOrWhiteSpace((value ?? "").ToString()) || value.ToString().ValidatePastDate()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Data Inválida"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoDataPassadaObrigatoria.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoDataPassadaObrigatoria.cs new file mode 100644 index 0000000..456a6d8 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoDataPassadaObrigatoria.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoDataPassadaObrigatoria : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (value.ToString().ValidatePastDate()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Data Inválida"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoDocumento.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoDocumento.cs new file mode 100644 index 0000000..94eacf1 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoDocumento.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoDocumento : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (string.IsNullOrWhiteSpace((value ?? "").ToString()) || value.ToString().ValidateDocument()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Documento Inválido"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoDocumentoObrigatorio.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoDocumentoObrigatorio.cs new file mode 100644 index 0000000..a97d2b2 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoDocumentoObrigatorio.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoDocumentoObrigatorio : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (value.ToString().ValidateDocument()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Documento Inválido"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoDouble.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoDouble.cs new file mode 100644 index 0000000..8b8b9ab --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoDouble.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoDouble : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (string.IsNullOrWhiteSpace((value ?? "").ToString()) || value.ToString().ValidateDouble()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Valor Inválido"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoEmail.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoEmail.cs new file mode 100644 index 0000000..8948d1a --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoEmail.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoEmail : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (string.IsNullOrWhiteSpace((value ?? "").ToString()) || value.ToString().ValidateMail()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"E-mail Inválido"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoEmailObrigatorio.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoEmailObrigatorio.cs new file mode 100644 index 0000000..f7006a9 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoEmailObrigatorio.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoEmailObrigatorio : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (value.ToString().ValidateMail()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"E-mail Inválido"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoEstado.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoEstado.cs new file mode 100644 index 0000000..90eee59 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoEstado.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoEstado : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (string.IsNullOrWhiteSpace((value ?? "").ToString()) || value.ToString().ValidateState()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Estado Inválido"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoEstadoObrigatorio.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoEstadoObrigatorio.cs new file mode 100644 index 0000000..752d6ce --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoEstadoObrigatorio.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoEstadoObrigatorio : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (value.ToString().ValidateState()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Estado Inválido"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoFipeObrigatorio.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoFipeObrigatorio.cs new file mode 100644 index 0000000..287d8c6 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoFipeObrigatorio.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoFipeObrigatorio : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (value.ToString().ValidateFipe()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"FIPE Inválido"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoInt.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoInt.cs new file mode 100644 index 0000000..0a5eb46 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoInt.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoInt : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (string.IsNullOrWhiteSpace((value ?? "").ToString()) || value.ToString().ValidateInt()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Número Inválido"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoIntObrigatorio.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoIntObrigatorio.cs new file mode 100644 index 0000000..778a3fd --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoIntObrigatorio.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoIntObrigatorio : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (value.ToString().ValidateInt()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Número Inválido"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoLong.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoLong.cs new file mode 100644 index 0000000..b60823a --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoLong.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoLong : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (string.IsNullOrWhiteSpace((value ?? "").ToString()) || value.ToString().ValidateLong()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Número Inválido"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoLongObrigatorio.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoLongObrigatorio.cs new file mode 100644 index 0000000..a1d6519 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoLongObrigatorio.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoLongObrigatorio : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (value.ToString().ValidateLong()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Número Inválido"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoObrigatorio.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoObrigatorio.cs new file mode 100644 index 0000000..ba91173 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoObrigatorio.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoObrigatorio : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"OBRIGATÓRIO"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoOrgao.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoOrgao.cs new file mode 100644 index 0000000..51527d6 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoOrgao.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoOrgao : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (string.IsNullOrWhiteSpace((value ?? "").ToString()) || value.ToString().ValidateOrgao()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Orgão Inválido"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoPlaca.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoPlaca.cs new file mode 100644 index 0000000..b9c7df0 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoPlaca.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoPlaca : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (string.IsNullOrWhiteSpace((value ?? "").ToString()) || value.ToString().ValidatePlate()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Placa Inválida"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoPlacaObrigatorio.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoPlacaObrigatorio.cs new file mode 100644 index 0000000..6eef2aa --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoPlacaObrigatorio.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoPlacaObrigatorio : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (value.ToString().ValidatePlate()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Placa Inválida"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoPrefixo.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoPrefixo.cs new file mode 100644 index 0000000..5974905 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoPrefixo.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoPrefixo : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (string.IsNullOrWhiteSpace((value ?? "").ToString()) || value.ToString().ValidatePrefix()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"DDD Inválido"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoPrefixoObrigatorio.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoPrefixoObrigatorio.cs new file mode 100644 index 0000000..aab4dd2 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoPrefixoObrigatorio.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoPrefixoObrigatorio : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (value.ToString().ValidatePrefix()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"DDD Inválido"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoRneObrigatorio.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoRneObrigatorio.cs new file mode 100644 index 0000000..966fe74 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoRneObrigatorio.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoRneObrigatorio : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (value.ToString().ValidateRne()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"RNE Inválido"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoTelefone.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoTelefone.cs new file mode 100644 index 0000000..ca085ee --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoTelefone.cs @@ -0,0 +1,18 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoTelefone : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (string.IsNullOrWhiteSpace((value ?? "").ToString()) || value.ToString().ValidatePhone()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Telefone Inválido"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoTelefoneObrigatorio.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoTelefoneObrigatorio.cs new file mode 100644 index 0000000..6744a03 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoTelefoneObrigatorio.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoTelefoneObrigatorio : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (value.ToString().ValidatePhone()) + { + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Telefone Inválido"); + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoValorDiferenteZero.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoValorDiferenteZero.cs new file mode 100644 index 0000000..e3e7793 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoValorDiferenteZero.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoValorDiferenteZero : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Expected O, but got Unknown + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_0047: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (!value.ToString().ValidateDouble() || (decimal)value == 0m) + { + return new ValidationResult(false, (object)"Valor Inválido"); + } + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoValorMaiorQueZero.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoValorMaiorQueZero.cs new file mode 100644 index 0000000..c0a7459 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoValorMaiorQueZero.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows.Controls; + +namespace Gestor.Common.Validation; + +public class ValidacaoValorMaiorQueZero : ValidationRule +{ + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Expected O, but got Unknown + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Expected O, but got Unknown + if (!string.IsNullOrWhiteSpace((value ?? "").ToString())) + { + if (!value.ToString().ValidateDouble() || (decimal)value < 0.01m) + { + return new ValidationResult(false, (object)"Valor Inválido"); + } + return ValidationResult.ValidResult; + } + return new ValidationResult(false, (object)"Obrigatório"); + } +} diff --git a/Gestor.Common/Gestor.Common.Validation/ValidationHelper.cs b/Gestor.Common/Gestor.Common.Validation/ValidationHelper.cs new file mode 100644 index 0000000..020b86a --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidationHelper.cs @@ -0,0 +1,881 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +using Gestor.Common.Helpers; +using Gestor.Model.Attributes; +using Gestor.Model.Helper; +using Microsoft.Win32; + +namespace Gestor.Common.Validation; + +public static class ValidationHelper +{ + public static T GetEnumFromDescription<T>(string description) + { + Type typeFromHandle = typeof(T); + if (!typeFromHandle.IsEnum) + { + throw new InvalidOperationException(); + } + FieldInfo[] fields = typeFromHandle.GetFields(); + foreach (FieldInfo fieldInfo in fields) + { + if (Attribute.GetCustomAttribute(fieldInfo, typeof(DescriptionAttribute)) is DescriptionAttribute descriptionAttribute) + { + if (descriptionAttribute.Description == description) + { + return (T)fieldInfo.GetValue(null); + } + } + else if (fieldInfo.Name == description) + { + return (T)fieldInfo.GetValue(null); + } + } + throw new ArgumentException("Not found.", "description"); + } + + public static T GetEnumFromEntity<T>(this string entityName) + { + Type typeFromHandle = typeof(T); + if (!typeFromHandle.IsEnum) + { + return default(T); + } + FieldInfo[] fields = typeFromHandle.GetFields(); + foreach (FieldInfo fieldInfo in fields) + { + Attribute? customAttribute = Attribute.GetCustomAttribute(fieldInfo, typeof(EntityAttribute)); + EntityAttribute val = (EntityAttribute)(object)((customAttribute is EntityAttribute) ? customAttribute : null); + if (val != null) + { + if (val.Description == entityName) + { + return (T)fieldInfo.GetValue(null); + } + } + else if (fieldInfo.Name == entityName) + { + return (T)fieldInfo.GetValue(null); + } + } + return default(T); + } + + public static string DescriptionAttribute(this PropertyInfo pi) + { + object obj = pi.GetCustomAttributes(typeof(DescriptionAttribute), inherit: true).FirstOrDefault(); + if (obj == null) + { + return ""; + } + return ((DescriptionAttribute)obj).Description; + } + + public static string GetCategory(this Enum genericEnum) + { + MemberInfo[] member = genericEnum.GetType().GetMember(genericEnum.ToString()); + if (member.Length == 0) + { + return genericEnum.ToString(); + } + object[] customAttributes = member[0].GetCustomAttributes(typeof(CategoryAttribute), inherit: false); + if (!customAttributes.Any()) + { + return genericEnum.ToString(); + } + return ((CategoryAttribute)customAttributes.ElementAt(0)).Category; + } + + public static string GetEntity(this Enum genericEnum) + { + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + MemberInfo[] member = genericEnum.GetType().GetMember(genericEnum.ToString()); + if (member.Length == 0) + { + return genericEnum.ToString(); + } + object[] customAttributes = member[0].GetCustomAttributes(typeof(EntityAttribute), inherit: false); + if (!customAttributes.Any()) + { + return genericEnum.ToString(); + } + return ((EntityAttribute)customAttributes.ElementAt(0)).Description; + } + + public static string GetDescription(this Enum genericEnum) + { + if (genericEnum == null) + { + return ""; + } + MemberInfo[] member = genericEnum.GetType().GetMember(genericEnum.ToString()); + if (member.Length == 0) + { + return genericEnum.ToString(); + } + object[] customAttributes = member[0].GetCustomAttributes(typeof(DescriptionAttribute), inherit: false); + if (!customAttributes.Any()) + { + return genericEnum.ToString().Trim(); + } + return ((DescriptionAttribute)customAttributes.ElementAt(0)).Description.Trim(); + } + + public static string GetTipo(this Enum genericEnum) + { + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + MemberInfo[] member = genericEnum.GetType().GetMember(genericEnum.ToString()); + if (member.Length == 0) + { + return genericEnum.ToString(); + } + object[] customAttributes = member[0].GetCustomAttributes(typeof(TipoAttribute), inherit: false); + if (!customAttributes.Any()) + { + return genericEnum.ToString(); + } + return ((TipoAttribute)customAttributes.ElementAt(0)).Description; + } + + public static string GetHelp(this Enum genericEnum) + { + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + MemberInfo[] member = genericEnum.GetType().GetMember(genericEnum.ToString()); + if (member.Length == 0) + { + return genericEnum.ToString(); + } + object[] customAttributes = member[0].GetCustomAttributes(typeof(HelpAttribute), inherit: false); + if (!customAttributes.Any()) + { + return genericEnum.ToString(); + } + return ((HelpAttribute)customAttributes.ElementAt(0)).Description; + } + + public static string Mask(this string value, string mask) + { + int num = mask.Count((char x) => x == '#'); + if (string.IsNullOrEmpty(value) || num != value.Length) + { + return string.Empty; + } + string text = string.Empty; + int num2 = 0; + int num3 = 0; + for (int i = 0; i < mask.Length; i++) + { + if (mask[i] != '#') + { + text += $"{value.Substring(num2, i - num2 - num3)}{mask[i]}"; + num2 = i - num3; + num3++; + } + } + return text + value.Substring(num2, mask.Length - num2 - num3); + } + + public static string Length(this string stringValue, int maxLength) + { + if (stringValue.Length > maxLength) + { + return stringValue.Substring(0, maxLength); + } + return stringValue; + } + + public static string StringValue(this decimal decimalValue) + { + return decimalValue.ToString("F", new CultureInfo("en-US")); + } + + public static int ToInt(this string stringValue) + { + int.TryParse(stringValue, out var result); + return result; + } + + public static long ToLong(this string stringValue) + { + long.TryParse(stringValue, out var result); + return result; + } + + public static int? ToIntNullable(this string stringValue) + { + if (int.TryParse(stringValue, out var result)) + { + return result; + } + return null; + } + + public static long? ToLongNullable(this string stringValue) + { + if (long.TryParse(stringValue, out var result)) + { + return result; + } + return null; + } + + public static string ToTitleCase(this string stringValue) + { + return Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(stringValue.ToLower()); + } + + public static string Join(this IEnumerable<string> stringValues, string separator) + { + return string.Join(separator, stringValues); + } + + public static string ToCurrencyWithSymbol<T>(this T currencyDecimal, string currentCulture = "pt-BR") + { + return string.Format(new CultureInfo(currentCulture), "R$ {0:N2}", currencyDecimal); + } + + public static string ToCurrency<T>(this T currencyDecimal, string currentCulture = "pt-BR") + { + return string.Format(new CultureInfo(currentCulture), "{0:N2}", currencyDecimal); + } + + public static decimal ToCurrency(this string currencyString, string currentCulture = "pt-BR") + { + decimal.TryParse(currencyString.ClearCurrency(), NumberStyles.Any, new CultureInfo(currentCulture), out var result); + return result; + } + + public static string ToFloating<T>(this T currencyDecimal, string currentCulture = "pt-BR") + { + return string.Format(new CultureInfo(currentCulture), "{0:F}", currencyDecimal); + } + + public static string Alphanumeric(this string stringToClean, string replaceWith = "") + { + return Regex.Replace(stringToClean, "[^a-zA-Z0-9]", replaceWith); + } + + public static string AlphanumericAndSpace(this string stringToClean) + { + return Regex.Replace(stringToClean, "[^a-zA-Z0-9 ]", string.Empty); + } + + public static string RemoveDiacritics(this string stringWithAccents) + { + if (stringWithAccents == null) + { + return ""; + } + return Encoding.ASCII.GetString(Encoding.GetEncoding("Cyrillic").GetBytes(stringWithAccents)); + } + + public static string RemoverAcentos(this string text) + { + if (string.IsNullOrEmpty(text)) + { + return string.Empty; + } + return new string((from c in text.Normalize(NormalizationForm.FormD) + where char.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark + select c).ToArray()); + } + + public static string RemoveTag(this string stringWithTag) + { + return Regex.Replace(stringWithTag, "<(.|\\n)*?>", string.Empty); + } + + public static string Clear(this string stringToClean) + { + if (stringToClean != null) + { + return Regex.Replace(stringToClean, "[^\\d]", string.Empty); + } + return null; + } + + public static bool IsNullOrEmpty(this string stringToVerify) + { + return string.IsNullOrEmpty(stringToVerify); + } + + public static bool NotEquals(this string obj, string value) + { + return !obj.Equals(value); + } + + public static DateTime ToDateTime(this string dateString) + { + DateTime.TryParse(dateString.Trim(), out var result); + return result; + } + + public static string ToToken(this string postCode) + { + return Functions.GetNetworkTime().ToFileTime().ToString(); + } + + public static DateTime? ToDateTimeNullable(this string dateString) + { + if (dateString == null) + { + return null; + } + DateTime.TryParse(dateString.Trim(), out var result); + if (!(result == DateTime.MinValue)) + { + return result; + } + return null; + } + + public static string ClearCurrency(this string stringToClean) + { + if (!string.IsNullOrEmpty(stringToClean)) + { + return Regex.Replace(stringToClean, "[^\\d\\,\\.]", string.Empty); + } + return string.Empty; + } + + public static bool ContainsEquals<T>(this T @this, params T[] possibles) + { + return possibles.Contains(@this); + } + + public static bool ContainsAny(this string stringToCheck, params string[] stringArray) + { + return stringArray.Any(stringToCheck.Contains); + } + + public static int Age(this DateTime birthDate) + { + DateTime date = Functions.GetNetworkTime().Date; + int num = date.Year - birthDate.Year; + if (birthDate > date.AddYears(-num)) + { + num--; + } + return num; + } + + public static bool ValidateDocument(this string cpfCnpj) + { + if (string.IsNullOrEmpty(cpfCnpj)) + { + return false; + } + string text = cpfCnpj.Clear(); + int[] array = new int[14]; + int[] array2 = new int[2]; + if (text == string.Empty || new string(text[0], text.Length) == text) + { + return false; + } + if (text.Length == 11) + { + for (int i = 0; i <= 10; i++) + { + array[i] = Convert.ToInt32(text.Substring(i, 1)); + } + for (int i = 0; i <= 1; i++) + { + int num = 0; + for (int j = 0; j <= 8 + i; j++) + { + num += array[j] * (10 + i - j); + } + array2[i] = num * 10 % 11; + if (array2[i] == 10) + { + array2[i] = 0; + } + } + return (array2[0] == array[9]) & (array2[1] == array[10]); + } + if (text.Length != 14) + { + return false; + } + for (int i = 0; i <= 13; i++) + { + array[i] = Convert.ToInt32(text.Substring(i, 1)); + } + for (int i = 0; i <= 1; i++) + { + int num = 0; + for (int j = 0; j <= 11 + i; j++) + { + num += array[j] * Convert.ToInt32("6543298765432".Substring(j + 1 - i, 1)); + } + array2[i] = num * 10 % 11; + if (array2[i] == 10) + { + array2[i] = 0; + } + } + return (array2[0] == array[12]) & (array2[1] == array[13]); + } + + public static bool ValidateChassi(this string chassiNumber) + { + chassiNumber = chassiNumber?.ToUpper(); + if (!string.IsNullOrEmpty(chassiNumber)) + { + if (chassiNumber.Length == 17 && !Regex.IsMatch(chassiNumber, "^0| |^.{4,}([0-9A-Z])\\1{5,}|[iIoOqQ]")) + { + return Regex.IsMatch(chassiNumber, "[0-9]{4}$"); + } + return false; + } + return true; + } + + public static bool ValidatePlate(this string plateNumber) + { + if (!string.IsNullOrEmpty(plateNumber?.Alphanumeric())) + { + return Regex.IsMatch(plateNumber, "^[a-zA-Z]{3}-?[0-9]{4}$"); + } + return true; + } + + public static bool ValidateMail(this string mail) + { + if (mail == null) + { + return false; + } + return new Regex("^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$").IsMatch(mail); + } + + public static bool ValidatePhone(this string number) + { + if (number != null) + { + return Regex.Match(number, "^([2-9][0-9]{3,4})\\-([0-9]{4})$").Success; + } + return false; + } + + public static bool ValidateInt(this string value) + { + int result; + return int.TryParse(value, out result); + } + + public static bool ValidateLong(this string value) + { + long result; + return long.TryParse(value, out result); + } + + public static bool ValidateDecimal(this string value) + { + decimal result; + return decimal.TryParse(value, out result); + } + + public static bool ValidateValor(this string value) + { + string[] array = value.Split(new char[1] { '.' }); + if (array.Length < 2) + { + return true; + } + if (array.Length == 2) + { + return array[1].Length <= 2; + } + return false; + } + + public static bool ValidatePrefix(this string prefix) + { + if (!int.TryParse(prefix, out var result)) + { + return false; + } + if (result == 20 || result == 23 || result == 25 || result == 26 || result == 29 || result == 30 || result == 36 || result == 39 || result == 40 || result == 50 || result == 52 || result == 56 || result == 57 || result == 58 || result == 59 || result == 60 || result == 70 || result == 72 || result == 76 || result == 78 || result == 80 || result == 90 || result < 11 || result > 99) + { + return false; + } + return true; + } + + public static bool ValidatePostCode(this string postCode) + { + if (postCode != null) + { + return Regex.Match(postCode, "^[0-9]{2}.?[0-9]{3}-[0-9]{3}$").Success; + } + return false; + } + + public static bool ValidateDouble(this string number) + { + double result; + return double.TryParse(number, out result); + } + + public static bool ValidateDate(this string birthday) + { + DateTime result; + return DateTime.TryParse(birthday, out result); + } + + public static bool ValidateAno(this string ano) + { + if (int.TryParse(ano, out var _)) + { + return ano.Length == 4; + } + return false; + } + + public static bool ValidatePastDate(this string birthday) + { + if (DateTime.TryParse(birthday, out var result)) + { + return result < Functions.GetNetworkTime().Date; + } + return false; + } + + public static bool ValidateFutureDate(this string birthday) + { + if (DateTime.TryParse(birthday, out var result)) + { + return result > Functions.GetNetworkTime().Date; + } + return false; + } + + public static bool ValidateAttendanceNumber(this string number) + { + if (number != null) + { + return Regex.Match(number, "^[0-9]").Success; + } + return false; + } + + public static string Normalized(this string word) + { + if (string.IsNullOrEmpty(word)) + { + return string.Empty; + } + return Encoding.ASCII.GetString(Encoding.GetEncoding("Cyrillic").GetBytes(word)).ToUpper().Trim(); + } + + public static string GetDefaultExtension(this string mimeType) + { + object obj = Registry.ClassesRoot.OpenSubKey("MIME\\Database\\Content Type\\" + mimeType, writable: false)?.GetValue("Extension", null); + if (obj == null) + { + return string.Join(string.Empty, mimeType.Split(Path.GetInvalidPathChars())).Replace("/", "."); + } + return obj.ToString(); + } + + public static string NormalizePath(this string fullFilename) + { + char[] invalidPathChars = Path.GetInvalidPathChars(); + char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); + fullFilename = fullFilename.Replace("/", string.Empty); + string text = Path.GetFileName(fullFilename); + string text2 = Path.GetDirectoryName(fullFilename); + char[] array = invalidPathChars; + foreach (char c in array) + { + text2 = text2.Replace(c.ToString(), string.Empty); + } + array = invalidFileNameChars; + foreach (char c2 in array) + { + text = text.Replace(c2.ToString(), string.Empty); + } + return text2 + "\\" + text; + } + + public static string OnlyNumber(this string sentence) + { + if (sentence == null) + { + return null; + } + return new Regex("[^\\d]").Replace(sentence, ""); + } + + public static string FormatarTelefone(this string number) + { + number = number?.OnlyNumber(); + return number?.Length switch + { + 8 => Convert.ToUInt64(number).ToString("0000\\-0000"), + 9 => Convert.ToUInt64(number).ToString("00000\\-0000"), + 11 => Convert.ToUInt64(number).ToString("0000 000 0000"), + _ => number.Clear(), + }; + } + + public static string FormatPostCode(this string postCode) + { + if (!string.IsNullOrEmpty(postCode)) + { + return Convert.ToUInt64(postCode.OnlyNumber()).ToString("00000\\-000"); + } + return ""; + } + + public static string FormatRegiao(this string str) + { + if (Regex.Match(str, "[^0-9-.]").Success) + { + return str; + } + if (!string.IsNullOrEmpty(str)) + { + return Convert.ToUInt64(str.OnlyNumber()).ToString("00\\.000\\-000"); + } + return ""; + } + + public static string FormatFipe(this string value) + { + if (!string.IsNullOrEmpty(value)) + { + return Convert.ToUInt64(value.OnlyNumber()).ToString("000000\\-0"); + } + return ""; + } + + public static bool IsNotNullOrEmpty(this string stringToVerify) + { + return !string.IsNullOrEmpty(stringToVerify); + } + + public static string FormatRenavam(this string value) + { + if (!string.IsNullOrEmpty(value)) + { + if (!long.TryParse(value.OnlyNumber(), out var result)) + { + return string.Empty; + } + return result.ToString("00\\.000\\.000\\.000"); + } + return string.Empty; + } + + public static string FormatCi(this string value) + { + string text = value.OnlyNumber().Trim(); + if (string.IsNullOrEmpty(text)) + { + return string.Empty; + } + if (long.TryParse(text, out var _)) + { + return Convert.ToUInt64(text).ToString("00\\.000\\.000\\.000\\.000"); + } + return text; + } + + public static bool ValidateState(this string state) + { + if (!string.IsNullOrEmpty(state)) + { + return new string[27] + { + "AC", "AL", "AP", "AM", "BA", "CE", "DF", "ES", "GO", "MA", + "MT", "MS", "MG", "PA", "PB", "PR", "PE", "PI", "RJ", "RN", + "RS", "RO", "RR", "SC", "SP", "SE", "TO" + }.Contains(state.ToUpper()); + } + return false; + } + + public static bool ValidateOrgao(this string orgao) + { + if (!string.IsNullOrEmpty(orgao)) + { + return new string[70] + { + "SSP", "DETRAN", "ABNC", "CGPI", "DUREX", "DPF", "CGPI", "CGPMAF", "CNIG", "CNT", + "COREN", "CORECON", "CRA", "CRAS", "CRB", "CRC", "CRE", "CREA", "CRECI", "CREFIT", + "CRESS", "CRF", "CRM", "CRN", "CRO", "CRP", "CRPRE", "CRQ", "CRRC", "CRMV", + "CSC", "CTPS", "DIC", "DIREX", "DPMAF", "DPT", "DST", "FGTS", "FIPE", "FLS", + "GOVGO", "I CLA", "IFP", "IGP", "IICCECF/RO", "IIMG", "IML", "IPC", "IPF", "MAE", + "MEX", "MMA", "OAB", "OMB", "PCMG", "PMMG", "POM", "SDS", "SNJ", "SECC", + "SEJUSP", "SES", "EST", "SESP", "SJS", "SJTC", "SJTS", "SPTC", "DGPC", "" + }.Contains(orgao.ToUpper()); + } + return false; + } + + public static bool ValidateFipe(this string value) + { + if (new Regex("^\\d{6}\\-\\d{1}$").IsMatch(value)) + { + return true; + } + return false; + } + + public static string FormatDocument(this string number) + { + number = number.OnlyNumber(); + return number.Length switch + { + 11 => Convert.ToUInt64(number).ToString("000\\.000\\.000\\-00"), + 14 => Convert.ToUInt64(number).ToString("00\\.000\\.000\\/0000\\-00"), + _ => number, + }; + } + + public static string FormatCurrency(this string value) + { + if (string.IsNullOrEmpty(value)) + { + return ""; + } + return value.ToCurrency().ToString("c"); + } + + public static string FormatDate(this string date) + { + if (string.IsNullOrEmpty(date)) + { + return ""; + } + date = date.OnlyNumber(); + switch (date.Length) + { + case 4: + date += Functions.GetNetworkTime().Date.Year; + return Convert.ToUInt64(date).ToString("00\\/00\\/0000"); + case 6: + return Convert.ToUInt64(date).ToString("00\\/00\\/00"); + case 8: + return Convert.ToUInt64(date).ToString("00\\/00\\/0000"); + default: + return date; + } + } + + public static string FormatCompetencia(this string date) + { + if (string.IsNullOrEmpty(date)) + { + return ""; + } + date = date.OnlyNumber(); + switch (date.Length) + { + case 2: + date += Functions.GetNetworkTime().Date.Year; + return Convert.ToUInt64(date).ToString("00\\/0000"); + case 4: + return Convert.ToUInt64(date).ToString("00\\/00"); + case 6: + return Convert.ToUInt64(date).ToString("00\\/0000"); + default: + return date; + } + } + + public static string FormatTime(this string time) + { + if (string.IsNullOrEmpty(time)) + { + return null; + } + time = time.OnlyNumber(); + return time.Length switch + { + 4 => Convert.ToUInt64(time).ToString("00:00"), + 3 => Convert.ToUInt64(time).ToString("00:00"), + _ => null, + }; + } + + public static void AddSorted<T>(this ObservableCollection<T> list, T item, IComparer<T> comparer = null) + { + if (comparer == null) + { + comparer = Comparer<T>.Default; + } + int i; + for (i = 0; i < list.Count && comparer.Compare(list[i], item) < 0; i++) + { + } + list.Insert(i, item); + } + + public static bool ValidateCei(this string cei) + { + if (string.IsNullOrEmpty(cei)) + { + return false; + } + cei = cei.Trim(); + cei = Regex.Replace(cei, "[^\\d]", ""); + if (cei.Length != 12) + { + return false; + } + int num = 0; + for (int i = 1; i < 12; i++) + { + int num2 = Convert.ToInt32("74185216374".Substring(i - 1, 1)); + int num3 = Convert.ToInt32(cei.Substring(i - 1, 1)); + num += num2 * num3; + } + int num4 = num / 10; + int num5 = num - num / 10 * 10; + num = num4 + num5; + num5 = num - num / 10 * 10; + int num6 = Convert.ToInt32(cei.Substring(11, 1)); + int num7 = 10 - num5; + return num6 == num7; + } + + public static bool ValidateRne(this string rne) + { + if (string.IsNullOrEmpty(rne)) + { + return false; + } + return true; + } + + public static bool ValidateCaepf(this string caepf) + { + return !string.IsNullOrEmpty(caepf); + } + + public static string Captalize(this string text) + { + return new CultureInfo("pt-Br", useUserOverride: false).TextInfo.ToTitleCase(text.ToLower()); + } + + public static bool ValidaCep(this string cep) + { + if (string.IsNullOrWhiteSpace(cep)) + { + return Regex.IsMatch(cep, "^\\d{5}-?\\d{3}$"); + } + return false; + } +} diff --git a/Gestor.Common/Gestor.Common.csproj b/Gestor.Common/Gestor.Common.csproj new file mode 100644 index 0000000..ebd448a --- /dev/null +++ b/Gestor.Common/Gestor.Common.csproj @@ -0,0 +1,25 @@ +<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> + <PropertyGroup> + <AssemblyName>Gestor.Common</AssemblyName> + <GenerateAssemblyInfo>False</GenerateAssemblyInfo> + <UseWPF>True</UseWPF> + <TargetFramework>net48</TargetFramework> + </PropertyGroup> + <PropertyGroup> + <LangVersion>11.0</LangVersion> + <AllowUnsafeBlocks>True</AllowUnsafeBlocks> + </PropertyGroup> + <PropertyGroup /> + <ItemGroup /> + <ItemGroup> + <Reference Include="Gestor.Model" /> + <Reference Include="System.Core"> + <HintPath>../../../../usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.25/System.Core.dll</HintPath> + </Reference> + <Reference Include="WindowsBase"> + <HintPath>../../../../usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.25/WindowsBase.dll</HintPath> + </Reference> + <Reference Include="System.Net.Http" /> + <Reference Include="PresentationCore" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Gestor.Common/Gestor.Common.dll_Decompiler.com.sln b/Gestor.Common/Gestor.Common.dll_Decompiler.com.sln new file mode 100644 index 0000000..dfb40ce --- /dev/null +++ b/Gestor.Common/Gestor.Common.dll_Decompiler.com.sln @@ -0,0 +1,24 @@ +Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.5.2.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gestor.Common", "Gestor.Common.csproj", "{CA151E34-14DD-A767-5D19-CDD073D2B10D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {CA151E34-14DD-A767-5D19-CDD073D2B10D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CA151E34-14DD-A767-5D19-CDD073D2B10D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CA151E34-14DD-A767-5D19-CDD073D2B10D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CA151E34-14DD-A767-5D19-CDD073D2B10D}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {7C27CA60-9FD6-4FFD-B937-48814CE98732}
+ EndGlobalSection
+EndGlobal
diff --git a/Gestor.Common/Gestor.Model.dll b/Gestor.Common/Gestor.Model.dll Binary files differnew file mode 100644 index 0000000..2b2b2d0 --- /dev/null +++ b/Gestor.Common/Gestor.Model.dll diff --git a/Gestor.Common/Properties/AssemblyInfo.cs b/Gestor.Common/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..cf878fb --- /dev/null +++ b/Gestor.Common/Properties/AssemblyInfo.cs @@ -0,0 +1,17 @@ +using System.Diagnostics; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +[assembly: AssemblyTitle("Gestor.Common")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Gestor.Common")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: ComVisible(false)] +[assembly: Guid("73d1cb17-a0c5-4e22-884f-171c125d27bc")] +[assembly: AssemblyFileVersion("8.4.0.0")] +[assembly: AssemblyVersion("8.4.0.0")] diff --git a/Gestor.Common/bin/Debug/net48/Gestor.Common.dll b/Gestor.Common/bin/Debug/net48/Gestor.Common.dll Binary files differnew file mode 100644 index 0000000..45ec5ea --- /dev/null +++ b/Gestor.Common/bin/Debug/net48/Gestor.Common.dll diff --git a/Gestor.Common/bin/Debug/net48/Gestor.Common.pdb b/Gestor.Common/bin/Debug/net48/Gestor.Common.pdb Binary files differnew file mode 100644 index 0000000..ee3762b --- /dev/null +++ b/Gestor.Common/bin/Debug/net48/Gestor.Common.pdb diff --git a/Gestor.Common/bin/Debug/net48/Gestor.Model.dll b/Gestor.Common/bin/Debug/net48/Gestor.Model.dll Binary files differnew file mode 100644 index 0000000..2b2b2d0 --- /dev/null +++ b/Gestor.Common/bin/Debug/net48/Gestor.Model.dll diff --git a/Gestor.Common/bin/Debug/net48/Newtonsoft.Json.dll b/Gestor.Common/bin/Debug/net48/Newtonsoft.Json.dll Binary files differnew file mode 100644 index 0000000..7af125a --- /dev/null +++ b/Gestor.Common/bin/Debug/net48/Newtonsoft.Json.dll diff --git a/Gestor.Common/obj/Debug/net48/.NETFramework,Version=v4.8.AssemblyAttributes.cs b/Gestor.Common/obj/Debug/net48/.NETFramework,Version=v4.8.AssemblyAttributes.cs new file mode 100644 index 0000000..3cf0af3 --- /dev/null +++ b/Gestor.Common/obj/Debug/net48/.NETFramework,Version=v4.8.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// <autogenerated />
+using System;
+using System.Reflection;
+[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
diff --git a/Gestor.Common/obj/Debug/net48/Gestor.C.C68C472A.Up2Date b/Gestor.Common/obj/Debug/net48/Gestor.C.C68C472A.Up2Date new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Gestor.Common/obj/Debug/net48/Gestor.C.C68C472A.Up2Date diff --git a/Gestor.Common/obj/Debug/net48/Gestor.Common.GeneratedMSBuildEditorConfig.editorconfig b/Gestor.Common/obj/Debug/net48/Gestor.Common.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..f562957 --- /dev/null +++ b/Gestor.Common/obj/Debug/net48/Gestor.Common.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,8 @@ +is_global = true
+build_property.RootNamespace = Gestor.Common
+build_property.ProjectDir = C:\Users\Usuario\Downloads\Gestor.Common.dll_Decompiler.com\
+build_property.EnableComHosting =
+build_property.EnableGeneratedComInterfaceComImportInterop =
+build_property.CsWinRTUseWindowsUIXamlProjections = false
+build_property.EffectiveAnalysisLevelStyle =
+build_property.EnableCodeStyleSeverity =
diff --git a/Gestor.Common/obj/Debug/net48/Gestor.Common.assets.cache b/Gestor.Common/obj/Debug/net48/Gestor.Common.assets.cache Binary files differnew file mode 100644 index 0000000..5ae7db8 --- /dev/null +++ b/Gestor.Common/obj/Debug/net48/Gestor.Common.assets.cache diff --git a/Gestor.Common/obj/Debug/net48/Gestor.Common.csproj.AssemblyReference.cache b/Gestor.Common/obj/Debug/net48/Gestor.Common.csproj.AssemblyReference.cache Binary files differnew file mode 100644 index 0000000..f52b7c8 --- /dev/null +++ b/Gestor.Common/obj/Debug/net48/Gestor.Common.csproj.AssemblyReference.cache diff --git a/Gestor.Common/obj/Debug/net48/Gestor.Common.csproj.CoreCompileInputs.cache b/Gestor.Common/obj/Debug/net48/Gestor.Common.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..6478caa --- /dev/null +++ b/Gestor.Common/obj/Debug/net48/Gestor.Common.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +7dc9cf261aef0675ecd47283f3aaeda00343728778ec934646e12395c6896467
diff --git a/Gestor.Common/obj/Debug/net48/Gestor.Common.csproj.FileListAbsolute.txt b/Gestor.Common/obj/Debug/net48/Gestor.Common.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..a36eb3c --- /dev/null +++ b/Gestor.Common/obj/Debug/net48/Gestor.Common.csproj.FileListAbsolute.txt @@ -0,0 +1,10 @@ +c:\Users\Usuario\Downloads\Gestor.Common.dll_Decompiler.com\obj\Debug\net48\Gestor.Common.csproj.AssemblyReference.cache
+c:\Users\Usuario\Downloads\Gestor.Common.dll_Decompiler.com\obj\Debug\net48\Gestor.Common.GeneratedMSBuildEditorConfig.editorconfig
+c:\Users\Usuario\Downloads\Gestor.Common.dll_Decompiler.com\obj\Debug\net48\Gestor.Common.csproj.CoreCompileInputs.cache
+c:\Users\Usuario\Downloads\Gestor.Common.dll_Decompiler.com\bin\Debug\net48\Gestor.Common.dll
+c:\Users\Usuario\Downloads\Gestor.Common.dll_Decompiler.com\bin\Debug\net48\Gestor.Common.pdb
+c:\Users\Usuario\Downloads\Gestor.Common.dll_Decompiler.com\bin\Debug\net48\Gestor.Model.dll
+c:\Users\Usuario\Downloads\Gestor.Common.dll_Decompiler.com\bin\Debug\net48\Newtonsoft.Json.dll
+C:\Users\Usuario\Downloads\Gestor.Common.dll_Decompiler.com\obj\Debug\net48\Gestor.C.C68C472A.Up2Date
+c:\Users\Usuario\Downloads\Gestor.Common.dll_Decompiler.com\obj\Debug\net48\Gestor.Common.dll
+c:\Users\Usuario\Downloads\Gestor.Common.dll_Decompiler.com\obj\Debug\net48\Gestor.Common.pdb
diff --git a/Gestor.Common/obj/Debug/net48/Gestor.Common.dll b/Gestor.Common/obj/Debug/net48/Gestor.Common.dll Binary files differnew file mode 100644 index 0000000..45ec5ea --- /dev/null +++ b/Gestor.Common/obj/Debug/net48/Gestor.Common.dll diff --git a/Gestor.Common/obj/Debug/net48/Gestor.Common.pdb b/Gestor.Common/obj/Debug/net48/Gestor.Common.pdb Binary files differnew file mode 100644 index 0000000..ee3762b --- /dev/null +++ b/Gestor.Common/obj/Debug/net48/Gestor.Common.pdb diff --git a/Gestor.Common/obj/Gestor.Common.csproj.nuget.dgspec.json b/Gestor.Common/obj/Gestor.Common.csproj.nuget.dgspec.json new file mode 100644 index 0000000..baa23f8 --- /dev/null +++ b/Gestor.Common/obj/Gestor.Common.csproj.nuget.dgspec.json @@ -0,0 +1,53 @@ +{
+ "format": 1,
+ "restore": {
+ "C:\\Users\\Usuario\\Downloads\\Gestor.Common.dll_Decompiler.com\\Gestor.Common.csproj": {}
+ },
+ "projects": {
+ "C:\\Users\\Usuario\\Downloads\\Gestor.Common.dll_Decompiler.com\\Gestor.Common.csproj": {
+ "version": "1.0.0",
+ "restore": {
+ "projectUniqueName": "C:\\Users\\Usuario\\Downloads\\Gestor.Common.dll_Decompiler.com\\Gestor.Common.csproj",
+ "projectName": "Gestor.Common",
+ "projectPath": "C:\\Users\\Usuario\\Downloads\\Gestor.Common.dll_Decompiler.com\\Gestor.Common.csproj",
+ "packagesPath": "C:\\Users\\Usuario\\.nuget\\packages\\",
+ "outputPath": "C:\\Users\\Usuario\\Downloads\\Gestor.Common.dll_Decompiler.com\\obj\\",
+ "projectStyle": "PackageReference",
+ "configFilePaths": [
+ "C:\\Users\\Usuario\\AppData\\Roaming\\NuGet\\NuGet.Config",
+ "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
+ ],
+ "originalTargetFrameworks": [
+ "net48"
+ ],
+ "sources": {
+ "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
+ "https://api.nuget.org/v3/index.json": {}
+ },
+ "frameworks": {
+ "net48": {
+ "targetAlias": "net48",
+ "projectReferences": {}
+ }
+ },
+ "warningProperties": {
+ "warnAsError": [
+ "NU1605"
+ ]
+ },
+ "restoreAuditProperties": {
+ "enableAudit": "true",
+ "auditLevel": "low",
+ "auditMode": "direct"
+ },
+ "SdkAnalysisLevel": "10.0.200"
+ },
+ "frameworks": {
+ "net48": {
+ "targetAlias": "net48",
+ "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\10.0.201\\RuntimeIdentifierGraph.json"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/Gestor.Common/obj/Gestor.Common.csproj.nuget.g.props b/Gestor.Common/obj/Gestor.Common.csproj.nuget.g.props new file mode 100644 index 0000000..2d9dd9c --- /dev/null +++ b/Gestor.Common/obj/Gestor.Common.csproj.nuget.g.props @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
+ <RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
+ <RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
+ <ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
+ <NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
+ <NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Usuario\.nuget\packages\</NuGetPackageFolders>
+ <NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
+ <NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">7.0.0</NuGetToolVersion>
+ </PropertyGroup>
+ <ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
+ <SourceRoot Include="C:\Users\Usuario\.nuget\packages\" />
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/Gestor.Common/obj/Gestor.Common.csproj.nuget.g.targets b/Gestor.Common/obj/Gestor.Common.csproj.nuget.g.targets new file mode 100644 index 0000000..35a7576 --- /dev/null +++ b/Gestor.Common/obj/Gestor.Common.csproj.nuget.g.targets @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
\ No newline at end of file diff --git a/Gestor.Common/obj/project.assets.json b/Gestor.Common/obj/project.assets.json new file mode 100644 index 0000000..eb9df3c --- /dev/null +++ b/Gestor.Common/obj/project.assets.json @@ -0,0 +1,58 @@ +{
+ "version": 3,
+ "targets": {
+ ".NETFramework,Version=v4.8": {}
+ },
+ "libraries": {},
+ "projectFileDependencyGroups": {
+ ".NETFramework,Version=v4.8": []
+ },
+ "packageFolders": {
+ "C:\\Users\\Usuario\\.nuget\\packages\\": {}
+ },
+ "project": {
+ "version": "1.0.0",
+ "restore": {
+ "projectUniqueName": "C:\\Users\\Usuario\\Downloads\\Gestor.Common.dll_Decompiler.com\\Gestor.Common.csproj",
+ "projectName": "Gestor.Common",
+ "projectPath": "C:\\Users\\Usuario\\Downloads\\Gestor.Common.dll_Decompiler.com\\Gestor.Common.csproj",
+ "packagesPath": "C:\\Users\\Usuario\\.nuget\\packages\\",
+ "outputPath": "C:\\Users\\Usuario\\Downloads\\Gestor.Common.dll_Decompiler.com\\obj\\",
+ "projectStyle": "PackageReference",
+ "configFilePaths": [
+ "C:\\Users\\Usuario\\AppData\\Roaming\\NuGet\\NuGet.Config",
+ "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
+ ],
+ "originalTargetFrameworks": [
+ "net48"
+ ],
+ "sources": {
+ "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
+ "https://api.nuget.org/v3/index.json": {}
+ },
+ "frameworks": {
+ "net48": {
+ "targetAlias": "net48",
+ "projectReferences": {}
+ }
+ },
+ "warningProperties": {
+ "warnAsError": [
+ "NU1605"
+ ]
+ },
+ "restoreAuditProperties": {
+ "enableAudit": "true",
+ "auditLevel": "low",
+ "auditMode": "direct"
+ },
+ "SdkAnalysisLevel": "10.0.200"
+ },
+ "frameworks": {
+ "net48": {
+ "targetAlias": "net48",
+ "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\10.0.201\\RuntimeIdentifierGraph.json"
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/Gestor.Common/obj/project.nuget.cache b/Gestor.Common/obj/project.nuget.cache new file mode 100644 index 0000000..a51564a --- /dev/null +++ b/Gestor.Common/obj/project.nuget.cache @@ -0,0 +1,8 @@ +{
+ "version": 2,
+ "dgSpecHash": "jOAbQppWG6I=",
+ "success": true,
+ "projectFilePath": "C:\\Users\\Usuario\\Downloads\\Gestor.Common.dll_Decompiler.com\\Gestor.Common.csproj",
+ "expectedPackageFiles": [],
+ "logs": []
+}
\ No newline at end of file |