public static void InitAllTypeInstances <TChild>(object instance)
        {
            if (instance == null)
            {
                return;
            }
            var Thost = instance.GetType();
            var t     = typeof(TChild);

            foreach (var Fi in Thost
                     .GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
                     .Where(fi => t.IsAssignableFrom(fi.FieldType)).ToList())
            {
                if (Fi.FieldType != typeof(Type))
                {
                    var it = (TChild)Fi.GetValue(instance);
                    if (it == null)
                    {
                        if (typeof(INode).IsAssignableFrom(Fi.FieldType))
                        {
                            Fi.SetValue(instance, (TChild)CreateNode(instance, Fi.FieldType));
                        }
                        else
                        {
                            Fi.SetValue(instance, (TChild)Activator.CreateInstance(Fi.FieldType));
                        }
                    }
                }
            }
        }
 public void setUp()
 {
     Fi.startEngine();
     pokemonFactory       = new PokemonFactory();
     calculations         = new BattleCalculations();
     pokemonBattleManager = new PokemonBattleManager();
 }
示例#3
0
        public static List <Fi> GetLocalFileInfos(string pattern)
        {
            var fis           = new List <Fi>();
            Fi  emptyFileInfo = null;

            foreach (var f in Directory.GetFiles(Path.GetDirectoryName(pattern), Path.GetFileName(pattern)))
            {
                var fi = new Fi(new FileInfo(f));
                if (fi.Size > 0)
                {
                    fis.Add(fi);
                }
                else if (emptyFileInfo == null)
                {
                    emptyFileInfo = fi;
                }
            }

            if (fis.Count == 0 && emptyFileInfo != null)
            {
                fis.Add(emptyFileInfo);
            }

            return(fis);
        }
        public static Object FindOfByUpdateTime(this Fi _selfie, Type type, IDataAccessor da, long lastUpdate, int p, int?limit)
        {
            // Holy mother of Reflection!
            var updateTime    = new DateTime(lastUpdate);
            var paramExpr     = Expression.Parameter(type, "x");
            var member        = Expression.MakeMemberAccess(paramExpr, type.GetMembers().FirstOrDefault(m => m.Name == "DataUpdate"));
            var conditionBody = Expression.GreaterThan(member, Expression.Convert(Expression.Constant(updateTime), member.Type));
            var funcTBool     = typeof(Func <,>).MakeGenericType(
                type, typeof(bool));
            var exprMethod = typeof(Expression)
                             .GetMethods().FirstOrDefault(
                m => m.Name == "Lambda")
                             .MakeGenericMethod(
                funcTBool);
            var expr = exprMethod
                       .Invoke(null, new object[] { conditionBody, new ParameterExpression[] { paramExpr } });
            var condition = Activator.CreateInstance(
                typeof(Conditions <>).MakeGenericType(type)
                , new object[] { expr });

            var FindMethod = da.GetType().GetMethods().FirstOrDefault(
                m =>
                m.Name == "Find" &&
                m.GetParameters().Length == 3)
                             .MakeGenericMethod(type);
            var retv = FindMethod
                       .Invoke(da, new object[] { expr, 1, null });

            // IT F*****G WORKS BIATCH YAY!
            return(retv);
        }
示例#5
0
        public static void ProcDeleteDir(string strPath)    // 폴더안에 파일이 있어도 삭제하는 함수
        {
            try
            {
                DirectoryInfo TempDirInfo = new DirectoryInfo(strPath);
                if (!TempDirInfo.Exists)
                {
                    return;
                }

                FileInfo[] files = TempDirInfo.GetFiles();

                foreach (FileInfo Fi in files)
                {
                    Fi.Delete();
                }

                //하위 폴더가 있는지 체크
                string[] folders = Directory.GetDirectories(strPath);
                foreach (string folder in folders)
                {
                    string namename = Path.GetFileName(folder);
                    ProcDeleteDir(folder);
                }

                Directory.Delete(strPath);
            }
            catch (Exception e)
            {
                string strerr = e.Message;
            }
        }
