本文整理汇总了C#中Module类的典型用法代码示例。如果您正苦于以下问题:C# Module类的具体用法?C# Module怎么用?C# Module使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Module类属于命名空间,在下文中一共展示了Module类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Build
protected override IHeader Build(Module module, params Value[] parameterArray)
{
var udpHeader = CreateHeader<UdpHeader>(parameterArray);
udpHeader.PseudoDestinationPort1 = (IPAddress)parameterArray.First(p => p.Scope.Equals("IPHeader") && p.Name.Equals("DestinationAddress")).AsObject;
udpHeader.PseudoSourcePort = (IPAddress)parameterArray.First(p => p.Scope.Equals("IPHeader") && p.Name.Equals("SourceAddress")).AsObject;
return udpHeader;
}
示例2: ModuleModel
public ModuleModel(Module module)
{
Id = module.Id;
Name = module.Name;
Description = module.Description;
AccessTypeId = module.AccessTypeId;
}
示例3: Displace
public Displace(Module sourceModule, Module displaceModuleX, Module displaceModuleY, Module displaceModuleZ)
{
SourceModule = sourceModule;
DisplaceModuleX = displaceModuleX;
DisplaceModuleY = displaceModuleY;
DisplaceModuleZ = displaceModuleZ;
}
示例4: Create
public ActionResult Create(PDCPMS.Modules.Authority.Model.BlockAddModel model)
{
if (model == null || model.block == null)
{
TempData["HintMessage"] = new PDCPMS.Application.HintMessage { Content = "操作失败,系统发生了一个错误" };
return RedirectToAction("Add");
}
Module domainmodel = new Module(model.block.Name, model.block.AddDate, model.block.Description, model.block.Status);
ReadOnlyCollection<BrokenRule> brokenRules = domainmodel.GetBrokenRules();
if (brokenRules.Count != 0)
{
TempData["HintMessage"] = new PDCPMS.Application.HintMessage { Content = "你的输入有误,模块添加失败" };
TempData["BrokenRules"] = brokenRules;
TempData["InvalidModel"] = model;
}
repository.Add(domainmodel);
unitOfWork.Commit();
TempData["HintMessage"] = new PDCPMS.Application.HintMessage { Content = string.Format("模块({0})添加成功", model.block.Name) };
return RedirectToAction("Index");
}
示例5: GivenModuleHasUrlReference_ThenCreateModuleContainersGeneratesExternalModuleForTheUrl
public void GivenModuleHasUrlReference_ThenCreateModuleContainersGeneratesExternalModuleForTheUrl()
{
var module = new Module("~/test");
module.AddReferences(new[] { "http://test.com/api.js" });
var externalModule = new Module("http://test.com/api.js");
var moduleFactory = new Mock<IModuleFactory<Module>>();
moduleFactory.Setup(f => f.CreateExternalModule("http://test.com/api.js"))
.Returns(externalModule);
var moduleFactories = new Dictionary<Type, object>
{
{ typeof(Module), moduleFactory.Object }
};
var moduleSource = new Mock<IModuleSource<Module>>();
moduleSource
.Setup(s => s.GetModules(It.IsAny<IModuleFactory<Module>>(), It.IsAny<ICassetteApplication>()))
.Returns(new[] { module });
var config = new ModuleConfiguration(
Mock.Of<ICassetteApplication>(),
Mock.Of<IDirectory>(),
Mock.Of<IDirectory>(),
moduleFactories,
""
);
config.Add(moduleSource.Object);
var containers = config.CreateModuleContainers(false, "");
var generatedModule = containers[typeof(Module)].FindModuleContainingPath("http://test.com/api.js");
generatedModule.ShouldBeSameAs(externalModule);
}
示例6: Label
public Label(Module parent, string text, Point position)
: base(parent)
{
var stringSize = GameManager.Instance.MenuFont.MeasureString(text);
Bounds = new Rectangle(position.X, position.Y, (int)stringSize.X, (int)stringSize.Y);
Text = text;
}
示例7: SetUp
public static void SetUp(Module module, Grammar grammar)
{
if (pattern == null)
{
BlockCommentPrototype.pattern
= new AbstractPattern(null, "BlockCommentPrototype");
BlockCommentPrototype.pattern.SetType(typeof(BlockCommentPrototype));
grammar.PatternDefined(BlockCommentPrototype.pattern);
string expression = "s('/*' *(s(!('*/') a(0 any))) '*/')";
ParseGraphNode parseGraph = BootstrapParser.Parse(expression,
new Pattern[]{BlockCommentPrototype.pattern});
pattern = new ConcretePattern(null, "BlockComment",
parseGraph);
pattern.SetType(typeof(BlockComment));
BlockCommentPrototype.pattern.AddAltPattern(pattern);
}
module.SetName("BlockComment", typeof(BlockComment));
grammar.PatternDefined(pattern);
}
示例8: CallInfo
public CallInfo(Module vmModule, Method method, int instructionPointer)
{
Module = vmModule;
Class = null;
Method = method;
InstructionPointer = instructionPointer;
}
示例9: CreateMutant
/// <summary>
/// Performs the actual code mutations, returning each with
/// <c>yield</c> for the calling code to use.
/// </summary>
/// <remarks>
/// Implementing classes should yield the result obtained by calling
/// the <see mref="DoYield" /> method.
/// </remarks>
/// <param name="method">
/// A <see cref="MethodDefinition" /> for the method on which mutation
/// testing is to be carried out.
/// </param>
/// <param name="module">
/// A <see cref="Module" /> representing the main module of the
/// containing assembly.
/// </param>
/// <param name="originalOffsets"></param>
/// <returns>
/// An <see cref="IEnumerable{T}" /> of
/// <see cref="MutantMetaData" /> structures.
/// </returns>
protected override IEnumerable<MutantMetaData> CreateMutant(MethodDefinition method, Module module, int[] originalOffsets)
{
for (int index = 0; index < method.Body.Instructions.Count; index++)
{
var instruction = method.Body.Instructions[index];
if (instruction.OpCode == OpCodes.Clt
|| instruction.OpCode == OpCodes.Cgt)
{
var originalCode = instruction.OpCode.Code;
var loadZero = method.Body.GetILProcessor().Create(OpCodes.Ldc_I4_0);
var compareEqual = method.Body.GetILProcessor().Create(OpCodes.Ceq);
method.Body.Instructions.Insert(index + 1, compareEqual);
method.Body.Instructions.Insert(index + 1, loadZero);
instruction.OpCode = instruction.OpCode == OpCodes.Clt ? OpCodes.Cgt : OpCodes.Clt;
var description = string.Format("{0:x4}: {1} => not {2}", originalOffsets[index], originalCode, instruction.OpCode.Code);
yield return DoYield(method, module, description, index);
instruction.OpCode = instruction.OpCode == OpCodes.Clt ? OpCodes.Cgt : OpCodes.Clt;
method.Body.Instructions.Remove(compareEqual);
method.Body.Instructions.Remove(loadZero);
}
}
}
示例10: Log
public static void Log(Module module, string message, Exception ex)
{
#if APPVERSE_EMULATOR
Trace.WriteLine(module + ": " + message);
if (ex!=null) {
Trace.WriteLine(module + ": Exception=[" + ex.Message + "] Source=[" + ex.Source + "]");
Trace.WriteLine(module + ": Stacktrace ---------------------");
Trace.WriteLine(module + ": " + ex.StackTrace);
}
#endif
#if DEBUG && !WP8
Console.WriteLine(module+": "+message);
if (ex!=null) {
Console.WriteLine(module+": Exception=["+ex.Message+"] Source=["+ex.Source+"]");
Console.WriteLine(module+": Stacktrace ---------------------");
Console.WriteLine(module+": "+ex.StackTrace);
}
#endif
#if DEBUG && WP8
Debug.WriteLine(module + ": " + message);
if (ex == null) return;
Debug.WriteLine(module + ": Exception=[" + ex.Message + "] Source=[" + ex.Source + "]");
Debug.WriteLine(module + ": Stacktrace ---------------------");
Debug.WriteLine(module + ": " + ex.StackTrace);
#endif
}
示例11: ModuleMetadataInfo
public ModuleMetadataInfo(Module module, Mono.Cecil.ModuleDefinition cecilModule)
{
this.Module = module;
this.CecilModule = cecilModule;
typeRefLoader = new CecilLoader();
typeRefLoader.SetCurrentModule(cecilModule);
}
示例12: Execute
public void Execute(IContext context)
{
Module module = ModuleUtilities.LoadModule(this.modname, context);
IValues values = context;
int nname = 0;
foreach (var name in this.names)
{
string normname = name.Trim();
if (nname == this.names.Length - 1)
values.SetValue(normname, module);
else if (!values.HasValue(normname))
{
var mod = new Module(context.GlobalContext);
values.SetValue(normname, mod);
values = mod;
}
else
values = (IValues)values.GetValue(normname);
nname++;
}
}
示例13: FillMessageMergeVars
public void FillMessageMergeVars(MandrillMessage message, Module.Models.LinkOrderCampaignProductRecord record)
{
var products = new Dictionary<string, object>
{
{"quantity", record.Count},
{"name", record.CampaignProductRecord.ProductRecord.Name},
{"description", record.CampaignProductRecord.ProductRecord.Details},
{"price", record.CampaignProductRecord.Price},
{"total_price", record.OrderRecord.TotalPrice}
};
message.AddRcptMergeVars(record.OrderRecord.Email, "FNAME", record.OrderRecord.FirstName);
message.AddRcptMergeVars(record.OrderRecord.Email, "LNAME", record.OrderRecord.LastName);
message.AddRcptMergeVars(record.OrderRecord.Email, "CITY", record.OrderRecord.City);
message.AddRcptMergeVars(record.OrderRecord.Email, "STATE", record.OrderRecord.State);
message.AddRcptMergeVars(record.OrderRecord.Email, "COUNTRY", record.OrderRecord.Country);
if (record.OrderRecord.TotalPriceWithPromo > 0.0)
{
message.AddRcptMergeVars(record.OrderRecord.Email, "TOTALPRICE", record.OrderRecord.TotalPriceWithPromo.ToString());
}
else
{
message.AddRcptMergeVars(record.OrderRecord.Email, "TOTALPRICE", record.OrderRecord.TotalPrice.ToString());
}
message.AddRcptMergeVars(record.OrderRecord.Email, "PRODUCTS", products);
}
示例14: ControlLine
public ControlLine(Module module, byte address, byte modes, ControlLineMode mode)
{
Module = module;
Address = address;
Modes = modes;
Mode = mode;
}
示例15: Read
public override void Read(Module[] modules)
{
StringReader sr = new StringReader (csv);
int idx = 0;
string line = null;
while ((line = sr.ReadLine()) != null) {
int c = 0;
string[] ss = line.Split (',');
if (idx >= modules.Length)
continue;
Module m = modules [idx];
m.moduleName = ss [c++];
int num = (ss.Length - 1) / 4;
m.partials = new Module.Partial[num];
for (int i=0; i<num; i++) {
Module.Partial p = new Module.Partial ();
p.start = int.Parse (ss [c++]);
p.sColor = ToColor (int.Parse (ss [c++]));
p.end = int.Parse (ss [c++]);
p.eColor = ToColor (int.Parse (ss [c++]));
m.partials [i] = p;
}
idx++;
}
}