Example #1
0
        private static void ShowSpaceInfo(SyncExecution syncExec)
        {
            string sourceVolume = DriveHelper.GetSourceVolume(syncExec.SyncConfig);
            string destVolume   = DriveHelper.GetDestVolume(syncExec.SyncConfig);

            int  sourceAvailableSpace;
            int  destAvailableSpace;
            bool networkTransfer = false;

            if (sourceVolume.Contains(@"\\"))
            {
                sourceAvailableSpace = 0;
                networkTransfer      = true;
            }
            else
            {
                sourceAvailableSpace = DriveHelper.GetVolumeAvailableSpace(sourceVolume);
            }
            if (destVolume.Contains(@"\\"))
            {
                destAvailableSpace = 0;
                networkTransfer    = true;
            }
            else
            {
                destAvailableSpace = DriveHelper.GetVolumeAvailableSpace(destVolume);
            }

            if (!networkTransfer)
            {
                Console.WriteLine("\nRequired space on disk " + sourceVolume + ": " + syncExec.SpaceNeededInSource +
                                  "MB. Available space: "
                                  + sourceAvailableSpace + "MB");
                Console.WriteLine("Required space on disk " + destVolume + ": " + syncExec.SpaceNeededInDestination +
                                  "MB. Available space: "
                                  + destAvailableSpace + "MB");
                if (sourceAvailableSpace < syncExec.SpaceNeededInSource)
                {
                    Console.WriteLine(
                        "WARNING: there is not enough available space for synchronization to complete. Disk " +
                        sourceVolume);
                }
                if (destAvailableSpace < syncExec.SpaceNeededInDestination)
                {
                    Console.WriteLine(
                        "WARNING: there is not enough available space for synchronization to complete. Disk " +
                        destVolume);
                }
            }
        }