本文整理汇总了C#中IFormatter类的典型用法代码示例。如果您正苦于以下问题:C# IFormatter类的具体用法?C# IFormatter怎么用?C# IFormatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFormatter类属于命名空间,在下文中一共展示了IFormatter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DropCommand
public DropCommand(IConsoleWrapper console, IRepositoryFactoryFactory factory, IGameObjectQueries queries, IFormatter[] formatters)
: base(console, factory, queries, formatters)
{
AddCommandName("drop");
AddCommandName("putdown");
AddCommandName("release");
}
示例2: BuildFormatTimePart
private static string BuildFormatTimePart(IFormatter cultureFormatter, TimeUnit timeUnitType, int amountOfTimeUnits)
{
// Always use positive units to account for negative timespans
return amountOfTimeUnits != 0
? cultureFormatter.TimeSpanHumanize(timeUnitType, Math.Abs(amountOfTimeUnits))
: null;
}
示例3: Print
private static void Print(IFormatter formatter)
{
List<Publication> documents = new List<Publication>();
var newspaper = new Newspaper(formatter);
newspaper.Title = "The Publicist";
newspaper.Articles.Add("Sugar linked to bad eyesight", "Rod Sugar");
newspaper.Articles.Add("Sweden bans chocolate", "Willy Wonka");
newspaper.Articles.Add("Opera house to be painted orange", "Orange Arup");
documents.Add(newspaper);
var book = new Book(formatter)
{
Title = "Price of Silence",
Author = "Jay and Silent Bob",
Text = "Blah-de-blah-de-blah..."
};
documents.Add(book);
var magazine = new Magazine(formatter)
{
Name = "MixMag",
PrintDate = "30/08/1993",
CoverHeadline = "Downloads outstrip CD sales"
};
documents.Add(magazine);
foreach (var doc in documents)
{
doc.Print();
}
}
示例4: InventoryCommand
public InventoryCommand(IConsoleWrapper console, IRepositoryFactoryFactory factory, IGameObjectQueries queries, IFormatter[] formatters)
: base(console, factory, queries, formatters)
{
AddCommandName("inventory");
AddCommandName("inv");
AddCommandName("i");
}
示例5: FileModel
public FileModel(FileAndType ft, object content, FileAndType original = null, IFormatter serializer = null)
{
OriginalFileAndType = original ?? ft;
FileAndType = ft;
_content = content;
_serializer = serializer;
}
示例6: SimpleIterativeRouter2
public SimpleIterativeRouter2(Key self, ushort tcpPort, IMessagingSocket sock, IKeyBasedRoutingAlgorithm algo, IFormatter formatter, bool isStrictMode)
{
_selfId = self;
_tcpPort = tcpPort;
_sock = sock;
_algo = algo;
_strict_mode = isStrictMode;
// メッセージに含むことの出来る大体の最大NodeHandle数を計算
int overhead, nodeHandleBytes;
{
using (MemoryStream ms = new MemoryStream ()) {
formatter.Serialize (ms, new NextHopResponse (self, _tcpPort, true, new NodeHandle[0]));
overhead = (int)ms.Length;
}
using (MemoryStream ms = new MemoryStream ()) {
formatter.Serialize (ms, new NodeHandle (self, new IPEndPoint (IPAddress.Loopback, 0), tcpPort));
nodeHandleBytes = (int)ms.Length;
}
}
_maxNodeHandlesPerResponse = (dgramMaxSize - overhead) / nodeHandleBytes;
algo.Setup (self, this);
sock.AddInquiredHandler (typeof (NextHopQuery), MessagingSocket_Inquired_NextHopQuery);
sock.AddInquiredHandler (typeof (CloseNodeQuery), MessagingSocket_Inquired_CloseNodeQuery);
}
示例7: TakeCommand
public TakeCommand(IConsoleWrapper console, IRepositoryFactoryFactory factory, IGameObjectQueries queries, IFormatter[] formatters)
: base(console, factory, queries, formatters)
{
AddCommandName("take");
AddCommandName("pickup");
AddCommandName("get");
}
示例8: Run
public void Run(string dll, string filter, IFormatter outputFormatter, Action<string, string, IFormatter> action)
{
this.dll = dll;
var setup = new AppDomainSetup();
setup.ConfigurationFile = Path.GetFullPath(config);
setup.ApplicationBase = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
domain = AppDomain.CreateDomain("NSpecDomain.Run", null, setup);
var type = typeof(Wrapper);
var assemblyName = type.Assembly.GetName().Name;
var typeName = type.FullName;
domain.AssemblyResolve += Resolve;
var wrapper = (Wrapper)domain.CreateInstanceAndUnwrap(assemblyName, typeName);
wrapper.Execute(dll, filter, outputFormatter, action);
AppDomain.Unload(domain);
}
示例9: Bind
public IPort Bind(int portNumber, IFormatter formatter)
{
TcpPort port = new TcpPort(portNumber, formatter);
port.Open();
ports.Add(port);
return port;
}
示例10: LogConfig
public LogConfig(IFormatter formatter, LogCategoryRegistrar categoryRegistry = null)
{
Formatter = formatter;
CategoryRegistrar = categoryRegistry ?? new LogCategoryRegistrar();
TargetConfigs = new List<TargetConfig>();
Levels = new bool[LogLevels.Levels.Length];
}
示例11: HelpPrinter
HelpPrinter(IFormatter formatter)
{
this.formatter = formatter;
var parser = new Parser();
parser.LoadPlugin(typeof(UnitValue).Assembly);
doc = Documentation.Create(parser.Context);
}
示例12: PickUpCommand
public PickUpCommand(IConsoleFacade console, IRepositoryFactoryFactory factory, IGameObjectQueries goQueries, IFormatter[] formatters)
: base(console, factory, goQueries, formatters)
{
AddCommandName("pickup");
AddCommandName("get");
AddCommandName("grab");
}
示例13: Message
public Message(byte[] chunk, int chunkSize, int offset, IFormatter formatter)
{
this.chunk = chunk;
this.chunkSize = chunkSize;
this.offset = offset;
this.formatter = formatter;
}
示例14: MessageReceiver
public MessageReceiver(TcpClient client, IFormatter formatter, IHandler handler)
{
this.client = client;
this.handler = handler;
this.assembler = new MessageAssembler(formatter);
this.chunk = new byte[4096];
}
示例15: ConsoleTarget
public ConsoleTarget(IFormatter formatter)
{
if (formatter == null)
throw new ArgumentNullException("formatter");
Formatter = formatter;
}