本文整理汇总了C#中Meta类的典型用法代码示例。如果您正苦于以下问题:C# Meta类的具体用法?C# Meta怎么用?C# Meta使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Meta类属于命名空间,在下文中一共展示了Meta类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
_stub = new Stub { Int = 10, Str = "Str", Collection = new List<int> { 1, 2, 3 }, Array = new byte[10] };
_newStub = new Stub { Collection = new List<int> { 11, 12, 13 } };
_meta = new Meta { Int = 10, Str = "Str", Collection = new List<int> { 1, 2, 3 }, Array = new byte[10] };
_helper = new EditorHelper();
}
示例2: ChessGameFromFEN
public void ChessGameFromFEN()
{
const string fenString = "rnbqkbnr/pppppppp/8/8/8/3P4/PPP1PPPP/RNBQKBNR w KQkq - 0 1";
var i = new Meta();
i["FEN"] = fenString;
var g = new ChessGame(i);
Assert.AreEqual(fenString, g.State.ToString());
}
示例3: ItemTest
public void ItemTest()
{
var i = new Meta();
i["Key"] = "Value";
i["Key2"] = "Value2";
Assert.AreEqual("Value", i["Key"]);
Assert.AreEqual("Value2", i["Key2"]);
}
示例4: HandleCommand
public void HandleCommand(IStore store, Meta.BSon.BSonDoc command)
{
if (command.HasProperty(CommandKeyword.Collection))
{
var cc = store.GetCollection((command[CommandKeyword.Collection] ?? string.Empty).ToString());
if (cc != null)
cc.Flush();
}
}
示例5: ChessGame
public ChessGame(Meta metainfo)
{
Info = metainfo;
Players.Add(new Player(1));
Players.Add(new Player(2));
State = new FENParser().Parse(
(Info["FEN"] == null) || (Info["FEN"].Equals("")) ? FENParser.DefaultFEN : Info["FEN"],
Players);
}
示例6: AccionGuardar
private bool AccionGuardar()
{
if (!this.Validar())
return false;
Cargando.Mostrar();
int iSucursalID = Util.Entero(this.cmbSucursal.SelectedValue);
// Se guardan las metas específicas
Meta oMeta;
foreach (DataGridViewRow oFila in this.dgvEspecificas.Rows)
{
if (oFila.IsNewRow) continue;
int iMetaID = Util.Entero(oFila.Cells["mesMetaID"].Value);
int iCambio = Util.Entero(oFila.Cells["mesCambio"].Value);
switch (iCambio)
{
case Cat.TiposDeAfectacion.Agregar:
case Cat.TiposDeAfectacion.Modificar:
if (iCambio == Cat.TiposDeAfectacion.Agregar)
oMeta = new Meta() { SucursalID = iSucursalID };
else
oMeta = Datos.GetEntity<Meta>(c => c.MetaID == iMetaID);
oMeta.VendedorID = (Util.Entero(oFila.Cells["mesUsuarioID"].Value) > 0 ?
(int?)Util.Entero(oFila.Cells["mesUsuarioID"].Value) : null);
oMeta.MarcaParteID = (Util.Entero(oFila.Cells["mesMarcaID"].Value) > 0 ?
(int?)Util.Entero(oFila.Cells["mesMarcaID"].Value): null);
oMeta.LineaID = (Util.Entero(oFila.Cells["mesLineaID"].Value) > 0 ?
(int?)Util.Entero(oFila.Cells["mesLineaID"].Value) : null);
oMeta.ParteID = (Util.Entero(oFila.Cells["mesParteID"].Value) > 0 ?
(int?)Util.Entero(oFila.Cells["mesParteID"].Value) : null);
oMeta.NombreMeta = Util.Cadena(oFila.Cells["mesNombre"].Value);
oMeta.Cantidad = Util.Decimal(oFila.Cells["mesCantidad"].Value);
oMeta.RutaImagen = Util.Cadena(oFila.Cells["mesRutaImagen"].Value);
Datos.Guardar<Meta>(oMeta);
break;
case Cat.TiposDeAfectacion.Borrar:
oMeta = Datos.GetEntity<Meta>(c => c.MetaID == iMetaID);
Datos.Eliminar<Meta>(oMeta);
break;
}
}
Cargando.Cerrar();
this.CargarDatos();
return true;
}
示例7: SetPara
/// <summary>
/// Create parametter grid from meta.ParameterDefaultValues
/// </summary>
/// <param name="meta"></param>
protected void SetPara(Meta meta)
{
this.ShowMessage("");
this.myMeta = meta;
paramGrid.Rows.Clear();
string[] keys = meta.ParameterList.Keys;
object[] values = meta.ParameterList.Values;
for (int idx = 0; idx < keys.Length; idx++)
{
paramGrid.Rows.Add(keys[idx],values[idx]);
}
valueColumn.DefaultCellStyle.Format = "N" + meta.ParameterPrecision.ToString();
paraDescEd.Text = common.system.ToString(meta.ParameterDescriptions);
hintTextEd.Text = meta.Description + common.Consts.constCRLF + meta.URL;
}
示例8: HandleCommand
public void HandleCommand(IStore store, Meta.BSon.BSonDoc command)
{
BSonDoc value = null;
var collection = string.Empty;
if (command.HasProperty(CommandKeyword.Value))
{
value = command[CommandKeyword.Value] as BSonDoc;
}
if (command.HasProperty(CommandKeyword.Collection))
{
collection = (command[CommandKeyword.Collection] ?? string.Empty).ToString();
}
OnHandle(store, collection, command, value);
}
示例9: AlternateViewStartPath
public void AlternateViewStartPath()
{
// Given
Engine engine = new Engine();
engine.RootFolder = TestContext.CurrentContext.TestDirectory;
engine.InputFolder = @"TestFiles\Input\";
ReadFiles readFiles = new ReadFiles(@"AlternateViewStartPath\Test.cshtml");
Razor razor = new Razor().WithViewStart(@"AlternateViewStart\_ViewStart.cshtml");
Meta meta = new Meta("Content", (x, y) => x.Content);
engine.Pipelines.Add("Pipeline", readFiles, razor, meta);
// When
engine.Execute();
// Then
Assert.AreEqual(1, engine.Documents.FromPipeline("Pipeline").Count());
Assert.AreEqual("LAYOUT\r\n<p>This is a test</p>", engine.Documents.FromPipeline("Pipeline").First().String("Content"));
}
示例10: RunWithSqlServer
public static void RunWithSqlServer(IEnumerable<RecordBlueprint> recordDescriptors, Action<ISessionFactory> action)
{
var temporaryPath = Path.GetTempFileName();
if (File.Exists(temporaryPath))
File.Delete(temporaryPath);
Directory.CreateDirectory(temporaryPath);
var databasePath = Path.Combine(temporaryPath, "Coevery.mdf");
var databaseName = Path.GetFileNameWithoutExtension(databasePath);
try {
// create database
if (!TryCreateSqlServerDatabase(databasePath, databaseName))
return;
var meta = new Meta<CreateDataServicesProvider>((dataFolder, connectionString) =>
new SqlServerDataServicesProvider(dataFolder, connectionString),
new Dictionary<string, object> { { "ProviderName", "SqlServer" } });
var manager = (IDataServicesProviderFactory)new DataServicesProviderFactory(new[] { meta });
var parameters = new SessionFactoryParameters {
Provider = "SqlServer",
DataFolder = temporaryPath,
ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFileName=" + databasePath + ";Integrated Security=True;User Instance=True;",
RecordDescriptors = recordDescriptors,
};
var configuration = manager
.CreateProvider(parameters)
.BuildConfiguration(parameters);
new SchemaExport(configuration).Execute(false, true, false);
using (var sessionFactory = configuration.BuildSessionFactory()) {
action(sessionFactory);
}
}
finally {
try {
Directory.Delete(temporaryPath, true);
}
catch (IOException) { }
}
}
示例11: MetaEmString
public string MetaEmString(Meta meta)
{
if (meta == Meta.GANHAR_2KG)
return "Ganhar 2kg/semana";
else if (meta == Meta.GANHAR_1_5KG)
return "Ganhar 1.5kg/semana";
else if (meta == Meta.GANHAR_1KG)
return "Ganhar 1kg/semana";
else if (meta == Meta.GANHAR_0_5KG)
return "Ganhar 0.5kg/semana";
else if (meta == Meta.MANTER)
return "Manter peso";
else if (meta == Meta.PERDER_0_5KG)
return "Perder 0.5kg/semana";
else if (meta == Meta.PERDER_1KG)
return "Perder 1kg/semana";
else if (meta == Meta.PERDER_1_5KG)
return "Perder 1.5kg/semana";
else if (meta == Meta.PERDER_2KG)
return "Perder 2.0kg/semana";
else
throw new NotImplementedException();
}
示例12: MetaEmDouble
public double MetaEmDouble(Meta meta)
{
if (meta == Meta.GANHAR_2KG)
return 2;
else if (meta == Meta.GANHAR_1_5KG)
return 1.5;
else if (meta == Meta.GANHAR_1KG)
return 1;
else if (meta == Meta.GANHAR_0_5KG)
return 0.5;
else if (meta == Meta.MANTER)
return 0;
else if (meta == Meta.PERDER_0_5KG)
return -0.5;
else if (meta == Meta.PERDER_1KG)
return 1;
else if (meta == Meta.PERDER_1_5KG)
return -1.5;
else if (meta == Meta.PERDER_2KG)
return -2;
else
throw new NotImplementedException();
}
示例13: Buffer
public Buffer(Meta.File _file, UndoStack _undo, UndoStack _redo)
: base(tags)
{
/**
* Prepare for undo/redo.
*/
UndoStack = _undo;
RedoStack = _redo;
UndoStack.Applied.Add(e => RedoStack.Push(e.Invert()));
RedoStack.Applied.Add(e => UndoStack.Push(e.Invert()));
/**
* Read the file.
*/
File = _file;
var input = File.Info.OpenText();
IgnoreChanges(() => InsertAtCursor(input.ReadToEnd()));
input.Close();
PlaceCursor(GetIterAtOffset(0));
Changed += (o, a) =>
{
HasUnsavedChanges.Value = true;
};
}
示例14: LoadSimpleTemplateFile
public void LoadSimpleTemplateFile()
{
// Given
Engine engine = new Engine();
engine.RootFolder = TestContext.CurrentContext.TestDirectory;
engine.InputFolder = @"TestFiles\Input\";
ReadFiles readFiles = new ReadFiles(@"SimpleTemplate\Test.cshtml");
Razor razor = new Razor();
Meta meta = new Meta("Content", (x, y) => x.Content);
engine.Pipelines.Add("Pipeline", readFiles, razor, meta);
// When
engine.Execute();
// Then
Assert.AreEqual(1, engine.Documents.FromPipeline("Pipeline").Count());
Assert.AreEqual(@"<p>This is a test</p>", engine.Documents.FromPipeline("Pipeline").First().String("Content"));
}
示例15: SaveRawToFile
/// <summary>
/// The save raw to file.
/// </summary>
/// <param name="outputFilePath">The output file path.</param>
/// <param name="meta">The meta.</param>
/// <remarks></remarks>
public void SaveRawToFile(string outputFilePath, Meta.Meta meta)
{
int x = outputFilePath.LastIndexOf('.');
string temp = outputFilePath.Substring(0, x + 1) + meta.type + "raw";
if (meta.type == "snd!" &&
(meta.Map.HaloVersion == HaloVersionEnum.Halo2 ||
meta.Map.HaloVersion == HaloVersionEnum.Halo2Vista))
{
Stream s = File.Open(temp + "layout", FileMode.Create);
BinaryFormatter b = new BinaryFormatter();
Sound temps = (Sound)meta.raw;
b.Serialize(s, temps.Permutations);
s.Flush();
s.Close();
}
XmlTextWriter xtw = new XmlTextWriter(temp + ".xml", Encoding.Default);
xtw.Formatting = Formatting.Indented;
xtw.WriteStartElement("RawData");
xtw.WriteAttributeString("TagType", meta.type);
xtw.WriteAttributeString("TagName", meta.name);
xtw.WriteAttributeString("RawType", meta.raw.containerType.ToString());
xtw.WriteAttributeString("RawChunkCount", this.rawChunks.Count.ToString());
xtw.WriteAttributeString("Date", DateTime.Today.ToShortDateString());
xtw.WriteAttributeString("Time", DateTime.Now.ToShortTimeString());
xtw.WriteAttributeString("EntityVersion", "0.1");
BinaryWriter BW = new BinaryWriter(new FileStream(temp, FileMode.Create));
int loc = 0;
for (x = 0; x < this.rawChunks.Count; x++)
{
RawDataChunk r = this.rawChunks[x];
if (r.offset == -1)
{
continue;
}
xtw.WriteStartElement("RawChunk");
xtw.WriteAttributeString("RawDataType", r.rawDataType.ToString());
xtw.WriteAttributeString("PointerMetaOffset", r.pointerMetaOffset.ToString());
xtw.WriteAttributeString("ChunkSize", r.size.ToString());
xtw.WriteAttributeString("RawDataOffset", loc.ToString());
xtw.WriteAttributeString("PointsToOffset", r.offset.ToString());
xtw.WriteAttributeString("RawLocation", r.rawLocation.ToString());
xtw.WriteEndElement();
BW.BaseStream.Write(r.MS.ToArray(), 0, r.size);
loc += r.size;
}
BW.Flush();
BW.Close();
xtw.WriteEndElement();
xtw.Flush();
xtw.Close();
}