Clear() публичный Метод

public Clear ( ) : void
Результат void
Пример #1
0
        private void updatecombo(ComboBox cb,
                                 System.Collections.Specialized.StringCollection strs,
                                 string t)
        {
            if (cb.Items.IndexOf(t) != 0)
            {
                // should save selection and cursor position here
                int ss = cb.SelectionStart;
                int sl = cb.SelectionLength;

                cb.Items.Remove(t);
                cb.Items.Insert(0, t);
                cb.Select(ss, sl);

                strs.Clear();

                foreach (string i in cb.Items)
                {
                    strs.Add(i);
                }

                Properties.Settings.Default.Save();
            }

            if (!cb.Text.Equals(t))
            {
                cb.Text = t;
            }
        }
Пример #2
0
 public void ReadSection(String Section, StringCollection Idents)
 {
     Byte[] Buffer = new Byte[16384];
     Idents.Clear();
     int bufLen = getPrivateProfileString(Section, null, null,
         Buffer, Buffer.GetUpperBound(0), filename);
     //��Section�����
     getStringsFromBuffer(Buffer, bufLen, Idents);
 }
Пример #3
0
        //Read the config file and decide whether a task can be started or not
        public static bool AllowToUpdate(DateTime curDateTime)
        {
            string[] list;
            DateTime dt = common.Consts.constNullDate;
            StringCollection aFields = new StringCollection();
            bool saveEncryption = common.configuration.withEncryption;
            common.configuration.withEncryption = false;
            aFields.Clear();
            aFields.Add("Holidays");
            if (GetConfig("UPDATEDATA", "updateTime", aFields) && IsHolidays(curDateTime, aFields[0])) return false;

            int idx = -1;
            while (true)
            {
                idx++;
                aFields.Clear();
                aFields.Add("range" + idx.ToString());
                if (!GetConfig("UPDATEDATA", "updateTime", aFields)) break;
                //"Start time"  "End Time"  "Dow,,Dow"
                list = common.system.String2List(aFields[0], ";");
                if (list.Length != 3)
                {
                    common.fileFuncs.WriteLog("Invalid config : " + aFields[0]);
                    return false;
                }
                //Start date
                if (common.dateTimeLibs.StringToDateTime(list[0], out dt))
                {
                    if (curDateTime < dt) continue;
                }
                //End date
                if (common.dateTimeLibs.StringToDateTime(list[1], out dt))
                {
                    if (curDateTime > dt) continue;
                }
                //dayOfWeek
                string[] dow = common.system.String2List(list[2]);
                if (dow.Length > 0 && !dow.Contains(curDateTime.DayOfWeek.ToString().Substring(0, 3))) continue;
                return true;
            }
            return false;
        }
        /// <summary>
        /// Identifies the commands exposed by a bundle represented by the "packageZipFilePath"
        /// </summary>
        /// <param name="packageZipFilePath">Path to the zip file of the bundle</param>
        /// <param name="localCommands">Returns the local commands identified from packagecontents.xml</param>
        /// <param name="globalCommands">Returns the global commands identified from packagecontents.xml</param>
        public static void FindListedCommands(String packageZipFilePath, ref StringCollection localCommands, ref StringCollection globalCommands)
        {
            String tempPath = System.IO.Path.GetTempPath();
            if (File.Exists(packageZipFilePath))
            {
                using (System.IO.Compression.ZipArchive za = System.IO.Compression.ZipFile.OpenRead(packageZipFilePath))
                {
                    foreach (ZipArchiveEntry entry in za.Entries)
                    {
                        if (entry.FullName.EndsWith("PackageContents.xml", StringComparison.OrdinalIgnoreCase))
                        {
                            Directory.CreateDirectory(Path.GetDirectoryName(Path.Combine(tempPath, entry.FullName)));
                            String packageContentsXmlFilePath = Path.Combine(tempPath, entry.FullName);

                            if (File.Exists(packageContentsXmlFilePath))
                                File.Delete(packageContentsXmlFilePath);

                            entry.ExtractToFile(packageContentsXmlFilePath);

                            localCommands.Clear();
                            globalCommands.Clear();

                            System.IO.TextReader tr = new System.IO.StreamReader(packageContentsXmlFilePath);
                            using (System.Xml.XmlReader reader = System.Xml.XmlReader.Create(tr))
                            {
                                while (reader.ReadToFollowing("Command"))
                                {
                                    reader.MoveToFirstAttribute();
                                    if (reader.Name.Equals("Local"))
                                        localCommands.Add(reader.Value);
                                    else if (reader.Name.Equals("Global"))
                                        globalCommands.Add(reader.Value);

                                    while (reader.MoveToNextAttribute())
                                    {
                                        if (reader.Name.Equals("Local"))
                                            localCommands.Add(reader.Value);
                                        else if (reader.Name.Equals("Global"))
                                            globalCommands.Add(reader.Value);
                                    }
                                }
                            }
                            tr.Close();

                            break;
                        }
                    }
                }
            }
        }
Пример #5
0
        public void Test01()
        {
            StringCollection sc;

            // simple string values
            string[] values =
            {
                "",
                " ",
                "a",
                "aa",
                "text",
                "     spaces",
                "1",
                "$%^#",
                "2222222222222222222222222",
                System.DateTime.Today.ToString(),
                Int32.MaxValue.ToString()
            };


            // [] StringCollection.IsReadOnly should return false
            //-----------------------------------------------------------------

            sc = new StringCollection();

            // [] on empty collection
            //
            if (sc.IsReadOnly)
            {
                Assert.False(true, string.Format("Error, returned true for empty collection"));
            }

            // [] on filled collection
            //

            sc.Clear();
            sc.AddRange(values);
            if (sc.Count != values.Length)
            {
                Assert.False(true, string.Format("Error, count is {0} instead of {1}", sc.Count, values.Length));
            }
            if (sc.IsReadOnly)
            {
                Assert.False(true, string.Format("Error, returned true for filled collection"));
            }
        }
        /// <summary>
        /// Terminate instances.
        /// </summary>
        public void TerminateInstances()
        {
            string serviceName = this.name.Substring(this.name.LastIndexOf(".", StringComparison.OrdinalIgnoreCase) + 1);
            string query = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM MSBTS_ServiceInstance WHERE ServiceClass = {0} and ServiceStatus > 2 AND ServiceName = '{1}'", 1, serviceName);
            using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(new ManagementScope(@"root\MicrosoftBizTalkServer"), new WqlObjectQuery(query), null))
            {
                if (searcher.Get().Count > 0)
                {
                    StringCollection instanceIds = new StringCollection();
                    StringCollection serviceClassIds = new StringCollection();
                    StringCollection serviceTypeIds = new StringCollection();
                    string hostName = string.Empty;
                    int instanceCount = 0;
                    foreach (ManagementObject obj2 in searcher.Get())
                    {
                        if (string.IsNullOrEmpty(hostName))
                        {
                            hostName = obj2["HostName"].ToString();
                        }

                        // This seems to be a magic number, carried over from original source (it is un-documented)
                        if (instanceCount > 1999)
                        {
                            TerminateServiceInstancesByID(hostName, instanceIds, serviceClassIds, serviceTypeIds);
                            instanceCount = 0;
                            serviceClassIds.Clear();
                            serviceTypeIds.Clear();
                            instanceIds.Clear();
                        }

                        serviceClassIds.Add(obj2["ServiceClassId"].ToString());
                        serviceTypeIds.Add(obj2["ServiceTypeId"].ToString());
                        instanceIds.Add(obj2["InstanceID"].ToString());
                        instanceCount++;
                    }

                    if (serviceClassIds.Count > 0)
                    {
                        TerminateServiceInstancesByID(hostName, instanceIds, serviceClassIds, serviceTypeIds);
                    }
                }
            }
        }
Пример #7
0
        // Load stock list specified in the user's portfolio
        protected void LoadPortfolioStock()
        {
            StringCollection stockList = new StringCollection();
            TreeNode node;

            data.baseDS.portfolioDataTable portfolioTbl = new data.baseDS.portfolioDataTable();
            portfolioTbl.Clear();
            myStockCodeTbl.Clear();
            dataLibs.LoadPortfolioByInvestor(portfolioTbl, sysLibs.sysLoginCode, AppTypes.PortfolioTypes.Portfolio);
            stockTV.Nodes.Clear();
            DataView myStockView = new DataView(myStockCodeTbl);
            data.baseDS.stockCodeRow stockRow;
            myStockView.Sort = myStockCodeTbl.codeColumn.ColumnName;

            StringCollection list = new StringCollection();
            for (int idx1 = 0; idx1 < portfolioTbl.Count; idx1++)
            {
                node = stockTV.Nodes.Add(portfolioTbl[idx1].name);

                list.Clear();
                list.Add(portfolioTbl[idx1].code);
                myStockCodeTbl.Clear();
                if (portfolioTbl[idx1].type == (byte)AppTypes.PortfolioTypes.WatchList)
                    dataLibs.LoadStockCode_ByWatchList(myStockCodeTbl, list);
                else
                    dataLibs.LoadStockCode_ByPortfolios(myStockCodeTbl, list);

                stockList.Clear();
                for (int idx2 = 0; idx2 < myStockView.Count; idx2++)
                {
                    stockRow = (data.baseDS.stockCodeRow)myStockView[idx2].Row;  
                    //Ignore duplicate stocks
                    if (stockList.Contains(stockRow.tickerCode)) continue;
                    stockList.Add(stockRow.tickerCode);
                    node.Nodes.Add(stockRow.tickerCode);
                }
                node.Text = node.Text + "(" + node.Nodes.Count.ToString() + ")";
                node.ExpandAll();
            }
        }
