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


C# Text.Format类代码示例

本文整理汇总了C#中System.Text.Format的典型用法代码示例。如果您正苦于以下问题:C# Format类的具体用法?C# Format怎么用?C# Format使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Format类属于System.Text命名空间,在下文中一共展示了Format类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrintCmd

 public PrintCmd(Format format, string expression, Action<object> callback, GDBSubProcess gdbProc)
     : base(gdbProc)
 {
     _format = format;
     _expression = expression;
     _rh = new PrintRH(format, callback, _gdbProc);
 }
开发者ID:areiter,项目名称:InMemoryFuzzing,代码行数:7,代码来源:PrintCmd.cs

示例2: DX11RenderTexture3D

        public DX11RenderTexture3D(DX11RenderContext context, int w, int h, int d, Format format)
            : base(context)
        {
            Texture3DDescription desc = new Texture3DDescription()
            {
                BindFlags = BindFlags.UnorderedAccess | BindFlags.ShaderResource | BindFlags.RenderTarget,
                CpuAccessFlags = CpuAccessFlags.None,
                Depth = d,
                Format = format,
                Height = h,
                MipLevels = 1,
                OptionFlags = ResourceOptionFlags.None,
                Usage = ResourceUsage.Default,
                Width = w
            };

            RenderTargetViewDescription rtvd = new RenderTargetViewDescription();
            rtvd.Dimension = RenderTargetViewDimension.Texture3D;
            rtvd.MipSlice = 0;
            rtvd.FirstDepthSlice = 0;
            rtvd.DepthSliceCount = d;

            this.Resource = new Texture3D(context.Device, desc);
            this.SRV = new ShaderResourceView(context.Device, this.Resource);
            this.UAV = new UnorderedAccessView(context.Device, this.Resource);
            this.RTV = new RenderTargetView(context.Device, this.Resource, rtvd);

            this.Width = desc.Width;
            this.Height = desc.Height;
            this.Format = desc.Format;
            this.Depth = desc.Depth;
        }
开发者ID:kopffarben,项目名称:FeralTic,代码行数:32,代码来源:DX11RenderTexture3D.cs

示例3: SoundResource

        public SoundResource(ResourceManager mgr, string fullName, Stream stream, Format fmt)
        {
            _manager = mgr;
            FullName = fullName;

            switch (fmt)
            {
                case Format.MP3:
                {
                    Mp3FileReader mp3 = new Mp3FileReader(stream);
                    _reader = mp3;
                    break;
                }
                case Format.WAV:
                {
                    WaveFileReader wav = new WaveFileReader(stream);
                    _reader = wav;
                    break;
                }
                default:
                    throw new InvalidOperationException("Unsupported extension.");
            }

            _stream = new WaveChannel32(_reader);
            _stream.PadWithZeroes = false;

            _wavDevice.PlaybackStopped += _wavDevice_PlaybackStopped;
        }
开发者ID:Veggie13,项目名称:Genesis,代码行数:28,代码来源:SoundResource.cs

示例4: RenderTarget

 public RenderTarget(Device device, int width, int height, int sampleCount, int sampleQuality, Format format)
     : this()
 {
     Texture = _disposer.Add(new Texture2D(device, new Texture2DDescription
     {
         Format              = format,
         Width               = width,
         Height              = height,
         ArraySize           = 1,
         MipLevels           = 1,
         BindFlags           = BindFlags.RenderTarget | BindFlags.ShaderResource,
         CpuAccessFlags      = CpuAccessFlags.None,
         OptionFlags         = ResourceOptionFlags.None,
         Usage               = ResourceUsage.Default,
         SampleDescription   = new SampleDescription(sampleCount, sampleQuality),
     }));
     RenderTargetView = _disposer.Add(new RenderTargetView(device, Texture, new RenderTargetViewDescription
     {
         Format = format,
         Dimension = RenderTargetViewDimension.Texture2DMultisampled,
         //MipSlice = 0,
     }));
     
     ShaderResourceView = _disposer.Add(new ShaderResourceView(device, Texture));
     Viewport = new Viewport(0, 0, width, height, 0.0f, 1.0f);
 }
开发者ID:JoltSoftwareDevelopment,项目名称:Jolt.MashRoom,代码行数:26,代码来源:RenderTarget.cs

示例5: GetPixelFormat

 public static Imaging.PixelFormat GetPixelFormat(Format format)
 {
     if (!FormatTranslator.ContainsKey(format) || FormatTranslator[format] == null) {
         throw new NotImplementedException("The PixelFormat '" + format + "' is not currently supported.");
     }
     return FormatTranslator[format].PixelFormat;
 }
开发者ID:CloneDeath,项目名称:spine-runtimes,代码行数:7,代码来源:PixelFormatMap.cs

