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


C# TextReader.Close方法代码示例

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


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

示例1: Start

    // Use this for initialization
    void Start()
    {
        credits = new List<string>();
        positionRect = new List<Rect>();

        // Create reader & open file
        try{
            tr = new StreamReader(path);
            string temp;
            int count = 0;
            while((temp = tr.ReadLine()) != null)
            {
                credits.Add(temp);
                positionRect.Add(new Rect(Screen.width/4 - Screen.width/8, (float)(Screen.height * 0.07 * count + Screen.height), (float)(Screen.width/2 + Screen.width/4), (float)(Screen.height * 0.5)));
                count++;
            }

            // Close the stream
            tr.Close();
        }
        catch(FileLoadException e) {
            Debug.LogException(e);
            credits.Add("Error while loading credits file.");
        }
    }
开发者ID:rodrigod89,项目名称:project-decubed-online,代码行数:26,代码来源:Credits.cs

示例2: LoadRtfText

            /// <summary>
            /// Carga una cadena de Texto con formato RTF.
            /// </summary>
            /// <param name="text">Cadena de Texto que contiene el documento.</param>
            /// <returns>Se devuelve el valor 0 en caso de no producirse ningún error en la carga del documento.
            /// En caso contrario se devuelve el valor -1.</returns>
            public int LoadRtfText(string text)
            {
                //Resultado de la carga
                int res = 0;

                //Se abre el fichero de entrada
                rtf = new StringReader(text);

                //Se crea el analizador léxico para RTF
                lex = new RtfLex(rtf);

                //Se carga el árbol con el contenido del documento RTF
                res = parseRtfTree();

                //Se cierra el stream
                rtf.Close();

                //Se devuelve el resultado de la carga
                return res;
            }
开发者ID:sonygod,项目名称:dotahit,代码行数:26,代码来源:RtfTree.cs

示例3: Awake

    void Awake()
    {
        if (Application.loadedLevelName == "MainMenu" || Application.loadedLevelName == "Options" || Application.loadedLevelName == "PlanetSelector" || Application.loadedLevelName == "ProfileSelector")
        {
            isMenu = true;
        }
        entities = new Dictionary<Vector3Int, GameEntity> (new Vector3EqualityComparer ());
        sensorSpaces = new Dictionary<Vector3Int, List<BasicSensor>> (new Vector3EqualityComparer ());
        images[0] = Resources.Load("Art/Textures/GUI/button_exit") as Texture2D;
        images[1] = Resources.Load("Art/Textures/GUI/button_hint") as Texture2D;
        images[2] = Resources.Load("Art/Textures/GUI/button_restart") as Texture2D;
        skin = 		Resources.Load("Art/Textures/GUI/ingame_skin") as GUISkin;
        foreach (GameObject go in FindObjectsOfType(typeof(GameObject))){
            if (go.name == "Camera"){
                CameraDecubeLevel c = go.GetComponent<CameraDecubeLevel>();
                levelCamera = c;
                break;
            }
        }
        hints = new List<string>();
        path = "Assets/Resources/Txt/hints.txt";
        try{
            tr = new StreamReader(path);
            string temp;
            while((temp = tr.ReadLine()) != null)
            {
                if(hints.Count == 12){
                    hints.Add(temp);
                }
                hints.Add(temp);
            }

            // Close the stream
            tr.Close();
        }
        catch(FileLoadException e) {
            Debug.LogException(e);
        }
    }
开发者ID:semvidEAFIT,项目名称:project-decubed,代码行数:39,代码来源:Level.cs


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