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


C# BinaryReader.Close方法代码示例

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


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

示例1: JoinFile

    public static void JoinFile(string inputFile, string outputFile, KsSplitJoinHandler handler)
    {
        long rwIncrament=500000;//updateInterval=400000, updateIndex=0;
        FileInfo fInfo=new FileInfo(inputFile);
        long iLen=fInfo.Length;
        FileStream ifs=new FileStream(inputFile, FileMode.Open);
        BinaryReader reader=new BinaryReader(ifs);
        //bool cont;

        FileInfo fi=new FileInfo(outputFile);
        FileMode fm=FileMode.Append;
        if(!fi.Exists) fm=FileMode.CreateNew;
        FileStream ofs=new FileStream(outputFile, fm);
        BinaryWriter writer=new BinaryWriter(ofs);

        long i=0, cnt;
        while(i<iLen) {
            cnt=rwIncrament;
            if((i+cnt)>=iLen) cnt=iLen-i;
            //byte val[cnt];
            writer.Write(reader.ReadBytes((int)cnt));
            i+=cnt;
            if(!handler.OnUpdate(inputFile, outputFile, i, iLen)) {
                ifs.Close(); reader.Close();
                ofs.Close(); writer.Close();
                handler.OnCanceled(inputFile, outputFile, i, iLen);
                return;
            }
        }

        ifs.Close(); reader.Close();
        ofs.Close(); writer.Close();
        handler.OnFinished(inputFile, outputFile, i, iLen);
    }
开发者ID:erin100280,项目名称:KnifeSpan,代码行数:34,代码来源:KsJoiner.cs

示例2: Load

    // 바이너리 로드
    public void Load()
    {
        FileStream fs = new FileStream("StageDB.bin", FileMode.Open);
        BinaryReader br = new BinaryReader(fs);

        // *주의
        // 바이너리 세이브 순서와 로드 순서가 같아야된다. [5/13/2012 JK]
        // 바이너리 리드
        int iCount = br.ReadInt32();        // 갯수 읽기
        for (int i = 0; i < iCount; ++i)
        {
            CStateInfo kInfo = new CStateInfo();

            kInfo.m_nStageIndex = br.ReadInt32();          // 캐릭터 코드
            for (int k = 0; k < 4; ++k)
            {
                kInfo.m_anCharCode[k] = br.ReadInt32();     // 스테이지 별로 나오는 캐릭터
            }
            kInfo.m_fTermTime = br.ReadSingle();

            m_tmStage.Add(kInfo.m_nStageIndex, kInfo);
        }

        fs.Close();
        br.Close();
    }
开发者ID:ditto21c,项目名称:ExampleSource,代码行数:27,代码来源:StageDB.cs

示例3: Load

    // 바이너리 로드
    public void Load(TextAsset kTa_)
    {
        //FileStream fs = new FileStream("Assets\\Resources\\SkillDB.bytes", FileMode.Open);

        //BinaryReader br = new BinaryReader(fs);
        Stream kStream = new MemoryStream (kTa_.bytes);
        BinaryReader br = new BinaryReader(kStream);

        // *주의
        // 바이너리 세이브 순서와 로드 순서가 같아야된다. [5/13/2012 JK]
        // 바이너리 리드
        int iCount = br.ReadInt32();        // 갯수 읽기
        for (int i = 0; i < iCount; ++i)
        {
            StSkillInfo Info = new StSkillInfo();

            Info.m_nSkillCode = br.ReadInt32();               // 스킬 고유 코드
            Info.m_strName = br.ReadString();                // 스킬 이름
            Info.m_fRange = br.ReadSingle();                 // 스킬 적용 범위
            Info.m_nDamage = br.ReadInt32();            // 스킬 데미지량
            Info.m_nHeal = br.ReadInt32();              // 스킬 힐량
            Info.m_fContinueTime = br.ReadSingle();          // 스킬 적용되는 시간
            Info.m_strPrefab = br.ReadString();             // 스킬 사용시 사용할 Prefab

            m_tmSkill.Add(Info.m_nSkillCode, Info);
        }

        //fs.Close();
        br.Close();
        kStream.Close();
    }
