Inheritance: System.EventArgs
 internal void OnDownloading(GettingEventArgs args)
 {
     if (null != Getting)
     {
         Getting(this, args);
     }
 }
        public static void vcServer_Getting(object sender, GettingEventArgs e)
        {
            string fileName = null;
            if (e.TargetLocalItem != null)
            {
                string dirName = Path.GetDirectoryName(e.TargetLocalItem);
                fileName = Path.GetFileName(e.TargetLocalItem);

                if (e.TargetLocalItem == dirName)
                {
                    fileName = e.TargetLocalItem;
                }
                else
                {
                    if (lastFolderDisplayed != dirName)
                    {
                        if (lastFolderDisplayed != null)
                        {
                            Utilities.OutputCommandString("");
                        }
                        Utilities.OutputCommandString(dirName);
                        lastFolderDisplayed = dirName;
                    }
                }
            }

            string str;
            string message = e.GetMessage(fileName, out str);
            switch (e.Status)
            {
                case OperationStatus.Conflict:
                case OperationStatus.SourceWritable:
                case OperationStatus.TargetLocalPending:
                case OperationStatus.TargetWritable:
                case OperationStatus.SourceDirectoryNotEmpty:
                case OperationStatus.TargetIsDirectory:
                case OperationStatus.UnableToRefresh:
                    Utilities.OutputCommandString("Warning: " + str);
                    return;

                case OperationStatus.Getting:
                case OperationStatus.Replacing:
                case OperationStatus.Deleting:
                    Utilities.OutputCommandString(message);
                    return;
            }
        }
Exemple #3
0
    public void MyGettingEventHandler(Object sender, GettingEventArgs e)
    {
        if (e.DeletionId != 0)
            {
                Console.WriteLine("deleting " + CanonicalPath(e.SourceLocalItem));
                return;
            }

        if ((!String.IsNullOrEmpty(e.TargetLocalItem))&&
                (!String.IsNullOrEmpty(e.SourceLocalItem))&&
                (e.SourceLocalItem != e.TargetLocalItem))
            Console.WriteLine("renaming " + CanonicalPath(e.TargetLocalItem));
        else
            Console.WriteLine("updating " + CanonicalPath(e.TargetLocalItem));

        if (e.ItemType == ItemType.Folder) return;
        fileList.Add(e.TargetLocalItem, e.Version);
    }
 private void OnGet(object sender, GettingEventArgs e)
 {
     Log.Debug(String.Format(
         "Status: '{0}',  ChangeType: '{1}', TargetLocalItem: '{2}' ServerItem: '{3}' Version: '{4}'",
         e.Status.ToString(), e.ChangeType.ToString(), e.TargetLocalItem, e.ServerItem, e.Version));
 }
Exemple #5
0
 /// <summary>
 /// Called as TFS retrieves files from the version control repository. The
 /// event is handled by writing information about the "get" operation to the
 /// console.
 /// </summary>
 /// <param name="sender">Source of the event</param>
 /// <param name="e">Specifics of the get operation</param>
 internal static void OnGetting(Object sender, GettingEventArgs e)
 {
     Console.WriteLine("Getting: {0}, status: {1}", e.TargetLocalItem, e.Status);
 }
Exemple #6
0
 /// <summary>
 /// metodo gestione on get
 /// </summary>
 /// <param name="sender">
 /// sendere sender
 /// </param>
 /// <param name="e">
 /// evento event
 /// </param>
 internal static void OnGetting(object sender, GettingEventArgs e)
 {
     Console.WriteLine("Getting: " + e.TargetLocalItem + ", status: " + e.Status);
 }
