Exemplo n.º 1
0
            private void Complete(Which which, params object[] args)
            {
                if (which == Which.Resolve)
                {
                    DoThen = (f, e, p) => { Resolve(args); };
                }
                else
                {
                    DoThen = (f, e, p) => { Reject(args); };
                }

                var i = 0;

                while (i < Thens.Count)
                {
                    var aThen = Thens[i];

                    if (which == Which.Resolve)
                    {
                        if (aThen.Filled != null)
                        {
                            aThen.Filled.Apply(null, args);
                        }
                    }
                    else
                    {
                        if (aThen.Error != null)
                        {
                            aThen.Error.Apply(null, args);
                        }
                    }
                    i++;
                }
                Thens.Clear();
            }
Exemplo n.º 2
0
        public static void Load(Page page, Which which)
        {
            try
            {
                XmlDocument xD = new XmlDocument();
                xD.Load(FolderNames.GetFolder(NiceSystemInfo.DEFAULT, MyFolders.ASP_ServerStateFolder) + "\\KeyWords\\KeyWords.xml");
                XmlNode allkeyNode = xD["KeyWords"];
                XmlNode keyNode    = null;
                switch (which)
                {
                case Which.Default: keyNode = allkeyNode["Default"]; break;

                case Which.HowItWorks: keyNode = allkeyNode["HowItWorks"]; break;

                case Which.HowToUse: keyNode = allkeyNode["HowToUse"]; break;

                case Which.Login: keyNode = allkeyNode["Login"]; break;

                case Which.Register: keyNode = allkeyNode["Register"]; break;

                case Which.Price: keyNode = allkeyNode["Price"]; break;
                }

                page.MetaKeywords    = keyNode["KeyWords"].InnerText;
                page.MetaDescription = keyNode["Description"].InnerText;
                page.Title           = keyNode["Title"].InnerText;
            }
            catch
            {
            }
        }
