Exemplo n.º 1
0
 public TGLineByLineReverse(PresetSettings Settings)
 {
     this.CurrentLine = 0;
     this.Lines       = new string[0];
     this.settings    = Settings;
     this.MainRandom  = new Random();
 }
Exemplo n.º 2
0
 public TGLineByLineCopyPaste(PresetSettings Settings)
 {
     CurrentLine = 0;
     Lines       = new string[0];
     settings    = Settings;
     MainRandom  = new Random();
 }
Exemplo n.º 3
0
 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";
            }
Exemplo n.º 5
0
 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();
         }
     }
 }
Exemplo n.º 6
0
 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]);
     }
 }
Exemplo n.º 7
0
        /// <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);
            }
        }
Exemplo n.º 8
0
    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>();
    }
Exemplo n.º 9
0
        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;
            }
        }
Exemplo n.º 10
0
 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();
     }
 }
Exemplo n.º 11
0
        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);
        }
Exemplo n.º 12
0
        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);
                }
            }
        }
Exemplo n.º 13
0
 /// <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));
     }
 }
Exemplo n.º 14
0
        /// <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));
        }
Exemplo n.º 15
0
 public TGBlockCopyPaste(PresetSettings Settings)
 {
     this.Blocks     = new string[0];
     this.settings   = Settings;
     this.MainRandom = new Random();
 }
Exemplo n.º 16
0
        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)));
        }
Exemplo n.º 17
0
 public TGTrigram(PresetSettings Settings)
 {
     settings   = Settings;
     MainRandom = new Random();
 }
Exemplo n.º 18
0
 public TGBlockReverse(PresetSettings Settings)
 {
     this.settings   = Settings;
     this.MainRandom = new Random();
 }
Exemplo n.º 19
0
 public TGAdvancedReverse(PresetSettings Settings)
 {
     this.settings   = Settings;
     this.MainRandom = new Random();
 }
Exemplo n.º 20
0
 public TGMarkovClassic(PresetSettings Settings)
 {
     settings   = Settings;
     MainRandom = new Random();
 }
Exemplo n.º 21
0
 public TGRandom(PresetSettings Setings)
 {
     setting    = Setings;
     MainRandom = new Random();
 }
Exemplo n.º 22
0
 public TGCopyPaste(PresetSettings Settings)
 {
     settings   = Settings;
     MainRandom = new Random();
 }
Exemplo n.º 23
0
Arquivo: Task.cs Projeto: michel50/UDS
        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);
        }
Exemplo n.º 24
0
 public TGConceptualGraph(PresetSettings Settings)
 {
     settings   = Settings;
     MainRandom = new Random();
 }
Exemplo n.º 25
0
 public TGCommaConnection(PresetSettings Settings)
 {
     this.settings   = Settings;
     this.MainRandom = new Random();
 }