Beispiel #1
0
        static void Main(string[] args)
        {
            List <double> valores = new List <double>();

            string valor = "";

            while (!valor.Contains('S'))
            {
                Console.WriteLine("Digite o valor ou S para terminar:");
                valor = Console.ReadLine();
                if (!valor.Contains('S'))
                {
                    valores.Add(DoubleType.FromString(valor));
                }
            }

            Console.WriteLine("Crescente");
            foreach (var item in valores.OrderBy(v => v))
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("Decrescente");
            foreach (var item in valores.OrderByDescending(v => v))
            {
                Console.WriteLine(item);
            }
        }
Beispiel #2
0
        private static string word2(string numb, string param)
        {
            string[] textArray1;
            string   text2 = "";

            if (Strings.Len(numb) == 1)
            {
                textArray1 = new string[] { text2, Word(numb), " ", param, " " };
                return(string.Concat(textArray1));
            }
            if (Strings.Len(numb) == 2)
            {
                if (Conversion.Val(numb) == 0)
                {
                    return(text2);
                }
                if ((DoubleType.FromString(numb) > 0) & (DoubleType.FromString(numb) < 20))
                {
                    textArray1 = new string[] { text2, Word(numb), " ", param, " " };
                    return(string.Concat(textArray1));
                }
                textArray1 = new string[] { text2, Word(StringType.FromDouble(DoubleType.FromString(Strings.Left(numb, 1)) * 10)), " ", Word(Strings.Mid(numb, 2, 1)), " ", param, " " };
                return(string.Concat(textArray1));
            }
            if (Strings.Len(numb) == 3)
            {
                string text1 = Strings.Mid(numb, 1, 1);
                if (Conversion.Int(Conversion.Val(text1)) != 0)
                {
                    text2 = text2 + Word(Strings.Mid(numb, 1, 1)) + " hundred ";
                }
                text1 = Strings.Mid(numb, 2, 2);
                if (Conversion.Val(text1) == 0)
                {
                    if (DoubleType.FromString(Strings.Mid(numb, 1, 1)) != 0)
                    {
                        text2 = text2 + " " + param + " ";
                    }
                }
                else if (((Conversion.Val(text1) > 0) & (Conversion.Val(text1) < 20)) | ((DoubleType.FromString(text1) % 10) == 0))
                {
                    textArray1 = new string[] { text2, Word(Strings.Mid(numb, 2, 2)), " ", param, " " };
                    text2      = string.Concat(textArray1);
                }
                else
                {
                    textArray1 = new string[] { text2, Word(StringType.FromDouble(DoubleType.FromString(Strings.Mid(numb, 2, 1)) * 10)), " ", Word(Strings.Mid(numb, 3, 1)), " ", param, " " };
                    text2      = string.Concat(textArray1);
                }
            }
            return(text2);
        }
Beispiel #3
0
 private void btnBusqNom_Click(object sender, EventArgs e)
 {
     new frmBusqClixNom().ShowDialog();
     if (DoubleType.FromString(Variables.gCodCli) == 0.0)
     {
         this.editCodCli.Text = "";
     }
     else
     {
         this.editCodCli.Text = Variables.gCodCli;
     }
     this.editDescCli.Text = Variables.gNomCli;
 }
Beispiel #4
0
        protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
        {
            Debug.WriteLine("ComboBox Edit");
            Point     point         = this.DataGridTableStyle.DataGrid.PointToClient(Cursor.Position);
            Rectangle controlBounds = this.GetControlBounds(bounds);
            Rectangle rectangle2    = new Rectangle(point.X, point.Y, 1, 1);

            this.m_comboBox.SelectedIndex = IntegerType.FromObject(this.GetColumnValueAtRow(source, rowNum));
            Debug.WriteLine(DoubleType.FromString("SelectedItem: ") + this.m_comboBox.SelectedIndex);
            Point point2 = new Point(controlBounds.X, controlBounds.Y);

            this.m_comboBox.Location = point2;
            this.m_comboBox.Visible  = true;
            if (rectangle2.IntersectsWith(controlBounds))
            {
                this.m_comboBox.DroppedDown = true;
            }
            this.m_previouslyEditedCellRow = rowNum;
        }
