当前位置: 首页>>代码示例>>C#>>正文


C# IFormatter类代码示例

本文整理汇总了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");
 }
开发者ID:trayburn,项目名称:Adventure,代码行数:7,代码来源:DropCommand.cs

示例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;
 }
开发者ID:gabrielrainha,项目名称:Humanizer,代码行数:7,代码来源:TimeSpanHumanizeExtensions.cs

示例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();
            }
        }
开发者ID:Maceage,项目名称:DesignPatterns,代码行数:34,代码来源:Program.cs

示例4: InventoryCommand

 public InventoryCommand(IConsoleWrapper console, IRepositoryFactoryFactory factory, IGameObjectQueries queries, IFormatter[] formatters)
     : base(console, factory, queries, formatters)
 {
     AddCommandName("inventory");
     AddCommandName("inv");
     AddCommandName("i");
 }
开发者ID:trayburn,项目名称:Adventure,代码行数:7,代码来源:InventoryCommand.cs

示例5: FileModel

 public FileModel(FileAndType ft, object content, FileAndType original = null, IFormatter serializer = null)
 {
     OriginalFileAndType = original ?? ft;
     FileAndType = ft;
     _content = content;
     _serializer = serializer;
 }
开发者ID:yonglehou,项目名称:docfx,代码行数:7,代码来源:FileModel.cs

示例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);
        }
开发者ID:kazuki,项目名称:p2pncs,代码行数:26,代码来源:SimpleIterativeRouter2.cs

示例7: TakeCommand

 public TakeCommand(IConsoleWrapper console, IRepositoryFactoryFactory factory, IGameObjectQueries queries, IFormatter[] formatters)
     : base(console, factory, queries, formatters)
 {
     AddCommandName("take");
     AddCommandName("pickup");
     AddCommandName("get");
 }
开发者ID:trayburn,项目名称:Adventure,代码行数:7,代码来源:TakeCommand.cs

示例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);
        }
开发者ID:JosephJung,项目名称:NSpec,代码行数:26,代码来源:NSpecDomain.cs

示例9: Bind

 public IPort Bind(int portNumber, IFormatter formatter)
 {
     TcpPort port = new TcpPort(portNumber, formatter);
     port.Open();
     ports.Add(port);
     return port;
 }
开发者ID:ccidral,项目名称:courier,代码行数:7,代码来源:TcpServer.cs

示例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];
 }
开发者ID:Belorus,项目名称:XLog,代码行数:7,代码来源:LogConfig.cs

示例11: HelpPrinter

 HelpPrinter(IFormatter formatter)
 {
     this.formatter = formatter;
     var parser = new Parser();
     parser.LoadPlugin(typeof(UnitValue).Assembly);
     doc = Documentation.Create(parser.Context);
 }
开发者ID:FlorianRappl,项目名称:YAMP,代码行数:7,代码来源:HelpPrinter.cs

示例12: PickUpCommand

 public PickUpCommand(IConsoleFacade console, IRepositoryFactoryFactory factory, IGameObjectQueries goQueries, IFormatter[] formatters)
     : base(console, factory, goQueries, formatters)
 {
     AddCommandName("pickup");
     AddCommandName("get");
     AddCommandName("grab");
 }
开发者ID:mrayburn,项目名称:Zorklike,代码行数:7,代码来源:PickUpCommand.cs

示例13: Message

 public Message(byte[] chunk, int chunkSize, int offset, IFormatter formatter)
 {
     this.chunk = chunk;
     this.chunkSize = chunkSize;
     this.offset = offset;
     this.formatter = formatter;
 }
开发者ID:ccidral,项目名称:courier,代码行数:7,代码来源:MessageAssembler.cs

示例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];
 }
开发者ID:ccidral,项目名称:courier,代码行数:7,代码来源:MessageReceiver.cs

示例15: ConsoleTarget

        public ConsoleTarget(IFormatter formatter)
        {
			if (formatter == null)
				throw new ArgumentNullException("formatter");

            Formatter = formatter;
        }
开发者ID:Leafney,项目名称:Kalman.Studio,代码行数:7,代码来源:ConsoleTarget.cs


注:本文中的IFormatter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。