开发者ID:ditto21c,项目名称:ExampleSource,代码行数:32,代码来源:SkillDB.cs

示例4: Load

    // 바이너리 로드
    public void Load()
    {
        FileStream fs = new FileStream("CharDB.bin", FileMode.Open);
        BinaryReader br = new BinaryReader(fs);

        // *주의
        // 바이너리 세이브 순서와 로드 순서가 같아야된다. [5/13/2012 JK]
        // 바이너리 리드
        int iCount = br.ReadInt32();        // 갯수 읽기
        for (int i = 0; i < iCount; ++i )
        {
            CCharInfo charInfo = new CCharInfo();

            charInfo.m_nCode = br.ReadInt32();          // 캐릭터 코드
            charInfo.m_strName = br.ReadString();       // 캐릭터 이름
            charInfo.m_strPrefab = br.ReadString();       // Assets 안에 있는 Prefab 텍스트명
            charInfo.m_nCharType = br.ReadInt32();      // 캐릭터 타입 0:플레이어 1:몬스터
            charInfo.m_nNowHP = br.ReadInt32();         // 현재 체력
            charInfo.m_nMaxHP = br.ReadInt32();         // 최대 체력
            charInfo.m_nCharWidth = br.ReadInt32();     // 캐릭터 넓이
            charInfo.m_fMoveSpeed = br.ReadSingle();    // 이동 속도(s) 목표지점까지 몇초만에 도착하는지
            charInfo.m_nAttackDamage = br.ReadInt32();  // 공격 데미지
            charInfo.m_nAttackRange = br.ReadInt32();   // 캐릭터 기본 사거리
            charInfo.m_fAttackSpeed = br.ReadSingle();  // 캐릭터 공격 속도 1: 1초에 한번
            charInfo.m_nExp = br.ReadInt32();           // 캐릭터가 죽었을시 제공되는 경험치
            charInfo.m_fAfterAttackIdleTermTime = br.ReadSingle(); // 공격후 Idle 유지 시간
            charInfo.m_nPay = br.ReadInt32();   // 보상(돈)
            m_mapCharacter.Add(charInfo.m_nCode, charInfo);
        }

        fs.Close();
        br.Close();
    }
开发者ID:ditto21c,项目名称:ExampleSource,代码行数:34,代码来源:CharacterDB.cs

示例5: LoadTable

	public override void LoadTable(string _path)
	{		
		if ((null != AssetbundleManager.Instance && true == AssetbundleManager.Instance.useAssetbundle) || true == AsTableManager.Instance.useReadBinary) 
		{
			// Ready Binary
			TextAsset textAsset = ResourceLoad.LoadTextAsset (_path);
			MemoryStream stream = new MemoryStream (textAsset.bytes);
			BinaryReader br = new BinaryReader (stream);

			int nCount = br.ReadInt32 ();

			for (int i = 0; i < nCount; i++) {
				Tbl_SynDisassemble_Record record = new Tbl_SynDisassemble_Record (br);
					m_recordList.Add (record);		
			}

			br.Close ();
			stream.Close ();				
		} 
		else 
		{
			XmlElement root = GetXmlRootElement(_path);
			XmlNodeList nodes = root.ChildNodes;
			
			foreach(XmlNode node in nodes)
			{
				Tbl_SynDisassemble_Record record = new Tbl_SynDisassemble_Record((XmlElement)node);			
				m_recordList.Add( record );
			}		
		}
	}		 
开发者ID:ftcaicai,项目名称:ArkClient,代码行数:31,代码来源:Tbl_SynDisassembleTable.cs

