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


C# FileReader.ReadString方法代码示例

本文整理汇总了C#中FileReader.ReadString方法的典型用法代码示例。如果您正苦于以下问题:C# FileReader.ReadString方法的具体用法?C# FileReader.ReadString怎么用?C# FileReader.ReadString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileReader的用法示例。


在下文中一共展示了FileReader.ReadString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Tags

        /// <summary>
        /// Tagses the specified presious.
        /// </summary>
        /// <param name="files">The files.</param>
        /// <returns></returns>
        public List<string> Tags(List<string> files )
        {
            foreach (var file in files)
            {
                _fileReader = new FileReader(file);
                _length = _fileReader.Length();
                long currentPosition = 0;
                var trigger = string.Empty;
                var skip = false;
                var inTrigger = false;
                while (_length > currentPosition)
                {
                    var s = _fileReader.ReadString(1);
                    currentPosition++;
                    if (s == "<")
                    {

                        trigger = string.Empty;
                        skip = false;
                        inTrigger = true;
                    }
                    trigger = trigger + s;
                    if (s == " ")
                    {
                        if (inTrigger)
                        {
                            if (!_tags.Contains(trigger))
                            {
                                _tags.Add(trigger);
                            }
                            trigger = string.Empty;
                            skip = true;
                            inTrigger = false;
                        }
                    }
                    if (s == ">")
                    {
                        if (!skip)
                        {
                            if (inTrigger)
                            {
                                if (!_tags.Contains(trigger))
                                {
                                    _tags.Add(trigger);
                                }
                                trigger = string.Empty;
                                inTrigger = false;
                            }
                        }
                    }
                }

            }

            return _tags;
        }
开发者ID:romanservices,项目名称:CodeSamples,代码行数:61,代码来源:TagFinder.cs

示例2: Main

        static void Main(string[] args)
        {
            IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Loopback, 4040);
            Socket ss = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            string pathName = "C:/ftp/cs/";

            try
            {
                ss.Bind(localEndPoint);
                ss.Listen(10);
                while (true)
                {
                    Console.WriteLine("Servidor escuchando por conexiones");
                    Socket cliente = ss.Accept();
                    Console.WriteLine("Conexion aceptada " + cliente.LocalEndPoint.ToString());
                    FileReader sr = new FileReader(cliente);

                    int f = sr.ReadInt32();

                    for (int i = 0; i < f; i++)
                    {
                        string fileName = sr.ReadString();
                        Console.WriteLine("\t"+fileName);
                        sr.ReadFile(Path.Combine(pathName, fileName));
                    }

                    Console.WriteLine("Conexion terminada " + cliente.LocalEndPoint.ToString());
                    cliente.Shutdown(SocketShutdown.Both);
                    cliente.Close();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
开发者ID:rokerdan,项目名称:aplicaciones-redes,代码行数:36,代码来源:Program.cs

示例3: ReadHeader

        private void ReadHeader(FileReader Reader)
        {
            Type = (IFFChunkTypes)Enum.Parse(typeof(IFFChunkTypes), Reader.ReadString(4).Replace("#", "").Replace("\0", ""));
            Size = Reader.ReadUInt32();
            ID = Reader.ReadUShort();
            Reader.ReadUShort();  //Flags
            Reader.ReadBytes(64); //Label

            m_Data = Reader.ReadBytes((int)(Size - 76));

            if (!Endian.IsBigEndian)
                Array.Reverse(m_Data); //Data is Little Endian, so needs to be reversed.
        }
开发者ID:Afr0Games,项目名称:Project-Dollhouse,代码行数:13,代码来源:IFFChunk.cs

示例4: Bounce

        /// <summary>
        /// Bounces the specified tags.
        /// </summary>
        /// <param name="tags">The tags.</param>
        /// <param name="files">The files.</param>
        public void Bounce(List<string> tags, List<string> files)
        {
            foreach (var file in files)
            {

                using ( var fileReader = new FileReader(file))
                {
                    _length = fileReader.Length();
                    var output = string.Empty;
                    var trigger = string.Empty;
                    var bounce = false;
                    var close = false;
                    _currentPosition = 0;
                    while (_length > _currentPosition)
                    {
                        var s = fileReader.ReadString(1);
                        _currentPosition++;
                        if (s == ">")
                            close = true;
                        if (s == "<")
                        {

                            trigger = string.Empty;
                            bounce = false;
                            close = false;

                        }
                        if (!close)
                        {
                            trigger = trigger + s;

                        }
                        if (close)
                        {
                            if (s == ">")
                            {
                                trigger = trigger + s;
                                foreach (var tag in tags)
                                {
                                    if (trigger.Contains(tag))
                                        bounce = true;
                                }
                                if (!bounce)
                                {
                                    output = output + trigger;
                                }
                            }
                            else
                            {
                                output = output + s;
                            }

                        }
                    }
                    fileReader.Close();

                    using (var fileWriter = new FileWriter())
                    {
                        fileWriter.WriteFile(output, file);
                    }

                }
            }
        }
开发者ID:romanservices,项目名称:CodeSamples,代码行数:69,代码来源:Shad.cs


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