Esempio n. 1
0
        public static dAlbum LoadAlbumFromTzip(string path)
        {
            //FileStream filereader;
            StreamReader reader;
            dAlbum thisAlbum = new dAlbum();

            if (File.Exists(path)){
                reader = IO.Descompact(path);
            }
            //reader = new StreamReader(path);
            else//TODO:: Si no existe q hago.
                return null;
            thisAlbum._sversion = reader.ReadLine();
            thisAlbum._snombre = reader.ReadLine();
            int totalImages = int.Parse(reader.ReadLine());

            for (int k = 0; k < totalImages; k++)
            {
                xmlImagen img = new xmlImagen(thisAlbum);
                img.LoadLine(reader);
                thisAlbum.InsertImagen(img);
            }
            reader.Close();
            File.Delete(Application.ExecutablePath + "tmp");
            thisAlbum.need_change = false;          //el album recie creado no necesita guardarse
            thisAlbum._full_path = path;                      //esta es la direccion del album ahora
            return thisAlbum;
        }
        public xmlImagen(dAlbum parent, string path)
            : this(parent)
        {
            _fullpath = path;
            _sname = System.IO.Path.GetFileName(path);
            innerXML = new XmlDocument();

            root = innerXML.CreateElement(Atributos.Folder);

            DirectoryInfo dirInfo = new DirectoryInfo(path);
            root.SetAttribute(Atributos.Name, dirInfo.Name);//agrego el nombre
            root.SetAttribute(Atributos.FullPath, path);    //agrego el camino

            long size = Rcsvo(root, dirInfo);
            if (_errores.Length != 0) {
                MessageBox.Show("Ocurrieron los siguientes errores.\nInformación: " + _errores, "Error.");
            }
            root.SetAttribute(Atributos.Size, size.ToString());//agrego el tamaño
            root.SetAttribute(Atributos.FolderNum, _inum_folder.ToString());
            root.SetAttribute(Atributos.FilesNum, _inum_files.ToString());
            innerXML.AppendChild(root);
            parent.InsertImagen(this);
        }
Esempio n. 3
0
        public static dAlbum LoadAlbumFromTxml(string path)
        {
            StreamReader reader;
            dAlbum thisAlbum = new dAlbum();

            if (File.Exists(path)){
                reader = new StreamReader(path);
            }
            else//TODO:: Si no existe q hago.
                return null;
            thisAlbum._sversion = reader.ReadLine();
            thisAlbum._snombre = reader.ReadLine();
            int totalImages = int.Parse(reader.ReadLine());

            for (int k = 0; k < totalImages; k++)
            {
                xmlImagen img = new xmlImagen(thisAlbum);
                img.LoadLine(reader);
                thisAlbum.InsertImagen(img);
            }
            reader.Close();
            thisAlbum.need_change = false;          //el album no necesita guardarse
            return thisAlbum;
            thisAlbum._full_path = path;
        }