|
Hi Friends
I have used SourceSafeTypeLib dll in Win32 folder to open a connection with VSS database and get the Latest of the file required.
But i am not aware of how to do the Check Out and Check in Process in using C#.
The code that i have used to Get the Latest version of the file is
IVSSDatabase m_DB;
string m_username;
ArrayList m_FileDetails = new ArrayList();
ArrayList m_UniqueFileDetails = new ArrayList();
string[] m_strPaths = new string[100];
int m_index = 0;
string result = Connect(@"C:\Documents and Settings\admin\My Documents\SampleDatabase\srcsafe.ini","pvs","pvs");
if(result=="Connected")
{
string result1 = GetLatest(@"$\Sample\Requirements\SRS",@"C:\Sample1\Requirements\SRS","pvs");
if(result1== "Completed")
{
MessageBox.Show("Successfully completed the task");
}
else if(result1 == "IVSSDatabase is null")
{
MessageBox.Show("Error while Getting the Latest");
}
}
else
{
MessageBox.Show("Cannot Establish Connection to Database Specified");
}
}
catch(Exception ex)
{
MessageBox.Show("Exception Raised");
MessageBox.Show(ex.ToString());
}
}
public string Connect(string databasePath, string username, string password)
{
m_DB = new VSSDatabaseClass();
try
{
m_DB.Open(databasePath,username,password);
}
catch(System.Runtime.InteropServices.COMException ex)
{
return ex.Message.ToString();
}
catch(Exception ex)
{
return ex.Message.ToString();
}
return "Connected";
}
public string GetLatest( string path, string localpath,string username )
{
m_username = username;
m_FileDetails.RemoveRange( 0, m_FileDetails.Count );
m_UniqueFileDetails.RemoveRange( 0, m_UniqueFileDetails.Count );
string strResult = "IVSSDatabase is null";
if( m_DB != null )
{
IVSSItem vitem = m_DB.get_VSSItem( path, false );
GetItems( path, localpath, vitem );
strResult = "Completed";
}
m_index = 0;
return strResult;
}
public void GetItems( string path, string localpath, IVSSItem item )
{
string temp = localpath;
if( item.Type == 1 ) // ignore if not project
{
}
else
{
IVSSItems ppItems;
ppItems = item.get_Items( false );
string strProj = item.Name;
foreach( IVSSItem childItem in ppItems )
{
localpath = temp;
string strUniquePath = localpath;
//m_index = 0;
string strname = childItem.Name;
string strPath = GetPaths( childItem );
string strC = strPath;
strC += "\\";
strC += strname;
localpath += strC;
string strLocalPath = localpath;
m_username = m_username.Replace(" ","");
strUniquePath += m_username;
strUniquePath += "\\";
strUniquePath += strC;
childItem.Get( ref strUniquePath, 0 ); // store as
// unique path
localpath = temp;
m_FileDetails.Add( strLocalPath );
m_UniqueFileDetails.Add( strUniquePath );
GetItems( path, localpath, childItem );
}
}
}
public string GetPaths( IVSSItem pItem )
{
string b;
string cStr = "";
IVSSItem pParent = pItem.Parent;
if( pParent != null )
{
b = pParent.Name;
if( b.Length > 0 )
{
cStr += b;
m_strPaths[m_index] = cStr;
m_index++;
GetPaths( pParent );
}
}
string strPath = "";
for( int i = m_index; i > 0; i -- )
{
strPath += "\\";
strPath += m_strPaths[ i - 1 ];
}
return strPath;
}
The above code snippet will get the latest from the VSS and creates the same folder structure as in VSS in a seperate path with user name added to the Folder Name in the Server itself from where the Files can be read and placed in the Clients machine. it works fine.
But i need to do a Check Out and Check in operation from VSS.
Do any of u aware of this operation using C#. Do post replies
Sriram
|
|
|
|
|
Isn't it just a question of finding the methods for check in and check out in the SourceSafe automation model and calling them? Or is it that you've looked and it's not obvious how to access them?
Kevin
|
|
|
|
|
I've looked at the methods in the SourceSafe automation model. I had some problem in accessing it while doing the Checkout and CheckIn process.
When i do the checkout i check for the file attribute to be readonly. While using the Checkout method by default the version in the VSS is updated in the local machine. I want to set a flag to control that operation. That is what the problem that i had
But now i have used the VSSFlag enum to control this.
Thanks for ur interest Kevin
Will post if i encounter any serious problem by doing it
Sriram
|
|
|
|
|
Hi Sreram,
when i tried this code i am facing the problem of {System.Runtime.InteropServices.ExternalException} = {"Invalid DOS path: D:\\Projects\\Test_Msbuild\\MSBUILD\\data\\um.dat"}
Do you have any idea how to solve this problem?
Thanks
Priya
km@ciber.com
|
|
|
|
|
I have some code which looks like this:
public class EnformaCubeUser : EnformaUser
{
EnformaCubeUser(System.Security.Principal.IPrincipal User)
{
base.New(User.Identity.Name);
}
}
Given that I know whether I am enforma or enforma-nx, as described in the initial comment, is there a way of changing the inheritance relationship of the EnformaCubeUser class according to the commented out lines using some devious reflection technique? (I am not permitted to modify the EnformaUser and EnformaPassport classes.)
Kevin
|
|
|
|
|
Actually, as things stand I could just compose references to EnformaUser and EnformaPassport and then decide which to instantiate. So simple! - unless I intend to re-use other functionality from these classes.
Still, I'm curious as to whether there's a solution to the original question.
Kevin
|
|
|
|
|
Can a datagrid row be scrollable- if the length of the row exceeds the datagrid length can we make that row srollable. if so .how please send me the code.
thank u
Uma
|
|
|
|
|
Hi Guys howz it?
hmmm I'm still a newbie pls help,I have been given a task to write a class which will be used to send emails and sms,I 've no Idea where to start,I tried to google just get working application but I dont understand some of the concepts,pls help.
Thanks.
|
|
|
|
|
Hello
Since you're new as you say, you must first know that reposting your question 3 mins apart is very rude in CP. Please delete your earlier post before you get fried by others.
To your issue, Sending mails through C# will need an SMPT server to send through, and you'd use the System.Net.Mail namespace. Check it in your MSDN
On the other hand sending sms would be similar yet a little more complicated. There are articles in CodeProject about it, and the portal is http://www.messagevista.com[^]
Search Code Project for "sms" ands "email". If you didn't come up with anything, come back. Making things too easy sometimes is not for your benefit.
Regards
|
|
|
|
|
Can't you just do email to sms?
Send an email to X@vtext.com where X is a Verizon cell phone number and it will be delivered as an SMS to the phone. There are similar email addresses for Sprint, Cingular, and T-Mobile. Probably for companies not in America as well. Just remember that you are limited to 160 characters.
|
|
|
|
|
How can some message be passed between window service and desktop application?
1. from service to desktop application. (am interested here most)
2. from desktop to service
|
|
|
|
|
Hi there,
My problem is that when my app executes the following code :
private void AddImageToList(string file)<br />
{<br />
this.image = Image.FromFile(file); <br />
this.thumbnailImage = this.image.GetThumbnailImage(100, 100, new Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);<br />
thumbnailImage.Tag = file;<br />
this.imageList.Add(this.thumbnailImage); <br />
}
..my program freezes and it takes 10-15 secs to continue, also when I use these thumbnails again performance reduces dramatically..
Is there anything I can do to increase my performance?
P.S: generally images I wish to load into thumbnails are ~500kb to 1.5Mb
.:: Something is Wrong ::.
|
|
|
|
|
Why do you need to store a thumbnail ? Why not just draw the image smaller to show a thumbnail ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Because I thought - while I am going to use these thumbnails repeatedly - instead of loading the image file and draw it smaller to a picturebox, storing the undersized images (thumbnails) in a List will more proper..
Isn't it ?
.:: Something is Wrong ::.
|
|
|
|
|
It is better that u use Graphics object to resize / to generate thumbnail
by using following properties
CompositingQuality = high
SmoothingMode = high
InterpolationMode = high
and then add Image/Bitmap to ur ImageList this will higher quality and faster
Cris ( Chintan Patel )
|
|
|
|
|
I am sure this will help but :
Graphics tempGraph = Graphics.FromImage(Image.FromFile(file));<br />
tempGraph.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed;<br />
tempGraph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
.. and the I try to create an Image but there is only a DrawImage() method in which all its overloads needs a location data (I mean the [x,y], Point or Rectangle) to draw..
Let me tell what I try to do exactly :
get image files within a directory
make these images thumbnails and put them in a List
when the user browse from the treeView in my application to a directory all thumbnails in the List will loaded to pictureboxes (they are created dynamically)..
It works cool but as I said the performance decreases dramatically when image files' size are big..
-- modified at 10:09 Thursday 17th August, 2006
.:: Something is Wrong ::.
|
|
|
|
|
hi
1- i want to deploy a project and i want to embed .net framework 2.0 in my setup.exe. how is it in vs 2005. i looked up msdn and found Bootstrapper but it is just for 2003. is it integrated in vs 2005?
2- when i set "FormBorderStyle" of a form to "FixedDialog", "FixedSingle" or "Fixed3D" the user is not able to resize it. but when user double click on the caption of the window it just go full screen! i think its not a fixedDialog property.
-- modified at 7:14 Thursday 17th August, 2006
|
|
|
|
|
Hello
1- Make a new "Setup Project".
Set the prerequisites from the settings of your setup project to include .Net framework
Check the "... same location as my application" radiobutton below.
2- Even if you make the BorderFrameStyle Fixed, you have to remove the maximize button from the title bar to prevent maximizing -MaximizeButton = false; -. And dialogs can not be maximized;)
Regards
|
|
|
|
|
but it just start downloading. i want .net framework to embed into the setup file. i have Dotnetfx.exe which is version 2.0. what should i do?
thanks
|
|
|
|
|
hamidreza_buddy wrote: what should i do?
Do some research.
[Hint: Try using NSIS and don't embed dotnetfx, just reference the file (makes the installer smaller), if the file doesn't exist (i.e. someone downloaded your installer, then provide the option to download it from MSDN]
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
Hello
I told you to set the location to "same location as my application". This way when you compile your program the setup project will make a subfolder for each prerequisite inside the output folder.
Regards
|
|
|
|
|
Hi all,
I'm very new to socket programming, this will probably come across in my question!
One of our partners provides a service to us over TCP/IP sockets. We can send them data over any number of sockets, while we're supposed to keep one socket open to receive data from them.
I have done the first part ok (us sending data to them), I can connect, login (a requirement of the service) and send them data, but I am struggling to set up the part where we receive. I want to create a Windows Service (although I'm testing with a console app) with a socket set to 'listen' (I think?!), which seems to be a bit more complicated.
The code is use to connect to send data looks like this (IP, port, username and password are all dummy values):
Socket mySocket, sServer = "1.1.1.1";
int iPort = 800;
IPHostEntry hostEntry = Dns.Resolve(sServer);
IPAddress[] ipAddresses = hostEntry.AddressList;
IPEndPoint hostEndPoint = new IPEndPoint(ipAddresses[0], iPort);
mySocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
//Connect
mySocket.Connect(hostEndPoint);
if (mySocket.Connected)
{
Encoding ASCII = Encoding.ASCII;
string sLogin = "open tx username password\n";
byte[] bytLogin = ASCII.GetBytes(sLogin);
byte[] bytRec = new byte[256];
mySocket.Send(bytLogin, bytLogin.Length, 0);
int iRec = mySocket.Receive(bytRec, bytRec.Length, 0);
string sRec = ASCII.GetString(bytRec, 0, iRec);
if (sRec == "OK\n")
{
//Successfully logged in.
}
}
Is anyone able to point me in the right direction. I'm thinking that maybe I should be using the Listen() method of the Socket class, but I'm really not sure. If I try to call that after logging in as above I get the exception, "The requested address is not valid in its context".
Any help would be greatly appreciated! Thanks,
Toby
|
|
|
|
|
PS Apologies, the error I actually get is, "A connect request was made on an already connected socket".
|
|
|
|
|
Look into BeginReceive / BeginRead async methods of the socket class. These are event driven. Once you have logged in and established connectivity to their server, call beginrecieve. You can pass this a delegate to call as soon as data starts arriving, and in the meantime, you can send data down the same socket.
If you want more info, I can post some snippets tonight.... (now + about 8 hours).
Regards
Malc
*********************************************
|
|
|
|
|
Malc,
Great, thanks for that, I shall have a look at those methods and see if I can get any further. If it's no trouble to post that code later then please do - there's every chance I'll still be confused tonight, and even if not it would be good to see a working example.
Thanks again,
Toby
|
|
|
|