Ejemplo n.º 1
0
 public Color(int argb = 0)
 {
     byte[] argbBytes = Serializar.GetBytes(argb);
     a = argbBytes[Pixel.A];
     r = argbBytes[Pixel.R];
     g = argbBytes[Pixel.G];
     b = argbBytes[Pixel.B];
 }
Ejemplo n.º 2
0
 public Color(int argb = 0)
 {
     byte[] argbBytes = Serializar.GetBytes(argb);
     a = argbBytes[0];
     r = argbBytes[1];
     g = argbBytes[2];
     b = argbBytes[3];
 }
Ejemplo n.º 3
0
        private void SaveToFile(string text)
        {
            SaveFileDialog saveFile = new SaveFileDialog();

            if (saveFile.ShowDialog().GetValueOrDefault())
            {
                System.IO.File.WriteAllBytes(saveFile.FileName, Serializar.GetBytes(text));
            }
        }
        protected override IList IGetPartsObject(object obj)
        {
            Bitmap bmp = obj as Bitmap;

            if (bmp == null)
            {
                throw new Exception(string.Format("Se ha intentado leer {0} como System.Drawing.Bitmap", obj.GetType().FullName));
            }
            return(new object[] { Serializar.GetBytes(bmp) });
        }
Ejemplo n.º 5
0
        public void PonerPlantilla(XmlNode firstChild)
        {
            byte[] aux;

            gEtiqueta.MinHeight = double.Parse(firstChild.ChildNodes[(int)PlantillaXml.Height].InnerText);
            gEtiqueta.MaxHeight = double.Parse(firstChild.ChildNodes[(int)PlantillaXml.Height].InnerText);
            gEtiqueta.MinWidth  = double.Parse(firstChild.ChildNodes[(int)PlantillaXml.Width].InnerText);
            gEtiqueta.MaxWidth  = double.Parse(firstChild.ChildNodes[(int)PlantillaXml.Width].InnerText);
            aux = Serializar.GetBytes(int.Parse(firstChild.ChildNodes[(int)PlantillaXml.BackGroundBorder].InnerText));
            gEtiqueta.Background = new SolidColorBrush(Color.FromArgb(aux[0], aux[1], aux[2], aux[3]));
            aux = Serializar.GetBytes(int.Parse(firstChild.ChildNodes[(int)PlantillaXml.BackGroundText].InnerText));
            gCodigo.Background = new SolidColorBrush(Color.FromArgb(aux[0], aux[1], aux[2], aux[3]));
            gBody.Background   = new SolidColorBrush(Color.FromArgb(aux[0], aux[1], aux[2], aux[3]));
        }
Ejemplo n.º 6
0
        protected override byte[] JGetBytes(object obj)
        {
            Array         matriz      = (Array)(obj is IList <T>?Gabriel.Cat.S.Extension.ExtensionIList.ToArray((IList)obj) : obj);
            List <byte[]> datosMatriz = new List <byte[]>();

            int[] dimensiones = matriz.GetDimensiones();
            datosMatriz.Add(Serializar.GetBytes(matriz.Rank));
            for (int i = 0; i < matriz.Rank; i++)
            {
                datosMatriz.Add(Serializar.GetBytes(dimensiones[i]));
            }
            for (int i = 0, f = matriz.Length; i < f; i++)
            {
                datosMatriz.Add(Serializador.GetBytes(matriz.GetValue(dimensiones, i)));
            }
            return(new byte[0].AddArray(datosMatriz.ToArray()));
        }
Ejemplo n.º 7
0
        public void KeyValuePairTiposMios()
        {
            KeyValuePair <IdUnico, byte[]> pair = new KeyValuePair <IdUnico, byte[]>(new IdUnico(), Serializar.GetBytes("Gabriel"));
            ElementoBinario serializador        = ElementoBinario.GetSerializador(pair.GetType());

            byte[] data = serializador.GetBytes(pair);
            KeyValuePair <IdUnico, byte[]> pairDeserializada = (KeyValuePair <IdUnico, byte[]>)serializador.GetObject(data);

            Assert.IsTrue(pair.Key.GetId().ArrayEqual(pairDeserializada.Key.GetId()) && pair.Value.ArrayEqual(pairDeserializada.Value));
        }
Ejemplo n.º 8
0
 protected override byte[] IGetBytes(object obj)
 {
     byte[] data = (byte[])obj;
     return(Serializar.GetBytes(data.Length).AddArray(data));
 }
 protected override byte[] IGetBytes(object obj)
 {
     return(Serializar.GetBytes(obj));
 }
Ejemplo n.º 10
0
        public void TwoKeysTiposMios()
        {
            TwoKeys <IdUnico, byte[]> pair         = new TwoKeys <IdUnico, byte[]>(new IdUnico(), Serializar.GetBytes("Gabriel"));
            ElementoBinario           serializador = ElementoBinario.GetSerializador(pair.GetType());

            byte[] data = serializador.GetBytes(pair);
            TwoKeys <IdUnico, byte[]> pairDeserializada = (TwoKeys <IdUnico, byte[]>)serializador.GetObject(data);

            Assert.IsTrue(pair.Key1.GetId().ArrayEqual(pairDeserializada.Key1.GetId()) && pair.Key2.ArrayEqual(pairDeserializada.Key2));
        }