本文整理汇总了C#中Seed类的典型用法代码示例。如果您正苦于以下问题:C# Seed类的具体用法?C# Seed怎么用?C# Seed使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Seed类属于命名空间,在下文中一共展示了Seed类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: specify_db_can_be_specified
void specify_db_can_be_specified()
{
var connectionString = ConfigurationManager.ConnectionStrings["AnotherDb"].ConnectionString;
seed = new Seed(new ConnectionProfile
{
ConnectionString = connectionString
});
seed.PurgeDb();
seed.CreateTable("Authors",
seed.Id(),
new { Name = "nvarchar(255)" }
).ExecuteNonQuery(seed.ConnectionProfile);
seed.CreateTable("Emails",
seed.Id(),
new { AuthorId = "int" },
new { Address = "nvarchar(255)" }
).ExecuteNonQuery(seed.ConnectionProfile);
db = new DynamicDb(connectionString);
var authorId = db.Authors().Insert(new { Name = "hello" });
db.Emails().Insert(new { authorId, Address = "[email protected]" });
(db.Authors().All().First().Email().Address as string).should_be("[email protected]");
}
示例2: before_each
void before_each()
{
seed = new Seed();
GameSchema.CreateSchema(seed);
players = new Players();
player1Id = new { Name = "Jane" }.InsertInto("Players");
player2Id = new { Name = "John" }.InsertInto("Players");
game1Id = new { Title = "Mirror's Edge" }.InsertInto("Games");
game2Id = new { Title = "Gears of War" }.InsertInto("Games");
new { PlayerId = player1Id, GameId = game2Id }.InsertInto("Library");
new { PlayerId = player2Id, GameId = game1Id }.InsertInto("Library");
new { PlayerId = player2Id, GameId = game2Id }.InsertInto("Library");
sqlQueries = new List<string>();
DynamicRepository.WriteDevLog = true;
DynamicRepository.LogSql = new Action<object, string, object[]>(
(sender, sql, @params) =>
{
sqlQueries.Add(sql);
});
}
示例3: create_seed
protected Seed create_seed(string id)
{
string local_account = AccountManager.get().getAccountData(GlobalParam.get().global_account_id).account_id;
Seed seed = null;
seed = this.seeds.Find(x => x.id == id);
if(seed == null) {
// 찾지 못했으므로 만든다.
seed = new Seed(local_account, id);
this.seeds.Add(seed);
// [TODO] seeds가 전 단말에서 공통되게 동기화한다.
} else {
if(seed.creator == local_account) {
// 같은 id의 시드를 두 번이상 만들려고 함.
Debug.LogError("Seed \"" + id + "\" already exist.");
seed = null;
} else {
// 다른 플레이어가 만든 같은 시드가 있었다.
}
}
return(seed);
}
示例4: SetState
public void SetState(Seed seed, SearchState state)
{
lock (_thisLock)
{
_seedsDictionary.AddOrUpdate(seed, state, (_, orignalState) => orignalState | state);
}
}
示例5: before_each
void before_each()
{
seed = new Seed();
seed.PurgeDb();
cars = new Cars();
seed.CreateTable("Cars",
new { Id = "int" },
new { Model = "nvarchar(255)" }).ExecuteNonQuery();
seed.CreateTable("BluePrints",
new { Id = "int" },
new { CarId = "int" },
new { Sku = "nvarchar(255)" }).ExecuteNonQuery();
car1Id = 100;
new { Id = car1Id, Model = "car 1" }.InsertInto("Cars");
car2Id = 200;
new { Id = car2Id, Model = "car 2" }.InsertInto("Cars");
bluePrint1Id = 300;
new { Id = bluePrint1Id, CarId = car1Id, Sku = "Sku 1" }.InsertInto("BluePrints");
bluePrint2Id = 400;
new { Id = bluePrint2Id, CarId = car2Id, Sku = "Sku 2" }.InsertInto("BluePrints");
}
示例6: GenerateNodeKeyTest
public void GenerateNodeKeyTest()
{
var zeroBytes = new byte[16];
var pair = new Seed(zeroBytes).SetNodeKey().KeyPair();
Assert.AreEqual("n9LPxYzbDpWBZ1bC3J3Fdkgqoa3FEhVKCnS8yKp7RFQFwuvd8Q2c",
pair.Id());
}
示例7: before_each
void before_each()
{
seed = new Seed();
markets = new Markets();
seed.PurgeDb();
seed.CreateTable("Markets",
seed.Id(),
new { Name = "nvarchar(255)" }).ExecuteNonQuery();
seed.CreateTable("SupplyChains",
seed.Id(),
new { MarketId = "int" },
new { SupplierId = "int" }).ExecuteNonQuery();
seed.CreateTable("Suppliers",
seed.Id(),
new { Name = "nvarchar(255)" }).ExecuteNonQuery();
supplier1Id = new { Name = "Supplier 1" }.InsertInto("Suppliers");
supplier2Id = new { Name = "Supplier 2" }.InsertInto("Suppliers");
market1Id = new { Name = "Market 1" }.InsertInto("Markets");
market2Id = new { Name = "Market 2" }.InsertInto("Markets");
new { MarketId = market1Id, SupplierId = supplier1Id }.InsertInto("SupplyChains");
new { MarketId = market2Id, SupplierId = supplier1Id }.InsertInto("SupplyChains");
}
示例8: onLeftMouseDown
//For testing purposes we print out plant species
public string onLeftMouseDown(Seed playerSeed, Plant playerPlant)
{
if(occupied)
{
return "Space is occupied!";
// Call remove function?
}
//If player is holding seed, set it.
else if(playerSeed)
{
currentSeed = playerSeed;
occupied = true;
currentSeed.GetComponent<Seed>().currentSpace = this.gameObject.GetComponent<Plantable_Space>();
//Spawn GameObject of Seed
return "Planted " + playerSeed.species;
}
//Else if holding a plant, set that.
else if(playerPlant)
{
currentPlant = playerPlant;
occupied = true;
currentPlant.GetComponent<Plant>().currentSpace = this.gameObject.GetComponent<Plantable_Space>();
return "Planted " + playerPlant.species;
}
else
{
//Player has no plant or seed selected in inventory, nothing happens.
return null;
}
}
示例9: Crop
/// <summary>
/// Initializes a new crop
/// </summary>
public Crop(string name, double weight, Seed parentSeed)
{
Name = name;
EndWeight = weight;
CalculateQuality();
ParentSeed = parentSeed;
}
示例10: before_each
void before_each()
{
seed = new Seed();
books = new Books();
seed.PurgeDb();
seed.CreateTable("Books",
seed.Id(),
new { Title = "nvarchar(255)" }).ExecuteNonQuery();
seed.CreateTable("Chapters",
seed.Id(),
new { BookId = "int" },
new { Name = "nvarchar(255)" }).ExecuteNonQuery();
book1Id = new { Title = "book 1" }.InsertInto("Books");
new { BookId = book1Id, Name = "Chapter 1" }.InsertInto("Chapters");
new { BookId = book1Id, Name = "Chapter 2" }.InsertInto("Chapters");
book2Id = new { Title = "book 2" }.InsertInto("Books");
new { BookId = book2Id, Name = "Chapter 1" }.InsertInto("Chapters");
new { BookId = book2Id, Name = "Chapter 2" }.InsertInto("Chapters");
}
示例11: Test_AmoebaConverter_Box
public void Test_AmoebaConverter_Box()
{
var key = new Key(HashAlgorithm.Sha256, new byte[32]);
var metadata = new Metadata(1, key, CompressionAlgorithm.Xz, CryptoAlgorithm.Aes256, new byte[32 + 32]);
var seed = new Seed(metadata);
seed.Name = "aaaa.zip";
seed.Keywords.AddRange(new KeywordCollection
{
"bbbb",
"cccc",
"dddd",
});
seed.CreationTime = DateTime.Now;
seed.Length = 10000;
var box = new Box();
box.Name = "Box";
box.Seeds.Add(seed);
box.Boxes.Add(new Box() { Name = "Box" });
Box box2;
using (var streamBox = AmoebaConverter.ToBoxStream(box))
{
box2 = AmoebaConverter.FromBoxStream(streamBox);
}
Assert.AreEqual(box, box2, "AmoebaConverter #3");
}
示例12: Test_AmoebaConverter_Seed
public void Test_AmoebaConverter_Seed()
{
var seed = new Seed();
seed.Name = "aaaa.zip";
seed.Keywords.AddRange(new KeywordCollection
{
"bbbb",
"cccc",
"dddd",
});
seed.CreationTime = DateTime.Now;
seed.Length = 10000;
seed.Comment = "eeee";
seed.Rank = 1;
seed.Key = new Key(new byte[32], HashAlgorithm.Sha256);
seed.CompressionAlgorithm = CompressionAlgorithm.Xz;
seed.CryptoAlgorithm = CryptoAlgorithm.Aes256;
seed.CryptoKey = new byte[32 + 32];
DigitalSignature digitalSignature = new DigitalSignature("123", DigitalSignatureAlgorithm.Rsa2048_Sha256);
seed.CreateCertificate(digitalSignature);
var stringSeed = AmoebaConverter.ToSeedString(seed);
var seed2 = AmoebaConverter.FromSeedString(stringSeed);
Assert.AreEqual(seed, seed2, "AmoebaConverter #2");
}
示例13: FertileDirtGump
public FertileDirtGump(Seed seed, int amount, object attachTo)
: base(50, 50)
{
m_Seed = seed;
m_AttachTo = attachTo;
AddBackground(0, 0, 300, 210, 9200);
AddImageTiled(5, 5, 290, 30, 2624);
AddImageTiled(5, 40, 290, 100, 2624);
AddImageTiled(5, 145, 150, 60, 2624);
AddImageTiled(160, 145, 135, 60, 2624);
AddHtmlLocalized(90, 10, 150, 16, 1150359, LabelColor, false, false); // Raised Garden Bed
AddHtmlLocalized(10, 45, 280, 90, 1150363, LabelColor, false, false);
AddHtmlLocalized(10, 150, 80, 16, 1150361, LabelColor, false, false); // Needed:
AddHtmlLocalized(10, 180, 80, 16, 1150360, LabelColor, false, false); // You Have:
AddHtml(80, 150, 60, 16, String.Format("<BASEFONT COLOR=#{0:X6}>20</BASEFONT>", FontColor), false, false);
AddHtml(80, 180, 60, 16, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", FontColor, amount.ToString()), false, false);
AddButton(165, 150, 4023, 4025, 1, GumpButtonType.Reply, 0);
AddButton(165, 180, 4017, 4019, 2, GumpButtonType.Reply, 0);
AddHtml(205, 150, 100, 16, String.Format("<BASEFONT COLOR=#{0:X6}>Use</BASEFONT>", FontColor), false, false);
AddHtmlLocalized(205, 180, 100, 16, 1150364, LabelColor, false, false); // Not Use
}
示例14: SeedManagementViewModel
public SeedManagementViewModel(SeedModel.IDataAccessService servPxy)
{
dataAccessService = servPxy;
AddSeedCommand = new RelayCommand(SaveSeed);
DeleteSeedCommand = new RelayCommand<Seed>(DeleteSeed);
NewSeed = new Seed();
SeedList = dataAccessService.GetSeeds();
}
示例15: before_each
void before_each()
{
seed = new Seed();
records = new MemoizedRecords();
seed.PurgeDb();
}