Ejemplo n.º 1
0
        static public bool TryGetUnusedFilename(string basename, int suffix_length, int max_number_trys, out string filename)
        {
            int number_trys = 0;

            filename = basename;

            while (DoesFileExist(filename))
            {
                if (number_trys >= max_number_trys)
                {
                    return(false);
                }

                filename = Filename.AddFilenameSuffix(basename, Strings.PseudoRandom(suffix_length));
            }

            return(true);
        }
Ejemplo n.º 2
0
 static public string GetWorkingDirectory()
 {
     return(Filename.CleanPath(Directory.GetCurrentDirectory() + "/"));
 }
Ejemplo n.º 3
0
 static public string MakeUnusedDataFilename(string directory, string extension)
 {
     return(Filename.MakeUnusedFilename(MakeDataPath(directory), extension));
 }
Ejemplo n.º 4
0
 static public string MakeObfuscatedDataFilename(string directory, string info, string extension)
 {
     return(Filename.MakeDataFilename(directory, HashTypes.SHA1.CalculateAsUnicode(info).ToHexString(), extension));
 }
Ejemplo n.º 5
0
 public override string GetSystemName()
 {
     return(Filename.GetTopDirectoryName(directory));
 }
Ejemplo n.º 6
0
 public string GetFilename()
 {
     return(Filename.MakeFilename(dst_directory, src_filename));
 }
Ejemplo n.º 7
0
 static public void CopyFileOrDirectoryToDirectory(string src, string dst_directory, bool overwrite, long milliseconds = DEFAULT_WAIT)
 {
     CopyFileOrDirectory(src, Filename.MakeFilename(dst_directory, src), overwrite, milliseconds);
 }
Ejemplo n.º 8
0
 static public bool SaveChanges(this string item, string directory, string filename, bool overwrite)
 {
     return(item.SaveChanges(Filename.MakeFilename(directory, filename), overwrite));
 }
Ejemplo n.º 9
0
 private void SetName(string n)
 {
     name = Filename.CleanFilename(n);
 }
Ejemplo n.º 10
0
 static public string GetAssemblyFilename(this Assembly item)
 {
     return(Filename.GetAbsolutePath(new Uri(item.CodeBase).LocalPath));
 }
Ejemplo n.º 11
0
 static public string GetAssemblyDirectory(this Assembly item)
 {
     return(Filename.GetDirectory(item.GetAssemblyFilename()));
 }
Ejemplo n.º 12
0
 static public AttemptResult RenameFileInDirectory(string directory, string filename, string new_filename, bool overwrite, long milliseconds = DEFAULT_WAIT)
 {
     return(RenameFile(Filename.MakeFilename(directory, filename), new_filename, overwrite, milliseconds));
 }
Ejemplo n.º 13
0
 static public AttemptResult CopyFileBetweenDirectorysOverwriteOld(string src_directory, string dst_directory, string filename, long milliseconds = DEFAULT_WAIT)
 {
     return(CopyFileOverwriteOld(Filename.MakeFilename(src_directory, filename), Filename.MakeFilename(dst_directory, filename), milliseconds));
 }
Ejemplo n.º 14
0
 static public AttemptResult DeleteFileInDirectory(string directory, string filename, long milliseconds = DEFAULT_WAIT)
 {
     return(DeleteFile(Filename.MakeFilename(directory, filename), milliseconds));
 }
Ejemplo n.º 15
0
 static public AttemptResult RenameFile(string full_filename, string new_filename, bool overwrite, long milliseconds = DEFAULT_WAIT)
 {
     return(MoveFile(full_filename, Filename.MakeFilename(full_filename, new_filename), overwrite, milliseconds));
 }
Ejemplo n.º 16
0
 static public AttemptResult CopyDirectoryToDirectory(string src_directory, string dst_directory, bool overwrite, long milliseconds = DEFAULT_WAIT)
 {
     return(CopyDirectory(src_directory, Filename.MakeFilename(dst_directory, src_directory), overwrite, milliseconds));
 }
Ejemplo n.º 17
0
 static public AttemptResult CopyDirectoryBetweenDirectorys(string src_directory, string dst_directory, string directoryname, bool overwrite, long milliseconds = DEFAULT_WAIT)
 {
     return(CopyDirectory(Filename.MakeFilename(src_directory, directoryname), Filename.MakeFilename(dst_directory, directoryname), overwrite, milliseconds));
 }
Ejemplo n.º 18
0
 static public IEnumerable <string> GetFilenamesInDirectory(string directory)
 {
     return(Directory.GetFiles(Filename.GetDirectory(directory), "*", SearchOption.TopDirectoryOnly)
            .Convert(s => Filename.CleanPath(s)));
 }
Ejemplo n.º 19
0
 static public IEnumerable <string> GetRelativeFilenamesInDirectory(string directory)
 {
     return(GetFilenamesInDirectory(directory)
            .Convert(f => Filename.GetRelativePath(f, directory)));
 }
Ejemplo n.º 20
0
 static public IEnumerable <string> GetDirectorysInDirectory(string directory)
 {
     return(Directory.GetDirectories(Filename.GetDirectory(directory), "*", SearchOption.TopDirectoryOnly)
            .Skip(s => s == "." || s == "..")
            .Convert(s => Filename.CleanPath(s + "/")));
 }
Ejemplo n.º 21
0
 static public void CopyFileOrDirectoryBetweenDirectorys(string src_directory, string dst_directory, string name, bool overwrite, long milliseconds = DEFAULT_WAIT)
 {
     CopyFileOrDirectory(Filename.MakeFilename(src_directory, name), Filename.MakeFilename(dst_directory, name), overwrite, milliseconds);
 }
Ejemplo n.º 22
0
 static public string MakeDataFilename(string directory, string filename)
 {
     return(Filename.MakeFilename(MakeDataPath(directory), filename));
 }
Ejemplo n.º 23
0
 public virtual AttemptResult RenameStream(string path, string new_name, bool overwrite, long milliseconds = StreamSystem.DEFAULT_WAIT)
 {
     return(MoveStreamNative(path, Filename.SetFilenameWithExtension(path, new_name), overwrite, milliseconds));
 }
Ejemplo n.º 24
0
 protected override string CalculatePath(string path)
 {
     return(Filename.ForwardCombine(directory, path));
 }