Пример #8
0
    public static int TextHasErrors(ref HyperComponents.WebUI.CustomSpellChecker.SpellChecker c, string v)
    {
        System.Collections.Specialized.StringCollection badWords = new System.Collections.Specialized.StringCollection();
        BadWord badWord = null;

        badWords.Clear();
        //check some text.
        c.Check(v);
        int nbErrors = 0;

        //iterate through all bad words in the text.
        while ((badWord = c.NextBadWord()) != null)
        {
            if (badWords.IndexOf(badWord.Word) < 0)
            {
                //Trace.Warn("          -> " + badWord.Word + " - " + badWord.Reason.ToString());
                nbErrors++;
                badWords.Add(badWord.Word);
            }
        }
        return(nbErrors);
    }
Пример #9
0
        public static bool Load_Local_UserSettings_CHART()
        {
            decimal d = 0;
            //Color page
            StringCollection aFields = new StringCollection();
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysChartBgColor }));
            aFields.Add(common.system.GetName(new { Settings.sysChartFgColor }));
            aFields.Add(common.system.GetName(new { Settings.sysChartGridColor }));
            aFields.Add(common.system.GetName(new { Settings.sysChartVolumesColor }));

            aFields.Add(common.system.GetName(new { Settings.sysChartLineCandleColor }));

            aFields.Add(common.system.GetName(new { Settings.sysChartBearCandleColor }));
            aFields.Add(common.system.GetName(new { Settings.sysChartBearBorderColor }));

            aFields.Add(common.system.GetName(new { Settings.sysChartBullCandleColor }));
            aFields.Add(common.system.GetName(new { Settings.sysChartBullBorderColor }));

            aFields.Add(common.system.GetName(new { Settings.sysChartBarDnColor }));
            aFields.Add(common.system.GetName(new { Settings.sysChartBarUpColor }));
            if (!GetLocalUserConfig("ChartColors", aFields)) return false;

            if (aFields[0].Trim() != "") Settings.sysChartBgColor = ColorTranslator.FromHtml(aFields[0]);
            if (aFields[1].Trim() != "") Settings.sysChartFgColor = ColorTranslator.FromHtml(aFields[1]);
            if (aFields[2].Trim() != "") Settings.sysChartGridColor = ColorTranslator.FromHtml(aFields[2]);
            if (aFields[3].Trim() != "") Settings.sysChartVolumesColor = ColorTranslator.FromHtml(aFields[3]);

            if (aFields[4].Trim() != "") Settings.sysChartLineCandleColor = ColorTranslator.FromHtml(aFields[4]);

            if (aFields[5].Trim() != "") Settings.sysChartBearCandleColor = ColorTranslator.FromHtml(aFields[5]);
            if (aFields[6].Trim() != "") Settings.sysChartBearBorderColor = ColorTranslator.FromHtml(aFields[6]);

            if (aFields[7].Trim() != "") Settings.sysChartBullCandleColor = ColorTranslator.FromHtml(aFields[7]);
            if (aFields[8].Trim() != "") Settings.sysChartBullBorderColor = ColorTranslator.FromHtml(aFields[8]);

            if (aFields[9].Trim() != "") Settings.sysChartBarDnColor = ColorTranslator.FromHtml(aFields[9]);
            if (aFields[10].Trim() != "") Settings.sysChartBarUpColor = ColorTranslator.FromHtml(aFields[10]);

            //Chart page
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysChartShowDescription }));
            aFields.Add(common.system.GetName(new { Settings.sysChartShowVolume }));
            aFields.Add(common.system.GetName(new { Settings.sysChartShowGrid }));
            aFields.Add(common.system.GetName(new { Settings.sysChartShowLegend }));

            aFields.Add(common.system.GetName(new { Charts.Settings.sysZoom_Percent }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysZoom_MinCount }));

            aFields.Add(common.system.GetName(new { Charts.Settings.sysPAN_MovePercent }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysPAN_MoveMinCount}));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysPAN_MouseRate }));

            aFields.Add(common.system.GetName(new { Charts.Settings.sysNumberOfPoint_DEFA }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysNumberOfPoint_MIN }));
            
            aFields.Add(common.system.GetName(new { Charts.Settings.sysViewMinBarAtLEFT }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysViewMinBarAtRIGHT }));

            aFields.Add(common.system.GetName(new { Charts.Settings.sysChartMarginLEFT }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysChartMarginRIGHT}));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysChartMarginTOP }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysChartMarginBOT }));

            aFields.Add(common.system.GetName(new { Charts.Settings.sysViewSpaceAtLEFT }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysViewSpaceAtRIGHT}));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysViewSpaceAtTOP}));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysViewSpaceAtBOT}));

            if (!GetLocalUserConfig("ChartSettings", aFields)) return false;

            Settings.sysChartShowDescription = (aFields[0].Trim() == Boolean.TrueString);
            Settings.sysChartShowVolume = (aFields[1].Trim() == Boolean.TrueString);
            Settings.sysChartShowGrid = (aFields[2].Trim() == Boolean.TrueString);
            Settings.sysChartShowLegend = (aFields[3].Trim() == Boolean.TrueString);

            if (common.system.String2Number_Common(aFields[4], out d)) Charts.Settings.sysZoom_Percent = (int)d;
            if (common.system.String2Number_Common(aFields[5], out d)) Charts.Settings.sysZoom_MinCount = (int)d;

            if (common.system.String2Number_Common(aFields[6], out d)) Charts.Settings.sysPAN_MovePercent = (int)d;
            if (common.system.String2Number_Common(aFields[7], out d)) Charts.Settings.sysPAN_MoveMinCount = (int)d;
            if (common.system.String2Number_Common(aFields[8], out d)) Charts.Settings.sysPAN_MouseRate = (int)d;

            if (common.system.String2Number_Common(aFields[9], out d)) Charts.Settings.sysNumberOfPoint_DEFA = (int)d;
            if (common.system.String2Number_Common(aFields[10], out d)) Charts.Settings.sysNumberOfPoint_MIN = (int)d;

            if (common.system.String2Number_Common(aFields[11], out d)) Charts.Settings.sysViewMinBarAtLEFT = (int)d;
            if (common.system.String2Number_Common(aFields[12], out d)) Charts.Settings.sysViewMinBarAtRIGHT = (int)d;

            if (common.system.String2Number_Common(aFields[13], out d)) Charts.Settings.sysChartMarginLEFT = (int)d;
            if (common.system.String2Number_Common(aFields[14], out d)) Charts.Settings.sysChartMarginRIGHT = (int)d;
            if (common.system.String2Number_Common(aFields[15], out d)) Charts.Settings.sysChartMarginTOP = (int)d;
            if (common.system.String2Number_Common(aFields[16], out d)) Charts.Settings.sysChartMarginBOT = (int)d;

            if (common.system.String2Number_Common(aFields[17], out d)) Charts.Settings.sysViewSpaceAtLEFT = (int)d;
            if (common.system.String2Number_Common(aFields[18], out d)) Charts.Settings.sysViewSpaceAtRIGHT = (int)d;
            if (common.system.String2Number_Common(aFields[19], out d)) Charts.Settings.sysViewSpaceAtTOP = d;
            if (common.system.String2Number_Common(aFields[20], out d)) Charts.Settings.sysViewSpaceAtBOT = d;
            return true;
        }