示例6: GetInternalFormat

 internal static OpenGL.PixelInternalFormat GetInternalFormat(Format format)
 {
     if (!FormatTranslator.ContainsKey(format) || FormatTranslator[format] == null) {
         throw new NotImplementedException("The InternalFormat '" + format + "' is not currently supported.");
     }
     return FormatTranslator[format].InternalFormat;
 }
开发者ID:CloneDeath,项目名称:spine-runtimes,代码行数:7,代码来源:PixelFormatMap.cs

示例7: Direct2DRenderTarget

 public Direct2DRenderTarget(DeviceContext10_1 deviceContext10, Surface surface, Format format = Format.B8G8R8A8_UNorm)
 {
     m_deviceContext10 = deviceContext10;
     m_surface = surface;
     m_format = format;
     InitializeResources(surface);
 }
开发者ID:treytomes,项目名称:DirectCanvas,代码行数:7,代码来源:Direct2DRenderTarget.cs

示例8: DX11CubeDepthStencil

        public DX11CubeDepthStencil(DX11RenderContext context, int size, SampleDescription sd, Format format)
        {
            this.context = context;

            var texBufferDesc = new Texture2DDescription
            {
                ArraySize = 6,
                BindFlags = BindFlags.DepthStencil | BindFlags.ShaderResource,
                CpuAccessFlags = CpuAccessFlags.None,
                Format = DepthFormatsHelper.GetGenericTextureFormat(format),
                Height = size,
                Width = size,
                OptionFlags = ResourceOptionFlags.TextureCube,
                SampleDescription = sd,
                Usage = ResourceUsage.Default,
                MipLevels = 1
            };

            this.Resource = new Texture2D(context.Device, texBufferDesc);

            this.desc = texBufferDesc;

            //Create faces SRV/RTV
            this.SliceDSV = new DX11SliceDepthStencil[6];

            ShaderResourceViewDescription svd = new ShaderResourceViewDescription()
            {
                Dimension = ShaderResourceViewDimension.TextureCube,
                Format = DepthFormatsHelper.GetSRVFormat(format),
                MipLevels = 1,
                MostDetailedMip = 0,
                First2DArrayFace = 0
            };

            DepthStencilViewDescription dsvd = new DepthStencilViewDescription()
            {
                ArraySize= 6,
                Dimension = DepthStencilViewDimension.Texture2DArray,
                FirstArraySlice = 0,
                Format = DepthFormatsHelper.GetDepthFormat(format),
                MipSlice = 0
            };

            this.DSV = new DepthStencilView(context.Device, this.Resource, dsvd);

            if (context.IsFeatureLevel11)
            {
                dsvd.Flags = DepthStencilViewFlags.ReadOnlyDepth;
                if (format == Format.D24_UNorm_S8_UInt) { dsvd.Flags |= DepthStencilViewFlags.ReadOnlyStencil; }

                this.ReadOnlyDSV = new DepthStencilView(context.Device, this.Resource, dsvd);
            }

            this.SRV = new ShaderResourceView(context.Device, this.Resource, svd);

            for (int i = 0; i < 6; i++)
            {
                this.SliceDSV[i] = new DX11SliceDepthStencil(context, this, i, DepthFormatsHelper.GetDepthFormat(format));
            }
        }
开发者ID:arturoc,项目名称:FeralTic,代码行数:60,代码来源:DX11CubeDepthStencil.cs

示例9: Receipt

        public string Receipt(Format format)
        {
            var totalAmount = 0d;
            var reportLines = new TupleList<Line, string>();
            foreach (var line in _lines)
            {
                var thisAmount = 0d;
                thisAmount += CalculateAmountPlusDiscount(line.Bike, line.Quantity);
                reportLines.Add(line, thisAmount.ToString("C"));
                totalAmount += thisAmount;
            }
            var tax = totalAmount * TaxRate;

            var data = new ReceiptData(Company,
                                       totalAmount.ToString("C"),
                                       reportLines,
                                       tax.ToString("C"),
                                       (totalAmount + tax).ToString("C"));
            if (format == Format.Text)
                return new TextReceipt(data).TransformText();
            else if (format == Format.HTML)
                return new HtmlReceipt(data).TransformText();
            else if (format == Format.PDF)
            {
                return new PdfReceipt(data).TransformText();
            }
            else
                throw new Exception("Unsupported format type!");
        }
开发者ID:billyjf,项目名称:bike-distributor-refactor,代码行数:29,代码来源:Order.cs

示例10: Raw

 public Raw(string path, Size3i size, Format format)
 {
     using (var stream = File.OpenRead(path))
     {
         Load(stream, size, format);
     }
 }
开发者ID:Frassle,项目名称:Ibasa,代码行数:7,代码来源:Raw.cs

示例11: Save

 public void Save(string Path, JSONObject JSON, Format Format)
 {
     Serializer s = new Serializer();
     string text = s.GetText(JSON);
     text = s.FormatText(text, Format);
     File.WriteAllText(Path, text);
 }
开发者ID:DaveSanders,项目名称:jsontools,代码行数:7,代码来源:JSONFile.cs

