本文整理汇总了C#中Interface.WriteError方法的典型用法代码示例。如果您正苦于以下问题:C# Interface.WriteError方法的具体用法?C# Interface.WriteError怎么用?C# Interface.WriteError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interface
的用法示例。
在下文中一共展示了Interface.WriteError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Work
/// <summary>
/// Write the configuration on a file
/// </summary>
/// <returns>True if it succesfull or false otherwise</returns>
public override bool Work(Interface inter, Options option)
{
bool res = false;
System.IO.Directory.CreateDirectory("./" + Name);
string filename = "./" + Name + "/reader.cfg";
IntPtr ptr_c = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(RplethReaderStructure)));
FileStream file = null;
try
{
file = new FileStream(filename, FileMode.Create);
Marshal.StructureToPtr(struc, ptr_c, false);
for (int i = 0; i < Marshal.SizeOf(typeof(RplethReaderStructure)); i++)
{
file.WriteByte(Marshal.ReadByte(ptr_c, i));
}
inter.WriteMessage("\n\t\t\t***********************");
inter.WriteMessage("\tThe configuration file has been successfully writing.");
inter.WriteMessage("\t\t\t***********************\n");
res = true;
}
catch (Exception ex)
{
inter.WriteError(ex.Message);
inter.WriteMessage("\n\t\t\t***********************");
inter.WriteMessage("\tThe configuration file hasn't been successfully writing.");
inter.WriteMessage("\t\t\t***********************\n");
}
finally
{
if (file != null)
file.Flush();
file.Close();
Marshal.FreeHGlobal(ptr_c);
}
return res;
}