Пример #10
0
 public static bool Save_Local_UserSettings_STOCK()
 {
     //Systen tab 
     StringCollection aFields = new StringCollection();
     StringCollection aValues = new StringCollection();
     aFields.Clear();
     aFields.Add(common.system.GetName(new { Settings.sysStockMaxBuyQtyPerc }));
     aFields.Add(common.system.GetName(new { Settings.sysStockReduceQtyPerc }));
     aFields.Add(common.system.GetName(new { Settings.sysStockAccumulateQtyPerc }));
     aFields.Add(common.system.GetName(new { Settings.sysStockTotalCapAmt }));
     aFields.Add(common.system.GetName(new { Settings.sysStockMaxBuyAmtPerc }));
     aValues.Clear();
     aValues.Add(common.system.Number2String_Common(Settings.sysStockMaxBuyQtyPerc));
     aValues.Add(common.system.Number2String_Common(Settings.sysStockReduceQtyPerc));
     aValues.Add(common.system.Number2String_Common(Settings.sysStockAccumulateQtyPerc));
     aValues.Add(common.system.Number2String_Common(Settings.sysStockTotalCapAmt));
     aValues.Add(common.system.Number2String_Common(Settings.sysStockMaxBuyAmtPerc));
     return SaveLocalUserConfig("STOCK", aFields, aValues);
 }
Пример #11
0
        public static bool Load_Local_UserSettings_STOCK()
        {
            //Systen tab 
            StringCollection aFields = new StringCollection();
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysStockMaxBuyQtyPerc }));
            aFields.Add(common.system.GetName(new { Settings.sysStockReduceQtyPerc }));
            aFields.Add(common.system.GetName(new { Settings.sysStockAccumulateQtyPerc }));
            aFields.Add(common.system.GetName(new { Settings.sysStockTotalCapAmt }));
            aFields.Add(common.system.GetName(new { Settings.sysStockMaxBuyAmtPerc }));
            if (!GetLocalUserConfig("STOCK", aFields)) return false;

            decimal d = 0; 
            if (common.system.String2Number_Common(aFields[0], out d)) Settings.sysStockMaxBuyQtyPerc = d;
            if (common.system.String2Number_Common(aFields[1], out d)) Settings.sysStockReduceQtyPerc = d;
            if (common.system.String2Number_Common(aFields[2], out d)) Settings.sysStockAccumulateQtyPerc = d;
            if (common.system.String2Number_Common(aFields[3], out d)) Settings.sysStockTotalCapAmt = d;
            if (common.system.String2Number_Common(aFields[4], out d)) Settings.sysStockMaxBuyAmtPerc = d;
            return true;
        }
        private StringCollection ValidateExistence()
        {
            StringCollection validfiles = new StringCollection();
            StringCollection invalidfiles = new StringCollection();

            // remove all invalid log files
            foreach (string filename in XmlLogs)
            {
                if (File.Exists(filename))
                {
                    FileInfo fi = new FileInfo(filename);
                    validfiles.Add(fi.FullName.ToLower());
                }
                else
                {
                    invalidfiles.Add(filename);
                }
            }
            xmlLogs.Clear();
            foreach (string filename in validfiles)
            {
                if (!xmlLogs.Contains(filename))
                {
                    xmlLogs.Add(filename);
                }
            }
            validfiles.Clear();

            // remove all invalid req table files
            foreach (string filename in RequirementTables)
            {
                if (File.Exists(filename))
                {
                    FileInfo fi = new FileInfo(filename);
                    validfiles.Add(fi.FullName.ToLower());
                }
                else
                {
                    invalidfiles.Add(filename);
                }
            }
            requirementTables.Clear();
            foreach (string filename in validfiles)
            {
                if (!requirementTables.Contains(filename))
                {
                    requirementTables.Add(filename);
                }
            }
            return invalidfiles;
        }
Пример #13
0
        public static bool Save_User_Envir()
        {
            StringCollection aFields = new StringCollection();
            StringCollection aValues = new StringCollection();

            aFields.Clear(); aValues.Clear();
            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysLoginAccount }));
            aValues.Add(commonClass.SysLibs.sysLoginAccount);
            return common.configuration.SaveConfiguration(Settings.sysFileUserConfig, "Environment", "", aFields, aValues, false);
        }
Пример #14
0
        public static bool Load_Local_UserSettings_SYSTEM2()
        {
            StringCollection aFields = new StringCollection();
            //Company
            aFields.Clear();
            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysCompanyName }));
            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysCompanyAddr1 }));
            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysCompanyAddr2 }));
            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysCompanyAddr3 }));

            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysCompanyPhone }));
            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysCompanyFax }));
            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysCompanyEmail }));
            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysCompanyURL }));
            if (GetLocalUserConfig("Investor", aFields))
            {
                commonClass.SysLibs.sysCompanyName = aFields[0].ToString();
                commonClass.SysLibs.sysCompanyAddr1 = aFields[1].ToString();
                commonClass.SysLibs.sysCompanyAddr2 = aFields[2].ToString();
                commonClass.SysLibs.sysCompanyAddr3 = aFields[3].ToString();

                commonClass.SysLibs.sysCompanyPhone = aFields[4].ToString();
                commonClass.SysLibs.sysCompanyFax = aFields[5].ToString();
                commonClass.SysLibs.sysCompanyEmail = aFields[6].ToString();
                commonClass.SysLibs.sysCompanyURL = aFields[7].ToString();
            }
            //Image and Icon
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysImgFilePathBackGround })); 
            aFields.Add(common.system.GetName(new { Settings.sysImgFilePathIcon }));
            aFields.Add(common.system.GetName(new { Settings.sysImgFilePathCompanyLogo1 }));
            aFields.Add(common.system.GetName(new { Settings.sysImgFilePathCompanyLogo2 }));
            if (GetLocalUserConfig("Others", aFields))
            {
                Settings.sysImgFilePathBackGround = common.fileFuncs.MakeRelativePath(aFields[0].ToString());
                Settings.sysImgFilePathIcon = common.fileFuncs.MakeRelativePath(aFields[1].ToString());
                Settings.sysImgFilePathCompanyLogo1 = common.fileFuncs.MakeRelativePath(aFields[2].ToString());
                Settings.sysImgFilePathCompanyLogo2 = common.fileFuncs.MakeRelativePath(aFields[3].ToString());
            }
            return true; 
        }
Пример #15
0
        //From database
        public static bool Load_Global_Settings(ref GlobalSettings settings)
        {
            int num;
            StringCollection aFields = new StringCollection();
            // System
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.WriteLogAccess }));
            aFields.Add(common.system.GetName(new { settings.PasswordMinLen }));
            aFields.Add(common.system.GetName(new { settings.UseStrongPassword }));
            if (!GetConfig(ref aFields)) return false;

            if (int.TryParse(aFields[0], out num)) settings.WriteLogAccess = (AppTypes.SyslogMedia)num;
            if (int.TryParse(aFields[1], out num)) settings.PasswordMinLen = (byte)num;
            if (aFields[2].Trim() != "") settings.UseStrongPassword = (aFields[2] == Boolean.TrueString);

            // Data count
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.DayScanForLastPrice }));
            aFields.Add(common.system.GetName(new { settings.AlertDataCount }));
            aFields.Add(common.system.GetName(new { settings.ChartMaxLoadCount_FIRST }));
            aFields.Add(common.system.GetName(new { settings.ChartMaxLoadCount_MORE }));
            if (!GetConfig(ref aFields)) return false;
            
            if (aFields[0].Trim() != "" & int.TryParse(aFields[0], out num)) settings.DayScanForLastPrice = (short)num;
            if (aFields[1].Trim() != "" & int.TryParse(aFields[1], out num)) settings.AlertDataCount = (short)num;
            if (aFields[2].Trim() != "" & int.TryParse(aFields[2], out num)) settings.ChartMaxLoadCount_FIRST = (short)num;
            if (aFields[3].Trim() != "" & int.TryParse(aFields[3], out num)) settings.ChartMaxLoadCount_MORE = (short)num;


            //Auto key
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.DataKeyPrefix }));
            aFields.Add(common.system.GetName(new { settings.DataKeySize }));
            aFields.Add(common.system.GetName(new { settings.AutoEditKeySize }));
            aFields.Add(common.system.GetName(new { settings.TimeOut_AutoKey }));
            if(!GetConfig(ref aFields)) return false;
            if (aFields[0].Trim() != "") settings.DataKeyPrefix = aFields[0].Trim();
            if (int.TryParse(aFields[1], out num)) settings.DataKeySize = num;
            if (int.TryParse(aFields[2], out num)) settings.AutoEditKeySize = num;
            if (int.TryParse(aFields[3], out num)) settings.TimeOut_AutoKey = num;

            //Email
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.smtpAddress }));
            aFields.Add(common.system.GetName(new { settings.smtpPort }));
            aFields.Add(common.system.GetName(new { settings.smtpAuthAccount }));
            aFields.Add(common.system.GetName(new { settings.smtpAuthPassword }));
            aFields.Add(common.system.GetName(new { settings.smtpSSL}));
            if (!GetConfig(ref aFields)) return false;

            if (aFields[0].Trim() != "") settings.smtpAddress = aFields[0];
            if (aFields[1].Trim() != "" & int.TryParse(aFields[1], out num)) settings.smtpPort = num;
            settings.smtpAuthAccount = aFields[2].Trim();
            settings.smtpAuthPassword = aFields[3].Trim();
            settings.smtpSSL = (aFields[4].Trim() == Boolean.TrueString);

            //Default
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.DefautLanguage }));
            aFields.Add(common.system.GetName(new { settings.DefaultTimeRange }));
            aFields.Add(common.system.GetName(new { settings.DefaultTimeScaleCode }));
            aFields.Add(common.system.GetName(new { settings.ScreeningTimeScaleCode }));

            aFields.Add(common.system.GetName(new { settings.AlertDataCount}));
            aFields.Add(common.system.GetName(new { settings.ScreeningDataCount}));

            if (!GetConfig(ref aFields)) return false;

            if (aFields[0].Trim() != "") settings.DefautLanguage = AppTypes.Code2Language(aFields[0].Trim());
            if (aFields[1].Trim() != "") settings.DefaultTimeRange = AppTypes.TimeRangeFromCode(aFields[1]);
            if (aFields[2].Trim() != "") settings.DefaultTimeScaleCode = aFields[2];
            if (aFields[3].Trim() != "") settings.ScreeningTimeScaleCode = aFields[3];

            if (aFields[4].Trim() != "" & int.TryParse(aFields[4], out num)) settings.AlertDataCount = (short)num;
            if (aFields[5].Trim() != "" & int.TryParse(aFields[5], out num)) settings.ScreeningDataCount = (short)num;

            //Timming 
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.TimerIntervalInSecs }));
            aFields.Add(common.system.GetName(new { settings.RefreshDataInSecs }));
            aFields.Add(common.system.GetName(new { settings.CheckAlertInSeconds }));
            aFields.Add(common.system.GetName(new { settings.AutoCheckInSeconds }));
            if (!GetConfig(ref aFields)) return false;

            if (aFields[0].Trim() != "" & int.TryParse(aFields[0], out num)) settings.TimerIntervalInSecs = (short)num;
            if (aFields[1].Trim() != "" & int.TryParse(aFields[1], out num)) settings.RefreshDataInSecs = (short)num;
            if (aFields[2].Trim() != "" & int.TryParse(aFields[2], out num)) settings.CheckAlertInSeconds = (short)num;
            if (aFields[3].Trim() != "" & int.TryParse(aFields[3], out num)) settings.AutoCheckInSeconds = (short)num;
            return true;
        }
