private void SlowTaskBeginModule(string moduleName, int target) { if (currentSlowTaskStep < currentSlowTaskTarget) { double stepFraction = currentSlowTaskStep == 0 ? 1 : ((double)currentSlowTaskTarget / (double)currentSlowTaskStep); slowTask.EnterProgressFrame((float)(100.0 / stepFraction), GetSlowTaskTitle()); } currentSlowTaskStep = 0; currentSlowTaskTarget = Math.Max(target, 1); currentSlowTaskName = moduleName; }
private void SlowTaskBeginModule(string moduleName, int target) { if (currentSlowTaskStep < currentSlowTaskTarget) { double stepFraction = currentSlowTaskStep == 0 ? 1 : ((double)currentSlowTaskTarget / (double)currentSlowTaskStep); slowTask.EnterProgressFrame((float)(100.0 / stepFraction), GetSlowTaskTitle()); if (Native.NativeFunctions.codeGenContext != null) { Native.NativeFunctions.codeGenContext.StatusForceUpdate((int)slowTask.CompletedWork, slowTaskModuleCount * 100, "Generating: " + moduleName); } } currentSlowTaskStep = 0; currentSlowTaskTarget = Math.Max(target, 1); currentSlowTaskName = moduleName; }
private void SlowTaskStep(UObject target) { currentSlowTaskStep++; slowTask.EnterProgressFrame((float)(100.0 / currentSlowTaskTarget), GetSlowTaskTitle()); if (subSlowTask != null && target != null) { subSlowTask.EnterProgressFrame(1, target.GetName()); } }
internal static bool CompileCode(string slnPath, string projPath) { CodeGeneratorSettings settings = new CodeGeneratorSettings(); string pluginInstallerPath = Path.GetFullPath(Path.Combine(settings.GetManagedBinDir(), "PluginInstaller", "PluginInstaller.exe")); if (!File.Exists(slnPath)) { CommandLog(ELogVerbosity.Error, "The solution '" + slnPath + "' doesn't exist"); return(false); } if (!string.IsNullOrEmpty(projPath) && !File.Exists(projPath)) { CommandLog(ELogVerbosity.Error, "The project '" + projPath + "' doesn't exist"); return(false); } if (!File.Exists(pluginInstallerPath)) { CommandLog(ELogVerbosity.Error, "Plugin installer not found at '" + pluginInstallerPath + "'"); return(false); } const string typeName = "PluginInstaller.Program"; const string methodName = "BuildCustomSolution"; if (pluginInstallerBuildSlnMethod == null) { if (!pluginInstallerLoaded) { pluginInstallerLoaded = true; Assembly assembly = CurrentAssemblyContext.LoadFrom(pluginInstallerPath); if (assembly == null) { CommandLog(ELogVerbosity.Error, "Failed to load the plugin installer at '" + pluginInstallerPath + "'."); return(false); } Type type = assembly.GetType(typeName); if (type == null) { CommandLog(ELogVerbosity.Error, "Failed to resolve the plugin installer type '" + typeName + "'."); return(false); } // Set the AppDirectory path so that it can resolve the local msbuild path (if a local msbuild exists) type.GetField("AppDirectory", BindingFlags.Public | BindingFlags.Static).SetValue( null, Path.GetDirectoryName(pluginInstallerPath)); pluginInstallerBuildSlnMethod = type.GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Static); } if (pluginInstallerBuildSlnMethod == null) { CommandLog(ELogVerbosity.Error, "Failed to resolve the '" + methodName + "' function in plugin installer."); return(false); } } CommandLog(ELogVerbosity.Log, "Attempting to build generated solution at " + slnPath); bool built = false; using (FScopedSlowTask slowTask = new FScopedSlowTask(100, "Compiling...")) { slowTask.MakeDialog(); try { built = (bool)pluginInstallerBuildSlnMethod.Invoke(null, new object[] { slnPath, projPath }); if (built) { CommandLog(ELogVerbosity.Log, "Solution was compiled successfully."); } else { CommandLog(ELogVerbosity.Error, "There was an error building the solution. Try compiling manually at " + slnPath); } } catch (Exception e) { CommandLog(ELogVerbosity.Error, "'" + methodName + "' throw an exception whilst compiling: " + e); } // This will give us one frame of 100% rather than always showing 0% (is there an alternative dialog for unknown task lengths?) slowTask.EnterProgressFrame(99.9f); slowTask.EnterProgressFrame(0.1f); } return(built); }