.NET Forum / Visual Studio.NET / Source Safe / August 2007
SourceSafe clipboard format CF_SOURCESAFE available?
|
|
Thread rating:  |
SteveS - 03 Aug 2007 08:22 GMT As part of a release system, I'd like to be able to drag a list of checked out files from SourceSafe explorer onto my app's window, so that I can automatically populate a list. The user would fill in additional information in other controls on the window, and then the data is saved for later reporting, with the files being checked in by the application, rather than the user.
However, the IDataObject I get passed to my drop sink reports that only one clipboard format is supported. Is the format of the data documented anywhere?
My alternative is to have the user select one or more projects from the tree, and bring up a checklist of checked-out files they can select. I'd like to avoid this if possible.
The whole thing, by the way, is part of matching file changes to a change request, so that we can get reporting on what's been changed for a particular request, so that we know what needs to be built and shipped.
 Signature Steve S
WenYuan Wang [MSFT] - 03 Aug 2007 10:39 GMT Hello Steve,
What does your windows application developed against? Is it VS 2005?
In .net framework, all suported formater could be retrived by IDataObject.GetFormats Method. http://msdn2.microsoft.com/en-us/library/system.windows.forms.idataobject.ge tformats.aspx [IDataObject.GetFormats Method]
Under my test, if I drag an item from SourceSafe Explorer into winform application, CF_SOURCESAFE is the first item in the returned list (DataObject.GetFormats). e.Data.GetFormats() {Dimensions:[1]} [0]: "CF_SOURCESAFE"
I tried the following method. It seems works fine on my side. private void Form1_DragDrop(object sender, DragEventArgs e) { object o = e.Data.GetData("CF_SOURCESAFE"); }
Would you please try the above method and let me know if this is what you need. We are glad to assist you.
Thanks and Kind Regards, Wen Yuan Microsoft Online Community Support ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
SteveS - 03 Aug 2007 11:48 GMT > What does your windows application developed against? Is it VS 2005? > > Would you please try the above method and let me know if this is what you > need. We are glad to assist you. I'm developing using VC++ with both VS2005 and VS6, against VSS6.0d.
I have no problem in enumerating the available formats (there is only one!), or in getting a handle to (and then accessing) the data. However, this doesn't help me, as I don't have a definition of the data format. With VSS 6, it looks like there is a fixed block, followed by a fixed size block containing a project name, followed by a variable sized block which contain a series of nul-terminated item names, which is terminated by a zero-length item name.
I have not yet run against VSS2005 (although I plan to soon), so I thought I would see if there is an "official" version of this format I could use, rather than reverse engineering it. I suspect, for instance, that VSS2005 would put UNICODE names in the data, although I could be wrong, and it might even (probably should) register a different clipboad format.
Thanks
Steve S
WenYuan Wang [MSFT] - 06 Aug 2007 11:25 GMT Hello Steve,
I'm sorry I misunderstood your issue in my first reply. I misunderstood the issue as you need to retrieve all available formats. Actually, your issue is how to get a definition of the data format (CF_SOURCESAFE). If I misundertand the issue again, please recorrect me. Sorry again for this.
I'm afraid the CF_SOURCESAFE format is undocumented. However I will consult with VSS product team on this issue and reply you as soon as possible. Please wait me one more day. I will update here if I could get any useful information.
If you have any more concern on this, please feel free to let me know. It's my pleasure to work with you. Best regards, Wen Yuan Microsoft Online Community Support ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
WenYuan Wang [MSFT] - 07 Aug 2007 11:28 GMT Hello Steve Thanks for you wait.
I have consulted with VSS Product team today. They have confirmed the clipboard format is not publicly documented. However, we got some hint about the issue. Hope this helps.
VSS2005 does not use Unicode for names (the filenames are Ansi, as Unicode is supported only for file contents); the clipboard format is the same as in VSS6 (registered by name). In the fixed block we can find some information of interest like flags telling whether a project or files are dragged, whether the files belong to the same project, the number of files being dragged, the guid of the database, etc. Also note that Drag&Drop can be initiated while in search mode (in which case the files being dragged may not belong to the same project)
Please feel free to let me know you have any more concern on the issue. We are very glad to assist you. Best regards, Wen Yuan Microsoft Online Community Support ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
SteveS - 07 Aug 2007 12:38 GMT > Hello Steve > Thanks for you wait. [quoted text clipped - 17 lines] > Wen Yuan > Microsoft Online Community Support OK, thanks. If the format is the same in both, then I can examine the list at the end of the block to determine the items of interest. This will give me the names, and I can retrieve the status. I'm not sure how to determine the guid of the database, but for this usage, there is only one database, so that shouldn't be an issue.
Thanks for your help
Steve S
WenYuan Wang [MSFT] - 08 Aug 2007 11:49 GMT Hello Steve, Thanks for your reply.
I tried with ANSI encoding (VSS 2005), and got the string as below: "\0\0\0\0 \0\0\0 \0\0\0\0\0\0\0·] f̽ F? # \r$/ConsoleApplication47.root/ConsoleApplication47\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0$/ConsoleApplication47.root/ConsoleApplication47/ConsoleAp plication47.csproj\0$/ConsoleApplication47.root/ConsoleApplication47/Console Application47.csproj.vspscc\0$/ConsoleApplication47.root/ConsoleApplication4 7/ConsoleApplication47.sln\0\0"
It seems the path of each item is included in the last part of Data and separated by \0. We could get the name from each item. It seems the issue has been resolved. Is this what you need? Please let me know if you have any more concern on this. I'll follow up. It's my pleasure to work with you.
However, please notice this formate is undocumented and not suported.
Have a great day. Best regards, Wen Yuan Microsoft Online Community Support ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
SteveS - 08 Aug 2007 14:42 GMT > Hello Steve, > Thanks for your reply. [quoted text clipped - 20 lines] > > However, please notice this formate is undocumented and not suported. Thanks again. I did a little more digging and dumping, and I know that the format is roughly as follows:
DWORD unknown1; DWORD unknown2; DWORD nItems; DWORD unknown3; BYTE ssdbGuid[16]; char projectName[260]; // _MAX_PATH char itemNames[];
where itemNames is a nul-separated list of names, terminated by a zero length name. It might benefit me to know what the other DWORDs are, but I don't think it's essential for the utility I'm producing. It is handy, however, to know that the database GUID is contained at offset 0x44 in the UM.DAT file. :)
I appreciate that this is all undocumented (and most definitely not supported), but as is sometimes the case, if things change, it's likely that the code will get tossed out anyway!
Thanks again for your help.
Steve S
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|