//***************************************************************************
        // Public Methods
        //
        public string GetList()
        {
            int longLen             = 0;
            StringCollection strCol = new StringCollection();

            string[] lns = this.txtItems.Text.Split(new char[] { ',', ';', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < lns.Length; i++)
            {
                if (chkDistinct.Checked)
                {
                    strCol.AddUnique(lns[i]);
                }
                else
                {
                    strCol.Add(lns[i]);
                }
                longLen = (int)System.Math.Max(longLen, lns[i].Length);
            }

            string retVal = "";

            lns = strCol.ToArray();
            for (int i = 0; i < lns.Length; i++)
            {
                string newVal = string.Format("{2}{3}{1}{0}{1}{4}",
                                              lns[i],
                                              (this.chkQuotes.Checked)
                                                ? "'"
                                                : "",
                                              (i > 0) ? "," : "",
                                              (this.chkCheckSpace.Checked)
                                                ? ((i > 0) ? " " : "")
                                                : "",
                                              (this.numLnBreak.Value > 0 && ((i + 1) % (int)numLnBreak.Value == 0))
                                                ? "\n"
                                                : "");
                if (this.chkAlign.Checked)
                {
                    newVal = newVal.PadLeft(longLen + ((this.chkCheckSpace.Checked) ? 1 : 0) + ((this.chkQuotes.Checked) ? 2 : 0) + ((this.numLnBreak.Value > 0 && ((i + 1) % (int)numLnBreak.Value == 0)) ? 1 : 0) + 1, ' ');
                }
                retVal += newVal;
            }

            return(retVal.TrimEnd(',', '\n'));
        }
示例#2
0
        internal SqlBrowserTreeView(ConnectionCollection connCol)
            : this()
        {
            this.BeginUpdate();
            try
            {
                RainstormStudios.Collections.StringCollection colDatasource = new StringCollection();
                for (int i = 0; i < connCol.Count; i++)
                {
                    colDatasource.AddUnique(rsData.GetDataSource(connCol[i].ConnectionString), i.ToString());
                }

                for (int i = 0; i < colDatasource.Count; i++)
                {
                    Connection cn = connCol[int.Parse(colDatasource.GetKey(i))];
                    if (rsDb.IsSQL(cn.ConnectionString, cn.DatabaseProvider))
                    {
                        TreeNode ndDb = new TreeNode(colDatasource[i]);
                        ndDb.Tag = new rsDbSql(cn.ConnectionString);
                        //ndDb.Name = cn.Name + "-" + cn.DatabaseProvider.ToString();
                        ndDb.Name = colDatasource[i];
                        ndDb.Nodes.Add("<EMPTY>");
                        ndDb.ImageIndex         = 1;
                        ndDb.SelectedImageIndex = 1;
                        ndDb.ContextMenuStrip   = this.mnuNdGroup;
                        this.Nodes.Add(ndDb);
                    }
                }
            }
            catch (Exception ex)
            {
                this.Nodes.Clear();
                this.Nodes.Add("An Error Occured:");
                this.Nodes.Add(ex.Message);
            }
            finally
            {
                this.EndUpdate();
            }
        }
示例#3
0
        //***************************************************************************
        // Public Methods
        // 
        public string GetList()
        {
            int longLen = 0;
            StringCollection strCol = new StringCollection();
            string[] lns = this.txtItems.Text.Split(new char[] { ',', ';', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < lns.Length; i++)
            {
                if (chkDistinct.Checked)
                    strCol.AddUnique(lns[i]);
                else
                    strCol.Add(lns[i]);
                longLen = (int)System.Math.Max(longLen, lns[i].Length);
            }

            string retVal = "";
            lns = strCol.ToArray();
            for (int i = 0; i < lns.Length; i++)
            {
                string newVal = string.Format("{2}{3}{1}{0}{1}{4}",
                                        lns[i],
                                        (this.chkQuotes.Checked)
                                                ? "'"
                                                : "",
                                        (i > 0) ? "," : "",
                                        (this.chkCheckSpace.Checked)
                                                ? ((i > 0) ? " " : "")
                                                : "",
                                        (this.numLnBreak.Value > 0 && ((i + 1) % (int)numLnBreak.Value == 0))
                                                ? "\n"
                                                : "");
                if (this.chkAlign.Checked)
                    newVal = newVal.PadLeft(longLen + ((this.chkCheckSpace.Checked) ? 1 : 0) + ((this.chkQuotes.Checked) ? 2 : 0) + ((this.numLnBreak.Value > 0 && ((i + 1) % (int)numLnBreak.Value == 0)) ? 1 : 0) + 1, ' ');
                retVal += newVal;
            }

            return retVal.TrimEnd(',', '\n');
        }