コード例 #1
0
 //Método que lee el bloque principal
 public void LeePricipal(BinaryReader br, int t)
 {
     Principal.Clear();
     if (TDato == 'E')
     {
         for (int i = 0; i < 100; i++)
         {
             int             valor = br.ReadInt32();
             long            dir   = br.ReadInt64();
             BloquePrincipal b     = new BloquePrincipal(valor.ToString());
             b.Dir = dir;
             Principal.Add(b);
         }
     }
     else if (TDato == 'C')
     {
         for (int i = 0; i < 100; i++)
         {
             string aux  = "";
             char[] aux2 = br.ReadChars(t);
             foreach (char n in aux2)
             {
                 //if (char.IsLetter(n))
                 aux += n;
             }
             long            d = br.ReadInt64();
             BloquePrincipal b = new BloquePrincipal(aux);
             b.Dir = d;
             Principal.Add(b);
         }
     }
 }
コード例 #2
0
        //Método que crea y escribe en el archivo el bloque principal
        public void CreaPrincipal(BinaryWriter bw, int t)
        {
            if (TDato == 'E')
            {
                int n = int.MaxValue;
                for (int i = 0; i < 200; i++)
                {
                    string          valor = n.ToString();
                    BloquePrincipal b     = new BloquePrincipal(valor);
                    bw.Write(n);
                    bw.Write(b.Dir);
                    Principal.Add(b);
                }
            }
            if (TDato == 'C')
            {
                for (int i = 0; i < 200; i++)
                {
                    tam = t;
                    string valor = "";

                    /*for(int j =0; j < tam; j++)
                     * {
                     *  char c = 'z';
                     *  valor += c;
                     * }*/
                    ConvierteChar(valor);
                    BloquePrincipal b = new BloquePrincipal(valor);
                    bw.Write(elemento);
                    bw.Write(b.Dir);
                    Principal.Add(b);
                }
            }
        }
コード例 #3
0
 //Método que escribe en el archivo los nuevos cambios del principal
 public void ActualizaPrincipal(BinaryWriter bw, int t)
 {
     if (TDato == 'E')
     {
         for (int i = 0; i < Principal.Count; i++)
         {
             BloquePrincipal b = Principal[i];
             int             n = Convert.ToInt32(b.Valor);
             bw.Write(n);
             bw.Write(b.Dir);
         }
     }
     if (TDato == 'C')
     {
         tam = t;
         for (int i = 0; i < Principal.Count; i++)
         {
             BloquePrincipal b = Principal[i];
             ConvierteChar(b.Valor);
             bw.Write(elemento);
             bw.Write(b.Dir);
         }
     }
 }