示例12: GetMovieDetails

 /// <summary>
 /// Provides an interface to the /api/v2/movie_details yify API.
 /// </summary>
 /// <param name="movieId">Sets the id of the movie details which are to be queried.</param>
 /// <param name="withImages">Sets wether the response should hold images.</param>
 /// <param name="withCast">Sets wether the response should hold information about the cast.</param>
 /// <param name="format">Sets the format in which to display the results in. DO NOT USE ANYTHING OTHER THAN JSON! (Experimental)</param>
 /// <returns>The ApiResponse representing the query result.</returns>
 public static ApiResponse<MovieDetailsData> GetMovieDetails(int movieId, bool withImages = false, bool withCast = false,
     Format format = Format.JSON)
 {
     string apiReq = string.Format("movie_id={0}&with_images={1}&with_cast={2}", movieId, withImages, withCast);
     // Getting the response
     Stream stream;
     try
     {
         stream =
             WebRequest.Create(string.Format("https://yts.to/api/v2/movie_details.{0}?{1}", ParseFormat(format),
                 apiReq))
                 .GetResponse()
                 .GetResponseStream();
         using (StreamReader sr = new StreamReader(stream))
         {
             // Parsing the response and returning it
             return new ApiResponse<MovieDetailsData>(JsonConvert.DeserializeObject<ApiResponseRaw>(sr.ReadToEnd()));
         }
     }
     catch (WebException)
     {
         // No internet connection
         throw new Exception("No internet connection.");
     }
 }
开发者ID:nguyenkien,项目名称:DirectTorrent,代码行数:33,代码来源:ApiWrapper.cs

示例13: Bind

 public void Bind(ProgramAttribute attribute, GraphicsBuffer buffer, int offsetInBytes, Format format, int stride)
 {
     if (attribute == null)
         throw new ArgumentNullException("attribute");
     throw new NotImplementedException();
     //GLExt.VertexAttribFormat(attribute.Index, format.ComponentCount, format.VertexAttribPonterType, format.IsNormalized, offsetInBytes);
 }
开发者ID:Burton-Radons,项目名称:Alexandria,代码行数:7,代码来源:VertexArray.cs

示例14: TryFormat

        public static bool TryFormat(this DateTime value, Span<byte> buffer, Format.Parsed format, EncodingData formattingData, out int bytesWritten)
        {
            if (format.IsDefault)
            {
                format.Symbol = 'G';
            }
            Precondition.Require(format.Symbol == 'R' || format.Symbol == 'O' || format.Symbol == 'G');

            switch (format.Symbol)
            {
                case 'R':
                    var utc = value.ToUniversalTime();
                    if (formattingData.IsUtf16)
                    {
                        return TryFormatDateTimeRfc1123(utc, buffer, EncodingData.InvariantUtf16, out bytesWritten);
                    }
                    else
                    {
                        return TryFormatDateTimeRfc1123(utc, buffer, EncodingData.InvariantUtf8, out bytesWritten);
                    }
                case 'O':
                    if (formattingData.IsUtf16)
                    {
                        return TryFormatDateTimeFormatO(value, true, buffer, EncodingData.InvariantUtf16, out bytesWritten);
                    }
                    else
                    {
                        return TryFormatDateTimeFormatO(value, true, buffer, EncodingData.InvariantUtf8, out bytesWritten);
                    }
                case 'G':
                    return TryFormatDateTimeFormagG(value, buffer, formattingData, out bytesWritten);
                default:
                    throw new NotImplementedException();
            }      
        }
开发者ID:jkotas,项目名称:corefxlab,代码行数:35,代码来源:PrimitiveFormatter_time.cs

示例15: DX11RenderMip3D

        public DX11RenderMip3D(DX11RenderContext context, int w, int h,int d, Format format) : base(context)
        {
            int levels = this.CountMipLevels(w,h,d);
            var texBufferDesc = new Texture3DDescription
            {
                BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
                CpuAccessFlags = CpuAccessFlags.None,
                Format = format,
                Height = h,
                Width = w,
                Depth = d,
                OptionFlags = ResourceOptionFlags.None,
                Usage = ResourceUsage.Default,
                MipLevels = levels,
            };

            this.Resource = new Texture3D(context.Device, texBufferDesc);
            this.Width = w;
            this.Height = h;
            this.Depth = d;

            this.SRV = new ShaderResourceView(context.Device, this.Resource);

            this.Slices = new DX11MipSliceRenderTarget[levels];

            int sw = w;
            int sh = h;
            int sd = d;

            for (int i = 0; i < levels; i++)
            {
                this.Slices[i] = new DX11MipSliceRenderTarget(this.context, this, i, w, h,d);
                w /= 2; h /= 2; d /= 2;
            }
        }
开发者ID:arturoc,项目名称:FeralTic,代码行数:35,代码来源:DX11RenderMip3D.cs


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