コード例 #1
0
ファイル: Lmhosts.cs プロジェクト: Cyber-Forensic/Potato
		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;
			}
		}
コード例 #2
0
ファイル: FileWriter.cs プロジェクト: Cyber-Forensic/Potato
		public FileWriter (FilePath path) : base(path.GetPath ())
		{
		}
コード例 #3
0
ファイル: FilePath.cs プロジェクト: Cyber-Forensic/Potato
		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);
		}
コード例 #4
0
ファイル: FilePath.cs プロジェクト: Cyber-Forensic/Potato
		public bool RenameTo (FilePath file)
		{
			return RenameTo (file._path);
		}
コード例 #5
0
ファイル: FilePath.cs プロジェクト: Cyber-Forensic/Potato
		public FilePath (FilePath other, string child)
			: this ((string) other, child)
		{

		}
コード例 #6
0
ファイル: FileWriter.cs プロジェクト: istupakov/SharpCifs
 public FileWriter(FilePath path)
     : base(new FileOutputStream(path))
 {
 }
コード例 #7
0
		public RandomAccessFile (FilePath file, string mode) : this(file.GetPath (), mode)
		{
		}
コード例 #8
0
		public FileInputStream (FilePath file) : this(file.GetPath ())
		{
		}
コード例 #9
0
ファイル: PrintWriter.cs プロジェクト: Cyber-Forensic/Potato
		public PrintWriter (FilePath path)
		{
			_writer = new StreamWriter (path);
		}