Ejemplo n.º 1
0
        /// <summary>
        /// Checks to see what builds are supported in the properties
        /// file, so it can update the menu options
        /// </summary>
        /// <returns></returns>
        public static string[] GetSupportedModes()
        {
            SimpleLog.Info("Loading Supported Modes");
            List <string> supportedModes = new List <string>();

            if (Properties.Setup.Default.AD_Supported)
            {
                supportedModes.Add(Build.AD_Mode.ToString());
            }

            if (Properties.Setup.Default.AP_Supported)
            {
                supportedModes.Add(Build.AP_Mode.ToString());
            }

            if (Properties.Setup.Default.General_Supported)
            {
                supportedModes.Add(Build.General_Mode.ToString());
            }

            if (Properties.Setup.Default.Support_Supported)
            {
                supportedModes.Add(Build.Support_Mode.ToString());
            }

            SimpleLog.Info("Loaded + " + string.Join(",", supportedModes) + " Modes");
            return(supportedModes.ToArray());
        }
Ejemplo n.º 2
0
        public static void Main()
        {
            // Setup logger
            Settings.SetupLogger();
            SimpleLog.Check(String.Format("{0} {1} {2}", Settings.ProgramName, Settings.ProgramVersion, "started"));

            // Load Settings
            Settings.LoadSettings();

            // Open MainWindow
            App app = new App();

            try
            {
                app.InitializeComponent();
                MainWindow window = new MainWindow();
                app.Run(window);
            }
            catch (Exception e)
            {
                SimpleLog.Log(e);
            }

            app.Shutdown();
            SimpleLog.Info(String.Format("{0} {1} {2}", Settings.ProgramName, Settings.ProgramVersion, "closed"));
            SimpleLog.Flush();
            SimpleLog.StopLogging();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Reads and returns the participating users list
        /// </summary>
        /// <returns>The participating usernames</returns>
        public List <User> ReadUserList()
        {
            SimpleLog.Info("Reading userlist...");

            int col = FirstUserCol;

            var users = new List <User>();

            while (col < MaxUserCol)
            {
                var cell = (Range)Worksheet.Cells[UserListRow, col];
                if (!cell.MergeCells)
                {
                    break;
                }
                SimpleLog.Info($"Read Excel cell [{UserListRow},{col}]");
                var cellVal = (string)cell.Value;
                if (!String.IsNullOrWhiteSpace(cellVal))
                {
                    var user = new User
                    {
                        Name    = cellVal,
                        UserCol = col,
                    };
                    users.Add(user);
                }
                SimpleLog.Info($"User found: {cellVal}");

                col += UserColCount;
            }

            return(users);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Log a message at specified level
        /// </summary>
        /// <param name="level">level to log</param>
        /// <param name="message">message to log</param>
        public void Log(LogLevel level, object message)
        {
            var messageToLog = String.Format("{0}|{1}", level, message);

            switch (level)
            {
            case LogLevel.Debug:
                SimpleLog.Info(messageToLog);
                break;

            case LogLevel.Error:
                SimpleLog.Error(messageToLog);
                break;

            case LogLevel.Fatal:
                SimpleLog.Error(messageToLog);
                break;

            case LogLevel.Info:
                SimpleLog.Info(messageToLog);
                break;

            case LogLevel.Warning:
                SimpleLog.Warning(messageToLog);
                break;

            default:
                SimpleLog.Error(messageToLog);
                break;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Writes the tips of the user to the excel file and returns true on tips to write
        /// </summary>
        /// <param name="userlist">The userlist</param>
        /// <returns>True on tips to write</returns>
        public bool WriteUsertips(List <User> userlist)
        {
            SimpleLog.Info($"Write {userlist.SelectMany(x => x.Tips).Count()} usertips...");

            for (int row = NextMatchdayRow + 1; row <= NextMatchdayRow + RealMatchesPerMatchday; row++)
            {
                // get match in row
                var team1Name = (string)((Range)Worksheet.Cells[row, MatchdayTeam1Col]).Value;
                if (String.IsNullOrWhiteSpace(team1Name))
                {
                    continue;
                }
                foreach (var user in userlist)
                {
                    var match = user.Tips.FirstOrDefault(m => m.TeamA == team1Name);
                    if (match == null)
                    {
                        continue;
                    }

                    // write tip
                    SimpleLog.Info($"Write Excel cell [{row},{user.UserCol}]: {match.ResultA}");
                    Worksheet.Cells[row, user.UserCol] = match.ResultA;
                    SimpleLog.Info($"Write Excel cell [{row},{user.UserCol + 1}]: {match.ResultB}");
                    Worksheet.Cells[row, user.UserCol + 1] = match.ResultB;
                }
            }

            return(userlist.SelectMany(x => x.Tips).Any());
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Reads an returns the <see cref="FootballMatch"/> of the next matchday
        /// </summary>
        /// <returns>The matches</returns>
        public List <FootballMatch> GetNextMatchdayMatches()
        {
            SimpleLog.Info("Reading next matchday matches...");

            var nextNo = ReadMatchdayNo();

            // search current matchday row
            int matchdayRow;

            for (matchdayRow = FirstMatchdayRow; matchdayRow < MaxMatchdayRow; matchdayRow += MatchdayRowCount)
            {
                SimpleLog.Info($"Read Excel cell [{matchdayRow},{MatchdayCol}]");
                var resValue = (double?)((Range)Worksheet.Cells[matchdayRow, MatchdayCol]).Value;
                if (resValue.HasValue && Math.Abs(resValue.Value - nextNo) < 0.1)
                {
                    break;
                }
            }

            // Get teams
            var matches = new List <FootballMatch>();

            for (int i = matchdayRow + 1; i <= matchdayRow + RealMatchesPerMatchday; i++)
            {
                SimpleLog.Info($"Read Excel cell [{i},{MatchdayTeam1Col}]");
                var team1 = (string)((Range)Worksheet.Cells[i, MatchdayTeam1Col]).Value;
                SimpleLog.Info($"Read Excel cell [{i},{MatchdayTeam2Col}]");
                var team2 = (string)((Range)Worksheet.Cells[i, MatchdayTeam2Col]).Value;
                matches.Add(new FootballMatch {
                    TeamA = team1, TeamB = team2
                });
            }

            return(matches);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MenuManager"/> class.
        /// </summary>
        /// <param name="orbWalker">The orb walker.</param>
        /// <param name="rootMenuNameInternalName">Name of the root menu name internal.</param>
        /// <param name="rootMenuName">Name of the root menu.</param>
        public MenuManager(IOrbwalker orbWalker, string rootMenuNameInternalName, string rootMenuName)
        {
            SimpleLog.Info("Initialising MenuManager");

            _menuItems = new MenuItems()
            {
                Root = new Menu(rootMenuNameInternalName, rootMenuName, true)
            };
            {
                orbWalker.Attach(_menuItems.Root);

                _menuItems.Mode = new Menu(Constants.MenuOptions.BuildL, Constants.MenuOptions.Build);
                {
                    _menuItems.Mode.Add(new MenuList(Constants.MenuOptions.ModeL, Constants.MenuOptions.Mode, MenuHelper.GetSupportedModes(), 0));
                }

                _menuItems.Misc = new Menu(Constants.MenuOptions.MiscMenuL, Constants.MenuOptions.MiscMenu);
                {
                    _menuItems.Misc.Add(new MenuBool(Constants.MenuOptions.SupportModeL, Constants.MenuOptions.SupportMode));
                    _menuItems.Misc.Add(new MenuBool(Constants.MenuOptions.DisableAAL, Constants.MenuOptions.DisableAA));
                    _menuItems.Misc.Add(new MenuBool(Constants.MenuOptions.ManaManagerDisableL, Constants.MenuOptions.ManaManagerDisable));
                    _menuItems.Misc.Add(new MenuList(Constants.MenuOptions.SpellLevelBlockerL, Constants.MenuOptions.SpellLevelBlocker, Constants.MenuOptions.SpellLevelBlockerOptions, 0));
                }
                _menuItems.Root.Add(_menuItems.Misc);
            }
            _menuItems.Root.Attach();

            SimpleLog.Info("MenuManager Initialised");
        }
Ejemplo n.º 8
0
        protected override void Dispose(bool A_0)
        {
            if (A_0)


            {
                dispose_escape();
                SimpleLog.Info("Prison Mod is Restarted");
                Function.Call(Hash.ENABLE_ALL_CONTROL_ACTIONS, new InputArgument[] { 1 });
                Game.Player.CanControlCharacter = true;
                Function.Call(Hash.SET_ENABLE_HANDCUFFS, new InputArgument[] { Game.Player.Character, 0 });
                Function.Call(Hash.SET_ENABLE_BOUND_ANKLES, new InputArgument[] { Game.Player.Character, 0 });
                Function.Call(Hash.SET_MAX_WANTED_LEVEL, new InputArgument[] { 5 });

                if (police != null)
                {
                    police.Delete();
                }
                if (escape_Ped != null)
                {
                    escape_Ped.Delete();
                }
                if (policecar != null)
                {
                    policecar.Delete();
                }
            }
        }
Ejemplo n.º 9
0
        private async void GenerateWikiCodeButton_Click(object sender, RoutedEventArgs e)
        {
            Settings.LogButtonClicked(sender as Button);
            SimpleLog.Info(String.Format("Generate Wikicode, LeagueSize={0}, Table={1}, Qual1Count={2}, Qual2Count={3}, Results={4}, Template={5}",
                                         League.TeamCount, TableCheckBox.IsChecked, Qual1PlacesComboBox.SelectedIndex, Qual2PlacesComboBox.SelectedIndex,
                                         ResultsCheckBox.IsChecked, (WikiTemplateComboBox.SelectedItem as LeagueWikiTemplate).Name));
            WikiCodeTextBox.Text = String.Empty;

            if (TableCheckBox.IsChecked == true)
            {
                try
                {
                    await League.CalculateTableAsync();

                    WikiCodeTextBox.Text += await WikiHelper.GenerateTableCodeAsync(League, Qual1PlacesComboBox.SelectedIndex, Qual2PlacesComboBox.SelectedIndex);
                }
                catch (Exception ex)
                {
                    SimpleLog.Log(ex);
                }
            }

            if (ResultsCheckBox.IsChecked == true && WikiTemplateComboBox.SelectedIndex >= 0)
            {
                try
                {
                    WikiCodeTextBox.Text += await WikiHelper.GenerateResultsCodeAsync(League, WikiTemplateComboBox.SelectedItem as LeagueWikiTemplate);
                }
                catch (Exception ex)
                {
                    SimpleLog.Log(ex);
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Füllt die Comboboxen für die Positionen der Qualx-Tabellenplätze
        /// </summary>
        private void FillWikiCodeQualComboBoxes()
        {
            SimpleLog.Info(String.Format("Filter Qual-Classes: LeagueSize={0}, Qual1Count={1}, Qual2Count={2}",
                                         League.TeamCount, Qual1PlacesComboBox.SelectedIndex, Qual2PlacesComboBox.SelectedIndex));

            var valuesQ1 = new int[League.TeamCount + 1];

            for (int i = 0; i <= League.TeamCount; i++)
            {
                valuesQ1[i] = i;
            }
            Qual1PlacesComboBox.ItemsSource = valuesQ1;
            if (Qual1PlacesComboBox.SelectedIndex == -1)
            {
                Qual1PlacesComboBox.SelectedIndex = 0;
            }

            var valuesQ2 = new int[League.TeamCount - Qual1PlacesComboBox.SelectedIndex + 1];

            for (int i = 0; i <= League.TeamCount - Qual1PlacesComboBox.SelectedIndex; i++)
            {
                valuesQ2[i] = i;
            }
            Qual2PlacesComboBox.ItemsSource = valuesQ2;
            if (Qual2PlacesComboBox.SelectedIndex == -1)
            {
                Qual2PlacesComboBox.SelectedIndex = 0;
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Filtert die Staatenliste basierend auf dem Kontinent
        /// </summary>
        private void FilterStateList()
        {
            SimpleLog.Info(String.Format("Filter Statelist: Continent={0}", SelectedContinent));

            StatesComboBoxList = (SelectedContinent != EContinent.Unknown) ? new StateCollection(Settings.States.Where(x => x.Continent == SelectedContinent)) : new StateCollection(Settings.States);
            StatesComboBoxList.Insert(0, State.NoneState);
        }
Ejemplo n.º 12
0
        public void AddTagItem(string segmentNumber, string removedTag)
        {
            SimpleLog.Info(string.Join(Environment.NewLine,
                                       $"{ Environment.NewLine }\tREMOVED TAG",
                                       $"\tId: { segmentNumber }",
                                       $"\tRemoved Tag: { removedTag + Environment.NewLine }"));

            tagRemoveCount++;
        }
Ejemplo n.º 13
0
        public static int Main()
        {
            ////Debugger.Launch();

            var arguments = GetArguments();

            GetAssemblyData(out var executingAssemblyLocation, out var executingAssemblyFileName);

            Configure(executingAssemblyFileName);

            SimpleLog.Info($"Full Commandline: {Environment.CommandLine}");
            SimpleLog.Info($"Detected Attributes: {arguments}");

            SimpleLog.Info($"RunHiddenConsole Executing Assembly FullName: {executingAssemblyFileName}");

            var targetExecutablePath = GetTargetExecutablePath(executingAssemblyLocation, executingAssemblyFileName);

            if (targetExecutablePath == null)
            {
                SimpleLog.Error("Unable to find target executable name in own executable name.");
                return(-7001);
            }

            var startInfo = new ProcessStartInfo
            {
                CreateNoWindow        = true,
                UseShellExecute       = false,
                RedirectStandardInput = true,
                WindowStyle           = ProcessWindowStyle.Hidden,
                WorkingDirectory      = Directory.GetCurrentDirectory(),
                Arguments             = arguments,
                FileName = targetExecutablePath,
            };

            try
            {
                var proc = Process.Start(startInfo);
                if (proc == null)
                {
                    SimpleLog.Error("Unable to start the target process.");
                    return(-7002);
                }

                // process will close as soon as its waiting for interactive input.
                proc.StandardInput.Close();

                proc.WaitForExit();

                return(proc.ExitCode);
            }
            catch (Exception ex)
            {
                SimpleLog.Error("Starting target process threw an unknown Exception: " + ex);
                SimpleLog.Log(ex);
                return(-7003);
            }
        }
Ejemplo n.º 14
0
        public static void ParseLeague(Settings settings)
        {
            Console.WriteLine($"Parsing {settings.LeagueName}.");
            SimpleLog.Info($"Parsing {settings.LeagueName}.");

            settings.Excel = new ExcelHandler();
            var readUserTask = Task.Run(() =>
            {
                settings.Excel.OpenFile(settings.TargetFileName);
                return(settings.Excel.ReadUserList());
            });

            Console.Write("URL current matchday thread: ");
            settings.TipThreadUrl = Console.ReadLine();
            readUserTask.Wait();
            var users = readUserTask.Result;

            if (String.IsNullOrWhiteSpace(settings.TipThreadUrl))
            {
                settings.Excel.CloseFile();
                return; // cancel execution
            }
            var matches = settings.Excel.GetNextMatchdayMatches();

            SimpleLog.Info($"{users.Count} Users found. Use {settings.TipThreadUrl} to get tips.");

            // getting tips
            var posts = Crawler.GetPosts(settings);

            SimpleLog.Info($"{posts.Count} posts found.");
            var usermatches = Parser.ParsePosts(matches, users, posts);

            SimpleLog.Info("All data parsed.");

            // saving all
            if (settings.Excel.WriteUsermatches(usermatches))
            {
                Console.WriteLine("Matches between users writed.");
            }
            else
            {
                Console.WriteLine("No matches between users writed.");
            }

            if (settings.Excel.WriteUsertips(users))
            {
                Console.WriteLine("Tips from users writed.");
            }
            else
            {
                Console.WriteLine("No tips from users writed.");
            }
            settings.Excel.SaveFile();

            Console.WriteLine();
        }
Ejemplo n.º 15
0
        public static int Main(string[] args)
        {
            var executingAssembly = Assembly.GetExecutingAssembly();

            var fullName = Path.GetFileName(executingAssembly.Location);

            SimpleLog.Prefix = $"{fullName}.";

            SimpleLog.Info($"RunHiddenConsole Executing Assembly FullName: {fullName}");

            var match = Regex.Match(fullName, @"(.+)w(\.\w{1,3})");

            if (!match.Success)
            {
                SimpleLog.Error("Unable to find target executable name in own executable name.");
                return(-7001);
            }

            var targetExecutableName = match.Groups[1].Value + match.Groups[2].Value;

            var fullDirectory = Path.GetDirectoryName(executingAssembly.Location) ?? string.Empty;
            var executable    = Path.Combine(fullDirectory, targetExecutableName);

            var startInfo = new ProcessStartInfo
            {
                CreateNoWindow        = true,
                UseShellExecute       = false,
                RedirectStandardInput = true,
                WindowStyle           = ProcessWindowStyle.Hidden,
                WorkingDirectory      = Directory.GetCurrentDirectory(),
                Arguments             = string.Join(" ", args),
                FileName = executable,
            };

            try
            {
                var proc = Process.Start(startInfo);
                if (proc == null)
                {
                    SimpleLog.Error("Unable to start the target process.");
                    return(-7002);
                }

                // process will close as soon as its waiting for interactive input.
                proc.StandardInput.Close();

                proc.WaitForExit();

                return(proc.ExitCode);
            }
            catch (Exception ex)
            {
                SimpleLog.Error("Starting target process threw an unknown Exception: " + ex);
                return(-7003);
            }
        }
Ejemplo n.º 16
0
        public void AddLockItem(string segmentNumber, string lockedContent, string lockReason)
        {
            SimpleLog.Info(string.Join(Environment.NewLine,
                                       $"{ Environment.NewLine }\tLOCKED SEGMENT",
                                       $"\tId: { segmentNumber }",
                                       $"\tContent: { lockedContent }",
                                       $"\tReason: { lockReason + Environment.NewLine }"));

            segmentLockCount++;
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GameObjectManager"/> class.
 /// </summary>
 public GameObjectManager()
 {
     SimpleLog.Info("Initialising GameObjectManager");
     _champion        = ObjectManager.GetLocalPlayer();
     _healthPredition = HealthPrediction.Implementation;
     _targetSelector  = TargetSelector.Implementation;
     _orbWalker       = Orbwalker.Implementation;
     _menu            = new MenuManager(_orbWalker, _champion.ChampionName.ToLower(), Constants.General.ProjectName + _champion.ChampionName);
     SimpleLog.Info("GameObjectManager Initialised");
 }
Ejemplo n.º 18
0
        public static void WindowGui()
        {
            Debug.WriteLine("Entering WindowGui");                                    // Debug Message
            SimpleLog.Info("Entered 'Main graphical interface thread (WindowGui)'."); // Writes 'info' level message to log

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Application.Run(new Main());
        }
Ejemplo n.º 19
0
 /// <summary>
 /// Exits or creates the Assembly depending on if the user is
 /// playing the supported champion
 /// </summary>
 private static void GameEvents_GameStart()
 {
     if (ObjectManager.GetLocalPlayer().ChampionName != ChampionName)
     {
         return;
     }
     InitLogFile();
     SimpleLog.Info("Loading + " + ChampionName);
     SetUp();
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChampionSetup"/> class.
 /// </summary>
 /// <param name="gamePlay">The game play.</param>
 public ChampionSetup(GameObjectManager gamePlay)
 {
     SimpleLog.Info("Initialising Champion " + _currentBuild);
     _gamePlay = gamePlay;
     _menu     = gamePlay._menu;
     _championMenu.PopulateSupportedBuilds(_menu);
     _currentBuild = _championMenu.GetBuildSettings(_menu);
     SetupNewBuild(_currentBuild);
     Game.OnUpdate += Game_OnUpdate;
     SimpleLog.Info("Champion Initialised " + _currentBuild);
 }
        private void SyncCalendar(int InstructorID)
        {
            InstructorBusiness InsBO = new InstructorBusiness();
            Instructor         Ins   = InsBO.GetInstructorByID(InstructorID);

            //Neu chua co teken thi ko lam gi het
            if (Ins.ApiToken == null)
            {
                return;
            }

            SimpleLog.Info("Begin Sync Calendar for Instructor " + Ins.Fullname + ".");
            try
            {
                String RefreshToken = Ins.ApiToken;
                var    WrapperAPI   = new GoogleCalendarAPIWrapper(RefreshToken);

                //Tim toan bo lich cua instructor
                var Calendars = WrapperAPI.GetCalendarList();
                //Tim xem da co teaching calendar chua, chua co thi insert
                GoogleCalendar TeachingCalendar = Calendars.Items.SingleOrDefault(ca => ca.Summary.Equals("Teaching Calendar"));

                if (TeachingCalendar == null)
                {
                    TeachingCalendar = WrapperAPI.InsertCalendar("Teaching Calendar");
                }
                else
                {
                    //Clear nhung ngay trong tuong lai
                    WrapperAPI.ClearFutureDateCalendar(TeachingCalendar.ID);
                }

                //Bat dau lay event, ghi vao calendar.
                StudySessionBusiness StuSesBO = new StudySessionBusiness();
                //Chi lay nhung event trong tuong lai, tiet kiem dung luong
                List <Event> Events = StuSesBO.GetCalendarEvent(InstructorID).
                                      Where(e => e.StartDate >= DateTime.Now).ToList();
                foreach (var Event in Events)
                {
                    WrapperAPI.InsertEvent(TeachingCalendar.ID, Event.title, Event.StartDate, Event.EndDate);
                }

                String Message = String.Format("Succesfull sync {0} events, from {1:dd-MM-yyyy} to {2:dd-MM-yyyy}",
                                               Events.Count, Events.First().StartDate, Events.Last().StartDate);

                SimpleLog.Info(Message);
            }
            catch (Exception e)
            {
                SimpleLog.Error("Error while trying to sync.");
                SimpleLog.Error(e.Message);
            }
        }
Ejemplo n.º 22
0
        public void AddConversionItem(string segmentNumber, string before, string after, string searchText, string replaceText = "")
        {
            SimpleLog.Info(string.Join(Environment.NewLine,
                                       $"{ Environment.NewLine }\tCHANGED TEXT",
                                       $"\tId: { segmentNumber }",
                                       $"\tBefore: { before }",
                                       $"\tAfter: { after }",
                                       $"\tSearched Text: { searchText }",
                                       $"\tReplaced Text: { replaceText + Environment.NewLine }"));

            conversionCount++;
        }
Ejemplo n.º 23
0
        private void btnClear_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Are you sure you would like to Clear the Database?", "Clear Database", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (dr == DialogResult.Yes)
            {
                if (Program.Globals.authMethod == 1)
                {
                    try
                    {
                        string query = "TRUNCATE TABLE " + Program.Globals.databaseTbl;

                        using (SqlConnection connection = new SqlConnection(Program.Globals.connectionStringWinAuth))
                        {
                            SqlCommand command = new SqlCommand(query, connection);
                            command.Connection.Open();
                            command.ExecuteNonQuery();
                            command.Connection.Close();
                        }

                        SimpleLog.Info("Cleared Database.");
                    }
                    catch (Exception ex)
                    {
                        SimpleLog.Log(ex);
                    }
                }
                else
                {
                    try
                    {
                        string query = "TRUNCATE TABLE " + Program.Globals.databaseTbl; // Defines the SQL query inline.

                        // Defines the connection with the Windows Authentication connection string.
                        using (SqlConnection connection = new SqlConnection(Program.Globals.connectionStringWinAuth))
                        {
                            SqlCommand command = new SqlCommand(query, connection);
                            command.Connection.Open();  // Opens the connection to the SQL Server
                            command.ExecuteNonQuery();  // Executes the inline SQL query against the specified database.
                            command.Connection.Close(); // Closes the the connection.
                        }

                        SimpleLog.Info("Cleared Database.");
                    }
                    catch (Exception ex)
                    {
                        SimpleLog.Log(ex);
                    }
                }
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Populates the menu with supported builds
        /// </summary>
        /// <param name="menu">The menu.</param>
        public void PopulateSupportedBuilds(MenuManager menu)
        {
            SimpleLog.Info("Initialising MenuManager");

            DisposeOldMenu(ref menu);

            menu._menuItems.Mode = new Menu(Constants.MenuOptions.BuildL, Constants.MenuOptions.Build);
            {
                menu._menuItems.Mode.Add(new MenuList(Constants.MenuOptions.ModeL, Constants.MenuOptions.Mode, MenuHelper.GetSupportedModes(), 0));
            }
            menu._menuItems.Root.Add(menu._menuItems.Mode);

            menu._menuItems.Mode.OnValueChanged += Mode_OnValueChanged;
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Filtert die Teamliste basierend auf Kontinent und Staat
        /// </summary>
        private void FilterTeamList()
        {
            SimpleLog.Info(String.Format("Filter Teamlist: Continent={0} State={1}", SelectedContinent, SelectedState?.Name));

            FilteredTeamList = new FootballTeamCollection(Settings.FootballTeams);
            if (SelectedContinent != EContinent.Unknown)
            {
                FilteredTeamList = new FootballTeamCollection(FilteredTeamList.Where(x => x.State.Continent == SelectedContinent));
            }
            if (SelectedState != null && SelectedState != State.NoneState)
            {
                FilteredTeamList = new FootballTeamCollection(FilteredTeamList.Where(x => x.State == SelectedState));
            }
        }
Ejemplo n.º 26
0
        public void Execute()
        {
            InstructorBusiness InsBO   = new InstructorBusiness();
            CalendarBusiness   CalenBO = new CalendarBusiness();
            //Tim nhung instructor co API Token
            List <Instructor> InstructorsWithAPI = InsBO.Find(ins => ins.ApiToken != null);

            foreach (var Instructor in InstructorsWithAPI)
            {
                CalenBO.SyncInstructorCalendar(Instructor.InstructorID);
            }

            SimpleLog.Info("Calendar for " + InstructorsWithAPI.Count + " instructors synced.");
        }
Ejemplo n.º 27
0
        private static async Task RealUpdateIfAvailable()
        {
            SimpleLog.Info("Checking remote server for update.");

            try
            {
                mgr = UpdateManager.GitHubUpdateManager(repoURL);
                await mgr.Result.UpdateApp();
            }
            catch (Exception ex)
            {
                SimpleLog.Error(ex.Message);
            }
        }
Ejemplo n.º 28
0
 public void Train_And_Untrain_Row3()
 {
     link.GridDataViewPresenter.CheckClicked();
     SimpleLog.Info("Check Clicked");
     link.GridDataViewPresenter.RowSelectionChanged(2);
     SimpleLog.Info("Row 3 Selected");
     link.ResultantViewPresenter.btnTrainClicked();
     SimpleLog.Info("Button Train Clicked");
     Assert.AreEqual(true, link.GridDataViewPresenter.isTrained(2));
     SimpleLog.Info("Assert is true for row 3 istrained.");
     link.GridDataViewPresenter.UnTrainClicked(2);
     SimpleLog.Info("row 3 untrained");
     Assert.AreEqual(false, link.GridDataViewPresenter.isTrained(2));
     SimpleLog.Info("Assert is false for row 3 istrained.");
 }
Ejemplo n.º 29
0
        /// <summary>
        /// Writes the usermatches to the excel file and returns true on matches to write
        /// </summary>
        /// <param name="usermatches">The usermatches</param>
        /// <returns>True on matches to write</returns>
        public bool WriteUsermatches(List <Usermatch> usermatches)
        {
            SimpleLog.Info($"Write {usermatches.Count} usermatches...");

            for (int i = 0; i < usermatches.Count; i++)
            {
                var cellRow = NextMatchdayRow + 1 + i;
                SimpleLog.Info($"Write Excel cell [{cellRow},{UsermatchUser1Col}]: {usermatches[i].UserA.Name}");
                Worksheet.Cells[cellRow, UsermatchUser1Col] = usermatches[i].UserA.Name;
                SimpleLog.Info($"Write Excel cell [{cellRow},{UsermatchUser2Col}]: {usermatches[i].UserB.Name}");
                Worksheet.Cells[cellRow, UsermatchUser2Col] = usermatches[i].UserB.Name;
            }

            return(usermatches.Any());
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Attemps get the Build currently set in the menu
 /// </summary>
 /// <param name="menu">The menu.</param>
 /// <returns></returns>
 private Build GetBuild(MenuManager menu)
 {
     try
     {
         SimpleLog.Info("Getting Build from menu");
         Build build;
         Enum.TryParse(menu._menuItems.Mode[Constants.MenuOptions.ModeL].As <MenuList>().SelectedItem.ToString(), out build);
         return(build);
     }
     catch (Exception ex)
     {
         SimpleLog.Error("Failed to GetBuild() " + ex.Message);
         return(Build.Unknown);
     }
 }