Beispiel #5
0
        private static string word3(string numb)
        {
            string text2 = string.Empty;

            if (Strings.Len(numb) == 1)
            {
                return(text2 + Word(numb));
            }
            if (Strings.Len(numb) == 2)
            {
                if (((DoubleType.FromString(numb) > 1) & (DoubleType.FromString(numb) < 20)) | ((DoubleType.FromString(numb) % 10) == 0))
                {
                    return(text2 + Word(numb));
                }
                return(text2 + Word(StringType.FromDouble(DoubleType.FromString(Strings.Left(numb, 1)) * 10)) + " " + Word(Strings.Right(numb, 1)));
            }
            if (Strings.Len(numb) == 3)
            {
                string text1 = Word(StringType.FromDouble(Conversion.Int(DoubleType.FromString(numb) / 100)));
                if (StringType.StrCmp(text1, "zero", false) != 0)
                {
                    text2 = text2 + text1 + " hundred ";
                }
                text1 = StringType.FromDouble(DoubleType.FromString(Strings.Mid(numb, 2)) % 10);
                if (StringType.StrCmp(text1, "0", false) == 0)
                {
                    text1 = Word(Strings.Mid(numb, 2));
                    if (StringType.StrCmp(text1, "zero", false) != 0)
                    {
                        text2 = text2 + text1;
                    }
                }
                else if ((DoubleType.FromString(Strings.Right(numb, 2)) > 0) & (DoubleType.FromString(Strings.Right(numb, 2)) < 20))
                {
                    text2 = text2 + Word(Strings.Right(numb, 2));
                }
                else
                {
                    text2 = text2 + Word(StringType.FromDouble(Conversion.Int(DoubleType.FromString(Strings.Mid(numb, 2, 1)) * 10))) + " " + ConvertNumberToWord.Word(Strings.Right(numb, 1));
                }
            }
            return(text2);
        }
Beispiel #6
0
        public static Object Int(Object Number)
        {
            if (Number == null)
            {
                throw new ArgumentNullException("Number");
            }
            switch (ObjectType.GetTypeCode(Number))
            {
            case TypeCode.Boolean:
            case TypeCode.Char:
            case TypeCode.SByte:
            case TypeCode.Byte:
            case TypeCode.Int16:
            case TypeCode.UInt16:
            case TypeCode.Int32:
                return(Int(IntegerType.FromObject(Number)));

            case TypeCode.UInt32:
            case TypeCode.Int64:
            case TypeCode.UInt64:
                return(Number);

            case TypeCode.Single:
                return(Int(SingleType.FromObject(Number)));

            case TypeCode.Double:
                return(Int(DoubleType.FromObject(Number)));

            case TypeCode.Decimal:
                return(Int(DecimalType.FromObject(Number)));

            case TypeCode.String:
                return(Int(DoubleType.FromString
                               (StringType.FromObject(Number))));
            }
            throw new ArgumentException(S._("VB_InvalidNumber"), "Number");
        }
 public void FromString_Invalid()
 {
     Assert.Throws <InvalidCastException>(() => DoubleType.FromString("abc"));
 }
 public void FromString(string value, double expected)
 {
     Assert.Equal(expected, DoubleType.FromString(value));
 }
Beispiel #9
0
        private static string Word(string numb)
        {
            string text1 = string.Empty;

            if (DoubleType.FromString(numb) == 0)
            {
                return("zero");
            }
            if (DoubleType.FromString(numb) == 1)
            {
                return("one");
            }
            if (DoubleType.FromString(numb) == 2)
            {
                return("two");
            }
            if (DoubleType.FromString(numb) == 3)
            {
                return("three");
            }
            if (DoubleType.FromString(numb) == 4)
            {
                return("four");
            }
            if (DoubleType.FromString(numb) == 5)
            {
                return("five");
            }
            if (DoubleType.FromString(numb) == 6)
            {
                return("six");
            }
            if (DoubleType.FromString(numb) == 7)
            {
                return("seven");
            }
            if (DoubleType.FromString(numb) == 8)
            {
                return("eight");
            }
            if (DoubleType.FromString(numb) == 9)
            {
                return("nine");
            }
            if (DoubleType.FromString(numb) == 11)
            {
                return("eleven");
            }
            if (DoubleType.FromString(numb) == 12)
            {
                return("twelve");
            }
            if (DoubleType.FromString(numb) == 13)
            {
                return("thirteen");
            }
            if (DoubleType.FromString(numb) == 14)
            {
                return("fourteen");
            }
            if (DoubleType.FromString(numb) == 15)
            {
                return("fifteen");
            }
            if (DoubleType.FromString(numb) == 16)
            {
                return("sixteen");
            }
            if (DoubleType.FromString(numb) == 17)
            {
                return("seventeen");
            }
            if (DoubleType.FromString(numb) == 18)
            {
                return("eighteen");
            }
            if (DoubleType.FromString(numb) == 19)
            {
                return("nineteen");
            }
            if (DoubleType.FromString(numb) == 10)
            {
                return("ten");
            }
            if (DoubleType.FromString(numb) == 20)
            {
                return("twenty");
            }
            if (DoubleType.FromString(numb) == 30)
            {
                return("thirty");
            }
            if (DoubleType.FromString(numb) == 40)
            {
                return("fourty");
            }
            if (DoubleType.FromString(numb) == 50)
            {
                return("fifty");
            }
            if (DoubleType.FromString(numb) == 60)
            {
                return("sixty");
            }
            if (DoubleType.FromString(numb) == 70)
            {
                return("seventy");
            }
            if (DoubleType.FromString(numb) == 80)
            {
                return("eighty");
            }
            if (DoubleType.FromString(numb) == 90)
            {
                return("ninety");
            }
            if (DoubleType.FromString(numb) == 90)
            {
                text1 = "ninety";
            }
            return(text1);
        }