Exemplo n.º 3
0
        void OnExecute()
        {
            var results = Which.FindPrograms(ProgramName, skipDot: SkipDot, skipTilde: SkipTilde, skipWinReg: SkipWinreg)
                          .ToList();

            if (S)
            {
                Environment.Exit(results.Count == 0 ? 1 : 0);
                return;
            }

            List <FileInfo> output = All ? results : results.Take(1).ToList();

            foreach (var item in output)
            {
                if (ShowTilde && item.FullName.IndexOf(Paths.HomeDir.FullName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    Console.WriteLine(
                        $"~{item.FullName.Remove(0, Paths.HomeDir.FullName.Length)}"
                        );
                }
                else
                {
                    Console.WriteLine(item.FullName);
                }
            }
        }
Exemplo n.º 4
0
            private void Complete(Which which, params object[] args)
            {
                if (which == Which.Resolve)
                {
                    DoThen = (f, e, p) => { Resolve(args); };
                }
                else
                {
                    DoThen = (f, e, p) => { Reject(args); };
                }

                var i = 0;
                while (i < Thens.Count)
                {
                    var aThen = Thens[i];

                    if (which == Which.Resolve)
                    {
                        if (aThen.Filled != null)
                        {
                            aThen.Filled.Apply(null, args);
                        }
                    }
                    else
                    {
                        if (aThen.Error != null)
                        {
                            aThen.Error.Apply(null, args);
                        }
                    }
                    i++;
                }
                Thens.Clear();
            }
Exemplo n.º 5
0
        private int FromTicks(Which what)
        {
            int num400, num100, num4, numyears;
            int M = 1;

            int[] days      = daysMonth;
            int   totaldays = this.ticks.Days;

            num400     = (totaldays / dp400);
            totaldays -= num400 * dp400;

            num100 = (totaldays / dp100);
            if (num100 == 4)               // leap
            {
                num100 = 3;
            }
            totaldays -= (num100 * dp100);

            num4       = totaldays / dp4;
            totaldays -= (num4 * dp4);

            numyears = totaldays / 365;

            if (numyears == 4)
            {
                //leap
                numyears = 3;
            }
            if (what == Which.Year)
            {
                return(num400 * 400 + num100 * 100 + num4 * 4 + numyears + 1);
            }

            totaldays -= (numyears * 365);
            if (what == Which.DayYear)
            {
                return(totaldays + 1);
            }

            if ((numyears == 3) && ((num100 == 3) || !(num4 == 24)))
            {
                //31 dec leapyear
                days = daysMonthLeap;
            }

            while (totaldays >= days[M])
            {
                totaldays -= days[M++];
            }

            if (what == Which.Month)
            {
                return(M);
            }

            return(totaldays + 1);
        }
Exemplo n.º 6
0
 public Tool(Which which, string[] arguments, int[] validExitCodes)
 {
     this._syncTarget = null;
     this._startInfo = new ProcessStartInfo();
     this._startInfo.UseShellExecute = false;
     this._startInfo.RedirectStandardOutput = true;
     this._startInfo.RedirectStandardError = true;
     this._startInfo.CreateNoWindow = true;
     this._startInfo.WindowStyle = ProcessWindowStyle.Hidden;
     this._startInfo.FileName = WhichAttribute.GetFor(which).FullExePath;
     StringBuilder args = null;
     if (arguments != null)
     {
         foreach (string argument in arguments)
         {
             if (argument != null)
             {
                 string a = argument.Trim();
                 if (a.Length > 0)
                 {
                     if (args == null)
                     {
                         args = new StringBuilder();
                     }
                     else
                     {
                         args.Append(' ');
                     }
                     args.Append(a);
                 }
             }
         }
     }
     this._startInfo.Arguments = ((args == null) ? "" : args.ToString());
     if (validExitCodes == null || validExitCodes.Length == 0)
     {
         this._validExitCodes = null;
     }
     else
     {
         this._validExitCodes = (int[])validExitCodes.Clone();
     }
     this._running = false;
     this._exitCode = null;
     this._stdOut = new StringBuilder();
     this._stdErr = new StringBuilder();
     this._lastResult = null;
 }
Exemplo n.º 7
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);

            if (move)
            {
                move = false;
            }
            else if (e.Y > 8 && e.Y < 22 && e.Button == MouseButtons.Left && this.ControlBox)
            {
                if (e.X > this.Width - 59 && e.X < this.Width - 45 && this.MinimizeBox)
                {
                    this.WindowState = FormWindowState.Minimized;

                    isMax = !isMax;
                    which = Which.Non;
                    state = MouseState.Normal;

                    this.Invalidate();
                }
                else if (e.X > this.Width - 39 && e.X < this.Width - 25 && this.MaximizeBox)
                {
                    if (!isMax)
                    {
                        this.WindowState = FormWindowState.Maximized;
                    }
                    else
                    {
                        this.WindowState = FormWindowState.Normal;
                    }

                    isMax = !isMax;
                    which = Which.Non;
                    state = MouseState.Normal;

                    this.Invalidate();
                }
                else if (e.X > this.Width - 21 && e.X < this.Width - 7)
                {
                    this.Close();
                }
            }
        }
Exemplo n.º 8
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (move)
            {
                this.Left += e.X - x;
                this.Top  += e.Y - y;
            }
            else
            {
                which = Which.Non;
                state = MouseState.Normal;

                if (e.Y > 8 && e.Y < 22 && this.ControlBox && e.X > this.Width - 59 && e.X < this.Width - 7)
                {
                    if (e.X > this.Width - 59 && e.X < this.Width - 45 && this.MinimizeBox)
                    {
                        which = Which.Min;
                    }
                    else if (e.X > this.Width - 39 && e.X < this.Width - 25 && this.MaximizeBox)
                    {
                        which = Which.Max;
                    }
                    else if (e.X > this.Width - 21 && e.X < this.Width - 7)
                    {
                        which = Which.Close;
                    }

                    if (e.Button == MouseButtons.Left)
                    {
                        state = MouseState.Down;
                    }
                    else
                    {
                        state = MouseState.On;
                    }
                }

                this.Invalidate(new Rectangle(this.Width - 59, 8, 52, 14));
            }
        }
