本文整理汇总了C#中Reader.Read方法的典型用法代码示例。如果您正苦于以下问题:C# Reader.Read方法的具体用法?C# Reader.Read怎么用?C# Reader.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reader
的用法示例。
在下文中一共展示了Reader.Read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read2
public static SimplyInt Read2(Reader reader)
{
SimplyInt result = new SimplyInt();
result.Field1 = -reader.Read<int>();
result.Field2 = reader.Read<uint>();
return result;
}
示例2: Setup
private static IEnvironment Setup(string program)
{
var evaluator = new Evaluator();
var reader = new Reader();
foreach (string lispThing in NihilEntryPoint.GetBasicLispThings())
{
evaluator.Evaluate(reader.Read(lispThing, evaluator.Environment));
}
evaluator.Evaluate(reader.Read(program, evaluator.Environment));
return evaluator.Environment;
}
示例3: ReadTags
public void ReadTags(ref TagDatabase tagdb, Reader objReader, int readTimeOut, out TagReadData[] trd)
{
//fontSize_TextChanged_1(sender, e);
//Change the datagrid data font size
//dataGrid1.FontSize = Convert.ToDouble(txtfontSize.Text);
//GUIturnoffWarning();
//simpleReadPlans.Clear();
try
{
//FontFamily fFamily = new FontFamily("Arial");
//dataGrid1.ColumnHeaderStyle
//Font objFont = new Font(fFamily, Convert.ToInt64(fontSize.Text));
//tagResultsGrid.Font = objFont;
DateTime timeBeforeRead = DateTime.Now;
TagReadData[] tagID = objReader.Read(readTimeOut);
DateTime timeAfterRead = DateTime.Now;
TimeSpan timeElapsed = timeAfterRead - timeBeforeRead;
trd = tagID;
tagdb.AddRange(tagID);
}
catch (Exception ex)
{
throw ex;
}
}
示例4: Main
public static int Main(string[] args)
{
gdcm.FileMetaInformation.SetSourceApplicationEntityTitle( "My Reformat App" );
// http://www.oid-info.com/get/1.3.6.1.4.17434
string THERALYS_ORG_ROOT = "1.3.6.1.4.17434";
gdcm.UIDGenerator.SetRoot( THERALYS_ORG_ROOT );
System.Console.WriteLine( "Root dir is now: " + gdcm.UIDGenerator.GetRoot() );
string filename = args[0];
string outfilename = args[1];
Reader reader = new Reader();
reader.SetFileName( filename );
if( !reader.Read() )
{
System.Console.WriteLine( "Could not read: " + filename );
return 1;
}
UIDGenerator uid = new UIDGenerator(); // helper for uid generation
FileDerivation fd = new FileDerivation();
// For the pupose of this execise we will pretend that this image is referencing
// two source image (we need to generate fake UID for that).
string ReferencedSOPClassUID = "1.2.840.10008.5.1.4.1.1.7"; // Secondary Capture
fd.AddReference( ReferencedSOPClassUID, uid.Generate() );
fd.AddReference( ReferencedSOPClassUID, uid.Generate() );
// Again for the purpose of the exercise we will pretend that the image is a
// multiplanar reformat (MPR):
// CID 7202 Source Image Purposes of Reference
// {"DCM",121322,"Source image for image processing operation"},
fd.SetPurposeOfReferenceCodeSequenceCodeValue( 121322 );
// CID 7203 Image Derivation
// { "DCM",113072,"Multiplanar reformatting" },
fd.SetDerivationCodeSequenceCodeValue( 113072 );
fd.SetFile( reader.GetFile() );
// If all Code Value are ok the filter will execute properly
if( !fd.Derive() )
{
return 1;
}
gdcm.FileMetaInformation fmi = reader.GetFile().GetHeader();
// The following three lines make sure to regenerate any value:
fmi.Remove( new gdcm.Tag(0x0002,0x0012) );
fmi.Remove( new gdcm.Tag(0x0002,0x0013) );
fmi.Remove( new gdcm.Tag(0x0002,0x0016) );
Writer writer = new Writer();
writer.SetFileName( outfilename );
writer.SetFile( fd.GetFile() );
if( !writer.Write() )
{
System.Console.WriteLine( "Could not write: " + outfilename );
return 1;
}
return 0;
}
示例5: Copy
public void Copy(Reader reader, Writer writer)
{
char c = reader.Read();
while (c != EOF)
{
writer.Write(c);
}
}
示例6: Run
/// <summary>
/// Copies brand information.
/// </summary>
public void Run()
{
var reader = new Reader(sourceFileName);
Information information = reader.Read();
var writer = new Writer(targetFileName);
writer.Write(information);
}
示例7: DotExceptionTest
public void DotExceptionTest(params string[] tokenNames)
{
var symbols = new SymbolsTable();
var reader = new Reader();
var tokens = GetTokens(tokenNames);
reader.Read(tokens, symbols);
}
示例8: TestMethod5
public void TestMethod5()
{
var evaluator = new Evaluator();
var reader = new Reader();
var program = "((lambda () #t))";
var sexp = reader.Read(program, evaluator.Environment);
var rexp = evaluator.Evaluate(sexp);
}
示例9: Read
private void Read(Reader reader)
{
using (var file = new StreamReader("Library.lisp"))
{
foreach (var form in reader.Read(file, Symbols))
{
Eval(form);
}
}
}
示例10: ReadEmptyListTest
public void ReadEmptyListTest()
{
var symbols = new SymbolsTable();
var reader = new Reader();
var tokens = new[] { "(", ")" }.Select(s => new Token(s));
var result = reader.Read(tokens, symbols);
Assert.AreEqual(1, result.Count);
Assert.AreSame(LispNull.Nil, result[0]);
}
示例11: Main
public static int Main(string[] args)
{
gdcm.Global global = gdcm.Global.GetInstance();
if( !global.LoadResourcesFiles() )
{
System.Console.WriteLine( "Could not LoadResourcesFiles" );
return 1;
}
string file1 = args[0];
string file2 = args[1];
Reader reader = new Reader();
reader.SetFileName( file1 );
bool ret = reader.Read();
if( !ret )
{
return 1;
}
string certpath = gdcm.Filename.Join(gdcm.Testing.GetSourceDirectory(), "/Testing/Source/Data/certificate.pem" );
gdcm.CryptographicMessageSyntax cms = new gdcm.CryptographicMessageSyntax();
if( !cms.ParseCertificateFile( certpath ) )
{
return 1;
}
//Anonymizer ano = new Anonymizer();
SmartPtrAno sano = Anonymizer.New();
Anonymizer ano = sano.__ref__();
//SimpleSubjectWatcher watcher = new SimpleSubjectWatcher(ano, "Anonymizer");
MyWatcher watcher = new MyWatcher(ano);
ano.SetFile( reader.GetFile() );
ano.SetCryptographicMessageSyntax( cms );
if( !ano.BasicApplicationLevelConfidentialityProfile() )
{
return 1;
}
Writer writer = new Writer();
writer.SetFileName( file2 );
writer.SetFile( ano.GetFile() );
ret = writer.Write();
if( !ret )
{
return 1;
}
return 0;
}
示例12: ReadListTest
public void ReadListTest(int count)
{
var symbols = new SymbolsTable();
var reader = new Reader();
var innerTokens = GetTokens(count);
var tokens = new List<Token> { new Token("(") };
tokens.AddRange(innerTokens);
tokens.Add(new Token(")"));
var result = reader.Read(tokens, symbols);
Assert.AreEqual(1, result.Count);
AssertList(result[0], innerTokens);
}
示例13: Main
public static int Main(string[] args)
{
string filename = args[0];
Reader reader = new Reader();
reader.SetFileName( filename );
bool ret = reader.Read();
if( !ret )
{
return 1;
}
File f = reader.GetFile();
DataSet ds = f.GetDataSet();
RecurseDataSet( f, ds, "" );
return 0;
}
示例14: DottedConsTest
public void DottedConsTest()
{
var symbols = new SymbolsTable();
var reader = new Reader();
const string CarName = "car";
const string CdrName = "cdr";
var tokens = GetTokens("(", CarName, ".", CdrName, ")");
var result = reader.Read(tokens, symbols);
Assert.AreEqual(1, result.Count);
var car = (Symbol)Car.Of(result[0]);
var cdr = (Symbol)Cdr.Of(result[0]);
Assert.That(car.SameName(CarName));
Assert.That(cdr.SameName(CdrName));
}
示例15: Read
public static FileType Read(Reader reader)
{
FileType result = new FileType();
try
{
result.Type = reader.Read<FileKind>();
}
catch (SystemException ex)
{
throw new FormatException("can't read 'Type' field", ex);
}
switch (result.Type)
{
case FileKind.Text:
break;
case FileKind.Data:
try
{
result.Creator = reader.ReadVar<string>(MaxNameLen);
}
catch (SystemException ex)
{
throw new FormatException("can't read 'Creator' field", ex);
}
break;
case FileKind.Exec:
try
{
result.Interpretor = reader.ReadVar<string>(MaxNameLen);
}
catch (SystemException ex)
{
throw new FormatException("can't read 'Interpretor' field", ex);
}
break;
default:
throw new FormatException("unexpected value: " + result.Type.ToString());
}
return result;
}