Пример #1
0
        /// <summary>
        /// Get input options for ejscript.
        /// </summary>
        /// <param name="args">Input arguments.</param>
        /// <returns>Input options.</returns>
        private static EParams GetOpt(string[] args)
        {
            EParams p = new EParams();

            for (var i = 0; i < args.Length; i++)
            {
                switch (args[i])
                {
                case "--compile":
                case "-c":
                    p.compile = true;
                    break;

                case "--output":
                case "-o":
                    p.output = args[++i];
                    break;

                default:
                    p.input = args[i++];
                    var s = new StringBuilder();
                    for (; i < args.Length; i++)
                    {
                        s.Append(args[i]).Append(' ');
                    }
                    if (s.Length > 0)
                    {
                        s = s.Remove(s.Length - 1, 1);
                    }
                    p.args = s.ToString();
                    break;
                }
            }
            return(p);
        }
Пример #2
0
		// static method
		/// <summary>
		/// I can touch the sky,
		/// I know that i am alive.
		/// : Celine Dion
		/// </summary>
		/// <param name="args">Input arguments.</param>
		static void Main(string[] args) {
			EParams p = new EParams(args);
			if (args.Length == 0) { GetGdiRamp(); return; }
			if (p.Red.Count == 0) { Console.Error.WriteLine("{0}: no red values.", APP); return; }
			if (p.Green.Count == 0) { Console.Error.WriteLine("{0}: no green values.", APP); return; }
			if (p.Blue.Count == 0) { Console.Error.WriteLine("{0}: no blue values.", APP); return; }
			if (p.Ramp) {
				RampMin2(p.Red, p.Green, p.Blue);
				p.Red = EVector.GetLin(new double[EGdi.RAMP_SZ], p.Red);
				p.Green = EVector.GetLin(new double[EGdi.RAMP_SZ], p.Green);
				p.Blue = EVector.GetLin(new double[EGdi.RAMP_SZ], p.Blue);
			}
			else {
				p.Red = GetRamp(p.Red[0], EGdi.RAMP_SZ);
				p.Green = GetRamp(p.Green[0], EGdi.RAMP_SZ);
				p.Blue = GetRamp(p.Blue[0], EGdi.RAMP_SZ);
			}
			SetGdiRamp(p.Red, p.Green, p.Blue);
		}