Ejemplo n.º 1
0
 private void Prepare()
 {
     var file = new File(TempFile());
     if (file.Exists())
     {
         file.Delete();
     }
     var testDB = OpenDB();
     var item = new Item("richard"
         , 100);
     testDB.Store(item);
     testDB.Close();
 }
Ejemplo n.º 2
0
		public Db4oDrsFixture(string name, IReflector reflector)
		{
			_name = name;
			File folder = new File(Path);
			if (!folder.Exists())
			{
				Sharpen.Runtime.Out.WriteLine("Path " + Path + " does not exist. Using current working folder."
					);
				Sharpen.Runtime.Out.WriteLine("Check the " + RamDriveProperty + " environment variable on your system."
					);
				folder = new File(".");
			}
			testFile = new File(folder.GetPath() + "/drs_cs_" + _name + ".db4o");
			if (reflector != null)
			{
				Config().ReflectWith(reflector);
			}
		}
Ejemplo n.º 3
0
 /// <exception cref="System.IO.IOException"></exception>
 public virtual void ReadFrom(File file)
 {
     if (!file.Exists())
     {
         throw new IOException(Messages.Get(41, file.GetAbsolutePath
                                                ()));
     }
     i_length = (int)file.Length();
     CheckExt(file);
     if (i_stream.IsClient)
     {
         i_file = file;
         ((IBlobTransport)i_stream).ReadBlobFrom(i_trans, this);
     }
     else
     {
         ReadLocal(file);
     }
 }
Ejemplo n.º 4
0
 /// <exception cref="System.IO.IOException"></exception>
 public virtual void ReadFrom(File file)
 {
     if (!file.Exists())
     {
         throw new IOException(Messages.Get(41, file.GetAbsolutePath
             ()));
     }
     i_length = (int) file.Length();
     CheckExt(file);
     if (i_stream.IsClient)
     {
         i_file = file;
         ((IBlobTransport) i_stream).ReadBlobFrom(i_trans, this);
     }
     else
     {
         ReadLocal(file);
     }
 }
Ejemplo n.º 5
0
        /// <exception cref="System.IO.IOException"></exception>
        public virtual void ReadLocal(File file)
        {
            var copied = false;

            if (fileName == null)
            {
                var newFile = new File(ServerPath(), file.GetName());
                if (!newFile.Exists())
                {
                    Copy(file, newFile);
                    copied   = true;
                    fileName = newFile.GetName();
                }
            }
            if (!copied)
            {
                Copy(file, ServerFile(CheckExt(file), true));
            }
            lock (i_stream.Lock())
            {
                i_stream.StoreInternal(i_trans, this, false);
            }
            i_status = Status.Completed;
        }
Ejemplo n.º 6
0
 /// <summary>returns true if the specified file system path already exists.</summary>
 /// <remarks>returns true if the specified file system path already exists.</remarks>
 public virtual bool Exists(string uri)
 {
     Sharpen.IO.File file = new Sharpen.IO.File(uri);
     return(file.Exists() && file.Length() > 0);
 }
		public override bool Exists(string path)
		{
			Sharpen.IO.File existingFile = new Sharpen.IO.File(path);
			return existingFile.Exists() && existingFile.Length() > 0;
		}
 public override bool Exists(string path)
 {
     Sharpen.IO.File existingFile = new Sharpen.IO.File(path);
     return(existingFile.Exists() && existingFile.Length() > 0);
 }
Ejemplo n.º 9
0
		/// <summary>returns true if the specified file system path already exists.</summary>
		/// <remarks>returns true if the specified file system path already exists.</remarks>
		public virtual bool Exists(string uri)
		{
			Sharpen.IO.File file = new Sharpen.IO.File(uri);
			return file.Exists() && file.Length() > 0;
		}
Ejemplo n.º 10
0
 /// <exception cref="System.IO.IOException"></exception>
 public virtual void ReadLocal(File file)
 {
     var copied = false;
     if (fileName == null)
     {
         var newFile = new File(ServerPath(), file.GetName());
         if (!newFile.Exists())
         {
             Copy(file, newFile);
             copied = true;
             fileName = newFile.GetName();
         }
     }
     if (!copied)
     {
         Copy(file, ServerFile(CheckExt(file), true));
     }
     lock (i_stream.Lock())
     {
         i_stream.StoreInternal(i_trans, this, false);
     }
     i_status = Status.Completed;
 }
Ejemplo n.º 11
0
        public override bool Exists(string path)
        {
            var existingFile = new File(path);

            return(existingFile.Exists() && existingFile.Length() > 0);
        }
Ejemplo n.º 12
0
 public override bool Exists(string path)
 {
     var existingFile = new File(path);
     return existingFile.Exists() && existingFile.Length() > 0;
 }
Ejemplo n.º 13
0
        /// <summary>returns true if the specified file system path already exists.</summary>
        /// <remarks>returns true if the specified file system path already exists.</remarks>
        public virtual bool Exists(string uri)
        {
            var file = new File(uri);

            return(file.Exists() && file.Length() > 0);
        }
Ejemplo n.º 14
0
 /// <summary>returns true if the specified file system path already exists.</summary>
 /// <remarks>returns true if the specified file system path already exists.</remarks>
 public virtual bool Exists(string uri)
 {
     var file = new File(uri);
     return file.Exists() && file.Length() > 0;
 }