using System;
using System.Collections.ObjectModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Text;
namespace wsControls.IO
{
public class wsFile
{
public const char tab = (char)178;
public const string space = "\t";
public const char eof = (char)13;
public const byte CR = 13;
public const string DateFmt = "yyyy-MM-dd HH:mm:ss.ff";
public const int MaxHeaderLength = 1024;
#region [ Text ] AppendText, WriteFile
public static bool AppendText(string filename, string text)
{
try
{
System.IO.StreamWriter file = File.AppendText(filename);
file.WriteLine(text);
file.Flush();
file.Close();
file.Dispose();
return true;
}
catch { return false; }
}
public static bool WriteFile(string filename, string text)
{
try
{
System.IO.StreamWriter file = new System.IO.StreamWriter(filename);
file.WriteLine(text);
file.Close();
file.Flush();
file.Dispose();
return true;
}
catch { return false; }
}
#endregion
public static bool WriteBuffer(string filename, byte[] buffer)
{
try
{
BinaryWriter bw = new BinaryWriter(System.IO.File.Open(filename, FileMode.Create), new UTF8Encoding());
bw.Write(buffer);
bw.Close();
return true;
}
catch { return false; }
}
#region [ Write BXF ] CreateBXF, AppendBXF, CloseBXF
public static bool CreateBXF(string filename, out BinaryWriter bw)
{
bw = null;
try
{
bw = new BinaryWriter(System.IO.File.Open(filename, FileMode.Create), new UTF8Encoding());
return true;
}
catch { return false; }
}
public static bool AppendBXF(BinaryWriter bw, string text)
{
try
{
bw.Write(text);
return true;
}
catch { return false; }
}
public static bool AppendBXF(BinaryWriter bw, decimal data)
{
try
{
bw.Write(data);
return true;
}
catch { return false; }
}
public static bool AppendBXF(BinaryWriter bw, string text, decimal data)
{
try
{
bw.Write(text);
bw.Write(data);
return true;
}
catch { return false; }
}
public static bool AppendBXF(BinaryWriter bw, DateTime datetime, decimal data)
{
try
{
bw.Write(datetime.ToString(DateFmt));
bw.Write(data);
return true;
}
catch { return false; }
}
public static bool AppendBXF(BinaryWriter bw, string[] text, decimal[] data)
{
try
{
for (int i = 0; i < text.Length; i++)
{
bw.Write(text[i]);
bw.Write(data[i]);
}
return true;
}
catch { return false; }
}
public static bool AppendBXF(BinaryWriter bw, float[] data)
{
try
{
bw.Write(data.Length.ToString());
for (int i = 0; i < data.Length; i++)
bw.Write(data[i]);
return true;
}
catch { return false; }
}
public static bool AppendBXF(BinaryWriter bw, string text, float[] data)
{
try
{
bw.Write(text);
bw.Write(data.Length.ToString());
for (int i = 0; i < data.Length; i++)
bw.Write(data[i]);
return true;
}
catch { return false; }
}
public static bool AppendBXF(BinaryWriter bw, DateTime datetime, float[] data)
{
try
{
bw.Write(datetime.ToString(DateFmt));
bw.Write(data.Length.ToString());
for (int i = 0; i < data.Length; i++)
bw.Write(data[i]);
return true;
}
catch { return false; }
}
public static bool AppendBXF(BinaryWriter bw, DateTime datetime, decimal[] data)
{
try
{
bw.Write(datetime.ToString(DateFmt));
bw.Write(data.Length.ToString());
for (int i = 0; i < data.Length; i++)
bw.Write(data[i]);
return true;
}
catch { return false; }
}
public static bool CloseBXF(BinaryWriter bw)
{
try
{
bw.Flush();
bw.Close();
bw.Dispose();
return true;
}
catch { return false; }
}
#endregion
#region [ Read BXF ] OpenBXF, ReadBXF, CloseBXF
public static bool OpenBXF(string filename, out FileStream fs, out BinaryReader br)
{
fs = null;
br = null;
try
{
fs = new FileStream(filename, FileMode.Open);
br = new BinaryReader(fs, new UTF8Encoding());
return true;
}
catch { return false; }
}
public static bool ReadBXF(BinaryReader br, out string text)
{
try
{
text = br.ReadString();
return true;
}
catch
{
text = string.Empty;
return false;
}
}
public static bool ReadBXF(BinaryReader br, out decimal dec)
{
try
{
dec = br.ReadDecimal();
return true;
}
catch
{
dec = 0;
return false;
}
}
public static bool ReadBXF(BinaryReader br,out string text, out decimal dec)
{
try
{
text = br.ReadString();
dec = br.ReadDecimal();
return true;
}
catch
{
text = string.Empty;
dec = 0;
return false;
}
}
public static bool ReadBXF(BinaryReader br, out DateTime datetime, out decimal dec)
{
try
{
datetime = Convert.ToDateTime(br.ReadString());
dec = br.ReadDecimal();
return true;
}
catch
{
datetime = new DateTime();
dec = 0;
return false;
}
}
public static bool ReadBXF(BinaryReader br, out float[] data)
{
try
{
string len = br.ReadString();
data = new float[Convert.ToInt32(len)];
for (int i = 0; i < data.Length; i++)
data[i] = br.ReadSingle();
return true;
}
catch
{
data = null;
return false;
}
}
public static bool ReadBXF(BinaryReader br, out string text, out float[] data)
{
try
{
text = br.ReadString();
string len = br.ReadString();
data = new float[Convert.ToInt32(len)];
for (int i = 0; i < data.Length; i++)
data[i] = br.ReadSingle();
return true;
}
catch
{
text = string.Empty;
data = null;
return false;
}
}
public static bool ReadBXF(BinaryReader br, out DateTime datetime, out float[] data)
{
try
{
datetime = Convert.ToDateTime(br.ReadString());
string len = br.ReadString();
data = new float[Convert.ToInt32(len)];
for (int i = 0; i < data.Length; i++)
data[i] = br.ReadSingle();
return true;
}
catch
{
datetime = new DateTime();
data = null;
return false;
}
}
public static bool ReadBXF(BinaryReader br, out DateTime datetime, out decimal[] data)
{
try
{
datetime = Convert.ToDateTime(br.ReadString());
string len = br.ReadString();
data = new decimal[Convert.ToInt32(len)];
for (int i = 0; i < data.Length; i++)
data[i] = br.ReadDecimal();
return true;
}
catch
{
datetime = new DateTime();
data = null;
return false;
}
}
public static bool CloseBXF(FileStream fs, BinaryReader br)
{
try
{
br.Close();
fs.Close();
return true;
}
catch { return false; }
}
#endregion
public static bool WriteTXT(string filename, string content)
{
try
{
System.IO.StreamWriter sfile = new System.IO.StreamWriter(filename);
sfile.WriteLine(content);
sfile.Close();
sfile.Dispose();
return true;
}
catch { return false; }
}
}
}
相关推荐
abaqus 根据坐标施加载荷- Analytical Field 载荷映射
在一些类型的分析中,需要将按位置分布的载荷施加到结构上,比如流体分析导出了结构的气动载荷、或者温度载荷,需要将压强分布、温度分布载荷施加到固体上。这种分析可以使用abaqus中的Analytical Field实现。 1 例子 1.1 结构 一个100*100mm的面,面的载荷分布函数为p=(x2+y2)0.5/((20.5)*100) MPa,即(0, 0)的压强为0,(100, 100)的压强为1。 1.2 载荷 载荷函数:p=(x^2+y^2)^0.5/((2^0.5)*100) in exce.
WS_FILENAME_GET函数
介绍下WS_FILENAME_GET函数的用法,给个例子。它的作用是按F4的时候,打开一个对话框选择了相应的文件后得到文件名并显示在选择屏幕上。我用这个函数就是将报表输出到execl的时候用到。代码如下: SPAN {font-family: "Courier New";font-size: 10pt;color: #000000;background: #FFFFF
华为海思2026届数字IC秋招笔试真题解析与实战技巧(2025最新版)
本文深度解析华为海思2026届数字IC秋招笔试真题,涵盖高频考点如后端设计、低功耗设计、SystemVerilog语法等核心内容。提供时序违例修复、时钟树综合等实战技巧,帮助考生高效备考。特别关注UPF低功耗设计规范等最新考点,助力考生在秋招笔试中脱颖而出。
ALV Grid Display ,Top-Of-Page, Variant, DownLoad...
ALV Grid Display ,Top-Of-Page, Variant, DownLoad...
API安全攻防实战:从信息搜集到漏洞利用的完整路径
本文详细解析了API安全攻防实战的全过程,从信息搜集到漏洞利用,涵盖了渗透测试的核心技巧和工具使用。通过真实案例展示如何发现和利用API漏洞,如HTTP方法滥用、内容类型转换攻击等,并提供企业级防御策略和测试心得,帮助安全研究人员提升API安全防护能力。
Ubuntu 22.04 局域网安装GitLab
下面直接给你一份。
.WS文件
后缀为WS的文件用什么软件打开 wangjinsong88 | 浏览 3847 次 问题未开放回答 推荐于2017-09-01 00:12:02 最佳答案 WS文件是用java script脚本语言编写的动态网页程序文件,可以用文本记事本或微软的frontpage打开并进行编辑工作,当然要运行WS文件还需要先安装设置好iis等web服务端软件,然后
Source Insight 4.0 及最新版序列号验证机制全解析:如何快速定位关键函数并构造有效Key
本文深入解析了Source Insight 4.0及最新版的序列号验证机制,详细介绍了如何快速定位关键函数并构造有效Key。通过静态分析和动态调试技术,帮助开发者理解现代软件保护的设计哲学,掌握逆向分析方法论,提升安全研究能力。
webserver实现服务器拉取客户端某磁盘下文件(WS)
webserver实现服务器端拉取客户端某磁盘下文件(WS)
Zipformer实战:5分钟快速搭建语音识别模型(附LibriSpeech测试结果)
本文提供了一份详细的Zipformer语音识别模型实战指南。通过清晰的步骤,指导读者在5分钟内完成从环境配置、LibriSpeech数据集准备到模型训练与测试的全过程。文章重点解析了关键配置参数,并分享了在LibriSpeech测试集上的性能结果,帮助开发者快速评估和应用这一高效的语音识别架构。
Jetson 平台编译安装 FFmpeg 7.1(支持 Nvmpi + SRT + x265)
摘要: 本文详细介绍了在NVIDIA Jetson平台上编译FFmpeg 7.1并集成关键功能的全过程。通过补丁方式加入Nvmpi实现硬件加速支持,同时编译集成x265编码器和SRT低延迟传输协议。步骤涵盖:1)安装x265编码器;2)配置SRT协议支持;3)编译jetson-ffmpeg的Nvmpi接口;4)定制化编译FFmpeg 7.1;5)验证模块集成情况。最终实现支持硬件编解码、高效HEVC压缩和可靠推流的增强版FFmpeg,为Jetson平台的音视频处理提供完整解决方案。
txt文件中如何写入换行符"\n"
编写php文件时,用fopen()函数打开一个txt文件,按如下方式写入字符时怎样都不能写入换行符 $outputstring = $date." ".$tireqty." tires ".$oilqty." oil ".$sparkqty." spark plugs \$".$totalamount." ".$address."\n"; fwrite($fp, $outputstring,s
2026.3.21:Ubuntu26.04 apt换国内源 清华源 阿里源 中科大源 163源
作为 LTS 版本,它会有 5 年的常规维护和安全更新。如果订阅 Ubuntu Pro,还能享受额外7年的支持。也就是说, Ubuntu Pro将享有长达 12 年的系统更新保障!接下来,我们将重点介绍 Ubuntu 24.04 LTS 中那些值得关注的新特性,以方便你决定是否进行升级。Ubuntu 24.04 LTS,代号 「Noble Numbat」,即将与我们见面!Canonical 已经宣布, Ubuntu 24.04 LTS。源文件地址 已经更换为。
C# 中的字体
C#中本来已经封装了通用字体Font,但是笔者认为这个Font在使用过程中很不方便。 1) Font的很多属性都是只读的,不能通过更改属性的值而对Font进行操作;必须重新初始化Font对象才行。例如:font.Size=12;是不允许的。 2) Font总归是用来写字的,但是C#中的Font类与string类没有什么联系,这给Font的使用带来了一些麻烦。比如我想要知道一个string对象使
复分析 阿尔福斯(Ahlfors) 第三版答案 英文
答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案
大中型超市收银系统(可直接运行)
光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开
FileAssociation
using System; using System.Text; using System.Runtime.InteropServices; using System.Windows.Forms; using Microsoft.Win32; namespace wsWin { #region [ FileAssociation ] public class FileAssoci
TMS_WebGMaps_1.9.8.0_Full_Source
TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder
c# 后台程序
C# 中的backgroundworker,是我个人认为最具有吸引力的windows标准控件之一,他允许程序在后台运行一个独立的线程,而不影响前台主窗口。这种进程控制在操作数据库或通讯时非常实用,因为后台线程在工作时并不影响前台的任何操作。如果不使用backgroundworker而简单的应用单一线程操作,则通讯时很有可能会造成主窗口假死,知道通讯结束后才会恢复。下面简单介绍backgroundw
WINCC7.3破解文件
WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!
C# 打开外部文件
System.Diagnostics.Process.Start(".//Help.chm");
StringX
namespace wsControls { public class StringX { public static char mylar = (char)220; #region [ Property ] String public string String { get; set; } #endregion
CDataGrid
enum DataMask { Num, Float, Date, NvChar, Bit }; [ToolboxBitmap(typeof(System.Windows.Forms.DataGridView))] class CDataGrid : DataGridView { public DataMask val_type; publi
ListView 到 Excel
using System.Reflection; Function() { Excel.Application app = new Excel.Application(); if (app == null) { MessageBox.Show("Failed to Load Excel,Pleas
win32
using System; using System.Runtime.InteropServices; using System.Drawing; using System.Text; namespace wsWin { public class Win32 { public const int GW_HWNDFIRST = 0; public
读写文件
BackgroundWorker background1 = new BackgroundWorker();byte[] buffer1;//HDD -> MEM BackgroundWorker background2 = new BackgroundWorker();byte[] buffer2;//MEM -> HDD UInt32 pointer1, pointer2; bool abor
ini, Reg
using System.Text; using Microsoft.Win32; namespace wsWin { #region [ *.ini file ] public class InI { public string path; public InI(string INIPath) {
User Define Message
You need total 3 steps to define your message [DllImport("user32.dll")] public static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wPar, IntPtr lPar); public const int UserMsg =
DataGrid导出到Ex el, 自动获取列标识
#region [ 导出到Excel ] public void Export() { #region range int count = this.Columns.Count; if (count > 256 || count == 0)//超出Excel的最大行数,
2万+



被折叠的 条评论
为什么被折叠?



