Example #1
0
		internal static NbtAddress GetByName(Name name)
		{
			lock (typeof(Lmhosts))
			{
				NbtAddress result = null;
				try
				{
					if (Filename != null)
					{
						FilePath f = new FilePath(Filename);
						long lm;
						if ((lm = f.LastModified()) > _lastModified)
						{
							_lastModified = lm;
							Tab.Clear();
							_alt = 0;
							Populate(new FileReader(f));
						}
						result = (NbtAddress)Tab[name];
					}
				}
				catch (FileNotFoundException fnfe)
				{
					if (_log.Level > 1)
					{
						_log.WriteLine("lmhosts file: " + Filename);
						Runtime.PrintStackTrace(fnfe, _log);
					}
				}
				catch (IOException ioe)
				{
					if (_log.Level > 0)
					{
						Runtime.PrintStackTrace(ioe, _log);
					}
				}
				return result;
			}
		}
Example #2
0
		public FileWriter (FilePath path) : base(path.GetPath ())
		{
		}
Example #3
0
		public static FilePath CreateTempFile (string prefix, string suffix, FilePath directory)
		{
			string file;
			if (prefix == null) {
				throw new ArgumentNullException ("prefix");
			}
			if (prefix.Length < 3) {
				throw new ArgumentException ("prefix must have at least 3 characters");
			}
			string str = (directory == null) ? Path.GetTempPath () : directory.GetPath ();
			do {
				file = Path.Combine (str, prefix + Interlocked.Increment (ref _tempCounter) + suffix);
			} while (File.Exists (file));
			
			new FileOutputStream (file).Close ();
			return new FilePath (file);
		}
Example #4
0
		public bool RenameTo (FilePath file)
		{
			return RenameTo (file._path);
		}
Example #5
0
		public FilePath (FilePath other, string child)
			: this ((string) other, child)
		{

		}
Example #6
0
 public FileWriter(FilePath path)
     : base(new FileOutputStream(path))
 {
 }
		public RandomAccessFile (FilePath file, string mode) : this(file.GetPath (), mode)
		{
		}
Example #8
0
		public FileInputStream (FilePath file) : this(file.GetPath ())
		{
		}
Example #9
0
		public PrintWriter (FilePath path)
		{
			_writer = new StreamWriter (path);
		}