void Start() { GameObject progressTrackerGO = GameObject.Find ("ProgressTracker"); if (progressTrackerGO != null) { progressTracker = progressTrackerGO.GetComponent<ProgressTracker> (); } }
void Awake() { instance = this; progress_tracker_instance = ProgressTracker.instance; race_manager = GameObject.Find("RaceManager"); fadeInLeft = GameObject.Find("Main Camera Left").GetComponent<ScreenFadeIn>(); fadeInRight = GameObject.Find("Main Camera Right").GetComponent<ScreenFadeIn>(); fadeOutLeft = GameObject.Find("Main Camera Left").GetComponent<ScreenFadeOut>(); fadeOutRight = GameObject.Find("Main Camera Right").GetComponent<ScreenFadeOut>(); }
public StreamWithReadProgress(Stream innerStream, TimeSpan progressInterval) { this.innerStream = innerStream; this.progressInterval = progressInterval; this.readStatus = new ProgressStatus(0, this.innerStream.Length, new ComputeStats()); this.progressTracker = new ProgressTracker(this.readStatus, Program.SyncOutput.ProgressOperationStatus, Program.SyncOutput.ProgressOperationComplete, this.progressInterval); }
public static void SaveGameInformation() { BinaryFormatter binaryFormatter = new BinaryFormatter(); FileStream file = File.Open(path + "/save.ecs", FileMode.OpenOrCreate); ProgressTracker data = new ProgressTracker(); data.levelCompleted = GameInformation.CompletedLevels; data.highScores = GameInformation.HighScoresOnLevels; binaryFormatter.Serialize(file, data); file.Close(); }
void Awake() { instance = this; if (!RaceManager.instance) return; target = new GameObject("New Progress Tracker").transform; circuit = GameObject.FindObjectOfType(typeof(WaypointsContainer)) as WaypointsContainer; GetComponent<Statistics>().target = target; }
// Use this for initialization void Awake () { if(Instance != null) { Destroy (this.gameObject); return; } Instance = this; SolverCheck.OnSolveAttempt += SolveAttempt; Randomizer.OnPuzzleCreated += NewPuzzle; string[] diffStrings = new string[]{EasyString,MediumString,HardString,ExpertString}; ProgressionDict = new Dictionary<string, DifficultyProgress>(); foreach(string s in diffStrings) { int solved = PrefCount(PrefKey(s,TotalSolvedString)); int attempted = PrefCount(PrefKey(s,TotalAttemptsString)); int seen = PrefCount(PrefKey(s,TotalPuzzlesString)); ProgressionDict.Add(s,new DifficultyProgress(solved,attempted,seen)); } }
private void Start() { if (INSTANCE != null) { Destroy(gameObject); return; } INSTANCE = this; DontDestroyOnLoad(gameObject); StartCoroutine(StatusCheck()); var now = System.DateTime.Now; Random.seed = now.Millisecond * now.Minute + now.Second * now.Hour; if(Seeds == null) Seeds = new[] { Random.Range(int.MinValue, int.MaxValue), Random.Range(int.MinValue, int.MaxValue), Random.Range(int.MinValue, int.MaxValue), }; Rebuild(); }
private DialogueData GetDialogues() { string jsonName = $"HomeSceneDialogues/Home_wk{ProgressTracker.GetTracker().WeekNum}"; return(base.GetDialogues(jsonName)); }
public void Save(IEnumerable <DatabaseItemStat> objs, ProgressTracker progressTracker) { ThreadExecuter.Execute( () => repo.Save(objs, progressTracker) ); }
/// <summary> /// Displays a progress dialog for the specified task. The dialog allows the user to cancel /// the task and displays the task's progress. /// </summary> /// <param name="owner">The owner window.</param> /// <param name="title">The title of the task progress dialog.</param> /// <param name="description">The description of the task.</param> /// <param name="task">The task.</param> /// <param name="cancelStopAbortTokensSource">The cancellation token source that cancels the task.</param> /// <param name="progressTracker">The progress tracker that tracks the task's progress.</param> /// <exception cref="ArgumentNullException"><paramref name="description"/> or <paramref name="task"/> is <c>null</c>.</exception> public static void Show(Window owner, string title, string description, Task task, CancelStopAbort cancelStopAbortTokensSource, ProgressTracker progressTracker, bool isAssay) { ProgressDialog dialog = new ProgressDialog(task); //Disable close button, as it doesn't work. HN 6.15.2015 //dialog.WindowStyle = WindowStyle.None; dialog.Topmost = true; dialog.DataContext = new TaskProgress(title, description, task, cancelStopAbortTokensSource, progressTracker, isAssay); dialog.Owner = owner; if (!isAssay) { } if (progressTracker.m_modal) { //dialog.Go(); dialog.ShowDialog(); } else { //dialog.Go(); dialog.Show(); } }
internal void ResetProgressChannel() { ProgressTracker.Reset(); }
public DownloadInfo(ProgressTracker progressTracker, DownloadPool owner, Uri uri) { this.progressTracker = progressTracker; this.owner = owner; this.uri = uri; }
private static void Migrate(string connectionString, string deviceDefinitionsFile) { LookupTables lookupTables; MeterLocation meterLocation; MeterLocation remoteMeterLocation; MeterLocationLine localLink; MeterLocationLine remoteLink; Meter meter; Line line; Series series; Channel channel; OutputChannel outputChannel; Dictionary <string, Tuple <Series, OutputChannel> > channelLookup; Tuple <Series, OutputChannel> tuple; string channelKey; int outputChannelIndex; LineImpedance lineImpedance; SourceImpedance localSourceImpedance; SourceImpedance remoteSourceImpedance; XDocument document = XDocument.Load(deviceDefinitionsFile); List <XElement> deviceElements = document.Elements().Elements("device").ToList(); XElement deviceAttributes; XElement impedancesElement; List <Tuple <Line, LineImpedance> > lineImpedances = new List <Tuple <Line, LineImpedance> >(); List <Tuple <MeterLocationLine, SourceImpedance> > sourceImpedances = new List <Tuple <MeterLocationLine, SourceImpedance> >(); List <Tuple <Series, OutputChannel> > outputChannels = new List <Tuple <Series, OutputChannel> >(); ProgressTracker progressTracker = new ProgressTracker(deviceElements.Count); using (MeterInfoDataContext meterInfo = new MeterInfoDataContext(connectionString)) using (FaultLocationInfoDataContext faultLocationInfo = new FaultLocationInfoDataContext(connectionString)) { // Load existing fault location configuration from the database progressTracker.StartPendingMessage("Loading existing fault location configuration from database..."); lookupTables = new LookupTables(meterInfo, faultLocationInfo); lookupTables.CreateLookups(document); progressTracker.EndPendingMessage(); // Load updates to fault location algorithms into the database progressTracker.StartPendingMessage("Loading updates to fault location algorithms into the database..."); foreach (XElement analyticsElement in document.Elements().Elements("analytics")) { LoadFaultLocationAlgorithms(analyticsElement, faultLocationInfo); } faultLocationInfo.SubmitChanges(); progressTracker.EndPendingMessage(); // Load updates to device configuration into the database progressTracker.WriteMessage(string.Format("Beginning migration of {0} device configurations...", deviceElements.Count)); foreach (XElement deviceElement in deviceElements) { lineImpedances.Clear(); sourceImpedances.Clear(); outputChannels.Clear(); // Get the element representing a device's attributes deviceAttributes = deviceElement.Element("attributes") ?? new XElement("attributes"); // Attempt to find existing configuration for this device and update the meter with any changes to the device's attributes meter = lookupTables.MeterLookup.GetOrAdd((string)deviceElement.Attribute("id"), assetKey => new Meter() { AssetKey = assetKey }); LoadMeterAttributes(meter, deviceAttributes); // Now that we know what meter we are processing, display a message to indicate that we are parsing this meter's configuration progressTracker.StartPendingMessage(string.Format("Loading configuration for meter {0} ({1})...", meter.Name, meter.AssetKey)); // Attempt to find existing configuration for the location of the meter and update with configuration changes meterLocation = lookupTables.MeterLocationLookup.GetOrAdd((string)deviceAttributes.Element("stationID"), assetKey => new MeterLocation() { AssetKey = assetKey }); LoadMeterLocationAttributes(meterLocation, deviceAttributes); // Link the meter location to the meter meter.MeterLocation = meterLocation; // Load updates to line configuration into the database foreach (XElement lineElement in deviceElement.Elements("lines").Elements("line")) { // Attempt to find existing configuration for the line and update with configuration changes line = lookupTables.LineLookup.GetOrAdd((string)lineElement.Attribute("id"), assetKey => new Line() { AssetKey = assetKey }); LoadLineAttributes(line, lineElement); // Provide a link between this line and the location housing the meter Link(meter, line, lineElement, lookupTables.MeterLineLookup); localLink = Link(meterLocation, line, lookupTables.MeterLocationLineLookup); if ((string)lineElement.Element("endStationID") != null) { // Attempt to find existing configuration for the location of the other end of the line and update with configuration changes remoteMeterLocation = lookupTables.MeterLocationLookup.GetOrAdd((string)lineElement.Element("endStationID"), assetKey => new MeterLocation() { AssetKey = assetKey }); LoadRemoteMeterLocationAttributes(remoteMeterLocation, lineElement); // Provide a link between this line and the remote location remoteLink = Link(remoteMeterLocation, line, lookupTables.MeterLocationLineLookup); } else { // Set remote meter location to null so we // know later that there isn't one defined remoteMeterLocation = null; remoteLink = null; } // Get a lookup table for the channels monitoring this line channelLookup = lookupTables.GetChannelLookup(meter, line); outputChannelIndex = 0; foreach (XElement channelElement in lineElement.Elements("channels").Elements()) { channelKey = channelElement.Name.LocalName; // Attempt to find an existing channel corresponding to this element if (channelLookup.TryGetValue(channelKey, out tuple)) { series = tuple.Item1; channel = series.Channel; outputChannel = tuple.Item2; } else { channel = new Channel(); series = new Series(); outputChannel = new OutputChannel(); channelLookup.Add(channelKey, Tuple.Create(series, outputChannel)); } // Load updates to channel configuration into the database LoadChannelAttributes(meter, line, remoteMeterLocation, channel, channelKey, lookupTables); LoadSeriesAttributes(channel, series, channelElement, lookupTables); outputChannel.ChannelKey = channelKey; outputChannel.LoadOrder = outputChannelIndex; outputChannels.Add(Tuple.Create(series, outputChannel)); outputChannelIndex++; } impedancesElement = lineElement.Element("impedances") ?? new XElement("impedances"); // Attempt to find existing impedance configuration for the line and update with configuration changes lineImpedance = lookupTables.LineImpedanceLookup.GetOrAdd(line, ln => new LineImpedance()); LoadLineImpedanceAttributes(lineImpedance, impedancesElement); lineImpedances.Add(Tuple.Create(line, lineImpedance)); // Attempt to find existing impedance configuration for the meter's location and update with configuration changes localSourceImpedance = lookupTables.SourceImpedanceLookup.GetOrAdd(localLink, location => new SourceImpedance()); LoadLocalSourceImpedanceAttributes(localSourceImpedance, impedancesElement); sourceImpedances.Add(Tuple.Create(localLink, localSourceImpedance)); if ((object)remoteLink != null) { // Attempt to find existing impedance configuration for the remote location and update with configuration changes remoteSourceImpedance = lookupTables.SourceImpedanceLookup.GetOrAdd(remoteLink, location => new SourceImpedance()); LoadRemoteSourceImpedanceAttributes(remoteSourceImpedance, impedancesElement); sourceImpedances.Add(Tuple.Create(remoteLink, remoteSourceImpedance)); } } if (meter.ID == 0) { meterInfo.Meters.InsertOnSubmit(meter); } meterInfo.SubmitChanges(); // Load updates to line impedance configuration into the database foreach (Tuple <Line, LineImpedance> mapping in lineImpedances) { line = mapping.Item1; lineImpedance = mapping.Item2; lineImpedance.LineID = line.ID; if (lineImpedance.ID == 0 && (lineImpedance.R0 != 0.0D || lineImpedance.X0 != 0.0D || lineImpedance.R1 != 0.0D || lineImpedance.X1 != 0.0D)) { faultLocationInfo.LineImpedances.InsertOnSubmit(lineImpedance); } } // Load updates to source impedance configuration into the database foreach (Tuple <MeterLocationLine, SourceImpedance> mapping in sourceImpedances) { localLink = mapping.Item1; localSourceImpedance = mapping.Item2; localSourceImpedance.MeterLocationLineID = localLink.ID; if (localSourceImpedance.ID == 0 && (localSourceImpedance.RSrc != 0.0D || localSourceImpedance.XSrc != 0.0D)) { faultLocationInfo.SourceImpedances.InsertOnSubmit(localSourceImpedance); } } // Load updates to source impedance configuration into the database foreach (Tuple <Series, OutputChannel> mapping in outputChannels) { series = mapping.Item1; outputChannel = mapping.Item2; outputChannel.SeriesID = series.ID; if (outputChannel.ID == 0) { faultLocationInfo.OutputChannels.InsertOnSubmit(outputChannel); } } faultLocationInfo.SubmitChanges(); progressTracker.EndPendingMessage(); // Increment the progress counter progressTracker.MakeProgress(); } } }
private DialogueData GetDialogues() { string jsonName = $"StoryDialogues/{ProgressTracker.GetTracker().StorylinePhase}"; return(base.GetDialogues(jsonName)); }
/// <summary> /// Default implementation of generating Asset Bundles using the Scriptable Build Pipeline. /// </summary> /// <param name="parameters">Set of parameters used for building asset bundles.</param> /// <param name="content">Set of content and explicit asset bundle layout to build.</param> /// <param name="result">Results from building the content and explicit asset bundle layout.</param> /// <param name="taskList">Custom task list for building asset bundles.</param> /// <param name="contextObjects">Additional context objects to make available to the build.</param> /// <returns>Return code with status information about success or failure causes.</returns> public static ReturnCode BuildAssetBundles(IBundleBuildParameters parameters, IBundleBuildContent content, out IBundleBuildResults result, IList <IBuildTask> taskList, params IContextObject[] contextObjects) { if (BuildPipeline.isBuildingPlayer) { result = null; BuildLogger.LogException(new InvalidOperationException("Cannot build asset bundles while a build is in progress")); return(ReturnCode.Exception); } // Avoid throwing exceptions in here as we don't want them bubbling up to calling user code if (parameters == null) { result = null; BuildLogger.LogException(new ArgumentNullException("parameters")); return(ReturnCode.Exception); } // Avoid throwing exceptions in here as we don't want them bubbling up to calling user code if (taskList.IsNullOrEmpty()) { result = null; BuildLogger.LogException(new ArgumentException("Argument cannot be null or empty.", "taskList")); return(ReturnCode.Exception); } // Don't run if there are unsaved changes if (ValidationMethods.HasDirtyScenes()) { result = null; return(ReturnCode.UnsavedChanges); } ThreadingManager.WaitForOutstandingTasks(); BuildContext buildContext = new BuildContext(contextObjects); BuildLog buildLog = null; IBuildLogger logger; if (!buildContext.TryGetContextObject <IBuildLogger>(out logger)) { logger = buildLog = new BuildLog(); buildContext.SetContextObject(buildLog); } using (logger.ScopedStep(LogLevel.Info, "AssetDatabase.SaveAssets")) AssetDatabase.SaveAssets(); ReturnCode exitCode; result = new BundleBuildResults(); BuildCacheUtility.ClearCacheHashes(); using (var interfacesWrapper = new BuildInterfacesWrapper()) #if !CI_TESTRUNNER_PROJECT using (new SceneStateCleanup()) using (var progressTracker = new ProgressTracker()) #else using (var progressTracker = new ProgressLoggingTracker()) #endif using (var buildCache = new BuildCache(parameters.CacheServerHost, parameters.CacheServerPort)) { Directory.CreateDirectory(parameters.TempOutputFolder); Directory.CreateDirectory(parameters.ScriptOutputFolder); try { buildContext.SetContextObject(parameters); buildContext.SetContextObject(content); buildContext.SetContextObject(result); buildContext.SetContextObject(interfacesWrapper); buildContext.SetContextObject(progressTracker); buildContext.SetContextObject(buildCache); // If IDeterministicIdentifiers was passed in with contextObjects, don't add the default if (!buildContext.ContainsContextObject(typeof(IDeterministicIdentifiers))) { buildContext.SetContextObject(parameters.ContiguousBundles ? new PrefabPackedIdentifiers() : (IDeterministicIdentifiers) new Unity5PackedIdentifiers()); } buildContext.SetContextObject(new BuildDependencyData()); buildContext.SetContextObject(new BundleWriteData()); buildContext.SetContextObject(BuildCallbacks); buildCache.SetBuildLogger(logger); } catch (Exception e) { // Avoid throwing exceptions in here as we don't want them bubbling up to calling user code result = null; BuildLogger.LogException(e); return(ReturnCode.Exception); } exitCode = BuildTasksRunner.Validate(taskList, buildContext); if (exitCode >= ReturnCode.Success) #if SBP_PROFILER_ENABLE { exitCode = BuildTasksRunner.RunProfiled(taskList, buildContext); } #else { exitCode = BuildTasksRunner.Run(taskList, buildContext); } #endif if (Directory.Exists(parameters.TempOutputFolder)) { Directory.Delete(parameters.TempOutputFolder, true); } if (buildLog != null) { string buildLogPath = parameters.GetOutputFilePathForIdentifier("buildlogtep.json"); Directory.CreateDirectory(Path.GetDirectoryName(buildLogPath)); File.WriteAllText(parameters.GetOutputFilePathForIdentifier("buildlogtep.json"), buildLog.FormatForTraceEventProfiler()); } } long maximumCacheSize = ScriptableBuildPipeline.maximumCacheSize * BuildCache.k_BytesToGigaBytes; BuildCache.PruneCache_Background(maximumCacheSize); return(exitCode); }
/** Progress tracers can be used to display progress information. */ public virtual void addProgressTracer(ProgressTracker pTracer) { progressTrackers.Add(pTracer); }
private DialogueData GetDialogues() { int weekNum = ProgressTracker.GetTracker().WeekNum; return(base.GetDialogues("WeeklyDialogues/WeeklyCombat_wk" + weekNum)); }
public CommandApplicationProcess(RaftLog raftLog, int maxBatchSize, int flushEvery, System.Func <DatabaseHealth> dbHealth, LogProvider logProvider, ProgressTracker progressTracker, SessionTracker sessionTracker, CoreState coreState, InFlightCache inFlightCache, Monitors monitors) { if (!InstanceFieldsInitialized) { InitializeInstanceFields(); InstanceFieldsInitialized = true; } this._raftLog = raftLog; this._flushEvery = flushEvery; this._progressTracker = progressTracker; this._sessionTracker = sessionTracker; this._log = logProvider.getLog(this.GetType()); this._dbHealth = dbHealth; this._coreState = coreState; this._inFlightCache = inFlightCache; //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: this._commitIndexMonitor = monitors.NewMonitor(typeof(RaftLogCommitIndexMonitor), this.GetType().FullName); this._batcher = new CommandBatcher(maxBatchSize, this.applyBatch); this._batchStat = StatUtil.create("BatchSize", _log, 4096, true); }
/// <summary> /// Initializes a new instance of the <see cref="TaskProgress"/> class with the specified /// description, task, cancellation token source, and progress tracker. /// </summary> /// <param name="title">The title for the progess pop-up.</param> /// <param name="description">The description of the task.</param> /// <param name="task">The task.</param> /// <param name="cancellationTokenSource">The cancellation token source that cancels the task.</param> /// <param name="progressTracker">The progress tracker that tracks the task's progress.</param> /// <exception cref="ArgumentNullException"><paramref name="description"/> or <paramref name="task"/> is <c>null</c>.</exception> public TaskProgress(string title, string description, Task task, CancelStopAbort cancelStopAbortTokensSource, ProgressTracker progressTracker, bool isAssay /*, string rates*/) { if (description == null || task == null) { throw new ArgumentNullException(); } m_stopCommand = new CancelCommand(cancelStopAbortTokensSource.StopTokenSource, 0); m_cancelCommand = new CancelCommand(cancelStopAbortTokensSource.CancellationTokenSource, 1); m_abortCommand = new CancelCommand(cancelStopAbortTokensSource.AbortTokenSource, 2); // make an enum! m_description = description; m_isProgressIndeterminate = true; m_progress = 0; m_progressTracker = progressTracker; m_task = task; m_title = title; m_isAssay = isAssay; //m_rates = rates; if (m_progressTracker != null) { m_progressTracker.ProgressChanged += (sender, e) => { IsProgressIndeterminate = false; Progress = e.ProgressPercentage; Description = (string)e.UserState; }; } }
void Start() { m_ProgressTracker = GameObject.FindObjectOfType <ProgressTracker>(); }
/// <summary> /// Extra code for handling resource create/update calls. /// </summary> /// <param name="operationResult">The result of the operation.</param> private string GetOperationState(OperationResult operationResult) { return(operationResult.AzureAsyncOperationUri != null ? this.GetAzureAsyncOperationState(operationResult) : ProgressTracker.GetResourceState(operationResult)); }
private void ViewModel_OnOpenFilePopup(FileViewModel file, ProgressTracker tracker) { var videoFilePopup = new VideoFilePopup(file); SetupPopup(videoFilePopup); }
public void Startup() { /*** NEW PLAYER ***/ _player = ExoPlayerFactory.NewSimpleInstance(Context, new DefaultTrackSelector()); _player.PlayWhenReady = true; _player.AddListener(this); progress?.Dispose(); clipper?.Dispose(); progress = new ProgressTracker(_player); progress.OnPositionChange += Progress_OnPositionChange; clipper = new ProgressTracker(_player, 50); clipper.OnPositionChange += Clipper_OnPositionChange; _playerView = FindViewById <PlayerView>(Resource.Id.videoview); Android.Graphics.Typeface subtitleTypeface = ResourcesCompat.GetFont(Context, Resource.Font.montserratregular); var captionStyleCompat = new CaptionStyleCompat(Android.Graphics.Color.White, Android.Graphics.Color.Transparent, Android.Graphics.Color.Transparent, CaptionStyleCompat.EdgeTypeNone, Android.Graphics.Color.Transparent, subtitleTypeface); _playerView.SubtitleView.SetStyle(captionStyleCompat); _playerView.SubtitleView.SetFractionalTextSize(0.06f); //_playerView.SubtitleView.SetFixedTextSize((int)ComplexUnitType.Sp, 10); _playerView.SubtitleView.SetBottomPaddingFraction(0.4f); _playerView.SubtitleView.TextAlignment = TextAlignment.Center; _playerView.Player = _player; _playerView.UseController = true; webclient = new OkHttpClient.Builder() .Cache((Context.ApplicationContext as BootleggerApp).FilesCache) .Build(); httpDataSourceFactory = new OkHttpDataSourceFactory(webclient, "BootleggerEditor", null); extractorsFactory = new DefaultExtractorsFactory(); defaultDataSourceFactory = new DefaultDataSourceFactory(Context, "BootleggerEditor"); /*************/ _audioPlayer = ExoPlayerFactory.NewSimpleInstance(Context, new DefaultTrackSelector()); _audioPlayer.Volume = 0.4f; _audioPlayer.RepeatMode = Player.RepeatModeOne; cursor = FindViewById <View>(Resource.Id.trackposition); seeker = FindViewById <RangeSliderControl>(Resource.Id.seeker); trackcontrols = FindViewById <View>(Resource.Id.trackcontrols); seeker.LowerValueChanged += Seeker_LeftValueChanged; seeker.UpperValueChanged += Seeker_RightValueChanged; seeker.StepValueContinuously = true; track = FindViewById <View>(Resource.Id.track); title = FindViewById <TextView>(Resource.Id.title); FindViewById <ImageButton>(Resource.Id.fullscreenbtn).Click += Fullscreen_Click; videoWrapper = FindViewById(Resource.Id.videoWrapper); mFullScreenDialog = new FullScreenVideoDialog(Context, Android.Resource.Style.ThemeBlackNoTitleBarFullScreen); mFullScreenDialog.OnAboutToClose += MFullScreenDialog_OnAboutToClose; seeker.Visibility = ViewStates.Invisible; }
/// <summary> /// Default implementation of generating Asset Bundles using the Scriptable Build Pipeline. /// </summary> /// <param name="parameters">Set of parameters used for building asset bundles.</param> /// <param name="content">Set of content and explicit asset bundle layout to build.</param> /// <param name="result">Results from building the content and explicit asset bundle layout.</param> /// <param name="taskList">Custom task list for building asset bundles.</param> /// <param name="contextObjects">Additional context objects to make available to the build.</param> /// <returns>Return code with status information about success or failure causes.</returns> public static ReturnCode BuildAssetBundles(IBundleBuildParameters parameters, IBundleBuildContent content, out IBundleBuildResults result, IList <IBuildTask> taskList, params IContextObject[] contextObjects) { // Avoid throwing exceptions in here as we don't want them bubbling up to calling user code if (parameters == null) { result = null; BuildLogger.LogException(new ArgumentNullException("parameters")); return(ReturnCode.Exception); } // Avoid throwing exceptions in here as we don't want them bubbling up to calling user code if (taskList.IsNullOrEmpty()) { result = null; BuildLogger.LogException(new ArgumentException("Argument cannot be null or empty.", "taskList")); return(ReturnCode.Exception); } // Don't run if there are unsaved changes if (ValidationMethods.HasDirtyScenes()) { result = null; return(ReturnCode.UnsavedChanges); } AssetDatabase.SaveAssets(); ReturnCode exitCode; result = new BundleBuildResults(); using (new BuildInterfacesWrapper()) #if !CI_TESTRUNNER_PROJECT using (new SceneStateCleanup()) using (var progressTracker = new ProgressTracker()) #else using (var progressTracker = new ProgressLoggingTracker()) #endif using (var buildCache = new BuildCache(parameters.CacheServerHost, parameters.CacheServerPort)) { Directory.CreateDirectory(parameters.TempOutputFolder); BuildContext buildContext; try { buildContext = new BuildContext(contextObjects); buildContext.SetContextObject(parameters); buildContext.SetContextObject(content); buildContext.SetContextObject(result); buildContext.SetContextObject(progressTracker); buildContext.SetContextObject(buildCache); // If IDeterministicIdentifiers was passed in with contextObjects, don't add the default if (!buildContext.ContainsContextObject(typeof(IDeterministicIdentifiers))) { buildContext.SetContextObject(new Unity5PackedIdentifiers()); } buildContext.SetContextObject(new BuildDependencyData()); buildContext.SetContextObject(new BundleWriteData()); buildContext.SetContextObject(BuildCallbacks); } catch (Exception e) { // Avoid throwing exceptions in here as we don't want them bubbling up to calling user code result = null; BuildLogger.LogException(e); return(ReturnCode.Exception); } exitCode = BuildTasksRunner.Validate(taskList, buildContext); if (exitCode >= ReturnCode.Success) #if SBP_PROFILER_ENABLE { exitCode = BuildTasksRunner.RunProfiled(taskList, buildContext); } #else { exitCode = BuildTasksRunner.Run(taskList, buildContext); } #endif if (Directory.Exists(parameters.TempOutputFolder)) { Directory.Delete(parameters.TempOutputFolder, true); } } int maximumSize = EditorPrefs.GetInt("BuildCache.maximumSize", 200); long maximumCacheSize = maximumSize * 1073741824L; // gigabytes to bytes ThreadPool.QueueUserWorkItem(PruneCache, maximumCacheSize); return(exitCode); }
public FCtrlBind() : base(true) { mProgressTracker = new ProgressTracker(); }
public PlayerData () { Progress = new ProgressTracker(); }
public DAQBind() : base(true) { mProgressTracker = new ProgressTracker(); }
private static async Task <Document> ApplyFixesAsync(Document document, ImmutableArray <AddImportFixData> fixes, CancellationToken cancellationToken) { if (fixes.IsEmpty) { return(document); } var solution = document.Project.Solution; var progressTracker = new ProgressTracker(); var textDiffingService = solution.Workspace.Services.GetRequiredService <IDocumentTextDifferencingService>(); var packageInstallerService = solution.Workspace.Services.GetService <IPackageInstallerService>(); var addImportService = document.GetRequiredLanguageService <IAddImportFeatureService>(); // Do not limit the results since we plan to fix all the reported issues. var codeActions = addImportService.GetCodeActionsForFixes(document, fixes, packageInstallerService, maxResults: int.MaxValue); var getChangesTasks = codeActions.Select( action => GetChangesForCodeActionAsync(document, action, progressTracker, textDiffingService, cancellationToken)); // Using Sets allows us to accumulate only the distinct changes. var allTextChanges = new HashSet <TextChange>(); // Some fixes require adding missing references. var allAddedProjectReferences = new HashSet <ProjectReference>(); var allAddedMetaDataReferences = new HashSet <MetadataReference>(); foreach (var getChangesTask in getChangesTasks) { var(projectChanges, textChanges) = await getChangesTask.ConfigureAwait(false); allTextChanges.UnionWith(textChanges); allAddedProjectReferences.UnionWith(projectChanges.GetAddedProjectReferences()); allAddedMetaDataReferences.UnionWith(projectChanges.GetAddedMetadataReferences()); } // Apply changes to both the project and document. var newProject = document.Project; newProject = newProject.AddMetadataReferences(allAddedMetaDataReferences); newProject = newProject.AddProjectReferences(allAddedProjectReferences); // Only consider insertion changes to reduce the chance of producing a // badly merged final document. Alphabetize the new imports, this will not // change the insertion point but will give a more correct result. The user // may still need to use organize imports afterwards. var orderedTextInserts = allTextChanges.Where(change => change.Span.IsEmpty) .OrderBy(change => change.NewText); // Capture each location where we are inserting imports as well as the total // length of the text we are inserting so that we can format the span afterwards. var insertSpans = allTextChanges .GroupBy(change => change.Span) .Select(changes => new TextSpan(changes.Key.Start, changes.Sum(change => change.NewText !.Length))); var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); var newText = text.WithChanges(orderedTextInserts); var newDocument = newProject.GetRequiredDocument(document.Id).WithText(newText); // When imports are added to a code file that has no previous imports, extra // newlines are generated between each import because the fix is expecting to // separate the imports from the rest of the code file. We need to format the // imports to remove these extra newlines. return(await CleanUpNewLinesAsync(newDocument, insertSpans, cancellationToken).ConfigureAwait(false)); }
public new void StartAction() { mProgressTracker = new ProgressTracker(); task = Task.Factory.StartNew(() => ThreadOp(null, null), NC.App.Opstate.CancelStopAbort.LinkedCancelStopAbortToken); Progress.ProgressDialog.Show(null, "DAQ " + NC.App.Opstate.Action.ToString(), NC.App.Name, task, NC.App.Opstate.CancelStopAbort, mProgressTracker, NC.App.Opstate.Action == NCCAction.Assay); }
static void Run(string[] args) { bool esp32mode = false; if (esp32mode) { Console.WriteLine("ESP32 image tool v1.1 [http://sysprogs.com/]"); } else { Console.WriteLine("ESP8266 image tool v1.1 [http://sysprogs.com/]"); } if (args.Length < 1) { PrintUsage(); return; } string port = null; string bootloader = null; int otaPort = 0; int baud = 115200; bool erase = false; List <string> files = new List <string>(); string frequency = null, mode = null, size = null; for (int i = 0; i < args.Length; i++) { if (args[i] == "--esp32") { esp32mode = true; } else if (args[i] == "--boot") { if (i >= (args.Length - 1)) { throw new Exception("--boot must be followed by the bootloader image"); } bootloader = args[++i]; } else if (args[i] == "--program") { if (i >= (args.Length - 1)) { throw new Exception("--program must be followed by port number"); } port = args[++i]; if ((i + 1) < args.Length && !args[i + 1].StartsWith("-")) { baud = int.Parse(args[++i]); } } else if (args[i] == "--mode") { if (i >= (args.Length - 1)) { throw new Exception("--mode must be followed by FLASH mode"); } mode = args[++i]; } else if (args[i] == "--size") { if (i >= (args.Length - 1)) { throw new Exception("--size must be followed by FLASH mode"); } size = args[++i]; } else if (args[i] == "--freq") { if (i >= (args.Length - 1)) { throw new Exception("--freq must be followed by FLASH mode"); } frequency = args[++i]; } else if (args[i].ToLower() == "--ota") { if (i >= (args.Length - 1)) { throw new Exception("--OTA must be followed by port number"); } otaPort = int.Parse(args[++i]); } else if (args[i] == "--erase") { erase = true; } else { files.Add(args[i]); } } ESP8266BinaryImage.IESPxxImageHeader hdr; if (esp32mode) { var hdr2 = new ESP8266BinaryImage.ESP32ImageHeader(frequency, mode, size); Console.WriteLine("FLASH Parameters:"); Console.WriteLine("\tFrequency: " + DumpEnumValue(hdr2.Frequency)); Console.WriteLine("\tMode: " + DumpEnumValue(hdr2.Mode)); Console.WriteLine("\tSize: " + DumpEnumValue(hdr2.Size)); hdr = hdr2; } else { var hdr2 = new ESP8266BinaryImage.ESP8266ImageHeader(frequency, mode, size); Console.WriteLine("FLASH Parameters:"); Console.WriteLine("\tFrequency: " + DumpEnumValue(hdr2.Frequency)); Console.WriteLine("\tMode: " + DumpEnumValue(hdr2.Mode)); Console.WriteLine("\tSize: " + DumpEnumValue(hdr2.Size)); hdr = hdr2; } if (otaPort != 0) { OTAServer.ServeOTAFiles(otaPort, (ESP8266BinaryImage.ESP8266ImageHeader)hdr, files.ToArray()); return; } foreach (var elf in files) { string pathBase = Path.ChangeExtension(elf, ".").TrimEnd('.'); List <ProgrammableRegion> regions = new List <ProgrammableRegion>(); Console.WriteLine("Processing " + elf + "..."); using (var elfFile = new ELFFile(elf)) { string status; if (esp32mode) { var img = ESP8266BinaryImage.MakeESP32ImageFromELFFile(elfFile, (ESP8266BinaryImage.ESP32ImageHeader)hdr); string fn = pathBase + "-esp32.bin"; using (var fs = new FileStream(fn, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite)) { img.Save(fs); regions.Add(new ProgrammableRegion { FileName = fn, Offset = 0x10000, Size = (int)fs.Length }); } } else { int appMode = ESP8266BinaryImage.DetectAppMode(elfFile, out status); Console.WriteLine(status); if (appMode == 0) { var img = ESP8266BinaryImage.MakeNonBootloaderImageFromELFFile(elfFile, (ESP8266BinaryImage.ESP8266ImageHeader)hdr); string fn = pathBase + "-0x00000.bin"; using (var fs = new FileStream(fn, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite)) { img.Save(fs); regions.Add(new ProgrammableRegion { FileName = fn, Offset = 0, Size = (int)fs.Length }); } foreach (var sec in ESP8266BinaryImage.GetFLASHSections(elfFile)) { fn = string.Format("{0}-0x{1:x5}.bin", pathBase, sec.OffsetInFLASH); using (var fs = new FileStream(fn, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite)) { fs.Write(sec.Data, 0, sec.Data.Length); regions.Add(new ProgrammableRegion { FileName = fn, Offset = (int)sec.OffsetInFLASH, Size = sec.Data.Length }); } } } else { string fn; var hdr2 = (ESP8266BinaryImage.ESP8266ImageHeader)hdr; var img = ESP8266BinaryImage.MakeBootloaderBasedImageFromELFFile(elfFile, hdr2, appMode); if (bootloader == null) { Console.WriteLine("Warning: no bootloader specified. Skipping bootloader..."); } else { if (!File.Exists(bootloader)) { throw new Exception(bootloader + " not found. Cannot program OTA images."); } byte[] data = File.ReadAllBytes(bootloader); data[2] = (byte)hdr2.Mode; data[3] = (byte)(((byte)hdr2.Size << 4) | (byte)hdr2.Frequency); fn = string.Format("{0}-boot.bin", pathBase); File.WriteAllBytes(fn, data); regions.Add(new ProgrammableRegion { FileName = fn, Offset = 0, Size = File.ReadAllBytes(fn).Length }); } fn = string.Format("{0}-user{1}.bin", pathBase, appMode); using (var fs = new FileStream(fn, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite)) { img.Save(fs); regions.Add(new ProgrammableRegion { FileName = fn, Offset = (int)img.BootloaderImageOffset, Size = (int)fs.Length }); } } } } if (port != null) { using (var serialPort = new SerialPortStream(port, baud, System.IO.Ports.Handshake.None) { AllowTimingOutWithZeroBytes = true }) { ESP8266BootloaderClient client = new ESP8266BootloaderClient(serialPort, 50, null); Console.WriteLine("Connecting to bootloader on {0}...", port); client.Sync(); if (erase) { Console.WriteLine("Erasing FLASH..."); client.EraseFLASH(); Console.WriteLine("FLASH erased. Please restart your ESP8266 into the bootloader mode again.\r\nPress any key when done..."); Console.ReadKey(); client.Sync(); } foreach (var region in regions) { DateTime start = DateTime.Now; Console.WriteLine("Programming " + Path.GetFileName(region.FileName) + "..."); var tracker = new ProgressTracker(region); client.BlockWritten += tracker.BlockWritten; client.ProgramFLASH((uint)region.Offset, File.ReadAllBytes(region.FileName)); client.BlockWritten -= tracker.BlockWritten; Console.WriteLine("\rProgrammed in {0} seconds ", (int)(DateTime.Now - start).TotalSeconds); } } } else { int fileNameLen = Path.GetFileName(args[0]).Length + 10; Console.WriteLine("\r\nCreated the following files:"); Console.WriteLine("File".PadRight(fileNameLen) + " FLASH Offset Size"); foreach (var region in regions) { Console.WriteLine(Path.GetFileName(region.FileName).PadRight(fileNameLen) + " " + string.Format("0x{0:x8} {1}KB", region.Offset, region.Size / 1024)); } } } }
private void Save(List <DatabaseItem> items, ProgressTracker progressTracker, bool reset) { // Insert the items (not stats) using (var session = SessionCreator.OpenSession()) { using (ITransaction transaction = session.BeginTransaction()) { var records = items.Select(m => m.Record).ToList(); session.CreateSQLQuery($@" DELETE FROM {DatabaseItemStatTable.Table} WHERE {DatabaseItemStatTable.Item} IN ( SELECT {DatabaseItemTable.Id} FROM {DatabaseItemTable.Table} WHERE {DatabaseItemTable.Record} IN ( :records ) )") .SetParameterList("records", records) .ExecuteUpdate(); session.CreateSQLQuery($"DELETE FROM {DatabaseItemTable.Table} WHERE {DatabaseItemTable.Record} IN ( :records )") .SetParameterList("records", records) .ExecuteUpdate(); transaction.Commit(); } using (ITransaction transaction = session.BeginTransaction()) { foreach (DatabaseItem item in items) { session.Save(item); progressTracker.Increment(); } transaction.Commit(); } } var createCommands = new[] { "create index idx_databaseitemstatv2_parent on DatabaseItemStat_v2 (id_databaseitem)", "create index idx_databaseitemstatv2_stat on DatabaseItemStat_v2 (Stat)", "create index idx_databaseitemstatv2_tv on DatabaseItemStat_v2 (TextValue)" }; var dropCommands = new[] { "drop index if exists idx_databaseitemstatv2_parent", "drop index if exists idx_databaseitemstatv2_stat", "drop index if exists idx_databaseitemstatv2_tv" }; // Drop index, insert stats, recreate index var sq = new System.Diagnostics.Stopwatch(); sq.Start(); const string sql = "insert into databaseitemstat_v2 (id_databaseitem, stat, textvalue, val1) values (@id, @stat, @tv, @val)"; int numStats; if (Dialect == SqlDialect.Sqlite) { numStats = InsertStatsSqlite(dropCommands, createCommands, sql, items); } else { numStats = InsertStatsPostgres(dropCommands, createCommands, items); } sq.Stop(); Logger.Info("Records stored"); Console.WriteLine($"Storing the records took {sq.ElapsedMilliseconds} milliseconds"); Logger.InfoFormat("Stored {0} items and {1} stats to internal db.", items.Count, numStats); }
public BaseProgressMonitor() { progressTracker = new ProgressTracker(); logger = new LogTextWriter(); logger.TextWritten += new LogTextEventHandler(WriteLogInternal); }
public async Task ProgressTrackerCommand([Remainder] string TrackerArgs) { //TODO this all needs to be reworked for globalization string[] splitArgs = TrackerArgs.Split(' '); string NameOfTrack = TrackerArgs; ChallengeRank difficulty = ChallengeRank.None; if (Enum.TryParse(Enum.GetNames(typeof(ChallengeRank)).FirstOrDefault(cr => ProgressTracker.HasMatchingChallengeRank(cr, splitArgs)), out difficulty)) { NameOfTrack = Regex.Replace(NameOfTrack, difficulty.ToString(), string.Empty, RegexOptions.IgnoreCase); } if (difficulty == ChallengeRank.None) { await CreateEmptyTracker(NameOfTrack); } else { await BuildProgressTrackerPostAsync(difficulty, NameOfTrack); } }
void init () { subscribeEvents(); _progress = WorldController.Instance.SaveFile.Progress; _conversation = ConversationDisplayController.Instance; }
private void Awake() { progressTracker = GetComponentInChildren <ProgressTracker>(); audioManager = FindObjectOfType <AudioManager>(); }
private void Save(List <DatabaseItem> items, ProgressTracker progressTracker, bool reset) { long numStats = 0; using (var session = SessionCreator.OpenSession()) { if (reset) { using (ITransaction transaction = session.BeginTransaction()) { var records = items.Select(m => m.Record).ToList(); session.CreateSQLQuery($@" DELETE FROM {DatabaseItemStatTable.Table} WHERE {DatabaseItemStatTable.Item} IN ( SELECT {DatabaseItemTable.Id} FROM {DatabaseItemTable.Table} WHERE {DatabaseItemTable.Record} IN ( :records ) )") .SetParameterList("records", records) .ExecuteUpdate(); session.CreateSQLQuery($"DELETE FROM {DatabaseItemTable.Table} WHERE {DatabaseItemTable.Record} IN ( :records )") .SetParameterList("records", records) .ExecuteUpdate(); transaction.Commit(); } } using (ITransaction transaction = session.BeginTransaction()) { foreach (DatabaseItem item in items) { session.Save(item); progressTracker.Increment(); } transaction.Commit(); } } var createCommands = new [] { "create index idx_databaseitemstatv2_parent on DatabaseItemStat_v2 (id_databaseitem)", "create index idx_databaseitemstatv2_stat on DatabaseItemStat_v2 (Stat)", "create index idx_databaseitemstatv2_tv on DatabaseItemStat_v2 (TextValue)" }; var dropCommands = new [] { "drop index if exists idx_databaseitemstatv2_parent", "drop index if exists idx_databaseitemstatv2_stat", "drop index if exists idx_databaseitemstatv2_tv" }; using (SQLiteConnection dbConnection = new SQLiteConnection(SessionFactoryLoader.SessionFactory.ConnectionString)) { dbConnection.Open(); var sq = new System.Diagnostics.Stopwatch(); sq.Start(); ExecuteTransactionSql(dbConnection, dropCommands); using (var transaction = dbConnection.BeginTransaction()) { using (SQLiteCommand command = new SQLiteCommand(dbConnection)) { string sql = "insert into databaseitemstat_v2 (id_databaseitem, stat, textvalue, val1) values (@id, @stat, @tv, @val)"; command.CommandText = sql; foreach (DatabaseItem item in items) { foreach (DatabaseItemStat stat in item.Stats) { command.Parameters.Add(new SQLiteParameter("@id", item.Id)); command.Parameters.Add(new SQLiteParameter("@stat", stat.Stat)); command.Parameters.Add(new SQLiteParameter("@tv", stat.TextValue)); command.Parameters.Add(new SQLiteParameter("@val", stat.Value)); command.ExecuteNonQuery(); numStats++; } } } transaction.Commit(); } ExecuteTransactionSql(dbConnection, createCommands); sq.Stop(); Logger.Info("Records stored"); Console.WriteLine($"Storing the records took {sq.ElapsedMilliseconds} milliseconds"); } Logger.InfoFormat("Stored {0} items and {1} stats to internal db.", items.Count, numStats); }
public void Save(ICollection <ItemTag> items, ProgressTracker tracker) { ThreadExecuter.Execute( () => repo.Save(items, tracker) ); }
public IActionResult UpdateBMI(string WeightMetric, double weight, double waist, string HeightMetric, double heightMeter = 0, double heightFeet = 0, double heightInches = 0) { try { string username = null; if (HttpContext.Session.GetString("LoggedIn") != null) { username = HttpContext.Session.GetString("Username"); } else { return(RedirectToAction("Index")); } double height; double UserWeight; if (HeightMetric == "Feet") { height = heightFeet * 12; height += heightInches; height *= 0.025; } else { height = heightMeter; } if (WeightMetric == "kg") { UserWeight = weight; } else { UserWeight = weight * 0.45; } //Saving the latest Weight data to Tracker table var TrackerList = db.ProgressTracker.ToList(); var latestMonth = TrackerList.Where(z => z.UserName.ToLower() == username.ToLower()).Max(x => x.Month); //getting the latest week updated ProgressTracker FirstPRogress = new ProgressTracker(); double BMI = weight / (height * height); FirstPRogress.TrackerId = Guid.NewGuid(); FirstPRogress.UserName = username; FirstPRogress.Wc = waist; FirstPRogress.Bmi = BMI; FirstPRogress.MonthlyHeight = height; FirstPRogress.MonthlyWeight = UserWeight; FirstPRogress.DateEntered = DateTime.Today; FirstPRogress.Month = latestMonth + 1; db.Add(FirstPRogress); //end of saving to table Tracker var dietUser = db.DietUsers.Where(x => x.UserName.ToLower() == username.ToLower()).FirstOrDefault(); float age = (float)Convert.ToDouble(dietUser.UserAge); int WCRange; if (dietUser.UserGender == "Male") { if (waist < 94) { WCRange = 1; } else if (waist < 102) { WCRange = 2; } else { WCRange = 3; } } else { if (waist < 80) { WCRange = 1; } else if (waist < 88) { WCRange = 2; } else { WCRange = 3; } } dietUser.UserWeightCategory = WeightClassification.returnClassification((float)BMI, WCRange); db.Update(dietUser); db.SaveChanges(); return(RedirectToAction("Dashboard")); } catch (SqlException) { string action = this.ControllerContext.RouteData.Values["action"].ToString(); string controller = this.ControllerContext.RouteData.Values["controller"].ToString(); return(RedirectToAction("Error", new { controllerName = controller, actionName = action })); } }
public DownloadPool(int maxCurrent, DownloadForm downloadForm, ProgressTracker progressTracker) { this.maxCurrent = maxCurrent; this.downloadForm = downloadForm; this.progressTracker = progressTracker; }