Beispiel #10
0
 // Get the numeric value of a string.
 public static double Val(String InputStr)
 {
     return(DoubleType.FromString(InputStr));
 }
Beispiel #11
0
        /// <summary>
        /// ToolSettings.cs \\ Load map-unrelated user settings
        /// </summary>
        public bool loadUserSettings()
        {
            string AppPath      = System.AppDomain.CurrentDomain.BaseDirectory;
            string toolSettings = AppPath + "\\CoD4CompileTools.settings";

            if (StringType.StrCmp(FileSystem.Dir(toolSettings, FileAttribute.Normal), "", false) == 0)
            {
                return(false);
            }

            File.SetAttributes(AppPath + "\\CoD4CompileTools.settings", FileAttributes.Normal);
            StreamReader streamReader = new StreamReader((Stream)File.OpenRead(toolSettings));

            while (streamReader.Peek() != -1)
            {
                string String1 = streamReader.ReadLine();
                int    count   = Strings.InStr(String1, ",", CompareMethod.Binary);

                if (count == 0)
                {
                    return(false);
                }

                string sLeft = String1.Remove(checked (count - 1), checked (String1.Length - count + 1));
                string str2  = String1.Remove(0, count);

                if (StringType.StrCmp(sLeft, "tree", false) == 0)
                {
                    Variables.strTreePath = str2;
                    this.updateLocalPaths();
                    this.fillMapList();
                }
                else if (StringType.StrCmp(sLeft, "mapname", false) == 0)
                {
                    int num1  = -1;
                    int num2  = 0;
                    int num3  = checked (lstMapFiles.Items.Count - 1);
                    int index = num2;

                    while (index <= num3)
                    {
                        if (ObjectType.ObjTst(lstMapFiles.Items[index], (object)str2, false) == 0)
                        {
                            num1 = index;
                        }

                        checked { ++index; }
                    }

                    if (num1 >= 0)
                    {
                        lstMapFiles.SelectedIndex = num1;
                    }
                }


                else if (StringType.StrCmp(sLeft, "developer", false) == 0)
                {
                    chkDeveloper.IsChecked = BooleanType.FromString(str2);
                }
                else if (StringType.StrCmp(sLeft, "developerscript", false) == 0)
                {
                    chkDeveloperScript.IsChecked = BooleanType.FromString(str2);
                }
                else if (StringType.StrCmp(sLeft, "cheats", false) == 0)
                {
                    chkCheats.IsChecked = BooleanType.FromString(str2);
                }
                else if (StringType.StrCmp(sLeft, "tab", false) == 0)
                {
                    compileTab.SelectedIndex = IntegerType.FromString(str2);
                }
                else if (StringType.StrCmp(sLeft, "chkCustomCommandLine", false) == 0)
                {
                    chkCustomCommandLine.IsChecked = BooleanType.FromString(str2);
                }
                else if (StringType.StrCmp(sLeft, "moveToUsermaps", false) == 0)
                {
                    Variables.copyToUsermaps = BooleanType.FromString(str2);
                }
                else if (StringType.StrCmp(sLeft, "txtCustomCommandLine", false) == 0)
                {
                    txtCustomCommandLine.Text = str2;
                }
                else if (StringType.StrCmp(sLeft, "exeGameMp", false) == 0)
                {
                    Variables.strGameMpName = str2;
                }
                else if (StringType.StrCmp(sLeft, "exeRadiant", false) == 0)
                {
                    Variables.strRadiantName = str2;
                }

                // GLSL->HLSL Syntax Converter
                else if (StringType.StrCmp(sLeft, "sgen_width", false) == 0)
                {
                    Variables.SyntaxConverterWidth = DoubleType.FromString(str2);
                }
                else if (StringType.StrCmp(sLeft, "sgen_height", false) == 0)
                {
                    Variables.SyntaxConverterHeight = DoubleType.FromString(str2);
                }
                else if (StringType.StrCmp(sLeft, "sgen_font", false) == 0)
                {
                    Variables.SyntaxConverterFontSize = DoubleType.FromString(str2);
                }
                else if (StringType.StrCmp(sLeft, "sgen_optimise", false) == 0)
                {
                    Variables.SyntaxConverterOptimise = BooleanType.FromString(str2);
                }
            }

            streamReader.Close();
            return(true);
        }