Exemplo n.º 9
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            which = Which.Non;
            state = MouseState.Normal;
            bool on = false;

            if (e.Y > 8 && e.Y < 22 && e.X > this.Width - 59 && e.X < this.Width - 7 && e.Button == MouseButtons.Left && this.ControlBox)
            {
                if (e.X > this.Width - 59 && e.X < this.Width - 45 && this.MinimizeBox)
                {
                    which = Which.Min;
                    on    = true;
                }
                else if (e.X > this.Width - 39 && e.X < this.Width - 25 && this.MaximizeBox)
                {
                    which = Which.Max;
                    on    = true;
                }
                else if (e.X > this.Width - 21 && e.X < this.Width - 7)
                {
                    which = Which.Close;
                    on    = true;
                }

                state = MouseState.Down;

                this.Invalidate();
            }

            if (e.Y > 0 && e.Y < 28 && e.Button == MouseButtons.Left && !on && WindowState != FormWindowState.Maximized)
            {
                x    = e.X;
                y    = e.Y;
                move = true;
            }
        }
Exemplo n.º 10
0
            static public NotificationOptions Options(Which chosen)
            {
                var value = new NotificationOptions();

                switch (chosen)
                {
                case Which.Info:
                    value = new NotificationOptions()
                    {
                        Title = "Info",
                        //Description = "The Description Content",
                        //IsClickable = true,
                        WindowsOptions = new WindowsOptions()
                        {
                            LogoUri = "icon.png"
                        },
                        ClearFromHistory = true,
                        //AllowTapInNotificationCenter = false,
                        AndroidOptions = new AndroidOptions()
                        {
                            HexColor          = "#00C1DE",
                            SmallDrawableIcon = 17301659,
                            //ForceOpenAppOnNotificationTap = true
                        }
                    };
                    break;

                case Which.Success:
                    value = new NotificationOptions()
                    {
                        Title          = "Success",
                        WindowsOptions = new WindowsOptions()
                        {
                            LogoUri = "icon.png"
                        },
                        ClearFromHistory = true,
                        AndroidOptions   = new AndroidOptions()
                        {
                            HexColor          = "#3FF18B",
                            SmallDrawableIcon = 17301540,
                        }
                    };
                    break;

                case Which.Warning:
                    value = new NotificationOptions()
                    {
                        Title          = "Warning",
                        WindowsOptions = new WindowsOptions()
                        {
                            LogoUri = "icon.png"
                        },
                        ClearFromHistory = true,
                        AndroidOptions   = new AndroidOptions()
                        {
                            HexColor          = "#7500E5",
                            SmallDrawableIcon = 17301642,
                        }
                    };
                    break;

                case Which.Error:
                    value = new NotificationOptions()
                    {
                        Title          = "Error",
                        WindowsOptions = new WindowsOptions()
                        {
                            LogoUri = "icon.png"
                        },
                        ClearFromHistory = true,
                        AndroidOptions   = new AndroidOptions()
                        {
                            HexColor          = "#E7002F",
                            SmallDrawableIcon = 17301543,
                        }
                    };
                    break;
                }
                return(value);
            }
Exemplo n.º 11
0
 public CurryMonster(Func <T, T, T, T, T> fun)
 {
     this.which  = Which._fn_4_1;
     this.fn_4_1 = fun;
 }
Exemplo n.º 12
0
 public static WhichAttribute GetFor(Which which)
 {
     if (WhichAttribute._getForCache == null)
     {
         WhichAttribute._getForCache = new Dictionary<Which, WhichAttribute>();
     }
     if (!WhichAttribute._getForCache.ContainsKey(which))
     {
         WhichAttribute._getForCache.Add(which, (WhichAttribute)typeof(Which).GetMember(which.ToString())[0].GetCustomAttributes(typeof(WhichAttribute), false)[0]);
     }
     return WhichAttribute._getForCache[which];
 }
Exemplo n.º 13
0
 public Tool(Which which, string[] arguments)
     : this(which, arguments, null)
 {
 }
Exemplo n.º 14
0
 public DelimitedBoxLink(DelimitedBox db, Which piece) : base(db)
 {
     _piece = piece;
 }