###前提・実現したいこと
ガーバーファイルからbitmap作成関数を作ろうとしています。
ガーバーファイルを一処理ずつ読み解くため * (アスタリスク)までの文がほしいです。
###発生している問題・エラーメッセージ
The best overloaded method match for 'project名.StreamReaderGBR.StreamReaderGBR(System.IO.Stream)' has some invalid arguments Argument 1: cannot convert from 'string' to 'System.IO.Stream'
###該当のソースコード
public class gbrFile { string Path; gbrFile (string Path) { this.Path = Path; } Bitmap gbrFileConvert (Bitmap a) { using (StreamReaderGBR srgbr = new StreamReaderGBR(this.Path)) { } return a; } } class StreamReaderGBR : StreamReader { public StreamReaderGBR(Stream stream) : base(stream) { } public override string ReadLine() { int c; c = Read(); if (c == -1) { return null; } StringBuilder sb = new StringBuilder(); do { char ch = (char)c; switch (ch) { case '*': return sb.ToString(); case '%': break; default: sb.Append(ch); break; } } while ((c = Read()) != -1); return sb.ToString(); } }
###補足情報(言語/FW/ツール等のバージョンなど)
ガーバーファイルの設定項目にある%が邪魔なので読み取らないようにしています。
下記のURLを参考(コピペ)に作っています。
https://stackoverflow.com/questions/6330699/override-streamreaders-readline-method

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。