Beispiel #1
0
        public static void CopyDatabase(TimeSeriesDB source, TimeSeriesDB dest)
        {
            ChannelInfo[] sourceChannels = source.GetAllChannels();

            Console.WriteLine($"CopyDatabase source db channel count: {sourceChannels.Length}.");

            double Total   = sourceChannels.Length;
            double counter = 0;

            foreach (ChannelInfo ch in sourceChannels)
            {
                counter += 1;

                if (dest.ExistsChannel(ch.Object, ch.Variable))
                {
                    Channel srcChannel = source.GetChannel(ch.Object, ch.Variable);
                    Channel dstChannel = dest.GetChannel(ch.Object, ch.Variable);

                    var  sw    = Stopwatch.StartNew();
                    long count = CopyChannel(srcChannel, dstChannel);
                    sw.Stop();
                    string progress = string.Format("{0:0.0}%", 100.0 * counter / Total);
                    Console.WriteLine($"Copied {count} entries of channel {ch.Object} in {sw.ElapsedMilliseconds} ms ({progress})");
                }
            }
        }
Beispiel #2
0
 private bool ExistsChannel(VariableRef v)
 {
     return(db.ExistsChannel(v.Object.LocalObjectID, v.Name));
 }