Tag: bin

从C#的zip文件中读取二进制文件而不解压缩

我想从zip文件中读取二进制文件而不解压缩它。 zip文件结构: zipFolderName/subFolder/BinFile 在BinFile中,我有: Id1, id2, value1 // id1, id2 are string, value1 is int 在C#中: ZipEntry binFileName = …; // it has been got from zipFile entries MemoryStream ms = new MemoryStream(); binFileName.Extract(ms); using (BinaryReader reader = new BinaryReader(ms)) { string id1 = reader.ReadString(); // error popped here string id2 = reader.ReadString(); int value1 […]

如何在asp.net应用程序中拥有多个bin文件夹?

我有一个位于C:/ MainApp的asp.net应用程序,它有一个bin文件夹。 在IIS中,我将其配置为Web应用程序,我可以运行我的测试页面。 现在,我有2个带有自己的dll的Web服务应用程序,我不想在主bin文件夹c:/ MainApp / Bin中部署这些dll,原因有些,请不要问为什么! 这两个子应用程序需要托管在同一个MainApp下,而无需为每个子应用程序创建新的虚拟文件夹。 所以, c:/MainApp c:/MainApp/bin c:/MainApp/SubApp1/bin c:/MainApp/SubApp2/bin 如何配置webconfig以使我的SubApp文件夹可以拥有自己的bin文件夹? 如果是这样,他们是否也会在运行时从MainApp bin文件夹inheritance? 非常感谢,

我如何直接在C#中执行批处理命令?

嗨,我对c#和批处理文件有疑问。 我想执行批处理命令并将输出保存在c#中的字符串中。 但我只能执行该文件但不能将此内容保存在字符串中并在文本框中显示。 我的批处理文件: @echo关闭 “C:\ lmxendutil.exe”-licstatxml -host serv005 -port 6200> C:\ Temp \ HW_Lic_XML.xml notepad C:\ Temp \ HW_Lic_XML.xml 这是我的c#代码: private void btnShowLicstate_Click(object sender, EventArgs e) { string command = “‘C:\\lmxendutil.exe’ -licstatxml -host lwserv005 -port 6200”; txtOutput.Text = ExecuteCommand(command); } static string ExecuteCommand(string command) { int exitCode; ProcessStartInfo processInfo; Process process; processInfo = new […]

C#如何将大型HEX字符串转换为二进制

我有一个包含14个字符的字符串。 这是7字节的hexrepresantation。 我想将其转换为二进制。 我尝试使用Convert.ToString(Convert.ToInt32(hexstring, 16), 2); 对于小字符串,这可以工作,但对于14个字符,它将无法工作,因为结果太大。 我怎么能管理这个? 请记住,转换的输出应该是一个二进制字符串,其长度为56个字符(我们必须保留前导零)。 (例如,(byte)0x01的转换应该产生“00000001”而不是“1”)