示例6: Load

    // 바이너리 로드
    public void Load()
    {
        FileStream fs = new FileStream("SkillDB.bin", FileMode.Open);
        BinaryReader br = new BinaryReader(fs);

        // *주의
        // 바이너리 세이브 순서와 로드 순서가 같아야된다. [5/13/2012 JK]
        // 바이너리 리드
        int iCount = br.ReadInt32();        // 갯수 읽기
        for (int i = 0; i < iCount; ++i)
        {
            CSkillInfo Info = new CSkillInfo();

            Info.m_nSkillCode = br.ReadInt32();               // 스킬 고유 코드
            Info.m_strName = br.ReadString();                // 스킬 이름
            Info.m_fRange = br.ReadSingle();                 // 스킬 적용 범위
            Info.m_nDamage = br.ReadInt32();            // 스킬 데미지량
            Info.m_nHeal = br.ReadInt32();              // 스킬 힐량
            Info.m_fContinueTime = br.ReadSingle();          // 스킬 적용되는 시간
            Info.m_strPrefab = br.ReadString();             // 스킬 사용시 사용할 Prefab

            m_tmSkill.Add(Info.m_nSkillCode, Info);
        }

        fs.Close();
        br.Close();
    }
开发者ID:ditto21c,项目名称:ExampleSource,代码行数:28,代码来源:SkillDB.cs

示例7: Load

    // 바이너리 로드
    public void Load(TextAsset kTa_)
    {
        //FileStream fs = new FileStream("Assets\\Resources\\StageDB.bytes", FileMode.Open);
        //BinaryReader br = new BinaryReader(fs);
        Stream kStream = new MemoryStream (kTa_.bytes);
        BinaryReader br = new BinaryReader(kStream);

        // *주의
        // 바이너리 세이브 순서와 로드 순서가 같아야된다. [5/13/2012 JK]
        // 바이너리 리드
        int iCount = br.ReadInt32();        // 갯수 읽기
        for (int i = 0; i < iCount; ++i)
        {
            StStateInfo kInfo = new StStateInfo();

            kInfo.m_nStageIndex = br.ReadInt32();          // 캐릭터 코드
            // 스테이지 별로 나오는 캐릭터
            kInfo.m_anCharCode = new int[(int)EStageDetail.Count];
            for (int k = 0; k < (int)EStageDetail.Count; ++k)
            {
                kInfo.m_anCharCode[k] = br.ReadInt32();
            }
            kInfo.m_fTermTime = br.ReadSingle();

            m_tmStage.Add(kInfo.m_nStageIndex, kInfo);
        }

        //fs.Close();
        br.Close();
        kStream.Close();
    }
开发者ID:ditto21c,项目名称:ExampleSource,代码行数:32,代码来源:StageDB.cs

示例8: WaveAudio

            /// <summary>
            /// Initializes this WaveAudio object with Wave audio file.
            /// </summary>
            /// <param name="filepath">Path of Wave Audio file.</param>
            public WaveAudio(FileStream filepath)
            {
                this.fs = filepath;
                this.br = new BinaryReader(fs);

                this.riffID = br.ReadBytes(4);
                this.size = br.ReadUInt32();
                this.wavID = br.ReadBytes(4);
                this.fmtID = br.ReadBytes(4);
                this.fmtSize = br.ReadUInt32();
                this.format = br.ReadUInt16();
                this.channels = br.ReadUInt16();
                this.sampleRate = br.ReadUInt32();
                this.bytePerSec = br.ReadUInt32();
                this.blockSize = br.ReadUInt16();
                this.bit = br.ReadUInt16();
                this.dataID = br.ReadBytes(4);
                this.dataSize = br.ReadUInt32();

                this.leftStream = new List<short>();
                this.rightStream = new List<short>();
                for (int i = 0; i < this.dataSize / this.blockSize; i++)
                {
                    leftStream.Add((short)br.ReadUInt16());
                    rightStream.Add((short)br.ReadUInt16());
                }

                br.Close();
                fs.Close();
            }
