public static DataStore NewTemplate(DataStoreCollection dsColl) { // ATTENTION: THIS MUST BE NOT CHANGED "AtLeastOneDataSource" ... DataStore ds = new DataStore( ); { ds.Creation = DateTime.Now; ds.FullPathName = Program.DATASTORE_1ST_XMLFULLNAME; ds.Name = Program.DATASTORE_1ST_XMLFILENAME; ds.IsActive = true; ds.wasTested = true; //string connectionString = MSSqlConnectionProvider.GetConnectionString( @"DBSRV\QWERTY", @"user02", @"8a0IucJ@Nx1Qy5HfFrX0Ob3m", @"Sales" ); //string connectionString1 = SQLiteConnectionProvider.GetConnectionString( @"D:\TEMP\SQLite\SQLITEDB1.db3" ); ds.ConnectionString = @"D:\TEMP\SQLite\SQLITEDB1.db3"; ds.LoginID = null; ds.Password = null; ds.SyntaxProvider = 1; ds.MetadataProvider = 1; ds.Preview = "Default 1st DataStore"; ds.Description = "Default 1st DataStore"; ds.XmlSerialize(ds.FullPathName); } //ds.Normalize( ); return(ds); }
public static DataStoreCollection Load(BindingList <ConfigPath> dirList) { DataStoreCollection coll = new DataStoreCollection( ); if (dirList == null) { return(coll); } coll.DirList = dirList; foreach (ConfigPath cp in dirList) { try { string[] files = Directory.GetFiles(cp.PathDir, "*.ds.xml", SearchOption.TopDirectoryOnly); foreach (string s in files) { var pathSeparator = Path.PathSeparator; var volumeSeparatorChar = Path.VolumeSeparatorChar; var invalidFileNameChars = Path.GetInvalidFileNameChars( ); var invalidPathChars = Path.GetInvalidPathChars( ); // var isPathRooted = Path.IsPathRooted(s); var hasExtension = Path.HasExtension(s); // var fullPath = Path.GetFullPath(s); var directoryName = Path.GetDirectoryName(s); var pathRoot = Path.GetPathRoot(s); var fileName = Path.GetFileName(s); var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(s); var extension = Path.GetExtension(s); // var randomFileName = Path.GetRandomFileName( ); var tempFileName = Path.GetTempFileName( ); var tempPath = Path.GetTempPath( ); // DataStore ds = DataStore.XmlDeserialize(s); ds.FullPathName = s; coll.List.Add(ds); } } catch (Exception ex) { } } return(coll); }