#wip(py,cs): Creating strong base.

This commit is contained in:
KyMAN 2026-04-07 07:18:10 +02:00
parent 58548a6576
commit 86424a0ca3
12 changed files with 88 additions and 110 deletions

View File

@ -1,29 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CSharp", "CSharp", "{B41BF331-FCCB-2ADF-CDB6-767964B34647}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnP", "CSharp\AnP.csproj", "{720E15E3-2F0D-4B91-98F1-400300826A0A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{720E15E3-2F0D-4B91-98F1-400300826A0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{720E15E3-2F0D-4B91-98F1-400300826A0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{720E15E3-2F0D-4B91-98F1-400300826A0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{720E15E3-2F0D-4B91-98F1-400300826A0A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{720E15E3-2F0D-4B91-98F1-400300826A0A} = {B41BF331-FCCB-2ADF-CDB6-767964B34647}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {47442BB3-05F5-4AAF-A859-D456A81FC0A2}
EndGlobalSection
EndGlobal

View File

@ -4,7 +4,7 @@
* @typedef {import("../Application/AnP.ecma.js").AnP} AnP * @typedef {import("../Application/AnP.ecma.js").AnP} AnP
*/ */
import {Utils} from "../Utils/Utils.ecma"; import {Common} from "../Utils/Common.ecma";
import {Check} from "../Utils/Check.ecma"; import {Check} from "../Utils/Check.ecma";
/** /**
@ -78,7 +78,7 @@ export const BaseAbstract = (function(){
const constructor = () => { const constructor = () => {
/** @type {base_abstract_get_value} */ /** @type {base_abstract_get_value} */
const get_value = anp.settings ? anp.settings.get : Utils.get_value; const get_value = anp.settings ? anp.settings.get : Common.get_value;
/** @type {Object.<string, boolean>} */ /** @type {Object.<string, boolean>} */
this.allow_print = [ this.allow_print = [
@ -114,7 +114,7 @@ export const BaseAbstract = (function(){
* @access public * @access public
*/ */
this.extends = item => { this.extends = item => {
Utils.extends(self, item); Common.extends(self, item);
}; };
/** /**

View File

@ -69,7 +69,7 @@ export const FilesDriver = (function(){
"timeout", "default_timeout" "timeout", "default_timeout"
], null, default_timeout); ], null, default_timeout);
Utils.execute(callback); Common.execute(callback);
return true; return true;
}; };
@ -100,7 +100,7 @@ export const FilesDriver = (function(){
/** @type {XMLHttpRequest} */ /** @type {XMLHttpRequest} */
const ajax = new XMLHttpRequest(), const ajax = new XMLHttpRequest(),
/** @type {number} */ /** @type {number} */
timeout = Utils.get_value([ timeout = Common.get_value([
"timeout", "ajax_timeout", "default_timeout" "timeout", "ajax_timeout", "default_timeout"
], inputs, default_timeout), ], inputs, default_timeout),
/** @type {number} */ /** @type {number} */
@ -108,7 +108,7 @@ export const FilesDriver = (function(){
end = code => { end = code => {
code && (error |= 1 << code); code && (error |= 1 << code);
!ended && (ended = true) && !ended && (ended = true) &&
Utils.execute( Common.execute(
callback, callback,
ajax.responseText, ajax.responseText,
ajax.status, ajax.status,
@ -119,11 +119,11 @@ export const FilesDriver = (function(){
}; };
ajax.open( ajax.open(
Utils.get_value([ Common.get_value([
"method", "http_method", "default_http_method" "method", "http_method", "default_http_method"
], inputs, default_http_method), ], inputs, default_http_method),
path, path,
Utils.get_value([ Common.get_value([
"asynchronous", "http_asynchronous", "default_http_asynchronous" "asynchronous", "http_asynchronous", "default_http_asynchronous"
], inputs, default_http_asynchronous) ], inputs, default_http_asynchronous)
); );

View File

@ -1,7 +1,7 @@
"use strict"; "use strict";
import {Check} from "../Utils/Check.ecma.js"; import {Check} from "../Utils/Check.ecma.js";
import {Utils} from "../Utils/Utils.ecma.js"; import {Common} from "../Utils/Common.ecma.js";
/** /**
* @typedef {import("../Application/AnP.ecma.js").AnP} AnP * @typedef {import("../Application/AnP.ecma.js").AnP} AnP
@ -57,7 +57,7 @@ export const I18NManager = (function(){
* @access public * @access public
*/ */
this.start = (callback = null) => { this.start = (callback = null) => {
Utils.execute_array([ Common.execute_array([
"default_i18n_files", "i18n_files" "default_i18n_files", "i18n_files"
], (key, next_callback) => { ], (key, next_callback) => {
self.add(anp.settings.get(key), next_callback, true); self.add(anp.settings.get(key), next_callback, true);
@ -80,7 +80,7 @@ export const I18NManager = (function(){
/** @type {Array.<string>} */ /** @type {Array.<string>} */
languages = [language_selected, default_language].concat(Object.keys(sentences)), languages = [language_selected, default_language].concat(Object.keys(sentences)),
/** @type {Array.<string>} */ /** @type {Array.<string>} */
keys = Utils.get_keys(texts); keys = Common.get_keys(texts);
if(keys.length) if(keys.length)
for(const language of languages){ for(const language of languages){
@ -104,7 +104,7 @@ export const I18NManager = (function(){
null) : null) :
null)) null))
return Utils.string_variables(( return Common.string_variables((
Check.is_array(text) ? text.join("") : Check.is_array(text) ? text.join("") :
text), variables, _default); text), variables, _default);
}; };

View File

@ -1,6 +1,6 @@
"use strict"; "use strict";
import {Utils} from "../Utils/Utils.ecma.js"; import {Common} from "../Utils/Common.ecma.js";
/** /**
* @typedef {import("../Application/AnP.ecma.js").AnP} AnP * @typedef {import("../Application/AnP.ecma.js").AnP} AnP
@ -59,7 +59,7 @@ export const IdentifiersManager = (function(){
do{ do{
identifier = ""; identifier = "";
while((identifier += Utils.get_random(alphabet)).length < length); while((identifier += Common.get_random(alphabet)).length < length);
}while( }while(
identifiers.includes(identifier) || identifiers.includes(identifier) ||
/^[^a-z]/i.test(identifier) || /^[^a-z]/i.test(identifier) ||

View File

@ -1,6 +1,6 @@
"use strict"; "use strict";
import {Utils} from "../Utils/Utils.ecma.js"; import {Common} from "../Utils/Common.ecma.js";
/** /**
* @typedef {import("../Application/AnP.ecma.js").AnP} AnP * @typedef {import("../Application/AnP.ecma.js").AnP} AnP
@ -45,7 +45,7 @@ export const SettingsManager = (function(){
*/ */
const constructor = () => { const constructor = () => {
customs = Utils.get_dictionary(customs); customs = Common.get_dictionary(customs);
}; };
@ -55,12 +55,12 @@ export const SettingsManager = (function(){
* @access public * @access public
*/ */
this.start = (callback = null) => { this.start = (callback = null) => {
Utils.execute_array([ Common.execute_array([
"default_settings_files", "settings_files" "default_settings_files", "settings_files"
], (key, next_callback) => { ], (key, next_callback) => {
self.add(self.get(key), next_callback, true); self.add(self.get(key), next_callback, true);
}, () => { }, () => {
Utils.execute_array([ Common.execute_array([
"default_secrets_files", "secrets_files" "default_secrets_files", "secrets_files"
], (key, next_callback) => { ], (key, next_callback) => {
self.add_secrets(self.get(key), next_callback, true); self.add_secrets(self.get(key), next_callback, true);
@ -76,7 +76,7 @@ export const SettingsManager = (function(){
* @access public * @access public
*/ */
this.get = (keys, inputs = null, _default = null) => ( this.get = (keys, inputs = null, _default = null) => (
Utils.get_value(keys, [inputs, customs, secrets, settings, SettingsManager.DEFAULT_SETTINGS], _default) Common.get_value(keys, [inputs, customs, secrets, settings, SettingsManager.DEFAULT_SETTINGS], _default)
); );
/** /**

View File

@ -4,13 +4,13 @@ import {Check} from "./Check.ecma.js";
import {Options} from "./Options.ecma.js"; import {Options} from "./Options.ecma.js";
/** /**
* @class Utils * @class Common
* @constructor * @constructor
* @returns {void} * @returns {void}
* @access public * @access public
* @static * @static
*/ */
export const Utils = (function(){ export const Common = (function(){
/** /**
* @callback utils_execute_callback * @callback utils_execute_callback
@ -31,22 +31,22 @@ export const Utils = (function(){
*/ */
/** /**
* @constructs Utils * @constructs Common
* @returns {void} * @returns {void}
* @access private * @access private
* @static * @static
*/ */
const Utils = function(){}; const Common = function(){};
/** @type {Options} */ /** @type {Options} */
Utils.GET_DICTIONARY_OPTIONS = new Options(Options.NO_OVERWRITE); Common.GET_DICTIONARY_OPTIONS = new Options(Options.NO_OVERWRITE);
/** @type {Options} */ /** @type {Options} */
Utils.GET_VALUE_OPTIONS = new Options(Options.ALLOW_NULLS); Common.GET_VALUE_OPTIONS = new Options(Options.ALLOW_NULLS);
/** @type {string} */ /** @type {string} */
Utils.BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; Common.BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
/** @type {string} */ /** @type {string} */
Utils.RANDOM_ALPHABET = "bHMnuamw/RUBk+xNvCXghsPdlSFG12rLoT0O3VZ=5QeWyI8pADqjcEfJ9Kt64i7Yz"; Common.RANDOM_ALPHABET = "bHMnuamw/RUBk+xNvCXghsPdlSFG12rLoT0O3VZ=5QeWyI8pADqjcEfJ9Kt64i7Yz";
/** /**
* @param {...(any|null)} items * @param {...(any|null)} items
@ -54,12 +54,12 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.get_keys = (...items) => items.reduce((keys, item) => { Common.get_keys = (...items) => items.reduce((keys, item) => {
if(Check.is_key(item)) if(Check.is_key(item))
item in keys || keys.push(item); item in keys || keys.push(item);
else if(Check.is_array(item)) else if(Check.is_array(item))
Utils.get_keys(...item).forEach(key => key in keys || keys.push(key)); Common.get_keys(...item).forEach(key => key in keys || keys.push(key));
return keys; return keys;
}, []); }, []);
@ -70,12 +70,12 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.get_dictionaries = (...items) => items.reduce((dictionaries, item) => { Common.get_dictionaries = (...items) => items.reduce((dictionaries, item) => {
if(Check.is_dictionary(item)) if(Check.is_dictionary(item))
dictionaries.push(item); dictionaries.push(item);
else if(Check.is_array(item)) else if(Check.is_array(item))
dictionaries.push(...Utils.get_dictionaries(...item)); dictionaries.push(...Common.get_dictionaries(...item));
return dictionaries; return dictionaries;
}, []); }, []);
@ -87,19 +87,19 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.get_dictionary = (items, custom_options = 0) => { Common.get_dictionary = (items, custom_options = 0) => {
/** @type {Object.<string, any|null>} */ /** @type {Object.<string, any|null>} */
const dictionary = {}, const dictionary = {},
/** @type {Options} */ /** @type {Options} */
options = new Options(custom_options, Utils.GET_DICTIONARY_OPTIONS); options = new Options(custom_options, Common.GET_DICTIONARY_OPTIONS);
if(Check.is_dictionary(items)){ if(Check.is_dictionary(items)){
for(const [key, value] of Object.entries(items)) for(const [key, value] of Object.entries(items))
dictionary[key] = value; dictionary[key] = value;
}else if(Check.is_array(items)) }else if(Check.is_array(items))
items.forEach(item => { items.forEach(item => {
for(const [key, value] of Object.entries(Utils.get_dictionary(item, options))) for(const [key, value] of Object.entries(Common.get_dictionary(item, options)))
if(options.overwrite || !(key in dictionary)) if(options.overwrite || !(key in dictionary))
dictionary[key] = value; dictionary[key] = value;
}); });
@ -116,17 +116,17 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.get_value = (keys, inputs, _default = null, custom_options = 0) => { Common.get_value = (keys, inputs, _default = null, custom_options = 0) => {
/** @type {number} */ /** @type {number} */
const l = (keys = Utils.get_keys(keys)).length, const l = (keys = Common.get_keys(keys)).length,
/** @type {Options} */ /** @type {Options} */
options = new Options(custom_options, Utils.GET_VALUE_OPTIONS); options = new Options(custom_options, Common.GET_VALUE_OPTIONS);
if(l){ if(l){
/** @type {number} */ /** @type {number} */
const m = (inputs = Utils.get_dictionaries(inputs)).length; const m = (inputs = Common.get_dictionaries(inputs)).length;
for(let i = 0; i < l; i++) for(let i = 0; i < l; i++)
for(let j = 0; j < m; j++) for(let j = 0; j < m; j++)
@ -144,9 +144,9 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.string_variables = (string, variables, _default = null) => { Common.string_variables = (string, variables, _default = null) => {
variables = Utils.get_dictionary(variables || {}); variables = Common.get_dictionary(variables || {});
return ("" + string).replace(/\{([a-z_][a-z0-9_]*)\}/gi, (all, key) => ( return ("" + string).replace(/\{([a-z_][a-z0-9_]*)\}/gi, (all, key) => (
key in variables ? variables[key] : key in variables ? variables[key] :
@ -160,7 +160,7 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.to_kebab_case = string => ("" + string).replace(/([A-Z]+)|[^a-z0-9]+/g, (_, upper) => ( Common.to_kebab_case = string => ("" + string).replace(/([A-Z]+)|[^a-z0-9]+/g, (_, upper) => (
upper ? "-" + upper.toLowerCase() : upper ? "-" + upper.toLowerCase() :
"-")); "-"));
@ -170,7 +170,7 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.to_snake_case = string => ("" + string).replace(/([A-Z]+)|[^a-z0-9]+/g, (_, upper) => ( Common.to_snake_case = string => ("" + string).replace(/([A-Z]+)|[^a-z0-9]+/g, (_, upper) => (
upper ? "_" + upper.toLowerCase() : upper ? "_" + upper.toLowerCase() :
"_")); "_"));
@ -181,14 +181,14 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.attributes = (item, attributes) => { Common.attributes = (item, attributes) => {
for(const [key, value] of Object.entries(attributes)){ for(const [key, value] of Object.entries(attributes)){
if(/^on[_\-]?/i.test(key) && Check.is_function(value)) if(/^on[_\-]?/i.test(key) && Check.is_function(value))
item.addEventListener(key.toLowerCase().replace(/^on[_\-]?/, ""), event => { item.addEventListener(key.toLowerCase().replace(/^on[_\-]?/, ""), event => {
Utils.execute(value, item, event); Common.execute(value, item, event);
}); });
else else
item.setAttribute(Utils.to_kebab_case(key), value); item.setAttribute(Common.to_kebab_case(key), value);
}; };
}; };
@ -199,7 +199,7 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.html = (item, ...structure) => { Common.html = (item, ...structure) => {
/** @type {Array.<HTMLElement>} */ /** @type {Array.<HTMLElement>} */
const items = []; const items = [];
@ -218,12 +218,12 @@ export const Utils = (function(){
/** @type {HTMLElement} */ /** @type {HTMLElement} */
element = document.createElement(tag); element = document.createElement(tag);
attributes && Utils.attributes(element, attributes); attributes && Common.attributes(element, attributes);
if(children && children.length){ if(children && children.length){
if(Check.is_string(children)) if(Check.is_string(children))
element.innerHTML += children; element.innerHTML += children;
else else
Utils.html(element, ...children); Common.html(element, ...children);
}; };
items.push(item.appendChild(element)); items.push(item.appendChild(element));
@ -238,7 +238,7 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.unique = item => ( Common.unique = item => (
Check.is_array(item) ? item.filter((item, i, array) => array.indexOf(item) == i) : Check.is_array(item) ? item.filter((item, i, array) => array.indexOf(item) == i) :
Check.is_string(item) ? item.split("").filter((char, i, array) => array.indexOf(char) == i).join("") : Check.is_string(item) ? item.split("").filter((char, i, array) => array.indexOf(char) == i).join("") :
item); item);
@ -250,7 +250,7 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.get_random = (from = null, to = null) => ( Common.get_random = (from = null, to = null) => (
Check.is_array(from) || Check.is_string(from) ? from.length ? from[Math.random() * from.length >> 0] : null : Check.is_array(from) || Check.is_string(from) ? from.length ? from[Math.random() * from.length >> 0] : null :
Check.is_integer(from) ? ( Check.is_integer(from) ? (
to === null ? Math.random() * from >> 0 : to === null ? Math.random() * from >> 0 :
@ -270,7 +270,7 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.encode_data = data => btoa(encodeURIComponent(JSON.stringify(data)).replace(/%([0-9A-F]{2})/g, (_, p1) => String.fromCharCode("0x" + p1))); Common.encode_data = data => btoa(encodeURIComponent(JSON.stringify(data)).replace(/%([0-9A-F]{2})/g, (_, p1) => String.fromCharCode("0x" + p1)));
/** /**
* @param {!string} code * @param {!string} code
@ -279,7 +279,7 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.decode_data = (code, is_json = true) => { Common.decode_data = (code, is_json = true) => {
/** @type {string} */ /** @type {string} */
const data = decodeURIComponent(atob(code).split("").map(c => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join("")); const data = decodeURIComponent(atob(code).split("").map(c => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join(""));
@ -299,7 +299,7 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.execute = (callback, ...inputs) => ( Common.execute = (callback, ...inputs) => (
Check.is_function(callback) ? callback(...inputs) : Check.is_function(callback) ? callback(...inputs) :
null); null);
@ -312,13 +312,13 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.execute_array = (array, each_callback, end_callback = null, i = 0) => { Common.execute_array = (array, each_callback, end_callback = null, i = 0) => {
if(i < array.length) if(i < array.length)
Utils.execute(each_callback, array[i], () => { Common.execute(each_callback, array[i], () => {
Utils.execute_array(array, each_callback, end_callback, i + 1); Common.execute_array(array, each_callback, end_callback, i + 1);
}); });
else else
Utils.execute(end_callback); Common.execute(end_callback);
}; };
/** /**
@ -327,7 +327,7 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.get_array = item => Check.is_array(item) ? item : [item]; Common.get_array = item => Check.is_array(item) ? item : [item];
/** /**
* @param {!string} string * @param {!string} string
@ -335,7 +335,7 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.randomize_string = string => string.split("").sort(() => Utils.get_random() - 0.5).join(""); Common.randomize_string = string => string.split("").sort(() => Common.get_random() - 0.5).join("");
/** /**
* @param {?any} data * @param {?any} data
@ -343,7 +343,7 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.encrypt_data = data => Utils.encode_data(data).split("").map(character => Utils.RANDOM_ALPHABET[Utils.BASE64_ALPHABET.indexOf(character)]).join(""); Common.encrypt_data = data => Common.encode_data(data).split("").map(character => Common.RANDOM_ALPHABET[Common.BASE64_ALPHABET.indexOf(character)]).join("");
/** /**
* @param {string} data * @param {string} data
@ -351,10 +351,10 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.decrypt_data = data => { Common.decrypt_data = data => {
/** @type {string} */ /** @type {string} */
const results = Utils.decode_data(data.split("").map(character => Utils.BASE64_ALPHABET[Utils.RANDOM_ALPHABET.indexOf(character)]).join(""), false); const results = Common.decode_data(data.split("").map(character => Common.BASE64_ALPHABET[Common.RANDOM_ALPHABET.indexOf(character)]).join(""), false);
try{ try{
return JSON.parse(results) || results; return JSON.parse(results) || results;
@ -369,7 +369,7 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.randomize_array = array => { Common.randomize_array = array => {
/** @type {number} */ /** @type {number} */
const l = array.length - 1; const l = array.length - 1;
@ -377,7 +377,7 @@ export const Utils = (function(){
array.forEach((item, i) => { array.forEach((item, i) => {
/** @type {number} */ /** @type {number} */
const j = Utils.get_random(l); const j = Common.get_random(l);
i != j && ([array[i], array[j]] = [array[j], array[i]]); i != j && ([array[i], array[j]] = [array[j], array[i]]);
@ -392,7 +392,7 @@ export const Utils = (function(){
* @access public * @access public
* @static * @static
*/ */
Utils.extends = (base, ...items) => { Common.extends = (base, ...items) => {
items.forEach(item => { items.forEach(item => {
Object.entries(item).forEach(([key, value]) => { Object.entries(item).forEach(([key, value]) => {
base[key] = value; base[key] = value;
@ -400,5 +400,5 @@ export const Utils = (function(){
}); });
}; };
return Utils; return Common;
})(); })();

View File

@ -3,7 +3,7 @@
from typing import Any, Self, Sequence, Optional from typing import Any, Self, Sequence, Optional
from Interfaces.Application.AnPInterface import AnPInterface from Interfaces.Application.AnPInterface import AnPInterface
from Utils.Utils import Utils from Utils.Common import Common
from Utils.Options import Options from Utils.Options import Options
class I18NManager: class I18NManager:
@ -28,7 +28,7 @@ class I18NManager:
options:Options options:Options
) -> str|list[str]|None: ) -> str|list[str]|None:
keys:list[str] = Utils.get_keys(strings) keys:list[str] = Common.get_keys(strings)
if len(keys): if len(keys):
@ -51,7 +51,7 @@ class I18NManager:
self.__sentences[language][key] is not None self.__sentences[language][key] is not None
): ):
return self.__sentences[language][key] return self.__sentences[language][key]
return Utils.get_strings(strings)[0] return Common.get_strings(strings)[0]
def get(self:Self, def get(self:Self,
strings:str|Sequence[str], strings:str|Sequence[str],
@ -61,9 +61,9 @@ class I18NManager:
) -> Any|None: ) -> Any|None:
options:Options = Options(custom_options, self.GET_OPTIONS) options:Options = Options(custom_options, self.GET_OPTIONS)
text:str|list[str]|None = self.__get_sentence(strings, Utils.get_array(languages), options) text:str|list[str]|None = self.__get_sentence(strings, Common.get_array(languages), options)
return Utils.string_variables(( return Common.string_variables((
text if isinstance(text, str) else text if isinstance(text, str) else
"".join(text) if isinstance(text, (list, tuple)) else "".join(text) if isinstance(text, (list, tuple)) else
str(text)), inputs) str(text)), inputs)

View File

@ -3,7 +3,7 @@
from typing import Any, Self, Sequence, Optional from typing import Any, Self, Sequence, Optional
from Interfaces.Application.AnPInterface import AnPInterface from Interfaces.Application.AnPInterface import AnPInterface
from Utils.Utils import Utils from Utils.Common import Common
from Utils.Options import Options from Utils.Options import Options
class SettingsManager: class SettingsManager:
@ -19,7 +19,7 @@ class SettingsManager:
) -> None: ) -> None:
self.anp:AnPInterface = anp self.anp:AnPInterface = anp
self.__inputs:dict[str, Any|None] = Utils.get_dictionary(inputs, Options.OVERWRITE) self.__inputs:dict[str, Any|None] = Common.get_dictionary(inputs, Options.OVERWRITE)
self.__secrets:dict[str, Any|None] = {} self.__secrets:dict[str, Any|None] = {}
def get(self:Self, def get(self:Self,
@ -28,7 +28,7 @@ class SettingsManager:
default:Any|None = None, default:Any|None = None,
custom_options:int = 0 custom_options:int = 0
) -> Any|None: ) -> Any|None:
return Utils.get_value(keys, ( return Common.get_value(keys, (
inputs, self.__inputs, self.__secrets, self.DEFAUTL_SETTINGS inputs, self.__inputs, self.__secrets, self.DEFAUTL_SETTINGS
), default, Options(custom_options, self.GET_OPTIONS).get()) ), default, Options(custom_options, self.GET_OPTIONS).get())

View File

@ -3,7 +3,7 @@
from typing import Optional, Self, Sequence from typing import Optional, Self, Sequence
from Utils.Color import Color from Utils.Color import Color
from Utils.Utils import Utils from Utils.Common import Common
class PrintTypeModel: class PrintTypeModel:
@ -25,6 +25,6 @@ class PrintTypeModel:
name:str name:str
for name in Utils.get_keys(names, self.names): for name in Common.get_keys(names, self.names):
if name not in self.names: if name not in self.names:
self.names.append(name) self.names.append(name)

View File

@ -7,7 +7,7 @@ from Utils.Check import Check
from Utils.Options import Options from Utils.Options import Options
from Utils.Patterns import RE from Utils.Patterns import RE
class Utils: class Common:
GET_DICTIONARY_OPTIONS:Options = Options(Options.NO_OVERWRITE) GET_DICTIONARY_OPTIONS:Options = Options(Options.NO_OVERWRITE)
GET_VALUE_OPTIONS:Options = Options(Options.ALLOW_NULLS) GET_VALUE_OPTIONS:Options = Options(Options.ALLOW_NULLS)
@ -111,11 +111,11 @@ class Utils:
strings:list[str] = [] strings:list[str] = []
item:Any|None item:Any|None
for item in Utils.get_array(value): for item in Common.get_array(value):
if Check.is_string(item): if Check.is_string(item):
item in strings or strings.append(item) item in strings or strings.append(item)
elif Check.is_array(item): elif Check.is_array(item):
strings.extend(Utils.get_strings(item)) strings.extend(Common.get_strings(item))
return strings return strings
@ -126,7 +126,7 @@ class Utils:
default:Optional[str] = None default:Optional[str] = None
) -> str: ) -> str:
variables = Utils.get_dictionary(variables) variables = Common.get_dictionary(variables)
def callback(matches:REMatch) -> str: def callback(matches:REMatch) -> str:

View File

@ -36,4 +36,11 @@ sudo apt update
sudo apt install -y dotnet-sdk-10.0 sudo apt install -y dotnet-sdk-10.0
``` ```
Luego, instalar el Pluggin Nuget de Visual Studio Code `C/C++ DevTools`. Luego, instalar el Pluggin Nuget de Visual Studio Code `C/C++ DevTools`.
Para ejecutar un proyecto .NET desde Docker.
```sh
#!/bin/bash
docker exec -it anp-dotnet dotnet run --project /workspace/CSharp/AnP.csproj -f net10.0
```