public void ZiperTest() { string str = null; AssertThat.DoesNotThrowException(() => { str = Ziper.TempPath; }); AssertThat.IsTrue(Directory.Exists(str)); Directory.CreateDirectory("Test"); File.WriteAllText(@"Test\Test", "Test"); AssertThat.DoesNotThrowException(() => { Ziper.Zip("Test.zip", "Test"); }); AssertThat.DoesNotThrowException(() => { Ziper.UnZip("Test.zip", "Test-copy"); }); AssertThat.AreEqual(File.ReadAllText(@"Test-copy\Test"), IS.a("Test")); File.Delete("Test.zip"); Directory.Delete("Test", true); Directory.Delete("Test-copy", true); }
public static void Start( string Path, Form form, SetMax Max, SetValue Value, SetLabel Label, Action End, Action Error, bool HideMessages, bool DeleteMessages, bool HideNicknames, bool HideServerIDs, bool HideServerNames, bool HideChannelIDs, bool HideChannelNames, bool HideApplication, bool DeleteApplication, bool HideOS, bool HideIPs, bool HideLocations, bool DeleteActivities ) { Task t = new Task(() => { form.Invoke(Max, 114); form.Invoke(Value, 0); int start = 0; int max = 0; #region UnZip max = 5; form.Invoke(Label, "UnZip"); if (!Ziper.UnZip(Path)) { form.Invoke(Error, "UnZipFailed"); return; } form.Invoke(Value, start += max); #endregion #region IDs max = 2; form.Invoke(Label, "IDs"); try { ServerIDs = new Dictionary <string, string>(); ChannelIDs = new Dictionary <string, string>(); string channel = $@"{Ziper.TempPath}\messages\index.json"; string servers = $@"{Ziper.TempPath}\servers\index.json"; JServerIDs = File.Exists(servers) ? JObject.Parse(File.ReadAllText(servers)) : null; JChannelIDs = File.Exists(channel) ? JObject.Parse(File.ReadAllText(channel)) : null; } catch { form.Invoke(Error, "IDsFailed"); return; } form.Invoke(Value, start += max); #endregion #region Messages Channel max = 35; form.Invoke(Label, "Messages"); string messages = $@"{Ziper.TempPath}\messages"; try { if (Directory.Exists(messages)) { string[] directories = Directory.GetDirectories(messages); if (DeleteMessages) { foreach (string directory in Directory.GetDirectories(messages)) { Directory.Delete(directory, true); } } else if (HideMessages) {