本文整理汇总了C#中SubRecord.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# SubRecord.Clone方法的具体用法?C# SubRecord.Clone怎么用?C# SubRecord.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubRecord
的用法示例。
在下文中一共展示了SubRecord.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompileResultScript
public static bool CompileResultScript(SubRecord sr, out Record r2, out string msg)
{
msg=null;
r2=null;
r=new Record();
string script=sr.GetStrData();
locals.Clear();
localList.Clear();
edidRefs.Clear();
refcount=0;
errors.Clear();
ts=new TokenStream(script, errors);
if(errors.Count>0) return OutputErrors(out msg);
schr=new SubRecord();
schr.Name="SCHR";
r.AddRecord(schr);
scda=new SubRecord();
scda.Name="SCDA";
r.AddRecord(scda);
sr=(SubRecord)sr.Clone();
r.AddRecord(sr);
bw=new BinaryWriter(new MemoryStream());
while(ts.PeekNextStatement().Length>0) {
try {
HandleResultsBlock();
} catch(Exception ex) {
return ReturnError(ex.Message, out msg);
}
}
if(errors.Count>0) {
return OutputErrors(out msg);
}
byte[] header=new byte[20];
TypeConverter.si2h(refcount, header, 4);
TypeConverter.i2h((uint)bw.BaseStream.Length, header, 8);
TypeConverter.si2h(localList.Count, header, 12);
TypeConverter.si2h(0x10000, header, 16);
schr.SetData(header);
byte[] compileddata=((MemoryStream)bw.BaseStream).GetBuffer();
if(compileddata.Length!=bw.BaseStream.Length) Array.Resize<byte>(ref compileddata, (int)bw.BaseStream.Length);
scda.SetData(compileddata);
bw.Close();
r2=r;
return true;
}