|
Hi All !!
Pls help....i dont know much of .NET and have been given an assignment to search files in a server according to filename and extension. The files are stored in StarTeam repository and we have to use a FileCollection object to store the files from Server and search it. I am able to connect to Server and find the directory where the files have been stored..But how to load them into FileCollection, i am not able to get..Please help...
I have written something like--->
<br />
private Borland.StarTeam.FileCollection filecol;<br />
private Borland.StarTeam.Server Server;<br />
private Borland.StarTeam.ServerAdministration ServAdmn;<br />
<br />
private Borland.StarTeam.Folder rtFolder = Server.Projects[0].Views[0].RootFolder;<br />
String strRootPath = rtFolder.Path;<br />
<br />
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("ServerIpAddress\\" + strRootPath + "\\" );
foreach (System.IO.FileInfo f in dir.GetFiles(filename))<br />
{ <br />
listBox1.Items.Add(f.Name);<br />
}<br />
<br />
Please help how to search files in remote system..Is there any other dedicated method other than System.IO.DirectoryInfo class method's that can fulfil the purpose...
Thanks in advace.
|
|
|
|
|
The remote server path would be formatted like this:
\\serverName\shareName\filePath
or you can use the servers IP address in place of serverName .
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I'm searching anyone who like to participate to a new open source project team core , if you are interset , please come here to know more:
http://simorgh.sepantahost.com
I like to discuss more:
m.farshadmehr@sepanta.com
|
|
|
|
|
It would have been nice, if you could have explained a few words about the project. Also, codeproject facilitates URLs to be hyperlinked by pasting it into the textbox.
|
|
|
|
|
|
I want to write a custome disassembler that process a file that comtains diffrent special symbols as seperators like (^,&,| etc.) and the result will be use to make a xml file, that i will furtur use for different purposes.
so has anyone ever done something like this? Can you shred some light for me? Or do you have any suggestion?
Please help and thanks for your input.
|
|
|
|
|
hi sweetdecember102
sorry for my bad english, i hope you unterstand me
you have to do 2 things: (for BizTalk 2006)
1. write a pipeline that receive the inputmessage. than manipulate it. (see code below)
2. write a disassembler that receive the manipulated message and create the xml message. (see code below)
Pipeline for manipulating the inputmessage. RemoveString and ReplaceStringOld are
properties in the class. you can change this properties in the admin console at runtime. this methode replace CR an LF from the inputmessage and return it.
///
/// Implements IComponent.Execute method.
///
/// <param name="pContext" />Pipeline context
/// <param name="pInMsg" />Input message
/// <returns>Original input message
/// <remarks>
/// IComponent.Execute method is used to initiate
/// the processing of the message in this pipeline component.
///
public Microsoft.BizTalk.Message.Interop.IBaseMessage Execute(Microsoft.BizTalk.Component.Interop.IPipelineContext pContext, Microsoft.BizTalk.Message.Interop.IBaseMessage pInMsg)
{
if (Enabled)
{
//Obtain the string of the original message
String inputMessage = string.Empty;
//System.Text.Encoding CurrentEncoding;
using (StreamReader streamReader = new StreamReader(pInMsg.BodyPart.Data, System.Text.Encoding.Default)) //.GetEncoding(this.Encoding)))
{
inputMessage = streamReader.ReadToEnd();
//CurrentEncoding = streamReader.CurrentEncoding;
}
if (RemoveString != null)
{
inputMessage = inputMessage.Replace(RemoveString, String.Empty);
}
if (ReplaceStringOld != null)
{
inputMessage = inputMessage.Replace(ReplaceStringOld, ReplaceStringNew);
}
if (RemoveCR)
{
inputMessage = inputMessage.Replace("\r", "");
}
if (RemoveLF)
{
inputMessage = inputMessage.Replace("\n", "");
}
MemoryStream origms = new MemoryStream(System.Text.Encoding.Default.GetBytes(inputMessage));
origms.Flush();
origms.Position = 0;
pInMsg.BodyPart.Data = origms;
}
return pInMsg;
}
this is the disassembler class methode that receive the manipulated message and return a XML document.
///
/// Builds the interchange from the messages that were added by the previous method.
/// Returns a pointer to the assembled message.
///
/// <param name="pContext" />the current pipeline context
/// <returns>the assembled message instance
public Microsoft.BizTalk.Message.Interop.IBaseMessage Assemble(Microsoft.BizTalk.Component.Interop.IPipelineContext pContext)
{
using (MemoryStream inMemoryStream = new MemoryStream())
{
XmlDocument xmlDocument = new XmlDocument();
Microsoft.BizTalk.Message.Interop.IBaseMessage inmsg = (Microsoft.BizTalk.Message.Interop.IBaseMessage)_inmsgs[0];
byte[] buffer = new byte[inmsg.BodyPart.Data.Length];
inmsg.BodyPart.Data.Read(buffer, 0, buffer.Length);
inMemoryStream.Write(buffer, 0, buffer.Length);
inMemoryStream.Seek(0, SeekOrigin.Begin);
xmlDocument.Load(inMemoryStream);
string messageType = xmlDocument.DocumentElement.NamespaceURI + "#" + xmlDocument.DocumentElement.LocalName;
IDocumentSpec documentSpec = pContext.GetDocumentSpecByType(messageType);
_ffAsmComp.DocumentSpecName = new Microsoft.BizTalk.Component.Utilities.SchemaWithNone(documentSpec.DocSpecStrongName);
}
return _ffAsmComp.Assemble(pContext);
}
regards
|
|
|
|
|
Respected sir /madam,
whic version of the .net compact frame work is needed for developing mobile applications and what are the other files neede with .net compact frame work.
sivakumar
|
|
|
|
|
|
I's like to have a dialog box to browse for folder and select folder path just like OpenFileDialog does for selecting files. ideal to browse network/unc path
The FolderBrowserDialog doesn't allow a user to type in a path, and is generally less usefull. What I'd like is what's used inside Visual Studio to select folders.
any help is appreciated
thanks
Mustafa
http://www.hostukdomain.com
|
|
|
|
|
Hi there,
I've been trying to use multithreading on a socket but without success. Here is what I want to do: I have a socket that is shared by two threads. One of them is continuously blocked on a Receive and the other one sends bytes (asynchronously) through the same socket. However, I can't do both things at the same time. If I have the first thread blocked on a Receive, when I use the other thread to send bytes I get an exception in the former thread saying something that an existing connection was forced to close by remote host...
Any help?
Thanks,
Spulit
|
|
|
|
|
Spulit wrote: and the other one sends bytes (asynchronously)
Post that part of the code.
led mike
|
|
|
|
|
Here is a simplified version ("buffer" is protected by a mutex). The receiving thread is a BackgroundWorker (readSocket method) which is fired over and over again until the thread is cancelled.
SocketRW::SocketRW(unsigned short int port_)
{
Port = port_;
socket = gcnew Socket(AddressFamily::InterNetwork,SocketType::Dgram,ProtocolType::Udp);
socket->Bind(gcnew IPEndPoint(IPAddress::Any, Port));
buffer = gcnew array<unsigned char="">(512);
worker = gcnew BackgroundWorker;
worker->WorkerSupportsCancellation = true;
worker->DoWork += gcnew DoWorkEventHandler(&(SocketRW::readSocket));
worker->RunWorkerCompleted += gcnew RunWorkerCompletedEventHandler(&(SocketRW::fireMsg));
}
void SocketRW::readSocket(Object^ sender, DoWorkEventArgs^ e)
{
int bytesrec;
try{
Array::Clear(buffer, 0, buffer->Length);
bytesrec = socket->Receive(buffer);
}
catch(Exception ^e)
{
// Whenever the other thread sends bytes through this socket, the Receive method above throws an System.Net.Sockets.SocketException with the message I posted above.
}
e->Result = bytesrec;
}
void SocketRW::fireMsg(Object^ sender, RunWorkerCompletedEventArgs^ e)
{
// do stuff with the message in "buffer"
// Need this in order to update the GUI with the correct thread
if (!e->Cancelled)
worker->RunWorkerAsync();
}
|
|
|
|
|
You have identified your problem. If you intend to use a single buffer for sending and receiving, then your receive must not block. Instead of causing the receive thread to not block, use separate buffers for reading and writing. Then you won't need a mutex to control access to the buffer.
Phil
|
|
|
|
|
Hi pbraun,
Thanks for your reply, but of course I'm not using the same buffer for sending and receiving. I just protect the receiving buffer because it is used in the BackgroundWorker method (for the Socket::Receive() method) and in the RunWorkerCompletedEventHandler (which runs in the main thread context, the same thread that is used to send bytes through the socket).
Thanks,
Spulit
|
|
|
|
|
Yeah, I have never really done any UDP but I don't think it works like a Stream socket. Take a look at this article[^] which uses two UdpClient objects, one for sending and one for receiving.
led mike
|
|
|
|
|
Hello,
I have a multiple instances that bind and listen to the same UDP (with same IP and Port #).
Is it possible to do that?
I set my UDP socket to REUSEADDRESS, but it seems only 1 instance receives the data. The rest are not.
Please help me,
Thanks,
nsutanto
|
|
|
|
|
We are presently upgrading from .Net 2003 to 2005. We have an application that invokes an FTP client asynchronously via a process component, redirecting standard output to a log file. In .Net 2003, all of standard output is redirected to the log file, however, in .Net 2005, only the commands we are passing to the ftp client are redirected to the log file. All of the FTP responses ie: “1000 bytes transmitted in 2 seconds”, etc. are not redirected to the log file.
The relevant lines of code are as follows:
Dim myProcess As New Process
myProcess.StartInfo.FileName = "FTP.exe"
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.Start()
Dim myStreamReader As StreamReader = myProcess.StandardOutput
Dim myStreamWriter As StreamWriter = File.AppendText(“myLog.txt”)
While Not sLine Is Nothing
myStreamWriter.WriteLine(sLine)
sLine = myStreamReader.ReadLine()
End While
myProcess.WaitForExit()
Does anyone know if changes were made with regard to the redirect of standard output for process components?
Thanks in advance for your replies.
|
|
|
|
|
Hi,
I have two projects in my project explorer which I would like to debug.The main project calls the other one with
Process.Start(new ProcessStartInfo(SubExe, Variables)
But when I set a breakpiont in my sub project and start the debugger I get the message
The breakpoint will not currently be hit. No symbols have been loaded for this document
I have alredy set the configuration to debug, deleted bin and obj folders with pdb and exe folders and rebuilt both projects. I would be very grateful for any suggestions
|
|
|
|
|
Close all instances of VisualStudio. Goto VSWebCache folder. Empty it. Now open the solution and Rebuild.
Sometimes the cache goes out of sync.
|
|
|
|
|
Thanks for the reply. But it doesn't work either
|
|
|
|
|
Perhaps it would be better to just start the process you want to debug and then use the debug process to hook into the thing you want to debug. If one of the projects you are trying to debug is a windows service, using the debug processes is a good way to debug.
Hope that helps.
Ben
|
|
|
|
|
Thats a good idea. The process I want to debug is expecting argumets from the caller procedure, but I think I can work around and this will work. Many Thaks.
|
|
|
|
|
It could also be that you set a breakpoint on a section of code that will never called. The debugger can figure this out when you start your app.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I place the breakpoint on a MessageBox which is displayed when I start the application but the breakpoint itself wont be hit
|
|
|
|