private IEnumerator talk(stringContainer sc) { int counter = 0; textPanel.transform.DOScale(1, 1f); foreach (string st in sc.strings) { express.changeExpression(sc.expressions[counter]); textMesh.text = ""; foreach (char c in st) { textMesh.text += c; voice.Stop(); AudioClip clip = clips[Random.Range(0, clips.Count)]; voice.clip = clip; voice.Play(); yield return(new WaitForSeconds(0.05f)); } yield return(new WaitForSeconds(3f)); counter++; } textPanel.transform.DOScale(0, 1f); playNextAction(); }
static void Main(string[] args) { Config config = new Config(); config.Init(); stringContainer[] status = new stringContainer[config.Querries.Length]; for (int i = 0; i < config.Querries.Length; i++) { Console.WriteLine("Initializing querry: \n" + config.Querries[i].ToString()); status[i] = new stringContainer(); HandleQuerry(config.Querries[i], status[i]); } Thread.Sleep(5000); while (true) { Console.Clear(); foreach (stringContainer sc in status) { Console.WriteLine(sc.s); } Thread.Sleep(2000); } }
static void HandleQuerry(BackupQuerry q, stringContainer status) { Task.Run(() => { q.BackupFolder = q.BackupFolder.Replace('\\', '/'); q.FolderToBackup = q.FolderToBackup.Replace('\\', '/'); for (int i = 0; i < q.Ignore.Length; i++) { q.Ignore[i] = q.Ignore[i].Replace('\\', '/'); } int hours = int.Parse(q.date.Split(':')[0]); int minutes = int.Parse(q.date.Split(':')[1]); Queue <string> Backups = new Queue <string>(); DateTime t = DateTime.Today.AddHours(hours).AddMinutes(minutes); while (DateTime.Now > t) { switch (q.Occurences) { case BackupOccurences.Hourly: t = t.AddHours(q.OccurenceFactor); break; case BackupOccurences.Dayly: t = t.AddDays(q.OccurenceFactor); break; case BackupOccurences.Monthly: t = t.AddDays(q.OccurenceFactor * 30.437); break; default: break; } } BackupData dats = new BackupData(); dats.date = "N/A"; dats.error = ""; dats.Size = ""; status.s = "Next backup of: " + q.FolderToBackup + " At: " + t + " In: " + (t - DateTime.Now).ToString("hh\\:mm\\:ss") + "\nLast: " + dats.date + " " + dats.Size + " " + dats.error + " "; while (true) { if ((t - DateTime.Now).TotalSeconds < 30) { MakeBackup(q.FolderToBackup, q.BackupFolder, in Backups, q.Ignore, ref dats, q.Compressed); Console.WriteLine("Next backup: " + t); if (Backups.Count > 1 && Backups.Count > q.BackupCountToKeep) { string p = Backups.Dequeue(); if (Directory.Exists(p)) { Directory.Delete(p, true); } else if (File.Exists(p + ".zip")) { File.Delete(p + ".zip"); } } switch (q.Occurences) { case BackupOccurences.Hourly: t = t.AddHours(q.OccurenceFactor); break; case BackupOccurences.Dayly: t = t.AddDays(q.OccurenceFactor); break; case BackupOccurences.Monthly: t = t.AddDays(q.OccurenceFactor * 30.437); break; default: break; } } else { status.s = "Next backup of: " + q.FolderToBackup + " At: " + t + " In: " + (t - DateTime.Now).ToString("hh\\:mm\\:ss") + "\nLast: " + dats.date + " " + dats.Size + " " + dats.error + " "; } Thread.Sleep(1000); } }); }