开发者ID:kushalpandya,项目名称:WavStagno,代码行数:34,代码来源:WaveAudio.cs

示例9: LoadTheScore

 public static int LoadTheScore()
 {
     #if UNITY_STANDALONE || UNITY_EDITOR
     string fullpath = Path.Combine(Application.dataPath, HighScoreFilename);
     #elif UNITY_IPHONE
     string path = Application.dataPath.Substring (0, Application.dataPath.Length - 5);
     path = path.Substring(0, path.LastIndexOf('/'));
     string fullpath = path + "/Documents/"+HighScoreFilename;
     #elif UNITY_ANDROID
     string fullpath = Path.Combine(Application.persistentDataPath , HighScoreFilename);
     #endif
     using (FileStream fs = new FileStream(fullpath, FileMode.OpenOrCreate, FileAccess.Read))
     {
         using (BinaryReader br = new BinaryReader(fs))
         {
             try
             {
                 highscore = br.ReadInt32();
                 //Debug.Log("Highscore " + highscore);
             }
             catch(EndOfStreamException e)
             {
                     Debug.Log("{0} caught and ignored. " + "Using default values."+ e.Message+" "+e.StackTrace);
             }
             finally
             {
                 br.Close();
             }
         }
         fs.Dispose();
     }
     return (highscore);
 }
开发者ID:robbybecker,项目名称:TimeyWimey,代码行数:33,代码来源:HighScore.cs

示例10: Start

    // Use this for initialization
    void Start()
    {
        var path = Application.dataPath + "/" + "ranki.txt";

        if (!File.Exists(path))
        {
            {
                FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write);
                BinaryWriter writer = new BinaryWriter(fs);

                if (writer != null)
                {
                    writer.Write(100000);
                    writer.Close();
                }
            }
        }

        {
            FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
            BinaryReader reader = new BinaryReader(fs);

            if (reader != null)
            {
                var i = reader.ReadInt32();
                reader.Close();
                Debug.Log(i);
            }
        }
    }
开发者ID:ooHIROoo,项目名称:BattleArms,代码行数:31,代码来源:JumpTest.cs

示例11: GetType

    public static System.Text.Encoding GetType( FileStream fs )
    {
        byte[] Unicode = new byte[] { 0xFF, 0xFE, 0x41 };
        byte[] UnicodeBIG = new byte[] { 0xFE, 0xFF, 0x00 };
        byte[] UTF8 = new byte[] { 0xEF, 0xBB, 0xBF }; //with BOM

        Encoding reVal;
        byte[] ss;
        int i;

        using (BinaryReader r = new BinaryReader(fs, System.Text.Encoding.Default)) {
            int.TryParse(fs.Length.ToString(), out i);
            ss = r.ReadBytes(i);

            if (IsUTF8Bytes(ss) || (ss[0] == 0xEF && ss[1] == 0xBB && ss[2] == 0xBF)) {
                reVal = Encoding.UTF8;
            } else if (ss[0] == 0xFE && ss[1] == 0xFF && ss[2] == 0x00) {
                reVal = Encoding.BigEndianUnicode;
            } else if (ss[0] == 0xFF && ss[1] == 0xFE && ss[2] == 0x41) {
                reVal = Encoding.Unicode;
            } else {
                reVal = Encoding.Default;
            }

            r.Close();
        }

        return reVal;
    }
开发者ID:kodybrown,项目名称:fixeol,代码行数:29,代码来源:EncodingType.cs

