如果我有一部电影(MKV)和它的大小像7 GB我怎么能在FileStream中读取它...我们知道int的最大大小约为2,147 MB ..如何从索引3G.B开始读取..因为FileStream中的.Read()方法将偏移量作为一个整数,其中3 GB超出了int范围.. ???
private void readingLargeFile(string path)
{
int start = 3*(1024*1024*1024);
FileStream fs = new FileStream(path,FileMode.Open);
fs.Read(data, start, (1024*8) );
}
Run Code Online (Sandbox Code Playgroud) 为什么Process.WaitForExit不等待?
static void Main(string[] args)
{
while (true)
{
try
{
if (Process.GetProcessesByName("ServerAPPFileManager").Length > 0)
{
Process clsProcess = Process.GetProcessesByName("ServerAPPFileManager")[0];
Console.WriteLine(clsProcess.ProcessName);
clsProcess.WaitForExit();
}
if (System.IO.File.Exists(System.IO.Path.Combine(Environment.CurrentDirectory, "ServerAPPFileManager.exe")))
{
Console.WriteLine("File Found");
Process p = new Process();
p.StartInfo.Verb = "runas";
p.StartInfo.FileName = System.IO.Path.Combine(Environment.CurrentDirectory, "ServerAPPFileManager.exe");
p.Start();
}
}
catch(Exception e)
{
Console.Write(e.Message);
System.Threading.Thread.Sleep(1000);
}
}
}
Run Code Online (Sandbox Code Playgroud)
它不断循环并一次又一次地启动应用程序!
编辑:
它现在有效,它没有工作,因为它就像这样 clsProcess.WaitForExit(1000);
我需要一个函数来获取特定 div 中的所有图像,我尝试使用BrowserDomAdapter但它抛出了这个错误el.querySelector is not a function,事实上我没有el在我的组件中声明任何变量
import { BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter';
...
...
constructor(private dom:BrowserDomAdapter){
}
ngAfterContentInit(){
this.lightboxImages();
}
lightboxImages(){
let dom = new BrowserDomAdapter();
let images = dom.querySelector('img','.post-body');
console.log(images);
}
Run Code Online (Sandbox Code Playgroud)
更新
如果我在<img>变量中有标签,我如何从中获取图像?
export class Post{
post:Post;
@Input()
set data(data:any) {
this.post = new Post(data);
this.lightboxImages(this.post.content());
}
lightboxImages(content:any){
let images = content. ???
console.log(images);
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个状态栏标签,我想在StatusBar标签上显示一个文本仅3秒钟
如何在不使用线程的情况下完成?
public void InfoLabel(string value)
{
if (InvokeRequired)
{
this.Invoke(new Action<string>(InfoLabel), new object[] { value });
return;
}
infoLabel.Text = value;
}
Run Code Online (Sandbox Code Playgroud) 我正在制作一个客户端 - 服务器应用程序,所以我需要静默关闭远程PC ..我已经在命令提示关闭/?..但我仍然不知道执行以下命令的正确参数.
那么如何在没有(/ m)的情况下在本地执行这些命令?
void ShutDown(string cmd)
{
Process.Start("shutdown", cmd);
}
Run Code Online (Sandbox Code Playgroud)
提前致谢.
我无法添加System.Windows.Forms到我的WCF服务库.
我想List<ListViewItem>从我的方法返回一个GetItems(string path),我也尝试添加引用,System.Windows.Forms但没有发现它看起来像WCF服务库不支持它.
任何想法我怎么能这样做?
namespace WcfServiceLibrary1
{
[ServiceContract]
public interface IFileManager
{
[OperationContract]
List<ListViewItem> collection(string path);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的Item.cs班级:
namespace WcfServiceLibrary1
{
[DataContract]
public class Item
{
[DataMember]
public string name;
[DataMember]
public string path;
[DataMember]
public long size;
[DataMember]
public DateTime date;
}
}
Run Code Online (Sandbox Code Playgroud) 在ListViewItem WPF中显示项目的可能方法
更新:

那是我需要添加到ListView的控件,在这里我只需要显示计算机名,但该项目仍应包含计算机地址

稍后,我将需要具有表示文件和文件夹的项目的ListView,这些文件和文件夹将具有:名称,路径,大小,图标,IsFile属性。
所以这就是我现在要处理的,我卡在listView中,当我切换到WPF时我没想到会发生这种情况
我想使用 rxjs Observable 使用区间变量进行无限循环,因此我尝试在 rxjs 中重写此函数
takeAWalk(player){
setTimeout(() => {
console.log("Player is walking...");
takeAWalk(player);
}, getRandomDelayBetween(1000, 2500));
}
Run Code Online (Sandbox Code Playgroud)
我试过
Observable
.timer(0, getRandomDelayBetween(1000, 2500))
.take(10)
.timeInterval()
.subscribe(res=>{
console.log("player is walking ...");
});
Run Code Online (Sandbox Code Playgroud)
但是这个问题是有限到 10 并且间隔是常数(getRandomDelayBetween只调用一次)。
我应该使用哪些运算符来产生相同的函数takeAWalk功能?
我想隐藏一个StopWatch标签,当它等于0时,我怎么能用条件运算符呢?
using System;
using System.Diagnostics;
using System.Threading;
namespace FileTransfer_Socket_Client
{
class transferRate
{
static Stopwatch stopWatch = new Stopwatch();
public static void timeLeft()
{
Thread StimeLeft = new Thread(Start);
StimeLeft.Start();
}
private static void Start()
{
int rate = 0;
int left = 0;
int prevSum = 0;
stopWatch.Start();
while (fileTransfer.client.Connected)
{
if (fileTransfer.sum != 0)
{
rate = (fileTransfer.sum-prevSum)/1024;
left = ((fileTransfer.fileSize - fileTransfer.sum)/ 1024) / rate;
TimeSpan t = TimeSpan.FromSeconds(left);
Program.mainForm.AppendLabel(string.Format("{0}kb/s timeleft: {1:D2}:{2:D2}:{3:D2}", rate, t.Hours, t.Minutes, t.Seconds));
prevSum …Run Code Online (Sandbox Code Playgroud) 我有下面的代码(但不起作用)..我需要等到线程完成其工作然后执行然后下一个命令
private void btnPaste_Click(object sender, EventArgs e)
{
if (copiedItems != null)
{
if (copy)
{
System.Threading.Thread thPASTE = new System.Threading.Thread(PasteFromCopy);
thPASTE.Start(currAddress);
lock (this)
{
btnRefresh_Click(sender, e);
}
}
else
{
System.Threading.Thread thPASTE = new System.Threading.Thread(PasteFromMove);
thPASTE.Start(currAddress);
lock (this)
{
btnRefresh_Click(sender, e);
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
粘贴应该做一些代码,然后我应该刷新列表即时显示..我需要这样做,因为它不适用于我,当我调用线程中的刷新
我怎么办?