示例#6
0
        private void button11_Click(object sender, EventArgs e)
        {
            //Recibe e imprime la informacion requerida por el usuario
            int Mul;
            int Fac;
            int Fi;

            switch (operador)
            {
            case "*":
            {
                b               = int.Parse(Textcuadro.Text);
                Mul             = obj.multiplicacion((a), (b));
                Textcuadro.Text = "La multiplicación de los numeros ingresados es: " + Mul.ToString();
            }
            break;

            case "!":
            {
                Fac             = obj2.Factorial((a));
                Textcuadro.Text = "El factorial del número ingresado es: " + Fac.ToString();
            }
            break;

            case "Fi":
            {
                Fi = obj3.Fibonacci((a));
                Textcuadro.Text = Fi.ToString();
                Textcuadro.Text = "El número que se encuentra en la posición " + a + " de la serie de fibonacci es: " + Fi.ToString();
            }
            break;
            }
        }
示例#7
0
        public static void Archive(string strBatch, string strRun)
        {
            //string strFilePath = "\\\\Cobmain\\usacms\\PODFO\\Output\\mergedPDFs";
            string strBatchPath = strBatchPathP + strBatch + strRun;

            if (!Directory.Exists(strBatchPath))
            {
                DirectoryInfo di = Directory.CreateDirectory(strBatchPath);
            }

            Log("I", string.Format("Archive Start for Batch: {0} Run: {1}", strBatch, strRun));
            string[] fileEntries = Directory.GetFiles(strBatchPath);
            string   archive     = strBatchPath + "\\Archive " + DateTime.Now.ToString("MM-dd-yyyy HH mm ss");


            if (!Directory.Exists(archive))
            {
                DirectoryInfo di = Directory.CreateDirectory(archive);
            }

            foreach (string Fi in fileEntries)
            {
                File.Copy(Fi, archive + "\\" + Fi.Remove(0, Fi.LastIndexOf("\\") + 1));
            }
            foreach (string Fi in fileEntries)
            {
                File.Delete(Fi);
            }

            Log("I", string.Format("Archive End for Batch: {0} Run: {1}, Count: {2}",
                                   strBatch, strRun, fileEntries.Length.ToString()));
        }
示例#8
0
        //Use this function when you want to register your account.
        public void RegisterAccount()
        {
            //First it will check if the inputfields are empty, if they are empty it will immidiatly stop the function.
            if (registerUsername.text == "" || registerPassword.text == "" || SaveFileName.text == "")
            {
                RespondText.text = "<color=red>Username, password or save file name has not been filled in.</color>";
                StartCoroutine(RemoveText(3));
                return;
            }
            else
            {
                SearchNewSaveFiles();
                //checks if files exist in the current directory it's checking.
                if (saveInfo.Length > 0)
                {
                    //foreach file found it will run the code below.
                    foreach (FileInfo Fi in saveInfo)
                    {
                        //it will load the current file the foreach has taken.
                        json = File.ReadAllText(Fi.ToString());

                        //it will get the information saved in the file and put the information in the dictionary and a string.
                        DataInfo = JsonConvert.DeserializeObject <SaveGameDataInfo>(json);
                        //the dictionary
                        accountHolder = DataInfo.Accounts;
                        //the string
                        LoadFileName = DataInfo.saveFileName;

                        //checks if the save file name of the username used for the account already exists, if it does it will stop the loop.
                        if (accountHolder.ContainsKey(registerUsername.text) || LoadFileName == DataInfo.saveFileName)
                        {
                            RespondText.text = "<color=red> account already exists.</color>";
                            StartCoroutine(RemoveText(3));
                            return;
                        }
                        //if that isn't the case it will register the account and stop the loop.
                        else
                        {
                            accountHolder.Add(registerUsername.text, registerPassword.text);
                            RespondText.text = "<color=blue>Account has been registered.</color>";
                            Data.SaveData();
                            StartCoroutine(RemoveText(3));
                            return;
                        }
                    }
                    ResetValues();
                }
                //if there are no files in the directory it will run the code below.
                else
                {
                    accountHolder.Add(registerUsername.text, registerPassword.text);
                    RespondText.text = "<color=blue>Account has been registered.</color>";
                    Data.SaveData();
                    ResetValues();
                    StartCoroutine(RemoveText(3));
                }
                accountHolder.Clear();
            }
        }
