//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: Start //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ protected virtual void Start() { m_ttWaitTimer = new TimeTracker(m_fWaitTimeBetweenRepeats); SetupAnimations(); }
partial void InsertUser(TimeTracker.Domain.User instance);
partial void DeleteUser(TimeTracker.Domain.User instance);
partial void InsertTaskType(TimeTracker.Domain.TaskType instance);
partial void InsertTimeEntry(TimeTracker.Domain.TimeEntry instance);
//Report 5 public List<DayWiseInOutDurationReportViewModel> GetDataForDailyInOutDurationReport(DateTime date) { List<DayWiseInOutDurationReportViewModel> lst = new List<DayWiseInOutDurationReportViewModel>(); DataTable dt; DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString; List<SqlParameter> list_params; try { using (DBDataHelper helper = new DBDataHelper()) { List<TimeTracker> lst_timetracker = new List<TimeTracker>(); list_params = new List<SqlParameter>() { new SqlParameter("@date", date) }; dt = helper.GetDataTable("spGetEntriesDateWise", SQLTextType.Stored_Proc, list_params); foreach (DataRow row in dt.Rows) { TimeTracker tracker = new TimeTracker(); tracker.EmployeeID = Convert.ToInt32(row[0].ToString()); tracker.InTime = row[1].ToString(); //We can set the status as No Out Punch here //To DO : MUDIT JUNEJA :: PLEASE DON'T FORGET :P tracker.OutTime = row[2] == DBNull.Value ? "16:10:00.0000000" : row[2].ToString(); lst_timetracker.Add(tracker); } foreach (var item in lst_timetracker.GroupBy(i => i.EmployeeID).Select(grp => grp.First())) { DayWiseInOutDurationReportViewModel model = new DayWiseInOutDurationReportViewModel(); model.EmployeeCode = item.EmployeeID; model.Tracker.AddRange(lst_timetracker.FindAll(j => j.EmployeeID == item.EmployeeID)); lst.Add(model); } } } // } catch (Exception) { // } return lst; }
/*-------------------------------------------------------------- POPOLARE CONTENUTI --------------------------------------------------------------*/ private void PopulateSelectedProject(ListBoxItem listBoxProject) { DbSet <TimeTrack> timeTracksDBSet = intimeDb.TimeTracks; DbSet <Assignment> AssignmentsDBSet = intimeDb.Assignments; selectedProject = (Project)listBoxProject.Tag; // POPOLA LA DATAGRID // seleziona tutti gli assignment per un progetto List <Assignment> assignmentList = (from Assignment in AssignmentsDBSet where Assignment.ProjectId == selectedProject.Id select Assignment).ToList(); List <AssignmentForDataGrid> dataGridAssignments = new List <AssignmentForDataGrid>(); long projectTotalTicks = 0; // serve per il tempo totale del progetto foreach (Assignment assignment in assignmentList) { int personId = assignment.PersonId; List <TimeTrack> timetracksList = (from TimeTrack in timeTracksDBSet // seleziona tutti i timetrack di UNA persona per IL progetto selezionato where TimeTrack.ProjectId == selectedProject.Id where TimeTrack.PersonId == personId select TimeTrack).ToList(); long personTotalTicks = 0; foreach (TimeTrack track in timetracksList) // calcola il tempo totale della persona { personTotalTicks += (long)track.WorkTime; } projectTotalTicks += personTotalTicks; // LISTA ASSIGNMENTS AssignmentForDataGrid assignmentForDataGrid = new AssignmentForDataGrid(); // creazione Assignment per DataGrid assignmentForDataGrid.name = assignment.Person.PersonName; assignmentForDataGrid.time = TimeTracker.ToString(TimeSpan.FromTicks(personTotalTicks)); assignmentForDataGrid.active = assignment.Active; assignmentForDataGrid.personId = assignment.PersonId; dataGridAssignments.Add(assignmentForDataGrid); } // COMBOBOX: FILTRO LISTA PERSONE GetPeopleListInComboBox(assignmentList); // PROPRIETà DEL PROGETTO (GROUPBOX) TotalWorkTime.Text = TimeTracker.ToString(TimeSpan.FromTicks(projectTotalTicks)); ProjectName.Text = selectedProject.ProjectName; // not null Customer.Text = selectedProject.Customer; // null Description.Text = selectedProject.Description; // null if (selectedProject.ProjectAssignedTime != null) { TimeSpan timespan = TimeSpan.FromTicks((long)selectedProject.ProjectAssignedTime); EstimatedTime.Text = TimeTracker.ToString(timespan); } // null else { EstimatedTime.Text = ""; } if (selectedProject.DueDate != null) { DueDate.Text = ((DateTime)selectedProject.DueDate).ToShortDateString(); } // null else { DueDate.Text = ""; } if (selectedProject.DateCreation != null) { CreationDate.Text = ((DateTime)selectedProject.DateCreation).ToShortDateString(); } // null else { CreationDate.Text = ""; } if (selectedProject.Active) // not null { Active.Text = "Sì"; } // not null else { Active.Text = "No"; } // BINDING CollectionViewSource itemCollectionViewSource; itemCollectionViewSource = (CollectionViewSource)(FindResource("ItemCollectionViewSource")); itemCollectionViewSource.Source = dataGridAssignments; }
public static string[] OnWillSaveAssets(string[] paths) { TimeTracker.OnTrigger(); return(paths); }
public FleeingGenerator(ObjectGuid fright) { i_frightGUID = fright; i_nextCheckTime = new TimeTracker(); }
/// <summary> /// Not thread safe. Loads and returns the account if it exists, otherwise returns null /// </summary> /// <param name="localAccountId"></param> /// <returns></returns> private static async Task <AccountDataItem> Load(Guid localAccountId) { var timeTracker = TimeTracker.Start(); IFile file = await GetFile(localAccountId); timeTracker.End(3, "AccountsManager.Load GetFile"); // If doesn't exist if (file == null) { return(null); } // Otherwise AccountDataItem account; timeTracker = TimeTracker.Start(); using (Stream s = await file.OpenAsync(StorageEverywhere.FileAccess.Read)) { timeTracker.End(3, "AccountsManager.Load open file stream"); timeTracker = TimeTracker.Start(); try { account = (AccountDataItem)GetSerializer().ReadObject(s); } catch (Exception ex) { // Sometimes the file becomes corrupt, nothing we can do, they'll have to log in again TelemetryExtension.Current?.TrackEvent("Error_FailDeserializeAccount", new Dictionary <string, string>() { { "Exception", ex.ToString() } }); return(null); } timeTracker.End(3, "AccountsManager.Load deserializing stream"); } account.LocalAccountId = localAccountId; SyncLayer.Sync.ChangedSetting?changedSettings = null; // Upgrade account data if (account.AccountDataVersion < 2) { // We introduced syncing selected semester in this version. // So if we upgraded, we need to make sure we force sync if (account.CurrentSemesterId != Guid.Empty) { account.NeedsToSyncSettings = true; if (changedSettings == null) { changedSettings = SyncLayer.Sync.ChangedSetting.SelectedSemesterId; } else { changedSettings = changedSettings.Value | SyncLayer.Sync.ChangedSetting.SelectedSemesterId; } } } if (account.AccountDataVersion < 3) { // We introduced auto-selecting the week that the schedule changes on, // so users in Spain will now have everything as Monday for first day DayOfWeek cultureFirstDayOfWeek = System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat.FirstDayOfWeek; if (account.WeekChangesOn == DayOfWeek.Sunday && account.WeekChangesOn != cultureFirstDayOfWeek) { account.NeedsToSyncSettings = true; account.SetWeekSimple(cultureFirstDayOfWeek, account.CurrentWeek); if (changedSettings == null) { changedSettings = SyncLayer.Sync.ChangedSetting.WeekOneStartsOn; } else { changedSettings = changedSettings.Value | SyncLayer.Sync.ChangedSetting.WeekOneStartsOn; } // While we technically should update their reminders/schedule tile (since if // they were using two-week schedules, that info changed), we'll skip doing that // since it's extra complicated to load the data items here while also loading the // account, and if they were using two week, they probably already have this set // correctly anyways } } if (account.AccountDataVersion < AccountDataItem.CURRENT_ACCOUNT_DATA_VERSION) { account.AccountDataVersion = AccountDataItem.CURRENT_ACCOUNT_DATA_VERSION; _ = Save(account); // Don't wait, otherwise we would get in a dead lock } if (changedSettings != null) { _ = SyncLayer.Sync.SyncSettings(account, changedSettings.Value); } return(account); }
public static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { TimeTracker.OnTrigger(); }
/// <summary> /// Not thread safe. Loads and returns the account if it exists, otherwise returns null /// </summary> /// <param name="localAccountId"></param> /// <returns></returns> private static async Task <AccountDataItem> Load(Guid localAccountId) { var timeTracker = TimeTracker.Start(); IFile file = await GetFile(localAccountId); timeTracker.End(3, "AccountsManager.Load GetFile"); // If doesn't exist if (file == null) { return(null); } // Otherwise AccountDataItem account; timeTracker = TimeTracker.Start(); using (Stream s = await file.OpenAsync(FileAccess.Read)) { timeTracker.End(3, "AccountsManager.Load open file stream"); timeTracker = TimeTracker.Start(); try { account = (AccountDataItem)GetSerializer().ReadObject(s); } catch (Exception ex) { // Sometimes the file becomes corrupt, nothing we can do, they'll have to log in again TelemetryExtension.Current?.TrackEvent("Error_FailDeserializeAccount", new Dictionary <string, string>() { { "Exception", ex.ToString() } }); return(null); } timeTracker.End(3, "AccountsManager.Load deserializing stream"); } account.LocalAccountId = localAccountId; bool needsSyncSettings = false; // Upgrade account data if (account.AccountDataVersion < 2) { // We introduced syncing selected semester in this version. // So if we upgraded, we need to make sure we force sync if (account.CurrentSemesterId != Guid.Empty) { account.NeedsToSyncSettings = true; needsSyncSettings = true; } } if (account.AccountDataVersion < AccountDataItem.CURRENT_ACCOUNT_DATA_VERSION) { account.AccountDataVersion = AccountDataItem.CURRENT_ACCOUNT_DATA_VERSION; var dontWait = Save(account); // Don't wait, otherwise we would get in a dead lock } if (needsSyncSettings) { var dontWait = SyncLayer.Sync.SyncSettings(account); } return(account); }
private void setTimer(TimeTracker pTimer) { i_timer = pTimer; }
public WeatherInfo(int current, int next, TimeSpan duration) { _current = current; Next = next; _timer = new TimeTracker(duration); }
private void StartSearch() { IConfigurationProxy cfgProxy = ProxyHome.Instance.RetrieveConfigurationProxy(EngineKeyKeeper.Instance.AccessKey); List<LinkFile2Language> bindedProj2LanguageFileType = null; // Retrieve project definitions from the Configuration component. Dictionary<int, IProjectDefinition> projects = cfgProxy.Projects(); // Let's run through all the projects and do our thing. foreach (KeyValuePair<int, IProjectDefinition> pair in projects) { IProjectDefinition project = pair.Value; if (!project.Enabled) continue; // Project definition was disabled. // Here we create the language file type containers for all the languages // that are in play for the current project. bindedProj2LanguageFileType = BindProjectLanguagesToFileTypes(project); // Find all files associated with the language file extension in // the current file container 'linkFile2Language'. foreach (LinkFile2Language linkFile2Language in bindedProj2LanguageFileType) { foreach (IDirectoryDefinition dir in project.Directories) { if (!dir.Enabled) continue; if (!Directory.Exists(dir.Path)) { string s = string.Format("No directory found ({0})", dir.Path); throw new IOException(s); } IRootDirectoryStatistics rds = ProxyHome.Instance.RetrieveStatisticsProxy(EngineKeyKeeper.Instance.AccessKey).CreateRootDirectory(project.Id); rds.RootDirectory = dir.Path; FileSearchEngine fileSearchEngine = new FileSearchEngine(dir, linkFile2Language.Language.Extension); fileSearchEngine.ExcludeDirs = project.ExcludedDirectories.Select(d => d).ToList(); fileSearchEngine.IncludeSubDirsInSearch = true; fileSearchEngine.Search(); // Adding all the files found with the extention given by // 'linkFile2Language.Language.Extension' to the file container 'linkFile2Language'. linkFile2Language.Filenames.AddRange(fileSearchEngine.FileFoundDuringSearch); // Adding all the files found to the StatisticsComponentProxy. ProxyHome.Instance.RetrieveStatisticsProxy(EngineKeyKeeper.Instance.AccessKey).IncrementCounter(CounterIds.Files, fileSearchEngine.FileCount); rds.Filenames.AddRange(fileSearchEngine.FileFoundDuringSearch); } } TimeTracker tt = new TimeTracker("Execution of regular expression on each file."); tt.Start(); IMatchProxy matchProxy = ProxyHome.Instance.RetrieveMatchProxy(EngineKeyKeeper.Instance.AccessKey); // Let's execute each regular expression from each rule that are enabled // and should be applied to the current language. foreach (LinkFile2Language linkFile2Language in bindedProj2LanguageFileType) { foreach (KeyValuePair<int, ICategoryDefinition> categoryDefinition in project.Categories) { if (!categoryDefinition.Value.Enabled) continue; foreach (KeyValuePair<int, IRuleDefinition> ruleDefinition in categoryDefinition.Value.Rules) { if (!ruleDefinition.Value.Enabled) continue; // Let's check whether or not the current 'rule' is associated with the current 'language'? IRuleDeclaration ruleDeclaration = cfgProxy.RuleDeclarationFromCategoryIdAndRuleId(categoryDefinition.Value.CategoryDeclarationReferenceId, ruleDefinition.Value.RuleDeclarationReferenceId); foreach (KeyValuePair<int, ILanguageDeclaration> languageRef in ruleDeclaration.Languages) { if (languageRef.Key == linkFile2Language.Language.Id) { // The language reference on the current rule is identical to the current 'linkFile2Language' // meaning that we should execute the regular expression from the current rule on all the // files placed in the 'linkFile2Language': IMatchInfoReferences references = matchProxy.MatchesFactory<IMatchInfoReferences>(typeof(IMatchInfoReferences)); references.ProjectDefinitionReference = project; references.CategoryDeclarationReference = cfgProxy.CategoryDeclaration(categoryDefinition.Value.CategoryDeclarationReferenceId); references.CategoryDefinitionReference = categoryDefinition.Value; references.RuleDeclarationReference = ruleDeclaration; references.RuleDefinitionReference = ruleDefinition.Value; references.LanguageDeclarationReference = languageRef.Value; Parallel.ForEach(linkFile2Language.Filenames, file => ExecuteRegularExpressionsOnBuffer(file, references, ruleDeclaration)); } } } } } tt.Stop("We are done."); tt.ToLog(Log); } }
protected override void StartModuleCycle(object state) { IsModuleRunning = true; m_rndServerAddr = Consts.WorldServerAddr[m_random.Next(0, Consts.WorldServerAddr.Count)]; Utils.Log("DownloadAndCheck Start. Server address: " + m_rndServerAddr, "SwfModule"); var tt = new TimeTracker("start"); var taskResult = DownloadAllSwfsAsync(SwfPaths).Result; tt.AddLap("end"); if (taskResult != null) { Utils.Log("All files downloaded. Time elapsed: " + tt.GetLapTimeDiff("start", "end", TimeTracker.TimeFormat.Seconds) + "s.", "SwfModule"); var existingFiles = Directory.GetFiles(m_exportPath); if (existingFiles.Length < 1) { foreach (var stream in taskResult) { File.WriteAllBytes(Path.Combine(m_exportPath, stream.Key), stream.Value.ToArray()); } } foreach (var fileWithPath in existingFiles) { string filename = Path.GetFileName(fileWithPath); if (!SwfFileNames.Contains(filename)) { if (taskResult.ContainsKey(filename)) { Utils.Log("File: " + filename + " is missing. Get a latest version.", "SwfModule"); File.WriteAllBytes(fileWithPath, taskResult[filename].ToArray()); } else { Utils.Log("File: " + filename + " is missing from the source. Achieve the missing file.", "SwfModule"); var utcDate = DateTime.UtcNow.ToString("yyyyMMddHH"); var achievedPath = Path.Combine(m_exportPath, utcDate); Directory.CreateDirectory(achievedPath); var newFilePath = Path.Combine(achievedPath, filename); File.Move(fileWithPath, newFilePath); } } else { var existingSwf = File.ReadAllBytes(fileWithPath); if (!Utils.StreamAreEqualHash(existingSwf, taskResult[filename].ToArray())) { Utils.Log("File: " + filename + " is different from stored version, achieve and update to latest version.", "SwfModule", ConsoleColor.Red, ConsoleColor.Green); var utcDate = DateTime.UtcNow.ToString("yyyyMMddHH"); var achievedPath = Path.Combine(m_exportPath, utcDate); Directory.CreateDirectory(achievedPath); var newFilePath = Path.Combine(achievedPath, filename); File.Move(fileWithPath, newFilePath); File.WriteAllBytes(fileWithPath, taskResult[filename].ToArray()); } } } Utils.Log("Current execution cycle is completed.", "SwfModule"); } else { Utils.Log("Some of files are not properly downloaded, current execution cycle canceled.", "SwfModule"); } m_checkingTimer.Change(m_timeInterval, Timeout.Infinite); IsModuleRunning = false; }
public WindowManager() { windows = new List<Window>(); windowsZOrder = new List<int>(); animatedWindows = new List<int>(); rand = new Random(); lastWindowOnTop = -1; time = new TimeTracker(); activeWindow = 0; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: Start //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void Start() { m_ttTransitionTimer = new TimeTracker(m_fTransitionTime); CycleThroughChildren(transform); }
public void Update() { if (m_GameProcess == null || m_GameProcess.HasExited) { if (m_SkipUpdates > 0) { --m_SkipUpdates; return; } m_SkipUpdates = 4; m_GameProcess = null; Active = false; if (Reader != null) { Reader.CloseHandle(); Reader = null; } if (m_Injector != null) { m_Injector.Dispose(); m_Injector = null; } var s_Processes = Process.GetProcessesByName("HitmanBloodMoney"); if (s_Processes.Length == 0) return; // We always select the first process. m_GameProcess = s_Processes[0]; // Setup our Memory Reader. Reader = new ProcessMemoryReader(m_GameProcess); try { if (Reader.OpenProcess()) { m_SkipUpdates = 0; Active = true; // Create our injector and inject our stat module. m_Injector = new Injector(m_GameProcess, false); m_Injector.InjectLibrary("HM3.dll"); // Setup our main control. MainApp.MainWindow.Dispatcher.Invoke(() => { Control = new MainControl(); }); // Setup our engine-specific classes. StatTracker = new StatTracker(this); TimeTracker = new TimeTracker(this); // Update level labels. CurrentLevel = "No Level"; CurrentLevelScene = "No Level"; InGame = false; Control.SetCurrentLevel(CurrentLevel); Control.SetCurrentLevelScene(CurrentLevelScene); // Set our control in the main window. InitMenuItems(); MainApp.MainWindow.SetEngineControl(Control, m_MenuItems); } } catch (Exception) { m_GameProcess = null; Active = false; } } if (!Active) return; // Update our trackers. TimeTracker.Update(); StatTracker.Update(); // Set game time. if (StatTracker.CurrentStats.m_Time > 0 || !InGame) Control.SetCurrentTime(StatTracker.CurrentStats.m_Time); else Control.SetCurrentTime(TimeTracker.CurrentTime); }
public ConfusedGenerator() { i_nextMoveTime = new TimeTracker(); }
partial void DeleteTask(TimeTracker.Domain.Task instance);
public TimedFleeingGenerator(ObjectGuid fright, uint time) : base(fright) { _totalFleeTime = new TimeTracker(time); }
partial void DeleteTaskType(TimeTracker.Domain.TaskType instance);
public FleeingGenerator(ObjectGuid fright) { _fleeTargetGUID = fright; _timer = new TimeTracker(); }
partial void DeleteTimeEntry(TimeTracker.Domain.TimeEntry instance);
partial void InsertProject(TimeTracker.Domain.Project instance);
partial void UpdateUser(TimeTracker.Domain.User instance);
partial void DeleteProject(TimeTracker.Domain.Project instance);
public PetAI(Creature c) : base(c) { i_tracker = new TimeTracker(5000); UpdateAllies(); }
partial void InsertWorkItem(TimeTracker.Domain.WorkItem instance);
public RandomMovementGenerator(float spawn_dist = 0.0f) { _timer = new TimeTracker(); _wanderDistance = spawn_dist; }
partial void DeleteWorkItem(TimeTracker.Domain.WorkItem instance);
public void StartTimer() { lock (_ApplicationTimerLock) { ApplicationTimer = new TimeTracker(Ids.APPLICATION_TIMER_INIT); ApplicationTimer.Start(); } }
partial void DeleteProjectTaskType(TimeTracker.Domain.ProjectTaskType instance);
// Use this for initialization void Start () { timeTracker = new TimeTracker(); }
partial void InsertTask(TimeTracker.Domain.Task instance);
// Use this for initialization void Start () { timeTracker = new TimeTracker(); onOneSecondPassed += oneSecondPassed; }
partial void UpdateTask(TimeTracker.Domain.Task instance);
public WindowAnimation() { animationState = STATE_STOPPED; time = new TimeTracker(); }
public override IDisposable GetResource(ResourceExecutingContext context) { string action = ProfilerActionSplitterAttribute.GetActionDescription(context); return(TimeTracker.Start(action)); }