示例12: LoadVolumeFromFile

    public static Texture3D LoadVolumeFromFile(string fileName, TextureFormat format, int elementSize ,int width, int height, int depth)
    {
        BinaryReader br = new BinaryReader(File.Open(fileName, FileMode.Open, FileAccess.Read));
        Texture3D noiseTex = new Texture3D(width, height, depth, TextureFormat.RGBA32, false);
        noiseTex.filterMode = FilterMode.Bilinear;
        noiseTex.wrapMode = TextureWrapMode.Repeat;

        int numElements = width * height * depth;
        List<Color> colors = new List<Color>(numElements);


        // Get pixels from 2d texture for each slize in z direction
        for (int z = 0; z < depth; z++)
        {
            Texture2D tex2d = LoadTexture2DRaw(br, width, height, format, elementSize);
            colors.AddRange(tex2d.GetPixels());
        }
        //colors should now be filled with all pixels
        noiseTex.SetPixels(colors.ToArray());
        noiseTex.Apply(false);

        br.Close();
        return noiseTex;
   
    }
开发者ID:Mymicky,项目名称:MarchingCubesUnity,代码行数:25,代码来源:Helper.cs

示例13: extractNAND

    /*
     * Extraction functions.
     */
    public static void extractNAND(string nandfile, string destionationpath)
    {
        extractPath = destionationpath;
        nandFile = nandfile;

        rom = new BinaryReader(File.Open(nandfile,
                                                FileMode.Open,
                                                FileAccess.Read,
                                                FileShare.Read),
                                            Encoding.ASCII);

        if (initNand() == true)
        {

            if (!Directory.Exists(extractPath))
                Directory.CreateDirectory(extractPath);

            extractFST(0, "");
        }
        else
        {
            throw new Exception("This is not a valid BootMii NAND Dump!");
        }

        rom.Close();
    }
开发者ID:fagensden,项目名称:showmiiwads,代码行数:29,代码来源:ShowMiiWads_NandExtract.cs

示例14: GetBagType

    //caller will use this to determine the right class and then
    //construct it himself
    public static Type GetBagType(string path)
    {
        BagType type;
        Type bagClass = null;
        FileStream idx;

        string idxPath = path.Replace(".bag",".idx");
        if (File.Exists(idxPath))
            idx = File.Open(idxPath, FileMode.OpenOrCreate);
        else
            idx = File.Open(path, FileMode.OpenOrCreate);

        BinaryReader rdr = new BinaryReader(idx);

        type = (BagType) rdr.ReadInt32();
        if (type == BagType.GABA)
            type = (BagType) rdr.ReadInt32();

        rdr.Close();

        //only support GABA2 and VIDEO for now
        switch (type)
        {
                //HACK: these can break if namespace or class names change, FIXME
            case BagType.VIDEO:
                bagClass = Type.GetType("NoxBagTool.VideoBag");
                break;
            case BagType.GABA2:
                bagClass = Type.GetType("NoxBagTool.Gaba2Bag");
                break;
        }

        return bagClass;
    }
开发者ID:CFusion,项目名称:OpenLoveForNox,代码行数:36,代码来源:Bag.cs

示例15: ExtractFile

	public static void ExtractFile(ListViewFileItem lvi, string exeName, string outName)
	{
		//extract file in ListViewFileItem
		FileStream fsIn = null;
		BinaryReader brIn = null;
		FileStream fsOut = null;
		BinaryWriter bwOut = null;
		try
		{
			fsIn = new FileStream(exeName, FileMode.Open);
			brIn = new BinaryReader(fsIn);
			fsOut = new FileStream(outName, FileMode.Create);
			bwOut = new BinaryWriter(fsOut);
			fsIn.Seek(lvi.Offset, SeekOrigin.Begin);
			bwOut.Write(brIn.ReadBytes(lvi.Size));
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
		}
		finally
		{
			if (brIn != null)
				brIn.Close();
			if (fsIn != null)
				fsIn.Close();
			if (bwOut != null)
				bwOut.Close();
			if (fsOut != null)
				fsOut.Close();
		}
	}
开发者ID:winch,项目名称:winch.pinkbile.com-c-sharp,代码行数:32,代码来源:proExe.cs


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