示例#9
0
        //Use this function when you want to login into an existing account.
        public void AccountLogin()
        {
            //First it will check if the inputfields are empty, if they are empty it will immidiatly stop the function.
            if (loginUsername.text == "" || loginPassword.text == "")
            {
                RespondText.text = "<color=red>You got to put something in the inputfield, otherwise it wont work.</color>";
                StartCoroutine(RemoveText(3));
                return;
            }
            else
            {
                SearchNewSaveFiles();
                //checks if files exist in the current directory it's checking.
                if (saveInfo.Length > 0)
                {
                    //foreach file found it will run the code below.
                    foreach (FileInfo Fi in saveInfo)
                    {
                        //it will load the current file the foreach has taken.
                        json = File.ReadAllText(Fi.ToString());

                        //it will get the information saved in the file and put the information in the dictionary and a string.
                        DataInfo = JsonConvert.DeserializeObject <SaveGameDataInfo>(json);
                        //the dictionary
                        accountHolder = DataInfo.Accounts;
                        //the string
                        LoadFileName = DataInfo.saveFileName;

                        //First it will check if the current information taken from the file equals the information from the inputfields.
                        //if it is true it will load the data from that account and end the loop.
                        if (accountHolder.ContainsKey(loginUsername.text) && accountHolder.ContainsValue(loginPassword.text))
                        {
                            RespondText.text = "<color=blue>Account information correct.</color>";
                            Data.LoadData(LoadFileName);
                            StartCoroutine(RemoveText(3));
                            Data.SaveUsername();
                            ResetValues();
                            SceneManager.LoadScene("Level 1");
                            return;
                        }
                        //if the information doesn't exist in the files it will give an error message that the password or username is incorrect.
                        else if (!accountHolder.ContainsKey(loginUsername.text) || !accountHolder.ContainsValue(loginPassword.text))
                        {
                            RespondText.text = "<color=red>Username or password is not correct.</color>";
                            StartCoroutine(RemoveText(3));
                        }
                        accountHolder.Clear();
                    }
                    ResetValues();
                }
                //if there are no files in the directory it will give an error that there are no files found.
                else
                {
                    RespondText.text = "<color=red>No save files found. Please register your account first.</color>";
                    ResetValues();
                    StartCoroutine(RemoveText(3));
                }
            }
        }
 public static void SetPageSizeOfRecordSet(this Fi _selfie, Object o, int?val)
 {
     try {
         o.GetType().GetMethod("Limit").Invoke(o, new object[] { val });
     } catch (Exception x) {
         Fi.Tech.WriteLine("Error in SetPageSizeOfRecordSet" + x.Message);
     }
 }
 public static void SetAccessorOfRecordSet(this Fi _selfie, Object o, IDataAccessor da)
 {
     try {
         o.GetType().GetProperties().Where((p) => p.Name == "DataAccessor").FirstOrDefault().SetValue(o, da);
     } catch (Exception x) {
         Fi.Tech.WriteLine("Error in SetAccessorOfRecordSet" + x.Message);
     }
 }
示例#12
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Fi.startEngine();
            Fi.battle.registerObserver(this);
            Fi.battle.setUpBattle(Fi.factories.opponentFactory.createWildPokemon(10, 10));

            loadPokemonData();
        }
 public static void SaveRecordSet(this Fi _selfie, Object o)
 {
     try {
         o.GetType().GetMethod("Save").Invoke(o, new object[1]);
     } catch (Exception x) {
         Fi.Tech.WriteLine("Error in SaveRecordSet" + x.Message);
     }
 }
