本文整理汇总了C#中Generator类的典型用法代码示例。如果您正苦于以下问题:C# Generator类的具体用法?C# Generator怎么用?C# Generator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Generator类属于命名空间,在下文中一共展示了Generator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetChars
/// <summary>
/// Analyses last char of password and removes all chars which are located on same phone key.
/// </summary>
/// <returns type="System.Char[]">Array of chars.</returns>
public override char[] GetChars(Generator generator, Word password, char[] charsList)
{
ValidateInput(generator, password, charsList);
if (charsList.Length == 0) return charsList;
// Keep only letters and numbers.
var chars = charsList.Intersect(charsets.Chars["Letnums"]);
// Limit if this is second+ letter only.
if (password.Chars.Length > 0)
{
// Get last char.
var lastChar = password.Chars.Last();
// Route thru GSM Phone keys.
for (int i = 0; i == 9; i++)
{
char[] keys = charsets.Chars["PhoneKey" + i];
// If current key contains last char of password then...
if (keys.Contains(lastChar))
{
// Remove all chars located on same key.
chars = chars.Intersect(keys);
break;
}
}
}
charsList = chars.ToArray();
ValidateOutput(generator, password, charsList);
return charsList;
}
示例2: RidgeNoise
/// <summary>
/// Create new ridge generator with user-supplied source. Usually one would use this with <see cref="ValueNoise" /> or
/// gradient noise with less dimensions, but
/// some weird effects may be achieved with other generators.
/// </summary>
/// <param name="source">noise source</param>
public RidgeNoise(Generator source)
: base(source)
{
Offset = 1;
Gain = 2;
m_exponent = 1;
}
示例3: EmitCode
public override void EmitCode(Generator generator, int depth, int ident)
{
if ( String.IsNullOrEmpty( GetName() ) )
return;
INode returntype;
bool constness, pointer;
string types = base.ResolveType( 1, out returntype, out constness, out pointer );
types = generator.ResolveType( types, constness, pointer, true, false );
generator.EmitLine( "public enum " + name + " : " + EnumShortCodes[types], depth );
generator.EmitLine( "{", depth );
foreach( INode child in children )
{
if ( child is EnumConstantNode )
{
generator.EmitLine( String.Format( "{0} = {1},", child.GetName(), child.GetAttribute( "value" ) ), depth + 1 );
}
}
generator.EmitLine( "};", depth );
generator.EmitLine( "", depth );
}
示例4: Start
// Use this for initialization
void Start()
{
g = GameObject.Find("Main Camera").GetComponent<Generator>();
var t = GetComponent<Renderer>().material;
t.SetFloat("X_Curvature", g.sindelta * 0.005f);
t.SetFloat("Y_Curvature", g.cosdelta * 0.005f);
}
示例5: Translate
///<summary>
/// Create new translation
///</summary>
///<param name="source">Source generator</param>
///<param name="x">Translate amount along X axis</param>
///<param name="y">Translate amount along Y axis</param>
///<param name="z">Translate amount along Z axis</param>
public Translate(Generator source, float x, float y, float z)
{
m_source = source;
m_z = z;
m_y = y;
m_x = x;
}
示例6: GetChars
/// <summary>
/// Analyses type of last char (volve or consonant) and removes all chars of same type.
/// This creates <volve>,<consonant>,<volve>,<consonant>,... password.
/// </summary>
/// <returns type="System.Char[]">Array of chars.</returns>
public override char[] GetChars(Generator generator, Word password, char[] charsList)
{
ValidateInput(generator, password, charsList);
if (charsList.Length == 0) return charsList;
// Keep only proper chars (volves and consonants).
var chars = charsList.Intersect(charsets.Chars["Letters"]);
// If password already contains some chars then...
if (password.Chars.Length > 0)
{
// If last character is volve then...
if (charsets.Chars["Volves"].Contains(password.Chars.Last()))
{
// Keep only consonants.
chars = chars.Intersect(charsets.Chars["Consonants"]);
}
else
{
// Keep only volves.
chars = chars.Intersect(charsets.Chars["Volves"]);
}
}
charsList = chars.ToArray();
ValidateOutput(generator, password, charsList);
return charsList;
}
示例7: ClearCache
/// <summary>
/// Clears the pen cache
/// </summary>
/// <remarks>
/// This is useful if you are using the <see cref="Cached"/> method to cache pens and want to clear it
/// to conserve memory or resources.
/// </remarks>
/// <param name="generator">Generator to clear the pen cache for</param>
public static void ClearCache (Generator generator = null)
{
var cache = generator.Cache<PenKey, Pen> (cacheKey);
lock (cache) {
cache.Clear ();
}
}
示例8: RadioMenuItem
protected RadioMenuItem (Generator generator, Type type, RadioMenuItem controller, bool initialize = true)
: base (generator, type, false)
{
Handler.Create (controller);
if (initialize)
Initialize ();
}
示例9: ValidateOutput
public virtual void ValidateOutput(Generator generator, Word password, char[] chars)
{
if (chars.Length == 0)
{
password.AppendLog("Error: '{0}' filter removed all chars from list.\r\n", FilterName);
}
}
示例10: ParseTracker
public void ParseTracker()
{
var generator = new Generator();
generator.Settings.ContextNaming = ContextNaming.Preserve;
generator.Settings.EntityNaming = EntityNaming.Singular;
generator.Settings.RelationshipNaming = RelationshipNaming.ListSuffix;
generator.Settings.TableNaming = TableNaming.Singular;
var selector = GetDatabaseSchema("Tracker");
Assert.IsNotNull(selector);
EntityContext entityContext = generator.Generate(selector);
Assert.IsNotNull(entityContext);
var settings = new XmlWriterSettings { Indent = true };
var serializer = new XmlSerializer(typeof(EntityContext));
using (var writer = XmlWriter.Create(@"..\..\Tracker.Generated.xml", settings))
serializer.Serialize(writer, entityContext);
string contextDirectory = @"..\..\..\Tracker.Core";
string mappingDirectory = @"..\..\..\Tracker.Core\Mapping";
Synchronizer.UpdateFromSource(entityContext, contextDirectory, mappingDirectory);
using (var writer = XmlWriter.Create(@"..\..\Tracker.Updated.xml", settings))
serializer.Serialize(writer, entityContext);
}
示例11: Main
static void Main(string[] args)
{
// Flag to indicate if we should write a report about every decision we make:
var report = false;
// Flag to indicate if we should launch the installer integrity tester at the end:
var testIntegrity = false;
// Flag to indicate if we should include all feature-unassigned files in FW_Core:
var addOrphans = false;
foreach (var arg in args)
{
switch (arg.ToLowerInvariant())
{
case "report":
report = true;
break;
case "check":
testIntegrity = true;
break;
case "addorphans":
addOrphans = true;
break;
}
}
var gen = new Generator(report, addOrphans, testIntegrity);
gen.Run();
}
示例12: GeneratorContext
public GeneratorContext(Generator g)
{
previous = Generator.Current;
previousValidate = Generator.ValidateGenerator;
Generator.Initialize(g);
Eto.Generator.ValidateGenerator = g;
}
示例13: Window
/// <summary>
/// Initializes a new instance of the <see cref="Eto.Forms.Window"/> class.
/// </summary>
/// <param name="generator">Generator to create the handler instance</param>
/// <param name="type">Type of interface to create for the handler, must implement <see cref="IWindow"/></param>
/// <param name="initialize"><c>true</c> to initialize the handler, false if the subclass will initialize</param>
protected Window(Generator generator, Type type, bool initialize = true)
: base(generator, type, false)
{
if (initialize)
Initialize();
HandleEvent(ClosedEvent);
}
示例14: Scale
///<summary>
/// Create new scaling
///</summary>
///<param name="source">Source generator</param>
///<param name="x">Scale amount along X axis</param>
///<param name="y">Scale amount along Y axis</param>
///<param name="z">Scale amount along Z axis</param>
public Scale(Generator source, float x, float y, float z)
{
m_Source = source;
m_Z = z;
m_Y = y;
m_X = x;
}
示例15: Application
protected Application(Generator g, Type type, bool initialize = true)
: base(g, type, initialize)
{
Application.Instance = this;
handler = (IApplication)base.Handler;
Generator.Initialize(g); // make everything use this by default
}