Exemple #7
0
        public GetStatus Get(GetRequest[] requests, GetOptions options, 
												 GetFilterCallback filterCallback, object userData)
        {
            bool force = ((GetOptions.Overwrite & options) == GetOptions.Overwrite);
            bool noGet = false; // not implemented below: ((GetOptions.Preview & options) == GetOptions.Preview);

            SortedList<int, DateTime> changesetDates = new SortedList<int, DateTime>();
            GetOperation[] getOperations = Repository.Get(Name, OwnerName, requests, force, noGet);
            if (null != filterCallback) filterCallback(this, getOperations, userData);

            UpdateLocalVersionQueue updates = new UpdateLocalVersionQueue(this);
            foreach (GetOperation getOperation in getOperations)
                {
                    string uPath = null;
                    GettingEventArgs args = new GettingEventArgs(this, getOperation);

                    // Console.WriteLine(getOperation.ToString());

                    if (getOperation.DeletionId != 0)
                        {
                            if ((getOperation.ItemType == ItemType.Folder)&&
                                    (Directory.Exists(getOperation.SourceLocalItem)))
                                {
                                    UnsetDirectoryAttributes(getOperation.SourceLocalItem);
                                    Directory.Delete(getOperation.SourceLocalItem, true);
                                }
                            else if ((getOperation.ItemType == ItemType.File)&&
                                             (File.Exists(getOperation.SourceLocalItem)))
                                {
                                    UnsetFileAttributes(getOperation.SourceLocalItem);
                                    File.Delete(getOperation.SourceLocalItem);
                                }
                        }
                    else if ((!String.IsNullOrEmpty(getOperation.TargetLocalItem))&&
                                     (!String.IsNullOrEmpty(getOperation.SourceLocalItem))&&
                                     (getOperation.SourceLocalItem != getOperation.TargetLocalItem))
                        {
                            uPath = getOperation.TargetLocalItem;
                            try
                                {
                                    File.Move(getOperation.SourceLocalItem, getOperation.TargetLocalItem);
                                }
                            catch (IOException)
                                {
                                    args.Status = OperationStatus.TargetIsDirectory;
                                }
                        }
                    else if (getOperation.ChangeType == ChangeType.None &&
                                     getOperation.VersionServer != 0)
                        {
                            uPath = getOperation.TargetLocalItem;
                            string directory = uPath;

                            if (getOperation.ItemType == ItemType.File)
                                directory = Path.GetDirectoryName(uPath);

                            if (!Directory.Exists(directory))
                                Directory.CreateDirectory(directory);

                            if (getOperation.ItemType == ItemType.File)
                                {
                                    DownloadFile.WriteTo(uPath, Repository, getOperation.ArtifactUri);

                                    // ChangesetMtimes functionality : none standard!
                                    if (mTimeSetting)
                                        {
                                            int cid = getOperation.VersionServer;
                                            DateTime modDate;

                                            if (!changesetDates.TryGetValue(cid, out modDate))
                                                {
                                                    Changeset changeset = VersionControlServer.GetChangeset(cid);
                                                    modDate = changeset.CreationDate;
                                                    changesetDates.Add(cid, modDate);
                                                }

                                            File.SetLastWriteTime(uPath, modDate);
                                        }

                                    // do this after setting the last write time!
                                    SetFileAttributes(uPath);
                                }
                        }

                    versionControlServer.OnDownloading(args);
                    updates.QueueUpdate(getOperation.ItemId, uPath, getOperation.VersionServer);
                }

            updates.Flush();
            return new GetStatus(getOperations.Length);
        }
Exemple #8
0
        public void MyGettingEventHandler(object sender, GettingEventArgs e)
        {
            string msg = String.Empty;
            if (e.DeletionId != 0)
                msg = String.Format("deleting {0}", e.SourceLocalItem);
            else
                {
                    if ((!String.IsNullOrEmpty(e.TargetLocalItem))&&
                            (!String.IsNullOrEmpty(e.SourceLocalItem))&&
                            (e.SourceLocalItem != e.TargetLocalItem))
                        msg = String.Format("renaming {0}", e.TargetLocalItem);
                    else
                        msg = String.Format("updating {0}", e.TargetLocalItem);
                }

            Pulse(msg);

            if (e.ItemType == ItemType.Folder) return;
            getLatestList.Add(e.TargetLocalItem);
        }