Пример #16
0
        private void WriteUserSettings()
        {
            try
            {
                if (!System.IO.Directory.Exists(appSettingsDir))
                    System.IO.Directory.CreateDirectory(appSettingsDir);

                string dataLoadSettings = Path.Combine(appSettingsDir, "DataLoad.ini");
                if (System.IO.File.Exists(dataLoadSettings))
                    System.IO.File.Delete(dataLoadSettings);

                //DevExpress.Utils.OptionsLayoutBase.FullLayout.
                gridViewSummary.SaveLayoutToXml(Path.Combine(appSettingsDir, SUMMARY_GRID_SETTINGS));
                gridViewRqmt.SaveLayoutToXml(Path.Combine(appSettingsDir, RQMT_GRID_SETTINGS));
                gridViewConfirm.SaveLayoutToXml(Path.Combine(appSettingsDir, CONFIRM_GRID_SETTINGS));
                dockManager.SaveLayoutToXml(Path.Combine(appSettingsDir, DOCK_MGR_SETTINGS));
                barmgrBrowser.SaveLayoutToXml(Path.Combine(appSettingsDir, BROWSER_BAR_SETTINGS));

                inboundPnl1.SaveGridSettings();

                Sempra.Ops.IniFile iniFile = new Sempra.Ops.IniFile(FileNameUtils.GetUserIniFileName(appSettingsDir));
                Sempra.Ops.IniFile iniFileDataLoad = new Sempra.Ops.IniFile(dataLoadSettings);

                iniFile.WriteValue(FORM_NAME, "TradeDataPanel_Width", dpTradeData.Width);
                iniFile.WriteValue(FORM_NAME, "TradeDataPanel_Height", dpTradeData.Height);
                iniFile.WriteValue(FORM_NAME, "BrowserAppsPanel_Width", dpBrowserApps.Width);
                iniFile.WriteValue(FORM_NAME, "BrowserAppsPanel_Height", dpBrowserApps.Height);
                iniFile.WriteValue(FORM_NAME, "VaultedDocsPanel_Width", dpVaultDocViewer.Width);
                iniFile.WriteValue(FORM_NAME, "VaultedDocsPanel_Height", dpVaultDocViewer.Height);
                iniFile.WriteValue(FORM_NAME, "InboundQueuePanel_Width", dpInboundQueue.Width);
                iniFile.WriteValue(FORM_NAME, "InboundQueuePanel_Height", dpInboundQueue.Height);
                iniFile.WriteValue(FORM_NAME, "InboundViewerPanel_Width", dpInboundViewer.Width);
                iniFile.WriteValue(FORM_NAME, "InboundViewerPanel_Height", dpInboundViewer.Height);

                iniFile.WriteValue(FORM_NAME, "MainPanel_Height", panelContainerMain.Height);


                //5/19/09 Israel - Make sure if minimized when closed it doesn't write those settings here.
                if (this.WindowState != FormWindowState.Minimized)
                {
                    iniFile.WriteValue(FORM_NAME, "Top", this.Top);
                    iniFile.WriteValue(FORM_NAME, "Left", this.Left);
                    iniFile.WriteValue(FORM_NAME, "Width", this.Width);
                    iniFile.WriteValue(FORM_NAME, "Height", this.Height);
                }

                //iniFile.WriteValue(FORM_NAME, "SplitterInboundPosition", splitterInbound.SplitterPosition);
                iniFile.WriteValue(FORM_NAME, "TradeDataSplitter_Height", splitContainerTradeData.Height);
                iniFile.WriteValue(FORM_NAME, "TradeDataSplitter_Position", splitContainerTradeData.SplitterPosition);
                iniFile.WriteValue(FORM_NAME, "RqmtSplitter_Height", splitContainerRqmt.Height);
                iniFile.WriteValue(FORM_NAME, "RqmtSplitter_Position", splitContainerRqmt.SplitterPosition);

                //iniFile.WriteValue("Preferences", "SempraCompanyId", sempraCompanyId);
                iniFile.WriteValue("Preferences", "Skin", defaultLookAndFeel.LookAndFeel.SkinName.ToString());
                iniFile.WriteValue("Preferences", "SaveToExcelDirectory", saveToExcelDirectory);
                iniFile.WriteValue("Preferences", "AutoDisplayDealsheet", userPrefsForm.cedAutoDispDealsheet.Checked);
                //iniFile.WriteValue("Preferences", "SaveToNewExcelFormat", userPrefsForm.cedSaveToNewExcelFormat.Checked);

                iniFile.WriteValue("FilterSettings", "ShowNewBusiness", barChkNB.Checked);
                iniFile.WriteValue("FilterSettings", "ReadyForFinalApproval", barChkRFA.Checked);
                iniFile.WriteValue("FilterSettings", "HasProblems", barChkHP.Checked);

                int faIndex = barEditFAComboBox.Items.IndexOf(barEditFA.EditValue);
                iniFile.WriteValue("FilterSettings", "FinalApproved", faIndex);
                iniFile.WriteValue("FilterSettings", "MostRecentUserDefined", GetMostRecentUserFilterIndex());

                iniFile.WriteValue("PanelVisibility", "TradeData", barChkTradeData.Checked);
                //iniFile.WriteValue("PanelVisibility", "VaultedDocs", barChkVaultedDocs.Checked);
                iniFile.WriteValue("PanelVisibility", "InboundQueue", barChkInboundQueue.Checked);
                iniFile.WriteValue("PanelVisibility", "InboundViewer", barChkInboundViewer.Checked);
                iniFile.WriteValue("PanelVisibility", "BrowserApps", barChkBrowserApps.Checked);
                //iniFile.WriteValue("PanelVisibility", "VaultedDocsPanel", barChkVaultedDocsPanel.Checked);

                iniFile.WriteValue("PanelVisibility", "CustomFilterPanel", barChkCustomFilterPanel.Checked);
                iniFile.WriteValue("PanelVisibility", "GridFilterPanel", barChkGridFilterPanel.Checked);
                iniFile.WriteValue("PanelVisibility", "GroupFilterPanel", barChkGridGroupPanel.Checked);

                StringCollection list = new StringCollection();
                for (int i = 0; i < userPrefsForm.cklbxSeCptySn.Items.Count; i++)
                {
                    if (userPrefsForm.cklbxSeCptySn.Items[i].CheckState == CheckState.Checked)
                    {
                        list.Add(userPrefsForm.cklbxSeCptySn.Items[i].Value.ToString());
                    }
                }
                iniFileDataLoad.WriteValue(LOAD_SEMPRA_COMPANY, list);

                list.Clear();
                for (int i = 0; i < userPrefsForm.cklbxCdtyGrp.Items.Count; i++)
                {
                    if (userPrefsForm.cklbxCdtyGrp.Items[i].CheckState == CheckState.Checked)
                    {
                        list.Add(userPrefsForm.cklbxCdtyGrp.Items[i].Value.ToString());
                    }
                }
                iniFileDataLoad.WriteValue(LOAD_CDTY_GROUP, list);
            }
            catch (Exception error)
            {
                throw new Exception("An error occurred while saving user settings to: " + appSettingsDir + "." + Environment.NewLine +
                     "Error CNF-013 in " + FORM_NAME + ".WriteUserSettings(): " + error.Message);
            }
        }
