Exemple #1
0
        static public Customers[] GetCustomerFromPhotoNumberOfDate(int PhotoNumber, ref int Total)
        {
            FileStream DummyFileStream = null;
            Customers  CustomersDummy  = null;

            Customers[] TotalCustomersDummy = new Customers[1000];
            Total = 0;
            //int Dimension = -1;
            try
            {
                PhotoMemmorry t = new PhotoMemmorry();
                DummyFileStream = new FileStream(STakeImage, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Read);
                BinaryFormatter Formatters = new BinaryFormatter();
                DummyFileStream.Seek(0, SeekOrigin.Begin);
                TakeImage DummyOutput = null;
                while (DummyFileStream.Position < DummyFileStream.Length)
                {
                    DummyOutput = (TakeImage)Formatters.Deserialize(DummyFileStream);
                    if (DummyOutput.PhotoNumberAccess == PhotoNumber)
                    {
                        CustomersDummy             = DummyOutput.CustomersAcess;
                        TotalCustomersDummy[Total] = CustomersDummy;
                        Total++;
                    }
                }
            }
            catch (SerializationException t)
            {
                Console.WriteLine(t.Message.ToString());
            }
            DummyFileStream.Flush(); DummyFileStream.Close();
            return(TotalCustomersDummy);
        }
Exemple #2
0
        static Photo[] GetPhotoFromPhotoFile(int PhotNumber, ref int Dimenstion)
        {
            FileStream DummyFileStream = null;

            Photo[] PhotoDummy = new Photo[1000];
            try
            {
                Dimenstion = -1;
                PhotoMemmorry t = new PhotoMemmorry();
                DummyFileStream = new FileStream(SPhoto, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Read);
                BinaryFormatter Formatters = new BinaryFormatter();
                DummyFileStream.Seek(0, SeekOrigin.Begin);
                Photo DummyOutput = null;
                while (DummyFileStream.Position < DummyFileStream.Length)
                {
                    DummyOutput = (Photo)Formatters.Deserialize(DummyFileStream);

                    if (DummyOutput.PhotoNumberAccsess == PhotNumber)
                    {
                        Dimenstion++;
                        PhotoDummy[Dimenstion] = new Photo();
                        PhotoDummy[Dimenstion] = DummyOutput;
                    }
                }
            }
            catch (SerializationException t)
            {
                Console.WriteLine(t.Message.ToString());
            }
            return(PhotoDummy);
        }
Exemple #3
0
        static public void RewritePhotos(PhotoMemmorry p)
        {
            FileStream DummyFileStream = null;

            try
            {
                PhotoMemmorry t             = p.PhotosNodeAccess;
                FileInfo      DummyFileInfo = new FileInfo(SPhoto);
                DummyFileInfo.Delete();
                DummyFileStream = new FileStream(SPhoto, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);
                BinaryFormatter Formatters = new BinaryFormatter();
                DummyFileStream.Seek(0, SeekOrigin.Begin);
                while (t != null)
                {
                    Formatters.Serialize(DummyFileStream, t.PhotosCurrentAccess);
                    t = t.PhotosNextAccess;
                }
                DummyFileStream.Close();
            }
            catch (NullReferenceException o)
            {
                Console.WriteLine(o.Message.ToString());
            }
            catch (IOException o)
            {
                Console.WriteLine(o.Message.ToString());
            }
        }
Exemple #4
0
        public void AddObject(PhotoMemmorry p)
        {
            //p.PhotosNextAccess = null;
            PhotoMemmorry t = new PhotoMemmorry();

            if (p.PhotosNodeAccess != null)
            {
                t = p.PhotosNodeAccess;
                while (t.PhotosNextAccess != null)
                {
                    t = t.PhotosNextAccess;
                }
                if (t.PhotosCurrentAccess == null)
                {
                    t.PhotosCurrentAccess = p.PhotosCurrentAccess;
                }
                else
                {
                    t.PhotosNextAccess = p;
                }
            }
            else
            {
                Node = p;
            }
        }
