diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Archive/Implementations/SQLSource.cs b/Source Code/TeamHobby.HobbyProjectGenerator.Archive/Implementations/SQLSource.cs index ab5b34a..c445c06 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator.Archive/Implementations/SQLSource.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator.Archive/Implementations/SQLSource.cs @@ -81,9 +81,9 @@ namespace TeamHobby.HobbyProjectGenerator.Archive origFile.CopyTo(compressor); return true; - } + } - return true; + return false; } catch (Exception ex) { diff --git a/Source Code/TeamHobby.Main/HobbyMain.cs b/Source Code/TeamHobby.Main/HobbyMain.cs index 6d30a27..3d20ec8 100644 --- a/Source Code/TeamHobby.Main/HobbyMain.cs +++ b/Source Code/TeamHobby.Main/HobbyMain.cs @@ -16,47 +16,17 @@ public class HobbyMain Console.WriteLine("File Name: {0}", fileInfo.FullName); - //Console.WriteLine("Starting file compression: "); - //Compress(fileInfo); - //Console.WriteLine("Ending compression"); - //SqlConnection myconn = new SqlConnection(); - - - //IDataSource dataSource = new SQLSource(); - SQLSource sqlSource = new SQLSource(); bool res = sqlSource.CompressFile(fileName); //bool res = CompressFile(fileName); Console.WriteLine(res); + Console.WriteLine(CreateFileName()); } - - - public static void Compress(FileInfo fi) + + public static string CreateFileName() { - // Get the stream of the source file. - using (FileStream inFile = fi.OpenRead()) - { - // Prevent compressing hidden and - // already compressed files. - if ((File.GetAttributes(fi.FullName) & FileAttributes.Hidden) != FileAttributes.Hidden & fi.Extension != ".gz") - { - // Create the compressed file. - using (FileStream outFile = - File.Create(fi.FullName + ".gz")) - { - using (GZipStream Compress = new GZipStream(outFile, CompressionMode.Compress)) - { - // Copy the source file into - // the compression stream. - inFile.CopyTo(Compress); - - Console.WriteLine("Compressed {0} from {1} to {2} bytes.", - fi.Name, fi.Length.ToString(), outFile.Length.ToString()); - } - } - } - } + return DateTime.Now.ToString() + "archive.txt"; } } diff --git a/Source Code/TeamHobby.Main/archiving2.txt.gz b/Source Code/TeamHobby.Main/archiving2.txt.gz new file mode 100644 index 0000000..d79034a Binary files /dev/null and b/Source Code/TeamHobby.Main/archiving2.txt.gz differ