Пример #17
0
 private void GetStringsFromBuffer(Byte[] Buffer, int bufLen, StringCollection Strings)
 {
     Strings.Clear();
     if (bufLen != 0)
     {
         int start = 0;
         for (int i = 0; i < bufLen; i++)
         {
             if ((Buffer[i] == 0) && ((i - start) > 0))
             {
                 String s = Encoding.GetEncoding(0).GetString(Buffer, start, i - start);
                 Strings.Add(s);
                 start = i + 1;
             }
         }
     }
 }
		/// <summary>
		/// Enumerates IAdaptorSelector classes and creates one
		/// instance into list of possible selectors
		/// </summary>
		public static void EnumAdaptorSelectors()
		{
			StringCollection cache = new StringCollection();

			// Since basic GetType already searches in mscorlib we can safely put it as already done
			cache.Add ("mscorlib");
			
			GetSelectorsInReferencedAssemblies (Assembly.GetEntryAssembly(), cache);
			cache.Clear();
			cache = null;
		}
Пример #19
0
		internal string RTLReplace (Regex regex, string input, MatchEvaluator evaluator, int count, int startat)
		{
			Match m = Scan (regex, input, startat, input.Length);
			if (!m.Success)
				return input;

			int ptr = startat;
			int counter = count;
#if NET_2_1
			var pieces = new System.Collections.Generic.List<string> ();
#else
			StringCollection pieces = new StringCollection ();
#endif
			
			pieces.Add (input.Substring (ptr));

			do {
				if (count != -1)
					if (counter-- <= 0)
						break;
				if (m.Index + m.Length > ptr)
					throw new SystemException ("how");
				pieces.Add (input.Substring (m.Index + m.Length, ptr - m.Index - m.Length));
				pieces.Add (evaluator (m));

				ptr = m.Index;
				m = m.NextMatch ();
			} while (m.Success);

			StringBuilder result = new StringBuilder ();

			result.Append (input, 0, ptr);
			for (int i = pieces.Count; i > 0; )
				result.Append (pieces [--i]);

			pieces.Clear ();

			return result.ToString ();
		}
Пример #20
0
        public static bool Save_Local_UserSettings_CHART()
        {
            //Systen tab 
            StringCollection aFields = new StringCollection();
            StringCollection aValues = new StringCollection();
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysChartBgColor }));
            aFields.Add(common.system.GetName(new { Settings.sysChartFgColor }));
            aFields.Add(common.system.GetName(new { Settings.sysChartGridColor }));
            aFields.Add(common.system.GetName(new { Settings.sysChartVolumesColor }));

            aFields.Add(common.system.GetName(new { Settings.sysChartLineCandleColor }));

            aFields.Add(common.system.GetName(new { Settings.sysChartBearCandleColor }));
            aFields.Add(common.system.GetName(new { Settings.sysChartBearBorderColor }));

            aFields.Add(common.system.GetName(new { Settings.sysChartBullCandleColor }));
            aFields.Add(common.system.GetName(new { Settings.sysChartBullBorderColor }));

            aFields.Add(common.system.GetName(new { Settings.sysChartBarDnColor }));
            aFields.Add(common.system.GetName(new { Settings.sysChartBarUpColor }));

            aValues.Clear();
            aValues.Add(ColorTranslator.ToHtml(Settings.sysChartBgColor));
            aValues.Add(ColorTranslator.ToHtml(Settings.sysChartFgColor));
            aValues.Add(ColorTranslator.ToHtml(Settings.sysChartGridColor));
            aValues.Add(ColorTranslator.ToHtml(Settings.sysChartVolumesColor));

            aValues.Add(ColorTranslator.ToHtml(Settings.sysChartLineCandleColor));

            aValues.Add(ColorTranslator.ToHtml(Settings.sysChartBearCandleColor));
            aValues.Add(ColorTranslator.ToHtml(Settings.sysChartBearBorderColor));

            aValues.Add(ColorTranslator.ToHtml(Settings.sysChartBullCandleColor));
            aValues.Add(ColorTranslator.ToHtml(Settings.sysChartBullBorderColor));

            aValues.Add(ColorTranslator.ToHtml(Settings.sysChartBarDnColor));
            aValues.Add(ColorTranslator.ToHtml(Settings.sysChartBarUpColor));
            if (!SaveLocalUserConfig("ChartColors", aFields, aValues)) return false;

            //Chart page
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysChartShowDescription }));
            aFields.Add(common.system.GetName(new { Settings.sysChartShowVolume }));
            aFields.Add(common.system.GetName(new { Settings.sysChartShowGrid }));
            aFields.Add(common.system.GetName(new { Settings.sysChartShowLegend }));

            aFields.Add(common.system.GetName(new { Charts.Settings.sysZoom_Percent }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysZoom_MinCount}));

            aFields.Add(common.system.GetName(new { Charts.Settings.sysPAN_MovePercent }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysPAN_MoveMinCount }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysPAN_MouseRate }));

            aFields.Add(common.system.GetName(new { Charts.Settings.sysNumberOfPoint_DEFA }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysNumberOfPoint_MIN }));

            aFields.Add(common.system.GetName(new { Charts.Settings.sysViewMinBarAtLEFT }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysViewMinBarAtRIGHT }));

            aFields.Add(common.system.GetName(new { Charts.Settings.sysChartMarginLEFT }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysChartMarginRIGHT }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysChartMarginTOP }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysChartMarginBOT }));

            aFields.Add(common.system.GetName(new { Charts.Settings.sysViewSpaceAtLEFT }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysViewSpaceAtRIGHT }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysViewSpaceAtTOP }));
            aFields.Add(common.system.GetName(new { Charts.Settings.sysViewSpaceAtBOT }));

            aValues.Clear();
            aValues.Add(Settings.sysChartShowDescription.ToString());
            aValues.Add(Settings.sysChartShowVolume.ToString());
            aValues.Add(Settings.sysChartShowGrid.ToString());
            aValues.Add(Settings.sysChartShowLegend.ToString());

            aValues.Add(common.system.Number2String_Common(Charts.Settings.sysZoom_Percent));
            aValues.Add(common.system.Number2String_Common(Charts.Settings.sysZoom_MinCount));

            aValues.Add(common.system.Number2String_Common(Charts.Settings.sysPAN_MovePercent));
            aValues.Add(common.system.Number2String_Common(Charts.Settings.sysPAN_MoveMinCount));
            aValues.Add(common.system.Number2String_Common(Charts.Settings.sysPAN_MouseRate));

            aValues.Add(common.system.Number2String_Common(Charts.Settings.sysNumberOfPoint_DEFA));
            aValues.Add(common.system.Number2String_Common(Charts.Settings.sysNumberOfPoint_MIN));

            aValues.Add(common.system.Number2String_Common(Charts.Settings.sysViewMinBarAtLEFT));
            aValues.Add(common.system.Number2String_Common(Charts.Settings.sysViewMinBarAtRIGHT));

            aValues.Add(common.system.Number2String_Common(Charts.Settings.sysChartMarginLEFT));
            aValues.Add(common.system.Number2String_Common(Charts.Settings.sysChartMarginRIGHT));
            aValues.Add(common.system.Number2String_Common(Charts.Settings.sysChartMarginTOP));
            aValues.Add(common.system.Number2String_Common(Charts.Settings.sysChartMarginBOT));

            aValues.Add(common.system.Number2String_Common(Charts.Settings.sysViewSpaceAtLEFT));
            aValues.Add(common.system.Number2String_Common(Charts.Settings.sysViewSpaceAtRIGHT));
            aValues.Add(common.system.Number2String_Common((decimal)Charts.Settings.sysViewSpaceAtTOP));
            aValues.Add(common.system.Number2String_Common((decimal)Charts.Settings.sysViewSpaceAtBOT));

            if (!SaveLocalUserConfig("ChartSettings", aFields, aValues)) return false;
            return true;
        }