示例#14
0
        private void btnadjuntar_Click(object sender, EventArgs e)
        {
            GenerarAdjunto();
            gbcabecera.Enabled = false;
            gbmensaje.Enabled  = false;
            gbopciones.Enabled = false;
            dgvadjuntos.SendToBack();
            OpenFileDialog BuscarArchivo = new OpenFileDialog();

            BuscarArchivo.Filter = "Archivos |*.*";
            //Aquí incluiremos los filtros que queramos.
            BuscarArchivo.FileName = "";
            BuscarArchivo.Title    = "Titulo del Dialogo";
            if (tipo == 1)
            {
                BuscarArchivo.InitialDirectory = @"C:\Ordenes de Compra";
            }
            else if (tipo == 2)
            {
                BuscarArchivo.InitialDirectory = @"C:\Cotizaciones";
            }
            //BuscarArchivo.InitialDirectory = @"C:\Ordenes de Compra";
            BuscarArchivo.Multiselect = true;
            if (BuscarArchivo.ShowDialog() == DialogResult.OK)
            {
                DataTable Dt     = new DataTable();
                Int32     idfile = 1;
                Dt.Columns.Add(new DataColumn("Id", typeof(Int32)));
                Dt.Columns.Add(new DataColumn("Archivo", typeof(String)));

                DataTable Dt2 = (DataTable)dgvadjuntos.DataSource;
                foreach (String Fi in BuscarArchivo.FileNames)
                {
                    Dt.Rows.Add(idfile, Fi.ToString());
                }
                foreach (String Fi in BuscarArchivo.SafeFileNames)
                {
                    link_adjunto1.Text        += Fi + "  ";
                    link_adjunto1.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
                }
                if (Dt2 == null)
                {
                    dgvadjuntos.DataSource = Dt;
                }
                else if (Dt.Rows != null)
                {
                    Dt2.Merge(Dt);
                    dgvadjuntos.DataSource = Dt2;
                }
            }

            gbcabecera.Enabled = true;
            gbmensaje.Enabled  = true;
            gbopciones.Enabled = true;
            //gbGestionEnvio.Enabled = true;
            this.Cursor = Cursors.Default;
        }
 public static int GetCountOfRecordSet(this Fi _selfie, Object o)
 {
     try {
         return((int)o.GetType().GetProperties().Where((p) => p.Name == "Count").FirstOrDefault().GetValue(o));
     } catch (Exception x) {
         Fi.Tech.WriteLine("Error in GetCountOfRecordSet" + x.Message);
     }
     return(-1);
 }
 public static Object GetRecordSetOf(this Fi _selfie, Type t, IDataAccessor da)
 {
     try {
         var retv = Activator.CreateInstance(typeof(RecordSet <>).MakeGenericType(t), da);
         return(retv);
     } catch (Exception x) {
     }
     return(null);
 }
示例#17
0
 public static Boolean ExistsInEnumeration(Type enumeration, String strValue)
 {
     foreach (FieldInfo Fi in enumeration.GetFields(BindingFlags.Public | BindingFlags.Static))
     {
         if (Fi.GetValue(enumeration).ToString().ToUpper() == strValue.ToUpper())
         {
             return(true);
         }
     }
     return(false);
 }
        //        private static Object _readLock = new Object();
        //        private static int _generalId = 0;
        //        public static ILogger ApiLogger;

        //        public static bool EnableStdoutLogs { get; set; } = false;


        public static String GetUpdateColumn(this Fi _selfie, Type type)
        {
            var fields = ReflectionTool.FieldsAndPropertiesOf(type);
            var retv   = fields
                         .Where((f) => f.GetCustomAttribute <UpdateTimeStampAttribute>() != null)
                         .FirstOrDefault()
                         ?.Name
                         ?? "UpdatedTime";

            return(retv);
        }
