public TGLineByLineReverse(PresetSettings Settings) { this.CurrentLine = 0; this.Lines = new string[0]; this.settings = Settings; this.MainRandom = new Random(); }
public TGLineByLineCopyPaste(PresetSettings Settings) { CurrentLine = 0; Lines = new string[0]; settings = Settings; MainRandom = new Random(); }
public TGBlockAdvancedReverse(PresetSettings Settings) { this.CurrentLine = 0; this.Blocks = new string[0]; this.settings = Settings; this.MainRandom = new Random(); }
public override void Setup(PresetSettings settings) { base.Setup(settings); var renderScripts = PlayerControl.RenderScripts .Where(script => script is IRenderChainUi) .Select(x => (x as IRenderChainUi).CreateNew()) .Concat(new[] { RenderChainUi.Identity }); scriptBox.DataSource = renderScripts.Select(x => new KeyValuePair <string, IRenderScriptUi>(x.Descriptor.Name, x)).OrderBy(x => x.Key).ToList(); scriptBox.DisplayMember = "Key"; scriptBox.ValueMember = "Value"; }
public void SelectPreset(int index) { for (int i = 0; i < Presets.transform.childCount; i++) { Presets.transform.GetChild(i).gameObject.SetActive(i == index); if (i == index) { PresetSettings s = Presets.transform.GetChild(i).GetComponent <PresetSettings>(); PresetName.text = "Name: " + s.presetName; PresetPlayers.text = "Players: " + s.players.ToString(); } } }
public void StartUpSetPresetSettings() { //Any presets? Set to first one else use default settings. if (presetList.Count <= 1) { useDefaultSettings = true; presetSettings = null; } else { useDefaultSettings = false; presetSettings = SettingsDB.DB_Select_PRESET(presetList[1]); } }
/// <summary> /// Loads the whole list as xml from a XmlReader. /// </summary> /// <param name="reader">An XmlReader object.</param> /// <remarks>Documented by Dev02, 2008-01-17</remarks> private void LoadByStream(XmlReader reader) { if (!xmlSerializer.CanDeserialize(reader)) { Debug.WriteLine("Unable to deserialize PresetSettings."); return; } PresetSettings presets = (PresetSettings)xmlSerializer.Deserialize(reader); m_presets.Clear(); foreach (XmlPreset preset in presets) { m_presets.Add((IPreset)preset); } }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(this.gameObject); } DontDestroyOnLoad(this.gameObject); GetComponent <FadeSceneChange>(); canvas = FindObjectOfType <Canvas>().gameObject.transform; AudioManager.instance = FindObjectOfType <AudioManager>(); }
public static void SetDirectoryDateRecursive(this string Path, PresetSettings Settings) { if (!Directory.Exists(Path)) { return; } string[] directories = Directory.GetDirectories(Path, "*", SearchOption.TopDirectoryOnly); foreach (string directory in directories.OrderByDescending(d => d.Length)) { DirectoryInfo info = new DirectoryInfo(directory); DateTime date = Settings.GeneralFileDateEnd; info.CreationTime = date; info.LastWriteTime = date; info.LastAccessTime = date; } }
public void UpdateCmbbxsFromPresetCmbbxChange() { if (cmbbx_presetSettings.SelectedItem == null) { useDefaultSettings = true; SetCmbbxFromSettings(); } else if (cmbbx_presetSettings.SelectedItem.ToString() == "default") { useDefaultSettings = true; SetCmbbxFromSettings(); } else { useDefaultSettings = false; presetSettings = SettingsDB.DB_Select_PRESET(cmbbx_presetSettings.SelectedItem.ToString()); SetCmbbxFromSettings(); } }
public static Preset Load(string Path) { int presetID = int.Parse(Path.Substring(Path.LastIndexOf("\\") + 1)); string presetName = string.Empty; int presetTemplateID = 0; int presetTextID = 0; string[] info = File.ReadAllLines(Path + "\\info.txt", Encoding.UTF8); for (int j = 0; j < info.Length; j++) { if (info[j].StartsWith("Name=")) { presetName = info[j].Substring(5); } else if (info[j].StartsWith("TemplateID=")) { presetTemplateID = int.Parse(info[j].Substring(11)); } else if (info[j].StartsWith("TextID=")) { presetTextID = int.Parse(info[j].Substring(7)); } } Preset preset = new Preset(presetID, presetName); preset.TemplateID = presetTemplateID; preset.TextID = presetTextID; try { preset.Settings = PresetSettings.Load(Path + "\\settings.txt"); } catch (Exception) { preset.Settings = new PresetSettings(); } return(preset); }
public static void SetFileDirectoryDate(this string Path, Random Random, PresetSettings Settings) { int attemptCount = 0; while (File.Exists(Path) && attemptCount <= IOWaitTreshold) { try { FileInfo info = new FileInfo(Path); DateTime fileDate = MakeFileDate(Random, Settings); info.CreationTime = fileDate; info.LastWriteTime = fileDate; info.LastAccessTime = fileDate; return; } catch (Exception) { attemptCount++; Thread.Sleep(IOWaitTresholdPause); } } while (Directory.Exists(Path) && attemptCount <= IOWaitTreshold) { try { DirectoryInfo info = new DirectoryInfo(Path); DateTime fileDate = Settings.GeneralFileDateEnd; info.CreationTime = fileDate; info.LastWriteTime = fileDate; info.LastAccessTime = fileDate; return; } catch (Exception) { attemptCount++; Thread.Sleep(IOWaitTresholdPause); } } }
/// <summary> /// Saves the whole list as xml into a Stream. /// </summary> /// <param name="filename">The filename.</param> /// <remarks> /// Documented by DAC, 2008-01-17. /// </remarks> public void Save(string filename) { try { using (StreamWriter sw = new StreamWriter(filename, false, FileEncoding)) { XmlWriterSettings xws = new XmlWriterSettings(); xws.Indent = true; using (XmlWriter writer = XmlWriter.Create(sw.BaseStream, xws)) { PresetSettings presets = new PresetSettings(); foreach (IPreset preset in m_presets) { presets.Add((XmlPreset)preset); } xmlSerializer.Serialize(writer, presets); } } } catch (Exception ex) { Debug.WriteLine(string.Format("Unable to write PresetSettings ({0}).", ex.Message)); } }
/// <summary> /// Копирование куска текста из оригинального источника /// </summary> /// <param name="Type">0 - RWORD; 1 - RPHRASE; 2 - RTEXT; 3 - RMINITEXT; 4 - RLINE; 5 - RPARAGRAPH</param> /// <returns></returns> public static string GetText(int Type, bool UpperCase, PresetSettings Settings, Random Random, int WorkspaceIndex, int TextIndex) { int startIndex = GetNextWordIndexInText(Random.Next(SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length), Random, WorkspaceIndex, TextIndex); string text = string.Empty; int endIndex = SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length; switch (Type) { case 0: { while ((endIndex >= SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length || SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.IndexOf(" ", endIndex) < 0)) { startIndex = GetNextWordIndexInText( Random.Next(SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length), Random, WorkspaceIndex, TextIndex); endIndex = startIndex + 1; } break; } case 1: { while (endIndex >= SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length || SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.IndexOf(" ", endIndex) < 0) { startIndex = GetNextWordIndexInText( Random.Next(SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length), Random, WorkspaceIndex, TextIndex); endIndex = startIndex + 1 + Random.Next(80, 130); } break; } case 2: { while (endIndex >= SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length || SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.IndexOf(" ", endIndex) < 0) { startIndex = GetNextWordIndexInText( Random.Next(SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length), Random, WorkspaceIndex, TextIndex); endIndex = startIndex + 1 + Random.Next(6 * Settings.TextGenrationTextLengthMin, 6 * Settings.TextGenrationTextLengthMax); } break; } case 3: { while (endIndex >= SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length || SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.IndexOf(" ", endIndex) < 0) { startIndex = GetNextWordIndexInText( Random.Next(SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length), Random, WorkspaceIndex, TextIndex); endIndex = startIndex + 1 + Random.Next(3 * Settings.TextGenrationTextLengthMin, 3 * Settings.TextGenrationTextLengthMax); } break; } case 4: { DateTime endTime = DateTime.Now.AddSeconds(1); while (endIndex >= SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length || SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.IndexOf(/*"\r\n"*/ "\n", endIndex) < 0) { do { if (endTime < DateTime.Now) { // RWORD startIndex = GetNextWordIndexInText( Random.Next(SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length), Random, WorkspaceIndex, TextIndex); endIndex = SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length; while (endIndex >= SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length || SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.IndexOf(" ", endIndex) < 0) { startIndex = GetNextWordIndexInText( Random.Next(SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length), Random, WorkspaceIndex, TextIndex); endIndex = startIndex + 1; } } else { startIndex = GetNextLineIndexInText( Random.Next(SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length), Random, WorkspaceIndex, TextIndex) + 2; endIndex = GetNextLineIndexInText(startIndex, Random, WorkspaceIndex, TextIndex); } } while (endIndex <= startIndex); } break; } case 5: { while (endIndex >= SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length || SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.IndexOf("\n", endIndex) < 0) { DateTime endTime = DateTime.Now.AddSeconds(1); do { if (endTime < DateTime.Now) { if (endTime.AddSeconds(1) < DateTime.Now) { // RWORD startIndex = GetNextWordIndexInText( Random.Next(SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length), Random, WorkspaceIndex, TextIndex); endIndex = SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length; while (endIndex >= SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length || SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.IndexOf(" ", endIndex) < 0) { startIndex = GetNextWordIndexInText( Random.Next( SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length), Random, WorkspaceIndex, TextIndex); endIndex = startIndex + 1; } } else { startIndex = GetNextLineIndexInText( Random.Next( SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length), Random, WorkspaceIndex, TextIndex) + 2; endIndex = GetNextLineIndexInText(startIndex, Random, WorkspaceIndex, TextIndex); } } else { startIndex = GetNextParagraphIndexInText( Random.Next( SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts.Length), Random, WorkspaceIndex, TextIndex) + 4; endIndex = GetNextParagraphIndexInText(startIndex, Random, WorkspaceIndex, TextIndex); } } while (endIndex <= startIndex); } break; } } switch (Type) { case 4: case 5: { text = SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts .Substring(startIndex, endIndex - startIndex); break; } default: { text = SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts .Substring(startIndex, SharedData.WorkSpaces[WorkspaceIndex].Texts[TextIndex].Texts .IndexOf(" ", endIndex) - startIndex); break; } } text = text.Replace("\r", " ").Replace("\n", " "); while (text.Contains(" ")) { text = text.Replace(" ", " "); } text = text.Trim(); text = text.Replace("{", string.Empty).Replace("}", string.Empty).Trim(); if (Type == 0) { text = text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[0]; } if (UpperCase) { if (text.Length > 1) { text = text.Substring(0, 1).ToUpper() + text.Substring(1); } else { text = text.ToUpper(); } } return(text.Replace("\r", string.Empty).Replace("\n", string.Empty)); }
public TGBlockCopyPaste(PresetSettings Settings) { this.Blocks = new string[0]; this.settings = Settings; this.MainRandom = new Random(); }
public static DateTime MakeFileDate(Random Random, PresetSettings Settings) { if (Settings == null) { return(DateTime.Now); } if (Settings.GeneralFileDateEnd < Settings.GeneralFileDateStart) { return(Settings.GeneralFileDateEnd); } if (Settings.GeneralFileDateStart == Settings.GeneralFileDateEnd) { return(Settings.GeneralFileDateStart); } // Create date, for specified date if (Settings.GeneralFileDateStart.Date == Settings.GeneralFileDateEnd.Date) { if (Settings.GeneralFileDateEnd.Hour < Settings.GeneralFileDateStart.Hour || (Settings.GeneralFileDateEnd.Hour < Settings.GeneralFileDateStart.Hour && Settings.GeneralFileDateEnd.Minute < Settings.GeneralFileDateStart.Minute)) { return(Settings.GeneralFileDateStart.Date.AddHours(Random.Next(0, 24)).AddMinutes(Random.Next(0, 60)).AddSeconds(Random.Next(0, 60))); } return (Settings.GeneralFileDateStart.Date.AddHours(Random.Next(Settings.GeneralFileDateStart.Hour, Settings.GeneralFileDateEnd.Hour)).AddMinutes( Random.Next(Settings.GeneralFileDateStart.Minute, Settings.GeneralFileDateEnd.Minute)).AddSeconds(Random.Next(0, Settings.GeneralFileDateStart.Second))); } // Date for specified time window List <int> yearRange = Enumerable.Range(Settings.GeneralFileDateStart.Year, Settings.GeneralFileDateEnd.Year).ToList(); List <int> monthRange = new List <int>(); if (Settings.GeneralFileDateStart.Year == Settings.GeneralFileDateEnd.Year) { monthRange.AddRange(Enumerable.Range(Settings.GeneralFileDateStart.Month, Settings.GeneralFileDateEnd.Month - Settings.GeneralFileDateStart.Month)); } else { for (int i = Settings.GeneralFileDateStart.Year; i <= Settings.GeneralFileDateEnd.Year; i++) { if (i == Settings.GeneralFileDateStart.Year) { monthRange.AddRange(Enumerable.Range(Settings.GeneralFileDateStart.Month, 12 - Settings.GeneralFileDateStart.Month)); } else if (i == Settings.GeneralFileDateEnd.Year) { monthRange.AddRange(Enumerable.Range(1, Settings.GeneralFileDateEnd.Month)); } else { monthRange.AddRange(Enumerable.Range(1, 12)); } } } List <int> dayRange = new List <int>(); // The same year and month if (Settings.GeneralFileDateStart.Year == Settings.GeneralFileDateEnd.Year && Settings.GeneralFileDateStart.Month == Settings.GeneralFileDateEnd.Month) { dayRange.AddRange(Enumerable.Range(Settings.GeneralFileDateStart.Day, Settings.GeneralFileDateEnd.Day - Settings.GeneralFileDateStart.Day)); } else { int dayCount = (Settings.GeneralFileDateEnd - Settings.GeneralFileDateStart).Days; for (int i = 0; i < dayCount; i++) { dayRange.Add(Settings.GeneralFileDateStart.AddDays(i).Day); } } // Generate date int year = yearRange[Random.Next(yearRange.Count)]; int month = monthRange[Random.Next(monthRange.Count)]; if (Settings.GeneralFileDateEnd.Month < month) { month = Settings.GeneralFileDateEnd.Month; } int day = dayRange[Random.Next(dayRange.Count)]; if (Settings.GeneralFileDateEnd.Date < new DateTime(year, month, day).Date) { day = Settings.GeneralFileDateEnd.Day; } if (Settings.GeneralFileDateEnd.Hour < Settings.GeneralFileDateStart.Hour || (Settings.GeneralFileDateEnd.Hour < Settings.GeneralFileDateStart.Hour && Settings.GeneralFileDateEnd.Minute < Settings.GeneralFileDateStart.Minute)) { return(new DateTime(year, month, day, Random.Next(0, 24), Random.Next(0, 60), Random.Next(0, 60))); } return(new DateTime(year, month, day, Random.Next(Settings.GeneralFileDateStart.Hour, Settings.GeneralFileDateEnd.Hour), Random.Next(Settings.GeneralFileDateStart.Minute, Settings.GeneralFileDateEnd.Minute), Random.Next(0, Settings.GeneralFileDateStart.Second))); }
public TGTrigram(PresetSettings Settings) { settings = Settings; MainRandom = new Random(); }
public TGBlockReverse(PresetSettings Settings) { this.settings = Settings; this.MainRandom = new Random(); }
public TGAdvancedReverse(PresetSettings Settings) { this.settings = Settings; this.MainRandom = new Random(); }
public TGMarkovClassic(PresetSettings Settings) { settings = Settings; MainRandom = new Random(); }
public TGRandom(PresetSettings Setings) { setting = Setings; MainRandom = new Random(); }
public TGCopyPaste(PresetSettings Settings) { settings = Settings; MainRandom = new Random(); }
public static Task Load(string Path) { int id = int.Parse(Path.Substring(Path.LastIndexOf("\\") + 1)); string name = string.Empty; int presetID = 0; int templateID = 0; int textID = 0; DateTime startTime = new DateTime(); DateTime endTime = new DateTime(); string[] info = File.ReadAllLines(Path + "\\info.txt", Encoding.UTF8); for (int j = 0; j < info.Length; j++) { if (info[j].StartsWith("Name=")) { name = info[j].Substring(5); } else if (info[j].StartsWith("PresetID=")) { presetID = int.Parse(info[j].Substring(9)); } else if (info[j].StartsWith("TemplateID=")) { templateID = int.Parse(info[j].Substring(11)); } else if (info[j].StartsWith("TextID=")) { textID = int.Parse(info[j].Substring(7)); } else if (info[j].StartsWith("StartTime=")) { startTime = DateTime.Parse(info[j].Substring(10)); } else if (info[j].StartsWith("EndTime=")) { try { endTime = DateTime.Parse(info[j].Substring(8)); } catch (Exception) { endTime = new DateTime(); } } } Task task = new Task(id, name); task.PresetID = presetID; task.TemplateID = templateID; task.TextID = textID; task.StartTime = startTime; task.EndTime = endTime; try { task.Settings = PresetSettings.Load(Path + "\\settings.txt"); } catch (Exception) { task.Settings = new PresetSettings(); } return(task); }
public TGConceptualGraph(PresetSettings Settings) { settings = Settings; MainRandom = new Random(); }
public TGCommaConnection(PresetSettings Settings) { this.settings = Settings; this.MainRandom = new Random(); }