Proprietà IVSSItem.Deleted

Ottiene o imposta un valore che indica se un determinato file o progetto è stato eliminato.

Spazio dei nomi: Microsoft.VisualStudio.SourceSafe.Interop
Assembly: Microsoft.VisualStudio.SourceSafe.Interop (in microsoft.visualstudio.sourcesafe.interop.dll)

Sintassi

'Dichiarazione
Property Deleted As Boolean
'Utilizzo
Dim instance As IVSSItem
Dim value As Boolean

value = instance.Deleted

instance.Deleted = value
bool Deleted { get; set; }
property bool Deleted {
    bool get ();
    void set ([InAttribute] bool pbDeleted);
}
/** @property */
boolean get_Deleted ()

/** @property */
void set_Deleted (/** @attribute InAttribute() */ boolean pbDeleted)
function get Deleted () : boolean

function set Deleted (pbDeleted : boolean)

Valore proprietà

true se il file o il progetto è contrassegnato come eliminato, altrimenti false.

Note

[IDL]

HRESULT Deleted ([out,retval]boolean *pbDeleted);

HRESULT Deleted ([in]boolean bDeleted);

La proprietà Deleted viene applicata sia ai file che ai progetti. Quando un progetto viene eliminato, vengono eliminati anche tutti i relativi file e sottoprogetti.

Esempio

Nell'esempio riportato di seguito viene illustrato come utilizzare la proprietà Deleted per verificare se la cartella del progetto e i file inclusi sono eliminati. Viene inoltre illustrato come eliminare un file, ovvero contrassegnarlo come "eliminato". A scopo di testing, il progetto TestFolder contiene un file eliminato, test1.txt, e due file che non sono eliminati, test2.txt e test3.txt. Il file test3.txt viene eliminato dal programma. All'avvio di Visual SourceSafe, il file test3.txt non verrà visualizzato in Gestione risorse Visual SourceSafe. Per eseguire nuovamente questo esempio, recuperare il file test3.txt in Gestione risorse Visual SourceSafe.

using System;
using Microsoft.VisualStudio.SourceSafe.Interop;

public class IVSSTest
{
    public static void Main()
    {
        // Create a VSSDatabase object.
        IVSSDatabase vssDatabase = new VSSDatabase();

        // Open a VSS database using network name for automatic user login.
        vssDatabase.Open(@"C:\VSSTestDB\srcsafe.ini", 
                         Environment.UserName, ""); 

        // Get IVSSItem references to project and files objects.
        VSSItem vssProject = vssDatabase.get_VSSItem("$/TestFolder", false);
        IVSSItem vssFile1 = 
                 vssDatabase.get_VSSItem("$/TestFolder/test1.txt", true);
        IVSSItem vssFile2 = 
                 vssDatabase.get_VSSItem("$/TestFolder/test2.txt", false);
        IVSSItem vssFile3 = 
                 vssDatabase.get_VSSItem("$/TestFolder/test3.txt", false);

        // Test whether or not the project and the files are deleted.
        if(vssProject.Deleted)            
            Console.WriteLine(vssProject.Name + " is deleted.");
        else    
            Console.WriteLine(vssProject.Name + " is not deleted.");
        if(vssFile1.Deleted)            
            Console.WriteLine(vssFile1.Name + " is deleted.");
        else    
            Console.WriteLine(vssFile1.Name + " is not deleted.");
        if(vssFile2.Deleted)
            Console.WriteLine(vssFile2.Name + " is deleted.");
        else    
            Console.WriteLine(vssFile2.Name + " is not deleted.");

        // Mark test3.txt as "Deleted". When you open SourceSafe
        // test3.txt will be deleted. Recover this file in
        // SourceSafe Explorer before running this example again.
        Console.WriteLine(vssFile3.Name + " is not deleted. Mark as deleted.");
        vssFile3.Deleted = true;
        Console.WriteLine(vssFile3.Name + " has been marked as deleted.");            
    }
}

Output:

TestFolder is not deleted.

test1.txt is deleted.

test2.txt is not deleted.

test3.txt is not deleted. Mark as deleted.

test3.txt has been marked as deleted.

Vedere anche

Riferimenti

Interfaccia IVSSItem
Membri IVSSItem
Spazio dei nomi Microsoft.VisualStudio.SourceSafe.Interop