Create function to create folder in archive
This commit is contained in:
parent
698aa45318
commit
feb2c0abe5
@ -12,18 +12,33 @@ namespace TeamHobby.HobbyProjectGenerator.Archive
|
||||
_conn = dataSource;
|
||||
}
|
||||
|
||||
public IDataSource<string> GetDataSource(){
|
||||
return _conn;
|
||||
}
|
||||
|
||||
// Create the folder where the compress file will be stored
|
||||
public bool CreateArchiveFolder(){
|
||||
string curPath = Directory.GetCurrentDirectory();
|
||||
//string temp = @
|
||||
string archiveFolder = curPath + "\\HobbyArhive";
|
||||
//Console.WriteLine("Creating a new folder at: {0}", archiveFolder);
|
||||
if (!Directory.Exists(archiveFolder))
|
||||
{
|
||||
Console.WriteLine("Creating a new folder at: {0}", archiveFolder);
|
||||
Directory.CreateDirectory(archiveFolder);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return the name of the new output file with Path
|
||||
public string CreateOutFileName(){
|
||||
return "hello";
|
||||
public string CreateOutFileName() {
|
||||
try {
|
||||
string path = Directory.GetCurrentDirectory();
|
||||
Console.WriteLine("The current directory is {0}", path);
|
||||
return path;
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("ArchiveCon: Creating a file name failed. ");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// put everything toget here
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using main;
|
||||
using System;
|
||||
using System.Data.Odbc;
|
||||
using TeamHobby.HobbyProjectGenerator.Archive;
|
||||
using TeamHobby.HobbyProjectGenerator.DataAccess;
|
||||
|
||||
|
||||
@ -67,6 +68,16 @@ namespace TeamHobby.HobbyProjectGenerator.Main
|
||||
// Closing the connection
|
||||
sqlDS.getConnection().Close();
|
||||
|
||||
// Testing archive Manager
|
||||
ArchiveController archive = new ArchiveController(datasource);
|
||||
string curPath = archive.CreateOutFileName();
|
||||
|
||||
//Creating the folder Archive
|
||||
Console.WriteLine("Creating a new folder ...");
|
||||
archive.CreateArchiveFolder();
|
||||
|
||||
|
||||
|
||||
// 2.Inserting Data into the database:
|
||||
//string sqlWrite = "INSERT into log(lvname, catname, userop, logmessage) values " +
|
||||
// "('Info', 'View', 'Testing DAL stuffs', 'new DAL method tested');";
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.Archive\TeamHobby.HobbyProjectGenerator.Archive.csproj" />
|
||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccess\TeamHobby.HobbyProjectGenerator.DataAccess.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user