示例#19
0
        public void Raise(IDomainEvent domainEvent)
        {
            WriteLog($"Raising Event {domainEvent.GetType()}");
            // Cache event
            if (FiTechCoreExtensions.StdoutEventHubLogs)
            {
                domainEvent.d_RaiseOrigin = Environment.StackTrace;
            }
            domainEvent.EventsHub = this;
            lock (EventCache) {
                if (EventCache.Any(x => x.RID == domainEvent.RID))
                {
                    return;
                }
                EventCache.RemoveAll(e => (DateTime.UtcNow - e.TimeStamp) > EventCacheDuration);
            }

            // Raise event on all listeners.
            List <IDomainEventListener> listeners;

            lock (Listeners) {
                Listeners.RemoveAll(l => l == null);
                listeners = Listeners.ToList();
            }
            foreach (var listener in listeners)
            {
                MainQueuer.Enqueue(async() => {
                    await listener.OnEventTriggered(domainEvent).ConfigureAwait(false);
                    if (domainEvent.AllowPropagation)
                    {
                        parentHub?.Raise(domainEvent);
                    }
                }, async x => {
                    try {
                        await listener.OnEventHandlingError(domainEvent, x).ConfigureAwait(false);
                    } catch (Exception y) {
                        Fi.Tech.Throw(x);
                    }
                }, (b) => {
                    return(Fi.Result());
                });
            }

            if (EnableEventCache)
            {
                lock (EventCache) {
                    domainEvent.TimeStamp = DateTime.UtcNow;
                    EventCache.Add(domainEvent);
                }
                LastEventDateTime = Fi.Tech.GetUtcTime();
                CancelationTokenSource.Cancel();
                CancelationTokenSource = new CancellationTokenSource();
            }
        }
        public static String GetIdColumn(this Fi _selfie, Type type)
        {
            var fields = ReflectionTool.FieldsAndPropertiesOf(type);
            var retv   = fields
                         .Where((f) => f.GetCustomAttribute <PrimaryKeyAttribute>() != null)
                         .FirstOrDefault()
                         ?.Name
                         ?? "Id";

            return(retv);
        }
示例#21
0
 public static int ValueFromEnumeration(Type enumeration, String strValue)
 {
     foreach (FieldInfo Fi in enumeration.GetFields(BindingFlags.Public | BindingFlags.Static))
     {
         if (Fi.GetValue(enumeration).ToString() == strValue)
         {
             return((int)Fi.GetValue(enumeration));
         }
     }
     return(-1);
 }
        public static Dictionary <string, FieldDescriptor <Tbase> > GetAllTypeInstancesBasedOn <Tbase>(Group instance)
        {
            var t         = typeof(Tbase);
            var allFields = new Dictionary <string, FieldDescriptor <Tbase> >();
            var Thost     = instance.GetType();

            foreach (var Fi in Thost
                     .GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
                     .Where(fi => t.IsAssignableFrom(fi.FieldType)).ToList())
            {
                allFields.Add(
                    Fi.Name,
                    new FieldDescriptor <Tbase> {
                    Value      = (Tbase)Fi.GetValue(instance),
                    Attributes = Fi.GetCustomAttributes(typeof(Attribute), true).Cast <Attribute>().ToList()
                }
                    );
            }

            t = typeof(List <Tbase>);

            foreach (var Fi in Thost
                     .GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
                     .Where(fi => fi.FieldType.IsList()).ToList())
            {
                var tp = Fi.FieldType.GenericTypeArguments.First();
                if (tp == typeof(Tbase))
                {
                    var it = Fi.GetValue(instance);

                    var l        = (List <Tbase>)Fi.GetValue(instance);
                    var iterator = 0;
                    if (l != null)
                    {
                        l.ForEach(
                            i => allFields.Add(
                                Fi.Name + "_" + iterator++,
                                new FieldDescriptor <Tbase> {
                            Value      = i,
                            Attributes =
                                Fi.GetCustomAttributes(typeof(Attribute), true).Cast <Attribute>().ToList()
                        }
                                )
                            );
                    }
                }
            }

            return(allFields);
        }