Exemple #9
0
        private void OnGet(object sender, GettingEventArgs e)
        {
            if (!String.IsNullOrEmpty(this.ResultFileSetRefId))
                this.ResultFileSet.Includes.Add(e.TargetLocalItem);
            this.ListOfFilesGotten.Add(e.TargetLocalItem);

            Level LogLevel = Level.Verbose;
            if (e.Status != OperationStatus.Replacing && e.Status != OperationStatus.Deleting && e.Status != OperationStatus.Getting)
            {
                LogLevel = Level.Error;
                this.Failed = true;
            }

            Log(LogLevel, "Status: '{0}',  ChangeType: '{1}', TargetLocalItem: '{2}' ServerItem: '{3}' Version: '{4}'", e.Status.ToString(), e.ChangeType.ToString(), e.TargetLocalItem, e.ServerItem, e.Version);
        }
 public void versionControl_Getting(object sender, GettingEventArgs e)
 {
     var status = ((GettingEventArgs)e);
 }
Exemple #11
0
        public GetStatus Get(GetRequest[] requests, GetOptions options,
                             GetFilterCallback filterCallback, object userData)
        {
            bool force = ((GetOptions.Overwrite & options) == GetOptions.Overwrite);
            bool noGet = false;             // not implemented below: ((GetOptions.Preview & options) == GetOptions.Preview);

            SortedList <int, DateTime> changesetDates = new SortedList <int, DateTime>();

            GetOperation[] getOperations = Repository.Get(Name, OwnerName, requests, force, noGet);
            if (null != filterCallback)
            {
                filterCallback(this, getOperations, userData);
            }

            UpdateLocalVersionQueue updates = new UpdateLocalVersionQueue(this);

            foreach (GetOperation getOperation in getOperations)
            {
                string           uPath = null;
                GettingEventArgs args  = new GettingEventArgs(this, getOperation);

                // Console.WriteLine(getOperation.ToString());

                if (getOperation.DeletionId != 0)
                {
                    if ((getOperation.ItemType == ItemType.Folder) &&
                        (Directory.Exists(getOperation.SourceLocalItem)))
                    {
                        UnsetDirectoryAttributes(getOperation.SourceLocalItem);
                        Directory.Delete(getOperation.SourceLocalItem, true);
                    }
                    else if ((getOperation.ItemType == ItemType.File) &&
                             (File.Exists(getOperation.SourceLocalItem)))
                    {
                        UnsetFileAttributes(getOperation.SourceLocalItem);
                        File.Delete(getOperation.SourceLocalItem);
                    }
                }
                else if ((!String.IsNullOrEmpty(getOperation.TargetLocalItem)) &&
                         (!String.IsNullOrEmpty(getOperation.SourceLocalItem)) &&
                         (getOperation.SourceLocalItem != getOperation.TargetLocalItem))
                {
                    uPath = getOperation.TargetLocalItem;
                    try
                    {
                        File.Move(getOperation.SourceLocalItem, getOperation.TargetLocalItem);
                    }
                    catch (IOException)
                    {
                        args.Status = OperationStatus.TargetIsDirectory;
                    }
                }
                else if (getOperation.ChangeType == ChangeType.None &&
                         getOperation.VersionServer != 0)
                {
                    uPath = getOperation.TargetLocalItem;
                    string directory = uPath;

                    if (getOperation.ItemType == ItemType.File)
                    {
                        directory = Path.GetDirectoryName(uPath);
                    }

                    if (!Directory.Exists(directory))
                    {
                        Directory.CreateDirectory(directory);
                    }

                    if (getOperation.ItemType == ItemType.File)
                    {
                        DownloadFile.WriteTo(uPath, Repository, getOperation.ArtifactUri);

                        // ChangesetMtimes functionality : none standard!
                        if (mTimeSetting)
                        {
                            int      cid = getOperation.VersionServer;
                            DateTime modDate;

                            if (!changesetDates.TryGetValue(cid, out modDate))
                            {
                                Changeset changeset = VersionControlServer.GetChangeset(cid);
                                modDate = changeset.CreationDate;
                                changesetDates.Add(cid, modDate);
                            }

                            File.SetLastWriteTime(uPath, modDate);
                        }

                        // do this after setting the last write time!
                        SetFileAttributes(uPath);
                    }
                }

                versionControlServer.OnDownloading(args);
                updates.QueueUpdate(getOperation.ItemId, uPath, getOperation.VersionServer);
            }

            updates.Flush();
            return(new GetStatus(getOperations.Length));
        }
 internal void OnDownloading(GettingEventArgs args)
 {
     if (null != Getting) Getting(this, args);
 }