コード例 #1
0
        // transfer data from a drive to a vessel
        public static bool Transfer(Drive drive, Vessel dst, bool samples)
        {
            double dataAmount  = drive.FilesSize();
            int    sampleSlots = drive.SamplesSize();

            if (dataAmount < double.Epsilon && (sampleSlots == 0 || !samples))
            {
                return(true);
            }

            // get drives
            var allDst = GetDrives(dst);

            bool allMoved = true;

            foreach (var b in allDst)
            {
                if (drive.Move(b, samples))
                {
                    allMoved = true;
                    break;
                }
            }

            return(allMoved);
        }
コード例 #2
0
        // transfer data between two vessels
        public static void Transfer(Vessel src, Vessel dst)
        {
            // get drives
            Drive a = DB.Vessel(src).drive;
            Drive b = DB.Vessel(dst).drive;

            // get size of data being transfered
            double amount = a.Size();

            // if there is data
            if (amount > double.Epsilon)
            {
                // transfer the data
                a.Move(b);

                // inform the user
                Message.Post
                (
                    Lib.BuildString(Lib.HumanReadableDataSize(amount), " of data transfered"),
                    Lib.BuildString("from <b>", src.vesselName, "</b> to <b>", dst.vesselName, "</b>")
                );
            }
        }
コード例 #3
0
        // transfer data between two vessels
        public static void Transfer(Vessel src, Vessel dst)
        {
            // get drives
            Drive a = DB.Vessel(src).drive;
            Drive b = DB.Vessel(dst).drive;

            // get size of data being transfered
            double amount = a.Size();

            // if there is data
            if (amount > double.Epsilon)
            {
                // transfer the data
                a.Move(b);

                // inform the user
                Message.Post
                (
                    Lib.BuildString(Lib.HumanReadableDataSize(amount), " ", Localizer.Format("#KERBALISM_Science_ofdatatransfer")),
                    Lib.BuildString(Localizer.Format("#KERBALISM_Generic_FROM"), " <b>", src.vesselName, "</b> ", Localizer.Format("#KERBALISM_Generic_TO"), " <b>", dst.vesselName, "</b>")
                );
            }
        }