public WebRetriever() { MiMFa_Path.CreateAllDirectories(TempDirectory); MiMFa_Path.DeleteAllFilesInAllDirectoriesInPath(TempDirectory); SetBrowser(fetch_browser); SetTimer(fetch_timer); }
public virtual List <string> delete(params object[] po) { _address = true; List <string> ls = search(po); MiMFa_Path.DeleteFiles(ls.ToArray()); (new FUNCTION()).restart(); return(ls); }
public override object execute(object obj, int index, int length) { string str = obj + ""; List <string> res = search(str); str = getpath(str); if (_go || g) { res.Add(HERE.current = getpath(obj + "")); } if ((_create || c || _new) && _directory) { MiMFa_Path.CreateDirectories(str); } if ((_create || c || _new) && _file) { MiMFa_Path.CreateFiles(str); } bool ifi = isfile(str); if (_delete && (_directory || d || !ifi)) { MiMFa_Path.DeleteAllDirectories(_file, str); } if (_delete && (_file || f || ifi)) { MiMFa_Path.DeleteFiles(str); } try { for (int i = 0; i < res.Count; i++) { int s = res[i].Split('.').Last().Length; if (isfile(res[i])) { if (!_longview) { res[i] = res[i].Split('\\').Last(); } } else if (!_longview) { if (_justName) { res[i] = Path.GetFileNameWithoutExtension(res[i]); } else { res[i] = Path.GetFileName(res[i]); } } } } catch { } return(res); }
public virtual List <string> all(params object[] po) { List <string> ls = MiMFa_Path.GetAllFiles(MCL.Address.BaseDirectory, true); if (!_address) { ls = MiMFa_CollectionService.ExecuteInAllItems(ls, (s) => System.IO.Path.GetFileNameWithoutExtension(s)); } return(ls); }
public void Set( string name = "Default", string mrlCode = "", string css = "", string script = "", object extra = null) { Name = name; MRLCode = mrlCode; Css = css; Script = script; Extra = extra; MiMFa_Path.CreateAllDirectories(Address); }
public override object execute(object obj, int index, int length) { if (obj is Function) { Function f = (Function)obj; string path = MCL.Address.BaseFunctionDirectory + f.Name + "(" + f.Inputs.Length + ")" + MCL.Address.FunctionExtension; string content = f.Access.Status.ToString().ToLower() + " function " + f.Name + "(" + MiMFa_CollectionService.GetAllItems(f.Inputs, ",") + ")" + Environment.NewLine + f.Commands + ";"; MiMFa_IOService.StringToFullFile(path, content); } else { string path = MiMFa_Path.CreateValidPathName(MCL.Address.BaseOtherDirectory, "out", MCL.Address.BinaryExtension, false); MiMFa_IOService.SaveSerializeFile(path, obj); } return(obj); }
public virtual Dictionary <string, string> GetDicOfRecoveryData() { string[] files = System.IO.Directory.GetFiles(DataTempDirectory); Dictionary <string, string> dic = new Dictionary <string, string>(); if (files.Length > 1) { for (int i = 0; i < files.Length; i++) { var fi = new System.IO.FileInfo(files[i]); if (!MiMFa_Path.IsUsingByProccess(files[i])) { dic.Add(files[i], (dic.Count + 1) + "- " + Exclusive.Language.MiMFa_LanguageReader.GetText("Date") + " " + MiMFa_Convert.ToMiMFaDate(fi.LastAccessTime).GetDate() + " " + Exclusive.Language.MiMFa_LanguageReader.GetText("On Clock") + " " + MiMFa_Convert.ToMiMFaTime(fi.LastAccessTime).GetTime() + " ---> (" + fi.Length + " byte)"); } } } return(dic); }
public MiMFa_Table AddInTable(MiMFa_Table dt, HTMLElementPatern elementPatern, MiMFa_XMLElement elem, List <MiMFa_XMLElement> xmls) { if (elem == null) { return(MiMFa_Table.AddInTable(dt, "", elementPatern.ColName, elementPatern.TableValuePositionType)); } string str = GetValueFromXML(elementPatern, elem); if (elementPatern.Usage != MiMFa_Usage.Set) { dt = MiMFa_Table.AddInTable(dt, str, elementPatern.ColName, elementPatern.TableValuePositionType); } else { switch (elementPatern.LinkJob) { case MiMFa_LinkJob.InternalPage: AppendInFetchQueue(new FetchPatern(fetch_url, str), true); break; case MiMFa_LinkJob.ExternalPage: AppendInFetchQueue(fetch_webpatern.FindFetchPaternFor(str, fetch_url.Source), true); break; //case MiMFa_LinkJob.Download: default: string file = string.Join("", elementPatern.DestinationPath, "\\", MiMFa_UnicCode.CreateNewString(10), "_"); if (MiMFa_Internet.IsWellURL(str)) { file += MiMFa_StringService.CompressedText(MiMFa_Path.NormalizeForFileAndFolderName(str.Split('/').Last()), 25, ""); } bool b = MiMFa_Internet.DownloadOrSave(str, file); dt = MiMFa_Table.AddInTable(dt, file, elementPatern.ColName, elementPatern.TableValuePositionType); dt = MiMFa_Table.AddInTable(dt, str, string.Join("", "auto_", elementPatern.ColName, "_URL"), MiMFa_TableValuePositionType.NextColumnCell); dt = MiMFa_Table.AddInTable(dt, b + "", string.Join("", "auto_", elementPatern.ColName, "_State"), MiMFa_TableValuePositionType.NextColumnCell); break; } } return(dt); }
public void Set( string name = "Default", ReportStyle style = null, string html = "", Object extra = null, Type type = null, params object[] objectArray) { Name = name; if (style != null) { Style.Set(style); } RSID = Style.RSID; ObjectArray = objectArray; Type = type; _HTML = html; Extra = extra; CreateDate = Default.Date; CreateTime = Default.Time; MiMFa_Path.CreateAllDirectories(Address); }
public List <string> search(string name) { List <string> res = new List <string>(); string address = ""; bool bb = (_search || ((_reclusive || r) && (_file || f || _directory || d || _delete || _create || c || _new))); if (bb) { address = HERE.current; } else { address = getpath(name); } if (_file || f) { if (isfile(address)) { res.Add(address); } else { res = MiMFa_Path.GetAllFiles(address, (_reclusive || r)); } } else if (_directory || d) { res = MiMFa_Path.GetAllDirectories(address, (_reclusive || r)); } else { res = MiMFa_CollectionService.Concat(MiMFa_Path.GetAllDirectories(address, (_reclusive || r)), MiMFa_Path.GetAllFiles(address, (_reclusive || r))); } if (bb && !name.Contains("\\")) { res = (from vv in res where vv.Split('\\').Last().Contains(name) select vv).ToList(); } return(res); }
public override object execute(object obj, int index, int length) { FileMode f = (_create) ? FileMode.OpenOrCreate : FileMode.Open; if (index == 0) { source = obj; } else if (obj != null && obj is string) { if (source != null && source is string) { string s = PATH.getpath(source.ToString().Trim()); string d = PATH.getpath(obj.ToString().Trim()); bool sf = PATH.isfile(s); bool df = PATH.isfile(d); if (!df && !_nocreatedestinationdirectory) { MiMFa_Path.CreateAllDirectories(d); } if (!df && !sf) { MiMFa_Path.DirectoryCopy(s, d, _copysubdirectory);//copy directory to directory } else if (!df && sf) { File.Copy(s, d + Path.GetFileName(s)); } else if (df && !sf) { throw new ArgumentException("Can not copy a directory in file!"); } else { File.Copy(s, d); } } else if (source != null) { if (_serialize) { MiMFa_IOService.SaveSerializeFile(obj.ToString(), source, f); } else if (_append) { MiMFa_IOService.StringNewLineAppendFile(obj.ToString(), MCL.Display.Done(source), f); } else { MiMFa_IOService.StringToFile(obj.ToString(), MCL.Display.Done(source), f); } } else { throw new ArgumentNullException("Can not be null sources!"); } } else { obj = source; } return(Null); }