/// <summary> /// Sets the sequence that the letters are animated in. /// </summary> void SetLetterOrder(int letterCount) { if (letterCount == 0) { return; } mLetterOrder = new int[letterCount]; mLetter = new LetterProperties[letterCount]; for (int i = 0; i < letterCount; ++i) { mLetterOrder[i] = (mCurrent.animationOrder == AnimationLetterOrder.Reverse) ? letterCount - 1 - i : i; int current = mLetterOrder[i]; mLetter[current] = new LetterProperties(); mLetter[current].offset = new Vector2(Random.Range(-mCurrent.offsetRange.x, mCurrent.offsetRange.x), Random.Range(-mCurrent.offsetRange.y, mCurrent.offsetRange.y)); } if (mCurrent.animationOrder == AnimationLetterOrder.Random) { // Shuffle the numbers in the array. var rng = new System.Random(); int n = letterCount; while (n > 1) { int k = rng.Next(--n + 1); int tmp = mLetterOrder[k]; mLetterOrder[k] = mLetterOrder[n]; mLetterOrder[n] = tmp; } } }
public RandomStringGenerator(int preferredLength = 0, LetterProperties letterProperties = LetterProperties.UpperAndLowerCase, bool useNumbersInFileName = false) { this.preferredLength = preferredLength > 0 ? preferredLength : DEFAULT_LENGTH; this.letterProperties = letterProperties; this.useNumbersInFileName = useNumbersInFileName; PseudoRng = new PseudoRNG(); }
public void SetLetterProperties(LetterProperties letterProperties) { var importantLetterData = new ImportantLetterData(); var xmlSerializer = new XmlSerializer(typeof(ImportantLetterData)); using (var stringReader = new StringReader(letterProperties.Properties)) { using (var reader = XmlReader.Create(stringReader)) { importantLetterData = (ImportantLetterData)xmlSerializer.Deserialize(reader); } } }
public string GetRandomString(int preferredLength, LetterProperties letterProperties = LetterProperties.UpperAndLowerCase, bool useNumbersInFileName = false) { var usedPreferredLength = preferredLength > 0 ? preferredLength : this.preferredLength; var randomChars = new char[usedPreferredLength]; for (var i = 0; i < usedPreferredLength; i++) { randomChars[i] = useNumbersInFileName && PseudoRng.GetBool() ? getRandomNumber() : getRandomLetter(letterProperties); } return(new string(randomChars)); }
private char getRandomLetter(LetterProperties letterProperties) { var preferredLetters = letterProperties; var randomChar = Convert.ToChar(Convert.ToInt32((Math.Floor(26 * PseudoRng.GetDouble() + 65)))); if (preferredLetters == LetterProperties.UpperAndLowerCase) { randomChar += Convert.ToChar(PseudoRng.GetBool() ? 0 : 32); } else if (preferredLetters == LetterProperties.LowercaseOnly) { randomChar += Convert.ToChar(32); } return(randomChar); }
public void SetLetterProperties(LetterProperties letterProperties) { var importantLetterData = new ImportantLetterData(); var xmlSerializer = new XmlSerializer(typeof(ImportantLetterData)); using (var stringReader = new StringReader(letterProperties.Properties)) { using (var reader = XmlReader.Create(stringReader)) { importantLetterData = (ImportantLetterData)xmlSerializer.Deserialize(reader); } } importanceDegreeEditorControl1.SelectedImportanceDegree = importantLetterData.DegreeImportance; }
/// <summary> /// Sets the sequence that the letters are animated in. /// </summary> void SetLetterOrder(int letterCount) { if (letterCount == 0) { mLetter = null; mLetterOrder = null; return; } mLetterOrder = new int[letterCount]; mLetter = new LetterProperties[letterCount]; for (int i = 0; i < letterCount; ++i) { mLetterOrder[i] = (mCurrent.animationOrder == AnimationLetterOrder.Reverse) ? letterCount - 1 - i : i; var prop = new LetterProperties(); prop.pos = new Vector3( Random.Range(mCurrent.pos1.x, mCurrent.pos2.x), Random.Range(mCurrent.pos1.y, mCurrent.pos2.y), Random.Range(mCurrent.pos1.z, mCurrent.pos2.z)); prop.rot = Quaternion.Euler(new Vector3( Random.Range(mCurrent.rot1.x, mCurrent.rot2.x), Random.Range(mCurrent.rot1.y, mCurrent.rot2.y), Random.Range(mCurrent.rot1.z, mCurrent.rot2.z))); prop.scale = new Vector3( Random.Range(mCurrent.scale1.x, mCurrent.scale2.x), Random.Range(mCurrent.scale1.y, mCurrent.scale2.y), Random.Range(mCurrent.scale1.z, mCurrent.scale2.z)); mLetter[mLetterOrder[i]] = prop; } if (mCurrent.animationOrder == AnimationLetterOrder.Random) { // Shuffle the numbers in the array. var rng = new System.Random(); int n = letterCount; while (n > 1) { int k = rng.Next(--n + 1); int tmp = mLetterOrder[k]; mLetterOrder[k] = mLetterOrder[n]; mLetterOrder[n] = tmp; } } }
public void InitializeForm() { InitializeClientService(); InitializeMessageService(); InitializeBaseControls(); LetterView letterView = ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).SelectedLetterView; LetterType selectedLetterType = ClientRequests.GetLetterType(letterView.Type); ILetterPropertiesUIPlugin newControl = ((PluginService)(ServiceProvider.GetService(typeof(PluginService)))).GetLetterPropetiesPlugin(selectedLetterType); LetterProperties prop = new LetterProperties() { }; int minXLocation = int.MaxValue; int minYLocation = int.MaxValue; int sizeForMinYLocation = 0; foreach (Control control in BaseControls) { minXLocation = Math.Min(control.Location.X, minXLocation); if (control.Location.Y < minYLocation) { minYLocation = control.Location.Y; sizeForMinYLocation = control.Size.Height; } } ((Control)newControl).Location = new Point(minXLocation, minYLocation + sizeForMinYLocation); int width = Math.Max(BaseSizeHeight.X, ((Control)newControl).Width); this.Controls.Clear(); this.Size = new Size(width, BaseSizeHeight.Y + ((Control)newControl).Size.Height); this.Controls.Add(((Control)newControl)); foreach (Control control in BaseControls) { control.Location = new System.Drawing.Point(control.Location.X, control.Location.Y + ((Control)newControl).Size.Height); this.Controls.Add(control); } }
public LetterProperties GetLetterProperties() { var letterProperties = new LetterProperties(); var xmlSerializer = new XmlSerializer(typeof(ImportantLetterData)); var importantLetterData = new ImportantLetterData(); using (var stringWriter = new StringWriter()) { using (var writer = XmlWriter.Create(stringWriter)) { xmlSerializer.Serialize(writer, importantLetterData); letterProperties.Properties = stringWriter.ToString(); return(letterProperties); } } }
public LetterProperties GetLetterProperties() { var letterProperties = new LetterProperties(); var xmlSerializer = new XmlSerializer(typeof(ImportantLetterData)); var importantLetterData = new ImportantLetterData(); importantLetterData.DegreeImportance = importanceDegreeEditorControl1.SelectedImportanceDegree; using (var stringWriter = new StringWriter()) { using (var writer = XmlWriter.Create(stringWriter)) { xmlSerializer.Serialize(writer, importantLetterData); letterProperties.Properties = stringWriter.ToString(); return(letterProperties); } } }
public void SetLetterProperties(LetterProperties letterProperties) { }