public MyFolder(String name, GeneralFile parent, UserInfo owner) : base(name, parent, owner) { if (!Directory.Exists(RealPath)) { directoryInfo = Directory.CreateDirectory(RealPath); } else { directoryInfo = new DirectoryInfo(RealPath); } childrens = new List <GeneralFile>(); }
public void EditChildren(GeneralFile child, String newContent) { GeneralFile file = childrens.Find(r => r.Name.Equals(child.Name)); if (file is MyFile file1) { file1.Edit(newContent); } else { Console.WriteLine(@"Fajl ne postoji!\nPritisnite enter za nastavak."); Console.ReadLine(); } }
public GeneralFile(string name, GeneralFile parent, UserInfo owner) { this.owner = owner; this.name = name; this.parent = parent; if (parent != null) { path += parent.path + @"\" + name; depth = parent.depth + 1; } else { path = name; depth = 0; } realPath = AppDomain.CurrentDomain.BaseDirectory + @"\" + path; }
public SharedFile(String name, GeneralFile parent, UserInfo owner, UserInfo user) : base(name, parent, owner) { this.user = user; }
public void RemoveChildren(GeneralFile child) { childrens.Remove(child); File.Delete(child.RealPath); }
public void AddChildren(GeneralFile child) { childrens.Add(child); }
public MyFile(FileInfo file, GeneralFile parent, UserInfo owner) : base(file.Name, parent, owner) { this.file = System.IO.File.Open(file.FullName, FileMode.OpenOrCreate); }
public MyFile(String name, GeneralFile parent, UserInfo owner) : base(name, parent, owner) { file = System.IO.File.Open(RealPath, FileMode.OpenOrCreate); file.Close(); }