Пример #21
0
        public static bool Load_Local_UserSettings_SYSTEM1()
        {
            StringCollection aFields = new StringCollection();

            //Format
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysMaskGeneralValue }));
            aFields.Add(common.system.GetName(new { Settings.sysMaskLocalAmt }));
            aFields.Add(common.system.GetName(new { Settings.sysMaskForeignAmt }));
            aFields.Add(common.system.GetName(new { Settings.sysMaskPercent }));
            aFields.Add(common.system.GetName(new { Settings.sysMaskQty }));
            aFields.Add(common.system.GetName(new { Settings.sysMaskPrice }));
            if (!GetLocalUserConfig("Format", aFields)) return false; 

            if (aFields[0].Trim() != "") Settings.sysMaskGeneralValue = aFields[2];
            if (aFields[1].Trim() != "") Settings.sysMaskLocalAmt = aFields[2];
            if (aFields[2].Trim() != "") Settings.sysMaskForeignAmt = aFields[2];
            if (aFields[3].Trim() != "") Settings.sysMaskPercent = aFields[3];
            if (aFields[4].Trim() != "") Settings.sysMaskQty = aFields[4];
            if (aFields[5].Trim() != "") Settings.sysMaskPrice = aFields[5];

            //Color
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_Increase_BG }));
            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_Increase_FG }));

            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_Decrease_BG }));
            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_Decrease_FG }));

            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_NotChange_BG }));
            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_NotChange_FG }));
            if (!GetLocalUserConfig("Color", aFields)) return false; ;

            if (aFields[0].Trim() != "") Settings.sysPriceColor_Increase_BG = ColorTranslator.FromHtml(aFields[0]);
            if (aFields[1].Trim() != "") Settings.sysPriceColor_Increase_FG = ColorTranslator.FromHtml(aFields[1]);

            if (aFields[2].Trim() != "") Settings.sysPriceColor_Decrease_BG = ColorTranslator.FromHtml(aFields[2]);
            if (aFields[3].Trim() != "") Settings.sysPriceColor_Decrease_FG = ColorTranslator.FromHtml(aFields[3]);

            if (aFields[4].Trim() != "") Settings.sysPriceColor_NotChange_BG = ColorTranslator.FromHtml(aFields[4]);
            if (aFields[5].Trim() != "") Settings.sysPriceColor_NotChange_FG = ColorTranslator.FromHtml(aFields[5]);

            //System
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysLanguage }));
            aFields.Add(common.system.GetName(new { Settings.sysAutoRefreshData}));
            if (!GetLocalUserConfig("System", aFields)) return false; ;
            Settings.sysLanguage = AppTypes.Code2Language(aFields[0].Trim());
            Settings.sysAutoRefreshData = aFields[1].Trim() != Boolean.FalseString;
            return true;
        }
Пример #22
0
 public static bool GetDefaultFormState(string formName,bool nullAsTrue)
 {
     StringCollection aFields = new StringCollection();
     aFields.Clear();
     aFields.Add(formName);
     if (!GetLocalUserConfig("DefaultForms", aFields)) return nullAsTrue; 
     return (aFields[0]!=Boolean.FalseString);
 }
Пример #23
0
        public static bool Save_Local_UserSettings_SYSTEM1()
        {
            StringCollection aFields = new StringCollection();
            StringCollection aValues = new StringCollection();

            //Format
            aFields.Clear();

            aFields.Add(common.system.GetName(new { Settings.sysMaskGeneralValue }));
            aFields.Add(common.system.GetName(new { Settings.sysMaskLocalAmt }));
            aFields.Add(common.system.GetName(new { Settings.sysMaskForeignAmt }));
            aFields.Add(common.system.GetName(new { Settings.sysMaskPercent }));
            aFields.Add(common.system.GetName(new { Settings.sysMaskQty }));
            aFields.Add(common.system.GetName(new { Settings.sysMaskPrice }));

            aValues.Clear();
            aValues.Add(Settings.sysMaskGeneralValue);
            aValues.Add(Settings.sysMaskLocalAmt);
            aValues.Add(Settings.sysMaskForeignAmt);
            aValues.Add(Settings.sysMaskPercent);
            aValues.Add(Settings.sysMaskQty);
            aValues.Add(Settings.sysMaskPrice);
            if (!SaveLocalUserConfig("Format", aFields, aValues)) return false; ;

            //Color
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_Increase_BG }));
            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_Increase_FG }));

            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_Decrease_BG }));
            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_Decrease_FG }));

            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_NotChange_BG }));
            aFields.Add(common.system.GetName(new { Settings.sysPriceColor_NotChange_FG }));

            aValues.Clear();
            aValues.Add(ColorTranslator.ToHtml(Settings.sysPriceColor_Increase_BG));
            aValues.Add(ColorTranslator.ToHtml(Settings.sysPriceColor_Increase_FG));

            aValues.Add(ColorTranslator.ToHtml(Settings.sysPriceColor_Decrease_BG));
            aValues.Add(ColorTranslator.ToHtml(Settings.sysPriceColor_Decrease_FG));

            aValues.Add(ColorTranslator.ToHtml(Settings.sysPriceColor_NotChange_BG));
            aValues.Add(ColorTranslator.ToHtml(Settings.sysPriceColor_NotChange_FG));
            if (!SaveLocalUserConfig("Color", aFields, aValues)) return false; ;

            //System
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysLanguage }));
            aFields.Add(common.system.GetName(new { Settings.sysAutoRefreshData }));

            aValues.Clear();
            aValues.Add(Settings.sysLanguage.ToString());
            aValues.Add(Settings.sysAutoRefreshData.ToString());
            if (!SaveLocalUserConfig("System", aFields, aValues)) return false;
            return true;
        }
Пример #24
0
        public void Test01()
        {
            IntlStrings intl;
            StringCollection sc;

            // simple string values
            string[] values =
            {
                "",
                " ",
                "a",
                "aa",
                "text",
                "     spaces",
                "1",
                "$%^#",
                "2222222222222222222222222",
                System.DateTime.Today.ToString(),
                Int32.MaxValue.ToString()
            };

            int cnt = 0;            // Count

            // initialize IntStrings
            intl = new IntlStrings();


            // [] StringCollection is constructed as expected
            //-----------------------------------------------------------------

            sc = new StringCollection();

            // [] on empty collection
            //
            for (int i = 0; i < values.Length; i++)
            {
                if (sc.Contains(values[i]))
                {
                    Assert.False(true, string.Format("Error, returned true for empty collection", i));
                }
            }


            // [] add simple strings and verify Contains()
            //

            cnt = sc.Count;
            sc.AddRange(values);
            if (sc.Count != values.Length)
            {
                Assert.False(true, string.Format("Error, count is {0} instead of {1}", sc.Count, values.Length));
            }

            for (int i = 0; i < values.Length; i++)
            {
                // verify that collection contains all added items
                //
                if (!sc.Contains(values[i]))
                {
                    Assert.False(true, string.Format("Error, collection doesn't contain item \"{1}\"", i, values[i]));
                }
            }

            //
            // Intl strings
            // [] add Intl strings and verify Contains()
            //

            string[] intlValues = new string[values.Length];

            // fill array with unique strings
            //
            for (int i = 0; i < values.Length; i++)
            {
                string val = intl.GetRandomString(MAX_LEN);
                while (Array.IndexOf(intlValues, val) != -1)
                    val = intl.GetRandomString(MAX_LEN);
                intlValues[i] = val;
            }

            int len = values.Length;
            Boolean caseInsensitive = false;
            for (int i = 0; i < len; i++)
            {
                if (intlValues[i].Length != 0 && intlValues[i].ToLower() == intlValues[i].ToUpper())
                    caseInsensitive = true;
            }

            cnt = sc.Count;
            sc.AddRange(intlValues);
            if (sc.Count != (cnt + intlValues.Length))
            {
                Assert.False(true, string.Format("Error, count is {0} instead of {1}", sc.Count, cnt + intlValues.Length));
            }

            for (int i = 0; i < intlValues.Length; i++)
            {
                // verify that collection contains all added items
                //
                if (!sc.Contains(intlValues[i]))
                {
                    Assert.False(true, string.Format("Error, collection doesn't contain item \"{1}\"", i, intlValues[i]));
                }
            }

            //
            // add very long string
            // [] add very long string and verify Contains()
            //
            cnt = sc.Count;
            string intlStr = intlValues[0];
            while (intlStr.Length < 10000)
                intlStr += intlStr;

            sc.Add(intlStr);
            if (sc.Count != cnt + 1)
            {
                Assert.False(true, string.Format("Error, count is {1} instead of {2}", sc.Count, cnt + 1));
            }

            // verify that collection contains newly added item
            //
            if (!sc.Contains(intlStr))
            {
                Assert.False(true, string.Format("Error, collection doesn't contain new item"));
            }

            //
            //  [] Case sensitivity: search should be case-sensitive
            //

            sc.Clear();
            if (sc.Count != 0)
            {
                Assert.False(true, string.Format("Error, count is {1} instead of {2} after Clear()", sc.Count, 0));
            }

            // add uppercase item
            //
            intlStr = intlValues[0].ToUpper();
            sc.Add(intlStr);
            if (sc.Count != 1)
            {
                Assert.False(true, string.Format("Error, count is {1} instead of {2}", sc.Count, 1));
            }

            // verify that Contains returns true for newly added uppercase item
            //
            if (!sc.Contains(intlStr))
            {
                Assert.False(true, string.Format("Error, Contains() returned false "));
            }
            // verify that Contains returns false for lowercase version
            //
            intlStr = intlValues[0].ToLower();
            if (!caseInsensitive && sc.Contains(intlStr))
            {
                Assert.False(true, string.Format("Error, Contains() returned true for lowercase version"));
            }
        }
