Ejemplo n.º 1
0
        // 将另一对象的数组内容灌入本对象
        public void Import(dp2ServerCollection servers)
        {
            this.Clear();
            this.AddRange(servers);
            this.m_bChanged = true;

            // 新增加的动作
            dp2ServerChangedEventArgs e = new dp2ServerChangedEventArgs();

            e.Url = "";
            e.ServerChangeAction = dp2ServerChangeAction.Import;
            OnServerChanged(this, e);
        }
Ejemplo n.º 2
0
        // 克隆。
        // 新数组中的对象完全是新创建的。
        public dp2ServerCollection Dup()
        {
            dp2ServerCollection newServers = new dp2ServerCollection();

            for (int i = 0; i < this.Count; i++)
            {
                dp2Server newServer = new dp2Server((dp2Server)this[i]);
                newServers.Add(newServer);
            }

            newServers.m_strFileName = this.m_strFileName;
            newServers.m_bChanged    = this.m_bChanged;
            newServers.ownerForm     = this.ownerForm;

            return(newServers);
        }
Ejemplo n.º 3
0
        private void GetDp2ResDlg_Load(object sender, EventArgs e)
        {
            this.dp2ResTree1.Servers = this.Servers;	// 引用
            this.dp2ResTree1.Channels = this.dp2Channels;
            this.dp2ResTree1.EnabledIndices = this.EnabledIndices;  // new int[] { dp2ResTree.RESTYPE_DB };
            this.dp2ResTree1.Fill(null);

            this.m_bLoaded = true;

            if (String.IsNullOrEmpty(this.textBox_path.Text) == false)
            {
                this.dp2ResTree1.ExpandPath(this.textBox_path.Text);
            }

            if (this.EnableNotAsk == true)
                this.checkBox_notAsk.Enabled = true;

            if (this.AutoClose == true)
                API.PostMessage(this.Handle, WM_AUTO_CLOSE, 0, 0);

        }
Ejemplo n.º 4
0
        private void GetDp2ResDlg_Load(object sender, EventArgs e)
        {
            this.dp2ResTree1.Servers        = this.Servers;        // 引用
            this.dp2ResTree1.Channels       = this.dp2Channels;
            this.dp2ResTree1.EnabledIndices = this.EnabledIndices; // new int[] { dp2ResTree.RESTYPE_DB };
            this.dp2ResTree1.Fill(null);

            this.m_bLoaded = true;

            if (String.IsNullOrEmpty(this.textBox_path.Text) == false)
            {
                this.dp2ResTree1.ExpandPath(this.textBox_path.Text);
            }

            if (this.EnableNotAsk == true)
            {
                this.checkBox_notAsk.Enabled = true;
            }

            if (this.AutoClose == true)
            {
                API.PostMessage(this.Handle, WM_AUTO_CLOSE, 0, 0);
            }
        }
Ejemplo n.º 5
0
        // 从文件中装载创建一个ServerCollection对象
        // parameters:
        //		bIgnorFileNotFound	是否不抛出FileNotFoundException异常。
        //							如果==true,函数直接返回一个新的空ServerCollection对象
        // Exception:
        //			FileNotFoundException	文件没找到
        //			SerializationException	版本迁移时容易出现
        public static dp2ServerCollection Load(
            string strFileName,
            bool bIgnorFileNotFound)
        {
            dp2ServerCollection servers = null;

            try
            {
                using(Stream stream = File.Open(strFileName, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    BinaryFormatter formatter = new BinaryFormatter();

                    servers = (dp2ServerCollection)formatter.Deserialize(stream);
                    servers.m_strFileName = strFileName;
                    return servers;
                }
            }
            catch (FileNotFoundException ex)
            {
                if (bIgnorFileNotFound == false)
                    throw ex;

                servers = new dp2ServerCollection();
                servers.m_strFileName = strFileName;

                // 让调主有一个新的空对象可用
                return servers;
            }
        }
Ejemplo n.º 6
0
        // 将另一对象的数组内容灌入本对象
        public void Import(dp2ServerCollection servers)
        {
            this.Clear();
            this.AddRange(servers);
            this.m_bChanged = true;

            // 新增加的动作
            dp2ServerChangedEventArgs e = new dp2ServerChangedEventArgs();
            e.Url = "";
            e.ServerChangeAction = dp2ServerChangeAction.Import;
            OnServerChanged(this, e);

        }
Ejemplo n.º 7
0
        // 克隆。
        // 新数组中的对象完全是新创建的。
        public dp2ServerCollection Dup()
        {
            dp2ServerCollection newServers = new dp2ServerCollection();

            for (int i = 0; i < this.Count; i++)
            {
                dp2Server newServer = new dp2Server((dp2Server)this[i]);
                newServers.Add(newServer);
            }

            newServers.m_strFileName = this.m_strFileName;
            newServers.m_bChanged = this.m_bChanged;
            newServers.ownerForm = this.ownerForm;

            return newServers;
        }
Ejemplo n.º 8
0
        public ListViewBiblioLoader(LibraryChannelCollection channels,
            dp2ServerCollection servers,
            Stop stop,
            List<ListViewItem> items,
            Hashtable cacheTable)
        {
            m_loader = new BiblioLoader();
            m_loader.Channels = channels;
            m_loader.Servers = servers;
            m_loader.Stop = stop;
            m_loader.Format = "xml";
            m_loader.GetBiblioInfoStyle = GetBiblioInfoStyle.Timestamp; // 附加信息只取得 timestamp

            this.Items = items;
            this.CacheTable = cacheTable;
        }