Exemple #5
0
 public void Load()
 {
     if (Node == null)
     {
         Node = new PhotoMemmorry();
     }
     Node.PhotosNextAccess    = null;
     Node.PhotosCurrentAccess = null;
     try
     {
         FileStream              DummyFileStream = new FileStream(S, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite);
         BinaryFormatter         Formatters      = new BinaryFormatter();
         RefrigtzW.Photo         Dummy           = new Photo();
         RefrigtzW.PhotoMemmorry Last            = null;
         Console.WriteLine("Loading...");
         DummyFileStream.Seek(0, SeekOrigin.Begin);
         while (DummyFileStream.Position < DummyFileStream.Length)
         {
             Dummy = (Photo)Formatters.Deserialize(DummyFileStream);
             if (Node.Current == null)
             {
                 Node.Current = Dummy;
             }
             else
             {
                 Last = Node;
                 while (Last.Next != null)
                 {
                     Last = Last.Next;
                 }
                 PhotoMemmorry New = new PhotoMemmorry();
                 New.Current           = Dummy;
                 Last.PhotosNextAccess = New;
             }
         }
         DummyFileStream.Flush();
         DummyFileStream.Close();
     }
     catch (IOException t)
     {
         Console.WriteLine(t.Message.ToString());
     }
 }
Exemple #6
0
        static public Photo[] GetPhotoFromPhotoNumberOfDate(int PhotoNumber, ref int Total)
        {
            FileStream DummyFileStream = null;

            Photo[] PhotoDummy      = null;
            Photo[] TotalPhotoDummy = new Photo[1000];
            Total = 0;
            int Dimension = -1;

            try
            {
                PhotoMemmorry t = new PhotoMemmorry();
                DummyFileStream = new FileStream(STakeImage, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Read);
                BinaryFormatter Formatters = new BinaryFormatter();
                DummyFileStream.Seek(0, SeekOrigin.Begin);
                TakeImage DummyOutput = null;
                while (DummyFileStream.Position < DummyFileStream.Length)
                {
                    DummyOutput = (TakeImage)Formatters.Deserialize(DummyFileStream);
                    if (DummyOutput.PhotoNumberAccess == PhotoNumber)
                    {
                        PhotoDummy = Operator.GetPhotoFromPhotoFile(DummyOutput.PhotoNumberAccess, ref Dimension);
                        if (Dimension > -1)
                        {
                            for (int i = Total; i <= Total + Dimension; i++)
                            {
                                TotalPhotoDummy[i] = new Photo();
                                TotalPhotoDummy[i] = PhotoDummy[i - Total];
                            }
                            Total     = Total + Dimension + 1;
                            Dimension = -1;
                        }
                    }
                }
            }
            catch (SerializationException t)
            {
                Console.WriteLine(t.Message.ToString());
            }
            DummyFileStream.Flush(); DummyFileStream.Close();
            return(TotalPhotoDummy);
        }
Exemple #7
0
        public void DeleteObject(PhotoMemmorry p)
        {
            PhotoMemmorry t = new PhotoMemmorry();

            t = Node;
            if ((t.PhotosCurrentAccess.PhotoNameAccess) != (p.PhotosCurrentAccess.PhotoNameAccess))
            {
                if (t != null)
                {
                    while ((t.PhotosNextAccess.PhotosCurrentAccess.PhotoNameAccess) != (p.PhotosCurrentAccess.PhotoNameAccess))
                    {
                        if (t.PhotosNextAccess != null)
                        {
                            t = t.PhotosNextAccess;
                        }
                        else
                        if ((t.PhotosCurrentAccess.PhotoNameAccess) != (p.PhotosCurrentAccess.PhotoNameAccess))
                        {
                            t = null;
                            break;
                        }
                    }
                }
                if (t != null)
                {
                    if (t.PhotosNextAccess != null)
                    {
                        t.PhotosNextAccess = t.PhotosNextAccess.PhotosNextAccess;
                    }

                    else
                    {
                        t.PhotosNextAccess = null;
                    }
                }
            }
            else
            {
                t    = t.PhotosNextAccess;
                Node = t;
            }
        }