示例#23
0
        /// <summary>

        /// Method used to get the enumeration values and names in the key value data table.

        /// It returns Key Value Datatable containing enumeration keys in its value column and enumeration values

        /// in its key column

        /// </summary>

        /// <param name="enumType"></param>

        /// <returns>Datatable containing enumeration keys in its value column and enumeration values

        /// in its key column

        /// </returns>
        public static Dictionary <String, string> GetEnumerationDataTable(Type enumeration, Boolean IncludeEmptyRow = false)
        {
            Dictionary <String, string> dtKeyValue = new Dictionary <String, string>();
            int i = 1;

            if (IncludeEmptyRow)
            {
                dtKeyValue.Add("", " ");
            }
            foreach (FieldInfo Fi in enumeration.GetFields(BindingFlags.Public | BindingFlags.Static))
            {
                dtKeyValue.Add(Fi.GetValue(enumeration).ToString(), Fi.GetValue(enumeration).ToString());
            }

            return(dtKeyValue);
        }
示例#24
0
        private List <Fi> GetFileInfos()
        {
            var fis = new List <Fi>();

            if (string.IsNullOrEmpty(_host))
            {
                return(GetLocalFileInfos(_pattern));
            }
            else
            {
                using (var stm = Remote.ConnectStream(_host))
                {
                    var s = "ls\n" + _pattern + "\n";
                    var b = System.Text.Encoding.ASCII.GetBytes(s);
                    stm.Write(b, 0, b.Length);
                    var lines = new StreamReader(stm).ReadToEnd().Split('\n');

                    // -rw------- 1 root root 169622 2016-04-10 03:20:01.945336135 +0000 /var/log/messages-20160410
                    var re = new Regex(@"^[\-rwx]+\s+[0-9]+\s+[a-z_][a-z0-9_-]*\s+[a-z_][a-z0-9_-]*\s+(?<size>-?[0-9]+)\s+(?<date>[0-9]{4}-[0-9]{2}-[0-9]{2}(T|\s)[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+Z?(\s[+\-][0-9]{4})?)\s(?<filename>.*$)", RegexOptions.CultureInvariant | RegexOptions.Compiled);
                    foreach (var line in lines)
                    {
                        var match = re.Match(line);

                        if (match.Success)
                        {
                            var groups = match.Groups;
                            var size   = long.Parse(groups["size"].Value);
                            if (size == -1)
                            {
                                size = long.MaxValue;
                            }
                            var date     = groups["date"].Value;
                            var dt       = DateTime.Parse(date, System.Globalization.CultureInfo.InvariantCulture);
                            var filename = groups["filename"].Value;
                            var fi       = new Fi(filename, size, dt);
                            if (fi.Size != 0)
                            {
                                fis.Add(fi);
                            }
                        }
                    }
                }
            }

            return(fis);
        }
        public static String CheapSanitize(this Fi _selfie, Object valor)
        {
            String valOutput;

            if (valor == null)
            {
                return("NULL");
            }
            if (valor.GetType().IsEnum)
            {
                return($"{(int)Convert.ChangeType(valor, Enum.GetUnderlyingType(valor.GetType()))}");
            }
            switch (valor.GetType().Name.ToLower())
            {
            case "string":
                if (valor.ToString() == "CURRENT_TIMESTAMP")
                {
                    return("CURRENT_TIMESTAMP");
                }
                var invalid = new char[] { (char)0x0, '\n', '\r', '\\', '\'', (char)0x1a };
                valOutput = String.Join(string.Empty, (valor as string).Select(a =>
                                                                               invalid.Contains(a) ? $"\\{a}" : $"{a}"
                                                                               ));
                return($"'{valOutput}'");

            case "float":
            case "double":
            case "decimal":
                valOutput = Convert.ToString(valor).Replace(",", ".");
                return($"{valOutput}");

            case "short":
            case "int":
            case "long":
            case "int16":
            case "int32":
            case "int64":
                return(Convert.ToString(valor));

            case "datetime":
                return($"'{((DateTime)valor).ToString("yyyy-MM-dd HH:mm:ss")}'");

            default:
                return(Convert.ToString(valor));
            }
        }
        private void  CalcularTodosOsIntervalos()
        {
            float Abertura = ValorMinimo;

            Passos.WriteLineAsyncCounter($"{Titulo("Calcular Abertura do Intervalo")}: Começa pelo Valor Minimo = {ValorMinimo} {HTMLElements.Hr()}");
            for (int i = 0; i < QuantidadeIntervalos; i++)
            {
                try
                {
                    if (!Simples)
                    {
                        float FimIntervalo = Abertura + Intervalo;
                        intervalos.Add($"{Abertura.ToString("0.00")}|--{FimIntervalo.ToString("0.00")}");
                        Passos.WriteLineAsyncCounter($"{Titulo("Calcule o Final do Intervalo")}: Abertura + Intervalo ");
                        Passos.WriteLineAsync($"$$ {Abertura} + {Intervalo} = {Abertura + Intervalo}$$");
                        Passos.WriteLineAsyncCounter($"{Titulo("Calcule o Intervalo")}: Abertura |-- Fim ");
                        Passos.WriteLineAsync($"$${Abertura.ToString("0.00")}|--{FimIntervalo.ToString("0.00")} $$");

                        xi.Add(CalcularMediaXI(Abertura, FimIntervalo));
                        fi.Add(CalcularFrequenciaSimples(Abertura, FimIntervalo));

                        Fi.Add(CalcularFrequenciaSimplesAcumulada(i));

                        fr.Add(CalcularFrequenciaRelativa(i));
                        Fr.Add(CalcularFrequenciaRelativaAcumulada(i));

                        Abertura = FimIntervalo;
                    }
                    else
                    {
                        Passos.WriteLineAsyncCounter($"{Titulo("Freq. Simples de ")} {ClassToHTML.AninharEmEm($"{ValoresDistintos[i].Key} [x{i + 1}]")}: {ValoresDistintos[i].Value}");
                        xi.Add(ValoresDistintos[i].Key);
                        fi.Add(ValoresDistintos[i].Value);

                        Fi.Add(CalcularFrequenciaSimplesAcumulada(i));
                        fr.Add(CalcularFrequenciaRelativa(i));
                        Fr.Add(CalcularFrequenciaRelativaAcumulada(i));
                    }
                }
                catch (Exception)
                {
                    continue;
                }
            }
        }
        public static QueryBuilder ListRids2 <T>(this Fi _selfie, List <T> set) where T : IDataObject
        {
            QueryBuilder retv = new QueryBuilder();

            for (int i = 0; i < set.Count; i++)
            {
                retv.Append(
                    new QueryBuilder().Append(
                        set[i].RID
                        )
                    );
                if (i < set.Count - 1)
                {
                    retv.Append(",");
                }
            }
            return(retv);
        }
