public static List <IFreeDocument> ReadGroupDataFile(string path) { IFileConnector json = SmartGetExport(path); json.FileName = path; return(json.ReadFile().ToList()); }
public DataCollection ReadFile(string fileName, string format = null) { IFileConnector exporter = null; if (format != null) { exporter = PluginProvider.GetObjectInstance <IFileConnector>(format); } else { exporter = FileConnector.SmartGetExport(fileName); } if (exporter == null) { return(null); } exporter.FileName = fileName; fileName = exporter.FileName; ControlExtended.SafeInvoke( () => AddDataCollection(exporter.ReadFile(), Path.GetFileNameWithoutExtension(fileName)), LogType.Important); return(GetCollection(fileName)); }
public static void SaveDataFile(string filename, IEnumerable <IFreeDocument> items) { IFileConnector json = SmartGetExport(filename); json.FileName = filename; json.WriteAll(items); }
public static IFreeDocument ReadDataFile(string path) { IFileConnector json = SmartGetExport(path); json.FileName = path; IFreeDocument r = json.ReadFile().LastOrDefault(); return(r); }
public static void WriteAll(this IFileConnector connector, IEnumerable <IFreeDocument> data) { Monitor.Enter(connector);//锁定,保持同步 var r = connector.WriteData(data).LastOrDefault(); Monitor.Exit(connector);//锁定,保持同步 Thread.Sleep(200); }
public static void SaveDataFile(string filename, IFreeDocument item) { IFileConnector json = SmartGetExport(filename); json.FileName = filename; var datas = new List <IFreeDocument> { item }; json.WriteAll(datas); }
public virtual void ReadConfig(string path = null) { if (path == null) { path = SavePath; } IFileConnector json = FileConnector.SmartGetExport(path); json.FileName = path; IDictionarySerializable da = json.ReadFile().FirstOrDefault(); DictDeserialize(da.DictSerialize()); }
public virtual void SaveConfig(string path = null) { if (path == null) { path = SavePath; } IFileConnector json = FileConnector.SmartGetExport(path); var Datas = new List <IFreeDocument> { DictSerialize() }; json.WriteAll(Datas); }
public static string GetCollectionString(IEnumerable <IFreeDocument> datas, string format = "xml") { IFileConnector connector = null; switch (format) { case "xml": connector = new FileConnectorXML(); break; case "json": connector = new FileConnectorXML(); break; } return(connector.GetString(datas)); ; }
public void SaveFile(DataCollection dataCollection, string path = null, string format = null) { IFileConnector exporter = null; if (format != null) { exporter = PluginProvider.GetObjectInstance <IFileConnector>(format); } else { exporter = FileConnector.SmartGetExport(path); } if (exporter == null) { return; } var data = dataCollection.ComputeData; exporter.FileName = path; processManager.CurrentProcessTasks.Add( TemporaryTask <FreeDocument> .AddTempTask(dataCollection + GlobalHelper.Get("key_252"), exporter.WriteData(data), null, result => { if (MainDescription.IsUIForm && string.IsNullOrEmpty(exporter.FileName) == false) { if ( MessageBox.Show(GlobalHelper.Get("key_253"), GlobalHelper.Get("key_99"), MessageBoxButton.OKCancel) == MessageBoxResult.OK) { try { System.Diagnostics.Process.Start(exporter.FileName); } catch (Exception ex) { MessageBox.Show(GlobalHelper.Get("key_254") + ex.Message); } } } }, data.Count, notifyInterval: 1000)); }
public static bool CheckFilePath(this IFileConnector connector, FileOperate readOrWrite) { if (connector.FileName == null && MainDescription.IsUIForm) { if (readOrWrite == FileOperate.Read) { var ofd = new OpenFileDialog(); ofd.DefaultExt = connector.ExtentFileName; ofd.Filter = String.Join("|", connector.ExtentFileName.Split(' ').Select(d => string.Format("(*{0})|*{0}", d))); if (ofd.ShowDialog() == true) { connector.FileName = ofd.FileName; } else { return(false); } } else { var ofd = new SaveFileDialog(); ofd.FileName = connector.FileName; ofd.DefaultExt = connector.ExtentFileName.Split(' ')[0]; ofd.Filter = String.Join("|", connector.ExtentFileName.Split(' ').Select(d => string.Format("(*{0})|*{0}", d))); if (ofd.ShowDialog() == true) { connector.FileName = ofd.FileName; } else { return(false); } } } return(true); }
public NtfsCrawlJob(IIntegrationCoordinatorService integrationCoordinatorService, IJobService jobService, IFileConnector fileConnector) : base(integrationCoordinatorService, jobService) { _fileConnector = fileConnector; }
public static void WriteAll(this IFileConnector connector, IEnumerable <IFreeDocument> data) { var r = connector.WriteData(data).LastOrDefault(); }