本文整理汇总了C#中Types.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Types.ToString方法的具体用法?C# Types.ToString怎么用?C# Types.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Types
的用法示例。
在下文中一共展示了Types.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Tile
public Tile(Types tileType)
{
Tag = tileType.ToString();
Type = tileType;
IsPassable = tileType == Types.Grass || tileType == Types.Sand || tileType == Types.Moor ;
}
示例2: TileData
public TileData(Types type, int resourceQuantity, int moveCost)
{
tileType = type;
maxResourceQuantity = resourceQuantity;
movementCost = moveCost;
if (type != Types.empty) {
isWalkable = false;
}
tileName = type.ToString ();
}
示例3: TileData
public TileData(int x, int y, Types type, int resourceQuantity, int moveCost, int _hardness = 0)
{
posX = x;
posY = y;
tileType = type;
maxResourceQuantity = resourceQuantity;
hardness = _hardness;
movementCost = moveCost;
// MAKING ROCK UNWAKABLE
if (type != Types.empty && type != Types.water) {
isWalkable = false;
}
tileName = type.ToString ();
tileStats = new TileStats();
}
示例4: Start
void Start()
{
cells = new Types[9];
for (int i = 0; i < 9; i++)
{
cells[i] = Types.EMPTY;
}
int x = rnd.Next(0, 2);
if (x == 0)
turn = Types.X;
else
turn = Types.O;
// GameObject start = reference[4];
// Instantiate(x, start.transform.position, Quaternion.identity);
// cells[4] = Types.X;
// Destroy(start);
turn = Types.O;
instructions.text = "Turn : " + turn.ToString();
}
示例5: Display
private void Display(Mode m, Color c, State s, Types t) {
string mstr = m.ToString();
string cstr = c.ToString();
string sstr = s.ToString();
string tstr = t.ToString();
}
示例6: Apply
/// <summary>Apply fertiliser.</summary>
/// <param name="Amount">The amount.</param>
/// <param name="Type">The type.</param>
/// <param name="Depth">The depth.</param>
/// <exception cref="ApsimXException">Cannot find fertiliser type ' + Type + '</exception>
public void Apply(double Amount, Types Type, double Depth = 0.0)
{
if (Amount > 0 && NitrogenChanged != null)
{
// find the layer that the fertilizer is to be added to.
int layer = GetLayerDepth(Depth, Soil.Thickness);
FertiliserType fertiliserType = Definitions.FirstOrDefault(f => f.Name == Type.ToString());
if (fertiliserType == null)
throw new ApsimXException(this, "Cannot find fertiliser type '" + Type + "'");
NitrogenChangedType NitrogenChanges = new NitrogenChangedType();
NitrogenChanges.Sender = Apsim.FullPath(this);
if (fertiliserType.FractionNO3 != 0)
{
NitrogenChanges.DeltaNO3 = new double[Soil.Thickness.Length];
NitrogenChanges.DeltaNO3[layer] = Amount * fertiliserType.FractionNO3;
NitrogenApplied += Amount * fertiliserType.FractionNO3;
}
if (fertiliserType.FractionNH4 != 0)
{
NitrogenChanges.DeltaNH4 = new double[Soil.Thickness.Length];
NitrogenChanges.DeltaNH4[layer] = Amount * fertiliserType.FractionNH4;
NitrogenApplied += Amount * fertiliserType.FractionNH4;
}
if (fertiliserType.FractionUrea != 0)
{
NitrogenChanges.DeltaUrea = new double[Soil.Thickness.Length];
NitrogenChanges.DeltaUrea[layer] = Amount * fertiliserType.FractionUrea;
NitrogenApplied += Amount * fertiliserType.FractionUrea;
}
NitrogenChanged.Invoke(NitrogenChanges);
Summary.WriteMessage(this, string.Format("{0} kg/ha of {1} added at depth {2} layer {3}", Amount, Type, Depth, layer + 1));
}
}
示例7: AddTableScript
/// <summary>
/// Adds a script for a crud operation to the table
/// </summary>
/// <param name="operationType">The type of operation</param>
/// <param name="tableName">The name of the WAMS table</param>
/// <param name="script">The script to add</param>
/// <param name="permission">The permissions of the script to upload</param>
public void AddTableScript(CrudOperation operationType, string tableName, string script, Types.MobileServices.Roles permission)
{
if (String.IsNullOrEmpty(tableName))
throw new FluentManagementException("unable to add table with an empty name", "CreateMobileServicesTableScriptCommand");
EnsureMobileServicesName();
Refresh();
// then create the script
var command = new CreateMobileServiceTableScriptCommand(MobileServiceName, tableName, operationType, script)
{
SubscriptionId = SubscriptionId,
Certificate = ManagementCertificate
};
command.Execute();
// update the script with the new permissions
var table = Tables.FirstOrDefault(a => a.TableName == tableName);
var values = new List<string> { table.InsertPermission.ToString(), table.UpdatePermission.ToString(), table.ReadPermission.ToString(), table.DeletePermission.ToString()};
// TODO: speak to MSFT about this - the cmdlets have a bug and all of the permissions need to be added for them to update more than a single one
var dictionary = BuildCrudDictionary(values);
dictionary[operationType.ToString().ToLower()] = permission.ToString().ToLower();
// updates the script table service permissions
var config = JsonConvert.SerializeObject(dictionary);
var updateCommand = new UpdateMobileServiceTablePermissionsCommand(MobileServiceName, tableName, config)
{
SubscriptionId = SubscriptionId,
Certificate = ManagementCertificate
};
updateCommand.Execute();
Refresh();
}
示例8: AddTable
/// <summary>
/// Adds a table to mobile services
/// </summary>
/// <param name="tableName">the name of the table</param>
/// <param name="defaultPermission">Sets the default permission for the table scripts</param>
public void AddTable(string tableName, Types.MobileServices.Roles defaultPermission = Types.MobileServices.Roles.Application)
{
if(String.IsNullOrEmpty(tableName))
throw new FluentManagementException("unable to add table with an empty name", "CreateMobileServicesTableCommand");
var permission = defaultPermission.ToString().ToLower();
var dictionary = BuildCrudDictionary(new List<string> {permission, permission, permission, permission});
dictionary["name"] = tableName;
EnsureMobileServicesName();
var config = JsonConvert.SerializeObject(dictionary);
var command = new CreateMobileServiceTableCommand(MobileServiceName, tableName, config)
{
SubscriptionId = SubscriptionId,
Certificate = ManagementCertificate
};
command.Execute();
}
示例9: FromEnv
public static Environment FromEnv(Types.env env)
{
return new Environment(env.ToString());
}
示例10: RulezException
/// <summary>
/// constructor
/// </summary>
/// <param name="handle"></param>
/// <param name="message"></param>
public RulezException(Types id = 0, String message = null, string category = null, string Tag = null, Exception inner = null, params object[] arguments)
{
_id = id;
_category = category;
_Tag = Tag;
if (message != null) _message = message;
else
{
_message = (_ResourceMessages != null) ? _ResourceMessages.GetString(MessagePrefix+id.ToString()) : _messages[(int)id];
// fall back
if (_message == null) _message = _messages[(int)id];
}
_message = (_message != null ) ? string.Format(_message, arguments) : OnTrack.Core.Converter.Array2StringList (arguments);
_innerException = inner;
// log it
System.Diagnostics.Debug.Print("Exception " + DateTime.Now.ToString("s") + ":" + ID.ToString() + " " + _message);
}
示例11: PseudoClassConstUse
public PseudoClassConstUse(Position position, TypeRef/*!*/typeRef, Types type, Position namePosition)
: base(position, typeRef, type.ToString().ToLowerInvariant(), namePosition)
{
this.consttype = type;
}
示例12: ScanNonpluggedILBlock
/// <summary>
/// Scans the specified non-plugged IL block.
/// </summary>
/// <param name="TheLibrary">The library currently being compiled.</param>
/// <param name="theMethodInfo">The method which generated the IL block.</param>
/// <param name="theILBlock">The IL block to scan.</param>
/// <returns>CompileResult.OK.</returns>
private static CompileResult ScanNonpluggedILBlock(ILLibrary TheLibrary, Types.MethodInfo theMethodInfo, ILBlock theILBlock)
{
CompileResult result = CompileResult.OK;
ASM.ASMBlock TheASMBlock = new ASM.ASMBlock()
{
OriginMethodInfo = theMethodInfo,
Priority = theMethodInfo.Priority
};
ILConversionState convState = new ILConversionState()
{
TheILLibrary = TheLibrary,
CurrentStackFrame = new StackFrame(),
Input = theILBlock,
Result = TheASMBlock
};
foreach (ILOp anOp in theILBlock.ILOps)
{
try
{
string commentText = TheASMBlock.GenerateILOpLabel(convState.PositionOf(anOp), "") + " -- " + anOp.opCode.ToString() + " -- Offset: " + anOp.Offset.ToString("X2");
ASM.ASMOp newCommentOp = TargetArchitecture.CreateASMOp(ASM.OpCodes.Comment, commentText);
TheASMBlock.ASMOps.Add(newCommentOp);
int currCount = TheASMBlock.ASMOps.Count;
if (anOp is ILOps.MethodStart)
{
TargetArchitecture.MethodStartOp.Convert(convState, anOp);
}
else if (anOp is ILOps.MethodEnd)
{
TargetArchitecture.MethodEndOp.Convert(convState, anOp);
}
else if (anOp is ILOps.StackSwitch)
{
TargetArchitecture.StackSwitchOp.Convert(convState, anOp);
}
else
{
ILOp ConverterOp = TargetArchitecture.TargetILOps[(ILOp.OpCodes)anOp.opCode.Value];
ConverterOp.Convert(convState, anOp);
}
if (anOp.LabelRequired)
{
if (currCount < TheASMBlock.ASMOps.Count)
{
TheASMBlock.ASMOps[currCount].ILLabelPosition = convState.PositionOf(anOp);
TheASMBlock.ASMOps[currCount].RequiresILLabel = true;
}
}
}
catch (KeyNotFoundException)
{
result = CompileResult.PartialFailure;
Logger.LogError(Errors.ILCompiler_ScanILOpFailure_ErrorCode, theMethodInfo.ToString(), anOp.Offset,
string.Format(Errors.ErrorMessages[Errors.ILCompiler_ScanILOpFailure_ErrorCode], Enum.GetName(typeof(ILOp.OpCodes), anOp.opCode.Value), "Conversion for IL op not found."));
}
catch (InvalidOperationException ex)
{
result = CompileResult.PartialFailure;
Logger.LogError(Errors.ILCompiler_ScanILOpFailure_ErrorCode, theMethodInfo.ToString(), anOp.Offset,
string.Format(Errors.ErrorMessages[Errors.ILCompiler_ScanILOpFailure_ErrorCode], Enum.GetName(typeof(ILOp.OpCodes), anOp.opCode.Value), ex.Message));
}
catch (NotSupportedException ex)
{
result = CompileResult.PartialFailure;
Logger.LogError(Errors.ILCompiler_ScanILOpFailure_ErrorCode, theMethodInfo.ToString(), anOp.Offset,
string.Format(Errors.ErrorMessages[Errors.ILCompiler_ScanILOpFailure_ErrorCode], Enum.GetName(typeof(ILOp.OpCodes), anOp.opCode.Value), "An IL op reported something as not supported : " + ex.Message));
}
catch (Exception ex)
{
result = CompileResult.Fail;
Logger.LogError(Errors.ILCompiler_ScanILOpFailure_ErrorCode, theMethodInfo.ToString(), anOp.Offset,
string.Format(Errors.ErrorMessages[Errors.ILCompiler_ScanILOpFailure_ErrorCode], Enum.GetName(typeof(ILOp.OpCodes), anOp.opCode.Value), ex.Message));
}
}
TheLibrary.TheASMLibrary.ASMBlocks.Add(TheASMBlock);
return result;
}
示例13: ApplyPrefixes
private void ApplyPrefixes(ref StringBuilder sb, Types type = Types.INFO)
{
if (PrefixDate)
{
sb.Append(DateTime.Now.ToString(PrefixDateFormat));
sb.Append(' ');
}
if (PrefixLogs)
{
sb.Append(type.ToString());
sb.Append(' ');
}
}
示例14: Read
public IList<Test> Read(Types Type)
{
return context.Tests.Where(t => t.Type.ToString() == Type.ToString()).ToList();
}
示例15: PseudoClassConstUse
public PseudoClassConstUse(Text.Span span, TypeRef/*!*/typeRef, Types type, Text.Span namePosition)
: base(span, typeRef, type.ToString().ToLowerInvariant(), namePosition)
{
this.consttype = type;
}