示例#28
0
        public static string[] ReturnFilePathOfPattern(object Pattern)
        {
            if (!Directory.Exists(DirectoryS))
            {
                Directory.CreateDirectory(DirectoryS);
            }

            List <string> TEMP = new List <string>();

            foreach (var Fi in Directory.GetFiles(DirectoryS))
            {
                if (Fi.Contains(Pattern.ToString()))
                {
                    TEMP.Add(Fi);
                }
            }

            return(TEMP.ToArray());
        }
示例#29
0
        public override void Close()
        {
            if (_currentStream != null)
            {
                _currentStream.Close();
                _currentStream = null;
            }

            if (_watcher != null)
            {
                _watcher.Dispose();
                _watcher = null;
            }

            _current = null;
            _pos     = 0;
            _length  = 0;
            base.Close();
        }
        public static QueryBuilder ListIds <T>(this Fi _selfie, RecordSet <T> set) where T : IDataObject, new()
        {
            QueryBuilder retv = new QueryBuilder();
            uint         seq  = 0;

            for (int i = 0; i < set.Count; i++)
            {
                retv.Append(
                    new QbFmt(
                        $"@{++upseq}_{++seq}",
                        set[i].Id
                        )
                    );
                if (i < set.Count - 1)
                {
                    retv.Append(",");
                }
            }
            return(retv);
        }