Пример #25
0
        public static bool Save_Local_UserSettings_SYSTEM2()
        {
            StringCollection aFields = new StringCollection();
            StringCollection aValues = new StringCollection();

            //Investor
            aFields.Clear();
            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysCompanyName }));
            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysCompanyAddr1 }));
            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysCompanyAddr2 }));
            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysCompanyAddr3 }));

            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysCompanyPhone }));
            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysCompanyFax }));
            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysCompanyEmail }));
            aFields.Add(common.system.GetName(new { commonClass.SysLibs.sysCompanyURL }));

            aValues.Clear();
            aValues.Add(commonClass.SysLibs.sysCompanyName);
            aValues.Add(commonClass.SysLibs.sysCompanyAddr1);
            aValues.Add(commonClass.SysLibs.sysCompanyAddr2);
            aValues.Add(commonClass.SysLibs.sysCompanyAddr3);

            aValues.Add(commonClass.SysLibs.sysCompanyPhone);
            aValues.Add(commonClass.SysLibs.sysCompanyFax);
            aValues.Add(commonClass.SysLibs.sysCompanyEmail);
            aValues.Add(commonClass.SysLibs.sysCompanyURL);
            SaveLocalUserConfig("Investor", aFields, aValues);
            
            //Image and icon
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysImgFilePathBackGround }));
            aFields.Add(common.system.GetName(new { Settings.sysImgFilePathIcon }));
            aFields.Add(common.system.GetName(new { Settings.sysImgFilePathCompanyLogo1 }));
            aFields.Add(common.system.GetName(new { Settings.sysImgFilePathCompanyLogo2 }));
            aValues.Clear();
            aValues.Add(common.fileFuncs.MakeRelativePath(Settings.sysImgFilePathBackGround));
            aValues.Add(common.fileFuncs.MakeRelativePath(Settings.sysImgFilePathIcon));
            aValues.Add(common.fileFuncs.MakeRelativePath(Settings.sysImgFilePathCompanyLogo1));
            aValues.Add(common.fileFuncs.MakeRelativePath(Settings.sysImgFilePathCompanyLogo2));
            SaveLocalUserConfig("Others", aFields, aValues);
            return true;
        }
Пример #26
0
        public void Test01()
        {
            IntlStrings intl;
            StringCollection sc;
            // simple string values
            string[] values =
            {
                "",
                " ",
                "a",
                "aa",
                "text",
                "     spaces",
                "1",
                "$%^#",
                "2222222222222222222222222",
                System.DateTime.Today.ToString(),
                Int32.MaxValue.ToString()
            };

            // initialize IntStrings
            intl = new IntlStrings();


            // [] StringCollection is constructed as expected
            //-----------------------------------------------------------------

            sc = new StringCollection();

            // [] Insert into empty collection
            //
            for (int i = 0; i < values.Length; i++)
            {
                if (sc.Count > 0)
                    sc.Clear();
                sc.Insert(0, values[i]);
                if (sc.Count != 1)
                {
                    Assert.False(true, string.Format("Error, Count {1} instead of 1", i, sc.Count));
                }
                if (!sc.Contains(values[i]))
                {
                    Assert.False(true, string.Format("Error, doesn't contain just inserted item", i));
                }
            }

            //
            // [] Insert into filled collection



            sc.Clear();
            sc.AddRange(values);
            if (sc.Count != values.Length)
            {
                Assert.False(true, string.Format("Error, count is {0} instead of {1}", sc.Count, values.Length));
            }

            // string to insert
            string val = intl.GetRandomString(MAX_LEN);

            sc.Insert(0, val);

            if (sc.Count != values.Length + 1)
            {
                Assert.False(true, string.Format("Error, Count returned {0} instead of {1}", sc.Count, values.Length + 1));
            }

            if (sc.IndexOf(val) != 0)
            {
                Assert.False(true, string.Format("Error, IndexOf returned {0} instead of {1}", sc.IndexOf(val), 0));
            }

            // check that all init items were moved
            for (int i = 0; i < values.Length; i++)
            {
                if (sc.IndexOf(values[i]) != i + 1)
                {
                    Assert.False(true, string.Format("Error, IndexOf returned {1} instead of {2}", i, sc.IndexOf(values[i]), i + 1));
                }
            }

            sc.Clear();
            sc.AddRange(values);
            if (sc.Count != values.Length)
            {
                Assert.False(true, string.Format("Error, count is {0} instead of {1}", sc.Count, values.Length));
            }

            sc.Insert(values.Length, val);

            if (sc.Count != values.Length + 1)
            {
                Assert.False(true, string.Format("Error, Count returned {0} instead of {1}", sc.Count, values.Length + 1));
            }

            if (sc.IndexOf(val) != values.Length)
            {
                Assert.False(true, string.Format("Error, IndexOf returned {0} instead of {1}", sc.IndexOf(val), values.Length));
            }

            // check that all init items were moved
            for (int i = 0; i < values.Length; i++)
            {
                if (sc.IndexOf(values[i]) != i)
                {
                    Assert.False(true, string.Format("Error, IndexOf returned {1} instead of {2}", i, sc.IndexOf(values[i]), i));
                }
            }


            sc.Clear();
            sc.AddRange(values);
            if (sc.Count != values.Length)
            {
                Assert.False(true, string.Format("Error, count is {0} instead of {1}", sc.Count, values.Length));
            }

            sc.Insert(values.Length / 2, val);

            if (sc.Count != values.Length + 1)
            {
                Assert.False(true, string.Format("Error, Count returned {0} instead of {1}", sc.Count, values.Length + 1));
            }

            if (sc.IndexOf(val) != values.Length / 2)
            {
                Assert.False(true, string.Format("Error, IndexOf returned {0} instead of {1}", sc.IndexOf(val), values.Length / 2));
            }

            // check that all init items were moved
            for (int i = 0; i < values.Length; i++)
            {
                int expected = i;
                if (i >= values.Length / 2)
                    expected = i + 1;
                if (sc.IndexOf(values[i]) != expected)
                {
                    Assert.False(true, string.Format("Error, IndexOf returned {1} instead of {2}", i, sc.IndexOf(values[i]), expected));
                }
            }

            //
            // [] Invalid parameter
            //
            Assert.Throws<ArgumentOutOfRangeException>(() => { sc.Insert(-1, val); });
            Assert.Throws<ArgumentOutOfRangeException>(() => { sc.Insert(sc.Count + 1, val); });
            Assert.Throws<ArgumentOutOfRangeException>(() => { sc.Insert(sc.Count + 2, val); });
        }
Пример #27
0
 public static bool SetDefaultFormState(string formName,bool isDefault)
 {
     StringCollection aFields = new StringCollection();
     StringCollection aValues = new StringCollection();
     aFields.Clear(); aValues.Clear();
     aFields.Add(formName);
     aValues.Add((isDefault?Boolean.TrueString:Boolean.FalseString) );
     if (!SaveLocalUserConfig("DefaultForms", aFields, aValues)) return false;
     return true;
 }
Пример #28
0
        public static bool Save_Global_Settings(GlobalSettings settings)
        {
            //Systen tab 
            StringCollection aFields = new StringCollection();
            StringCollection aValues = new StringCollection();
            //System
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.WriteLogAccess }));
            aFields.Add(common.system.GetName(new { settings.PasswordMinLen }));
            aFields.Add(common.system.GetName(new { settings.UseStrongPassword }));
            
            aValues.Clear();
            aValues.Add(((byte)settings.WriteLogAccess).ToString());
            aValues.Add(settings.PasswordMinLen.ToString());
            aValues.Add(settings.UseStrongPassword.ToString());
            if (!SaveConfig(aFields, aValues)) return false;

            //Data count
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.DayScanForLastPrice }));
            aFields.Add(common.system.GetName(new { settings.AlertDataCount }));
            aFields.Add(common.system.GetName(new { settings.ChartMaxLoadCount_FIRST }));
            aFields.Add(common.system.GetName(new { settings.ChartMaxLoadCount_MORE }));

            aValues.Clear();
            aValues.Add(settings.DayScanForLastPrice.ToString());
            aValues.Add(settings.AlertDataCount.ToString());
            aValues.Add(settings.ChartMaxLoadCount_FIRST.ToString());
            aValues.Add(settings.ChartMaxLoadCount_MORE.ToString());
            if (!SaveConfig(aFields, aValues)) return false;

            //Autokey
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.DataKeyPrefix }));
            aFields.Add(common.system.GetName(new { settings.DataKeySize }));
            aFields.Add(common.system.GetName(new { settings.AutoEditKeySize }));
            aFields.Add(common.system.GetName(new { settings.TimeOut_AutoKey }));
            
            aValues.Clear();
            aValues.Add(settings.DataKeyPrefix);
            aValues.Add(settings.DataKeySize.ToString());
            aValues.Add(settings.AutoEditKeySize.ToString());
            aValues.Add(settings.TimeOut_AutoKey.ToString());
            if (!SaveConfig(aFields, aValues)) return false;

            //Mail
            aFields.Clear(); 
            aFields.Add(common.system.GetName(new { settings.smtpAddress }));
            aFields.Add(common.system.GetName(new { settings.smtpPort }));
            aFields.Add(common.system.GetName(new { settings.smtpAuthAccount }));
            aFields.Add(common.system.GetName(new { settings.smtpAuthPassword }));
            aFields.Add(common.system.GetName(new { settings.smtpSSL }));

            aValues.Clear();
            aValues.Add(settings.smtpAddress);
            aValues.Add(settings.smtpPort.ToString());
            aValues.Add(settings.smtpAuthAccount);
            aValues.Add(settings.smtpAuthPassword);
            aValues.Add(settings.smtpSSL ? Boolean.TrueString : Boolean.FalseString);
            if (!SaveConfig(aFields, aValues)) return false;

            //Default
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.DefautLanguage }));
            aFields.Add(common.system.GetName(new { settings.AlertDataCount }));
            aFields.Add(common.system.GetName(new { settings.ScreeningDataCount }));

            aFields.Add(common.system.GetName(new { settings.ScreeningTimeScaleCode }));
            aFields.Add(common.system.GetName(new { settings.DefaultTimeRange }));
            aFields.Add(common.system.GetName(new { settings.DefaultTimeScaleCode }));

            aValues.Clear();
            aValues.Add(settings.DefautLanguage.ToString());
            aValues.Add(settings.AlertDataCount.ToString());
            aValues.Add(settings.ScreeningDataCount.ToString());
            aValues.Add(settings.ScreeningTimeScaleCode);
            aValues.Add(settings.DefaultTimeRange.ToString());
            aValues.Add(settings.DefaultTimeScaleCode);
            if (!SaveConfig(aFields, aValues)) return false;

            //Timming
            aFields.Clear();
            aFields.Add(common.system.GetName(new { settings.TimerIntervalInSecs }));
            aFields.Add(common.system.GetName(new { settings.RefreshDataInSecs }));
            aFields.Add(common.system.GetName(new { settings.CheckAlertInSeconds }));
            aFields.Add(common.system.GetName(new { settings.AutoCheckInSeconds }));

            aValues.Clear();
            aValues.Add(settings.TimerIntervalInSecs.ToString());
            aValues.Add(settings.RefreshDataInSecs.ToString());
            aValues.Add(settings.CheckAlertInSeconds.ToString());
            aValues.Add(settings.AutoCheckInSeconds.ToString());
            if (!SaveConfig(aFields, aValues)) return false;
            return true;
        }
Пример #29
0
		public void RealFileViewUpdate (ArrayList directoriesArrayList, ArrayList fileArrayList)
		{
			BeginUpdate ();
			
			DeleteOldThumbnails ();	// any existing thumbnail images need to be Dispose()d.
			Items.Clear ();
			SelectedItems.Clear ();
			
			foreach (FSEntry directoryFSEntry in directoriesArrayList) {
				if (!ShowHiddenFiles)
					if (directoryFSEntry.Name.StartsWith (".") || (directoryFSEntry.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
						continue;
				
				FileViewListViewItem listViewItem = new FileViewListViewItem (directoryFSEntry);
				
				Items.Add (listViewItem);
			}
			
			StringCollection collection = new StringCollection ();
			
			foreach (FSEntry fsEntry in fileArrayList) {
				
				// remove duplicates. that can happen when you read recently used files for example
				if (collection.Contains (fsEntry.Name)) {
					
					string fileName = fsEntry.Name;
					
					if (collection.Contains (fileName)) {
						int i = 1;
						
						while (collection.Contains (fileName + "(" + i + ")")) {
							i++;
						}
						
						fileName = fileName + "(" + i + ")";
					}
					
					fsEntry.Name = fileName;
				}
				
				collection.Add (fsEntry.Name);
				
				DoOneFSEntry (fsEntry);
			}
			
			EndUpdate ();
			
			collection.Clear ();
			collection = null;
			
			directoriesArrayList.Clear ();
			fileArrayList.Clear ();

			// Create thumbnail images for Image type files.  This greatly facilitates
			// choosing pictures whose names mean nothing.
			// See https://bugzilla.xamarin.com/show_bug.cgi?id=28025 for details.
			thumbCreator = new ThumbnailCreator(new ThumbnailDelegate(RedrawTheItem), this);
			var makeThumbnails = new Thread(new ThreadStart(thumbCreator.MakeThumbnails));
			makeThumbnails.IsBackground = true;
			makeThumbnails.Start();
		}
Пример #30
0
        //Local setting that apply to all users 
        public static bool Load_Local_Settings()
        {
            StringCollection aFields = new StringCollection();
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysTimeServer }));
            common.configuration.GetConfiguration(new string[] { "System" }, aFields, Settings.sysFileUserConfig, false);
            Settings.sysTimeServer = aFields[0].Trim();

            Font font = commonClass.Configuration.GetLocalConfigFont(new string[] { "MainFont" });
            if (font != null) Settings.sysFontMain = font;
            font = commonClass.Configuration.GetLocalConfigFont(new string[] { "MenuFont" });
            if (font != null)  Settings.sysFontMenu= font;
            return true;
        }
Пример #31
0
		public void RealFileViewUpdate (ArrayList directoriesArrayList, ArrayList fileArrayList)
		{
			BeginUpdate ();
			
			Items.Clear ();
			SelectedItems.Clear ();
			
			foreach (FSEntry directoryFSEntry in directoriesArrayList) {
				if (!ShowHiddenFiles)
					if (directoryFSEntry.Name.StartsWith (".") || (directoryFSEntry.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
						continue;
				
				FileViewListViewItem listViewItem = new FileViewListViewItem (directoryFSEntry);
				
				Items.Add (listViewItem);
			}
			
			StringCollection collection = new StringCollection ();
			
			foreach (FSEntry fsEntry in fileArrayList) {
				
				// remove duplicates. that can happen when you read recently used files for example
				if (collection.Contains (fsEntry.Name)) {
					
					string fileName = fsEntry.Name;
					
					if (collection.Contains (fileName)) {
						int i = 1;
						
						while (collection.Contains (fileName + "(" + i + ")")) {
							i++;
						}
						
						fileName = fileName + "(" + i + ")";
					}
					
					fsEntry.Name = fileName;
				}
				
				collection.Add (fsEntry.Name);
				
				DoOneFSEntry (fsEntry);
			}
			
			EndUpdate ();
			
			collection.Clear ();
			collection = null;
			
			directoriesArrayList.Clear ();
			fileArrayList.Clear ();
		}
Пример #32
0
        public static bool Save_Local_Settings()
        {
            StringCollection aFields = new StringCollection();
            StringCollection aValues = new StringCollection();
            aFields.Clear();
            aFields.Add(common.system.GetName(new { Settings.sysTimeServer }));
            aValues.Clear();
            aValues.Add(Settings.sysTimeServer);
            if (!common.configuration.SaveConfiguration(new string[] { "System" }, aFields, aValues, Settings.sysFileUserConfig, false)) return false;

            if (!commonClass.Configuration.SaveLocalConfigFont(new string[] {"MainFont" }, Settings.sysFontMain)) return false;
            if (!commonClass.Configuration.SaveLocalConfigFont(new string[] {"MenuFont" }, Settings.sysFontMenu)) return false;
            return true;
        }