Exemplo n.º 1
0
    private void ExportToolStripMenuItem_Click(object sender, EventArgs e)
    {
        ExportForm form = new ExportForm();

        form.Initialize(_databaseOperation, dataViewUserControl1.GetDataViewer(), dataViewUserControl1.GetDataViewerParameters());
        form.ShowDialog();
    }
Exemplo n.º 2
0
        public void FileCompile()
        {
            ExportForm form = new ExportForm();

            form.Document = _document;
            form.ShowDialog();
        }
Exemplo n.º 3
0
        public virtual async Task <IActionResult> Export(ExportForm form)
        {
            if (form == null)
            {
                throw new ArgumentNullException(nameof(form));
            }

            var model = this.CreateExportViewModel(form);

            if (this.ModelState.IsValid)
            {
                try
                {
                    var result = await this.DataExporter.ExportAsync(form.Types.Select(type => Type.GetType(type, true)));

                    var json = JsonConvert.SerializeObject(result, this.ExportJsonSerializerSettings);

                    return(this.Content(json, MediaTypeNames.Application.Json));
                }
                catch (Exception exception)
                {
                    this.Logger.LogErrorIfEnabled(exception, "Could not export.");
                    this.ModelState.AddModelError(nameof(ImportForm.Files), this.Localizer.GetString("errors/ExportException"));
                }
            }

            return(await Task.FromResult(this.View(model)));
        }
Exemplo n.º 4
0
        void ShowExportWindow(object sender, EventArgs e)
        {
            var model = sender.GetContextMenuModel <dnModuleModel>();
            var form  = new ExportForm(model.Module);

            form.ShowDialog();
        }
Exemplo n.º 5
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            //Form zum Export des Decks, vielleicht in .txt, .dec, Zwischenablage etc.
            var exportForm = new ExportForm();

            OpenChildForm(exportForm);
        }
Exemplo n.º 6
0
        private void ExportButton_Click(object sender, EventArgs e)
        {
            ExportForm _ExportForm = new ExportForm();

            _ExportForm.StartPosition = FormStartPosition.CenterScreen;
            _ExportForm.Show();
        }
Exemplo n.º 7
0
 private void PerformExport()
 {
     if (_exportForm == null)
     {
         _exportForm = new ExportForm();
     }
     _exportForm.Show(this, new ExportViewer(arDesigner.ReportViewer), _exportReportType);
 }
Exemplo n.º 8
0
 private void PerformExport()
 {
     if (_exportForm == null)
     {
         _exportForm = new ExportForm(ConfigurationHelper.GetConfigFlag(ConfigurationHelper.UsePdfExportFilterKey) == true);
     }
     _exportForm.Show(this, new ExportViewer(arDesigner.ReportViewer), _exportReportType);
 }
Exemplo n.º 9
0
        public static void ExportToFile(ConnectionInfo selectedNode, ConnectionTreeModel connectionTreeModel)
        {
            try
            {
                var saveFilter = new SaveFilter();

                using (var exportForm = new ExportForm())
                {
                    if (selectedNode?.GetTreeNodeType() == TreeNodeType.Container)
                    {
                        exportForm.SelectedFolder = selectedNode as ContainerInfo;
                    }
                    else if (selectedNode?.GetTreeNodeType() == TreeNodeType.Connection)
                    {
                        if (selectedNode.Parent.GetTreeNodeType() == TreeNodeType.Container)
                        {
                            exportForm.SelectedFolder = selectedNode.Parent;
                        }
                        exportForm.SelectedConnection = selectedNode;
                    }

                    if (exportForm.ShowDialog(FrmMain.Default) != DialogResult.OK)
                    {
                        return;
                    }

                    ConnectionInfo exportTarget;
                    switch (exportForm.Scope)
                    {
                    case ExportForm.ExportScope.SelectedFolder:
                        exportTarget = exportForm.SelectedFolder;
                        break;

                    case ExportForm.ExportScope.SelectedConnection:
                        exportTarget = exportForm.SelectedConnection;
                        break;

                    default:
                        exportTarget = connectionTreeModel.RootNodes.First(node => node is RootNodeInfo);
                        break;
                    }

                    saveFilter.SaveUsername     = exportForm.IncludeUsername;
                    saveFilter.SavePassword     = exportForm.IncludePassword;
                    saveFilter.SaveDomain       = exportForm.IncludeDomain;
                    saveFilter.SaveInheritance  = exportForm.IncludeInheritance;
                    saveFilter.SaveCredentialId = exportForm.IncludeAssignedCredential;

                    SaveExportFile(exportForm.FileName, exportForm.SaveFormat, saveFilter, exportTarget);
                }
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddExceptionMessage("App.Export.ExportToFile() failed.", ex);
            }
        }
Exemplo n.º 10
0
    private void ExportToolStripMenuItem_Click(object sender, EventArgs e)
    {
        ExportForm form = new ExportForm();

        form.DisableExportSql();
        form.DisableExportPtt();
        form.DisableExportSession();
        form.Initialize(_databaseOperation, dataViewer1, _dataViewerParametersDataViewer1);
        form.ShowDialog();
    }
Exemplo n.º 11
0
        public void _0007_ShowDialg()
        {
            ExportForm  ef    = new ExportForm();
            ExportTable table = TestExportTable();

            ef.ExportTableSource = table;
            ef.FileName          = "Demo";
            ef.Directory         = "Könyvtár";
            ef.ShowDialog();
        }
Exemplo n.º 12
0
        public ExportForm GetExportForm(NodeFactory factory)
        {
            ExportForm exportForm = factory.CompilationModuleGroup.GetExportMethodForm(_method, IsSpecialUnboxingThunk);

            if (exportForm == ExportForm.ByName)
            {
                return(ExportForm.None); // Non-extern symbols exported by name are naturally handled by the linker
            }
            return(exportForm);
        }
Exemplo n.º 13
0
        public static void ExportToFile(TreeNode rootTreeNode, TreeNode selectedTreeNode)
        {
            try
            {
                TreeNode      exportTreeNode = default(TreeNode);
                Security.Save saveSecurity   = new Security.Save();

                using (ExportForm exportForm = new ExportForm())
                {
                    if (Tree.ConnectionTreeNode.GetNodeType(selectedTreeNode) == Tree.TreeNodeType.Container)
                    {
                        exportForm.SelectedFolder = selectedTreeNode;
                    }
                    else if (Tree.ConnectionTreeNode.GetNodeType(selectedTreeNode) == Tree.TreeNodeType.Connection)
                    {
                        if (Tree.ConnectionTreeNode.GetNodeType(selectedTreeNode.Parent) == Tree.TreeNodeType.Container)
                        {
                            exportForm.SelectedFolder = selectedTreeNode.Parent;
                        }
                        exportForm.SelectedConnection = selectedTreeNode;
                    }

                    if (exportForm.ShowDialog(frmMain.Default) != DialogResult.OK)
                    {
                        return;
                    }

                    switch (exportForm.Scope)
                    {
                    case mRemoteNG.Forms.ExportForm.ExportScope.SelectedFolder:
                        exportTreeNode = exportForm.SelectedFolder;
                        break;

                    case mRemoteNG.Forms.ExportForm.ExportScope.SelectedConnection:
                        exportTreeNode = exportForm.SelectedConnection;
                        break;

                    default:
                        exportTreeNode = rootTreeNode;
                        break;
                    }

                    saveSecurity.Username    = exportForm.IncludeUsername;
                    saveSecurity.Password    = exportForm.IncludePassword;
                    saveSecurity.Domain      = exportForm.IncludeDomain;
                    saveSecurity.Inheritance = exportForm.IncludeInheritance;

                    SaveExportFile(exportForm.FileName, exportForm.SaveFormat, exportTreeNode, saveSecurity);
                }
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddExceptionMessage(message: "App.Export.ExportToFile() failed.", ex: ex, logOnly: true);
            }
        }
Exemplo n.º 14
0
        private void ExportMenuItemHandler(object sender, EventArgs e)
        {
            if (_exportForm == null)
            {
                _exportForm = new ExportForm();
            }

            var reportType = _reportType ?? DetermineOpenedReportType();

            _exportForm.Show(this, new ExportViewer(viewer), reportType);
        }
Exemplo n.º 15
0
        private void ExportMenuItemHandler(object sender, EventArgs e)
        {
            if (_exportForm == null)
            {
                _exportForm = new ExportForm(ConfigurationHelper.GetConfigFlag(ConfigurationHelper.UsePdfExportFilterKey) == true);
            }

            var reportType = _reportType ?? DetermineOpenedReportType();

            _exportForm.Show(this, new ExportViewer(viewer), reportType);
        }
Exemplo n.º 16
0
        protected override void OnEnvironmentClose()
        {
            Application.UserInterfaceManager.UserInteractionDisabled = true;
            var loadingBar = new LoadingBar("Closing Export Environment...");

            loadingBar.SetProgress(new ProgressUpdate("Saving Robot Data...", 3, 5));
            loadingBar.Show();
            RobotDataManager.SaveRobotData(OpenAssemblyDocument);
            loadingBar.Close();
            Application.UserInterfaceManager.UserInteractionDisabled = false;

            if (!RobotDataManager.wasForceQuit)
            {
                var exportResult = MessageBox.Show(new Form {
                    TopMost = true
                },
                                                   "The robot configuration has been saved to your assembly document.\nWould you like to export your robot to Synthesis?",
                                                   "Robot Configuration Complete",
                                                   MessageBoxButtons.YesNo);

                if (exportResult == DialogResult.Yes)
                {
                    UnsupportedComponentsForm.CheckUnsupportedComponents(RobotDataManager.RobotBaseNode.ListAllNodes());
                    if (ExportForm.PromptExportSettings(RobotDataManager))
                    {
                        if (RobotDataManager.ExportRobot())
                        {
                            AnalyticsUtils.LogEvent("Export", "Succeeded");
                            if (Instance.AddInSettingsManager.OpenSynthesis)
                            {
                                SynthesisUtils.OpenSynthesis(RobotDataManager.RobotName);
                            }
                        }
                        else
                        {
                            AnalyticsUtils.LogEvent("Export", "Cancelled");
                        }
                    }
                }
            }

            // Re-enable disabled components
            if (disabledAssemblyOccurrences != null)
            {
                InventorUtils.EnableComponents(disabledAssemblyOccurrences);
            }
            disabledAssemblyOccurrences = null;

            advancedJointEditor.DestroyDockableWindow();
            guideManager.DestroyDockableWindow();
            jointViewKey.DestroyDockableWindow();
            AnalyticsUtils.EndSession();
        }
Exemplo n.º 17
0
 //Otvorenie okna na export údajov do PDF a Excelu
 private void Export_Btn_Click(object sender, EventArgs e)
 {
     try
     {
         var export = new ExportForm(studentSkupina, currentUser);
         export.Show();
     }
     catch (Exception ex)
     {
         Logger logger = new Logger();
         logger.LogError(ex);
     }
 }
Exemplo n.º 18
0
 public void Export()
 {
     try
     {
         using (var modal = new ExportForm())
         {
             modal.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "OperationError".GetUiTranslation(), MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 19
0
        public void _0006_ShowDialg()
        {
            ExportForm  ef    = new ExportForm();
            ExportTable table = TestExportTable();

            var uniqueFileName = "Exported File " + Guid.NewGuid().ToString();

            ef.ExportTableSource = table;
            ef.FileName          = uniqueFileName;
            ef.Directory         = "Könyvtár";

            ef.ShowDialog();

            Assert.IsTrue(System.IO.File.Exists(Environment.CurrentDirectory + "\\" + ef.Directory + "\\" + ef.FileName + ".csv"), "A fájl nem jött létre.");
        }
Exemplo n.º 20
0
        public void EvaluateExportForm()
        {
            ExportForm form = new ExportForm(new string[] { "foo/1", "bar/2" });

            Assert.AreEqual(2, form.Names.Count);
            Assert.IsTrue(form.Names.Contains("foo/1"));
            Assert.IsTrue(form.Names.Contains("bar/2"));

            Module module = new Module(null);

            form.Evaluate(module.Context);

            Assert.AreEqual(2, module.ExportNames.Count);
            Assert.IsTrue(module.ExportNames.Contains("foo/1"));
            Assert.IsTrue(module.ExportNames.Contains("bar/2"));
        }
        public ExportForm GetExportForm(NodeFactory factory)
        {
            // Force non-fake exports for RuntimeImportMethods that have '*' as their module. ('*' means the method is
            // REALLY a reference to the linked in native code)
            if (((EcmaMethod)_method).GetRuntimeImportDllName() == "*")
            {
                ExportForm exportForm = factory.CompilationModuleGroup.GetExportMethodForm(_method, false);
                if (exportForm == ExportForm.ByName)
                {
                    return(ExportForm.None); // Method symbols exported by name are naturally handled by the linker
                }
                return(exportForm);
            }

            return(ExportForm.None);
        }
Exemplo n.º 22
0
        protected internal virtual ExportViewModel CreateExportViewModel(ExportForm form = null)
        {
            var model         = new ExportViewModel();
            var selectedTypes = (form?.Types ?? Enumerable.Empty <string>()).ToHashSet(StringComparer.OrdinalIgnoreCase);

            foreach (var type in this.DataExporter.ExportableTypes.OrderBy(type => type.Name))
            {
                model.Form.TypeList.Add(new SelectListItem
                {
                    Selected = selectedTypes.Contains(type.AssemblyQualifiedName),
                    Text     = type.Name,
                    Value    = type.AssemblyQualifiedName
                });
            }

            return(model);
        }
Exemplo n.º 23
0
        private static void UpdateProgress(ExportForm exportForm, string msg, float progress)
        {
            string currTxt = "";

            exportForm.ProgressLog.Invoke((MethodInvoker)(() => currTxt = exportForm.ProgressLog.Text));
            if (msg.EndsWith("faces complete") && currTxt.EndsWith("faces complete"))
            {
                exportForm.ProgressLog.Invoke((MethodInvoker)(() => {
                    string newMsg = currTxt.Substring(0, currTxt.LastIndexOf('\n'));
                    newMsg += "\n" + msg;
                    exportForm.ProgressLog.Text = newMsg;
                }));
            }
            else
            {
                exportForm.ProgressLog.Invoke((MethodInvoker)(() => exportForm.ProgressLog.AppendText("\n" + msg)));
            }
            exportForm.ProgressBar.Invoke((MethodInvoker)(() => exportForm.ProgressBar.Value = (int)(progress * 10000)));
        }
Exemplo n.º 24
0
        private void ExportDocument()
        {
            ExportForm.ReportType reportType;


            if (this._exportForm == null)
            {
                bool?configFlag = ConfigurationHelper.GetConfigFlag("UsePdfExportFilter");
                this._exportForm = new ExportForm((!configFlag.GetValueOrDefault() ? false : configFlag.HasValue));
            }
            ExportForm.ReportType?nullable = this._reportType;
            reportType = (nullable.HasValue ? nullable.GetValueOrDefault() : this.DetermineOpenedReportType());
            var vw = new ExportViewer(this.viewer1);


            this._exportForm.Text = "Export Report";

            this._exportForm.Show(this, new ExportViewer(this.viewer1), reportType);

            //ExportFormold exportForm = new ExportFormold( PageDocument);
            //exportForm.ShowDialog(this);
        }
Exemplo n.º 25
0
        private void eXPORTToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ExportForm form = new ExportForm(textBox1.Lines);

            form.Show();
        }
Exemplo n.º 26
0
 private void ApplicationInitFormData()
 {
     mRepresentativeSplitForm = new RepresentativeSplitForm();
     mLoginForm  = new LoginForm();
     mExportForm = new ExportForm();
 }
Exemplo n.º 27
0
 private void ExportToFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (var frm = new ExportForm(this.persistence, this.connectionManager, this.favoriteIcons))
         frm.ShowDialog();
 }
Exemplo n.º 28
0
        public static void Render(Document document, ExportForm exportForm, out List <LMFace> faces, out int lmCount)
        {
            var textureCollection = document.TextureCollection;

            var map = document.Map;

            faces = new List <LMFace>();
            var lightEntities = new List <Light>();

            threadExceptions = new List <LMThreadException>();

            List <LightmapGroup> lmGroups          = new List <LightmapGroup>();
            List <LMFace>        exclusiveBlockers = new List <LMFace>();

            //get faces
            UpdateProgress(exportForm, "Determining UV coordinates...", 0);
            LMFace.FindFacesAndGroups(map, out faces, out lmGroups);

            if (!lmGroups.Any())
            {
                throw new Exception("No lightmap groups!");
            }

            foreach (Solid solid in map.WorldSpawn.Find(x => x is Solid).OfType <Solid>())
            {
                foreach (Face tface in solid.Faces)
                {
                    LMFace face = new LMFace(tface, solid);
                    if (tface.Texture.Name.ToLower() != "tooltextures/block_light")
                    {
                        continue;
                    }
                    exclusiveBlockers.Add(face);
                }
            }

            for (int i = 0; i < lmGroups.Count; i++)
            {
                for (int j = i + 1; j < lmGroups.Count; j++)
                {
                    if ((lmGroups[i].Plane.Normal - lmGroups[j].Plane.Normal).LengthSquared() < 0.001f &&
                        lmGroups[i].BoundingBox.IntersectsWith(lmGroups[j].BoundingBox))
                    {
                        lmGroups[i].Faces.AddRange(lmGroups[j].Faces);
                        lmGroups[i].BoundingBox = new BoxF(new BoxF[] { lmGroups[i].BoundingBox, lmGroups[j].BoundingBox });
#if DEBUG
                        if (lmGroups[j].DebugBreakpoint)
                        {
                            lmGroups[i].DebugBreakpoint = true;
                        }
#endif
                        lmGroups.RemoveAt(j);
                        j = i + 1;
                    }
                }
            }

            //put the faces into the bitmap
            lmGroups.Sort((x, y) =>
            {
                if (x.Width == y.Width)
                {
                    if (x.Height == y.Height)
                    {
                        return(0);
                    }
                    if (x.Height < y.Height)
                    {
                        return(1);
                    }
                    return(-1);
                }

                if (x.Width < y.Width)
                {
                    return(1);
                }
                return(-1);
            });

            FaceRenderThreads = new List <Thread>();

            Light.FindLights(map, out lightEntities);

            List <LMFace> allBlockers = lmGroups.Select(q => q.Faces).SelectMany(q => q).Where(f => f.CastsShadows).Union(exclusiveBlockers).ToList();
            int           faceCount   = 0;

            List <LightmapGroup> uvCalcFaces = new List <LightmapGroup>(lmGroups);

            int totalTextureDims = LightmapConfig.TextureDims;
            lmCount = 0;
            for (int i = 0; i < 4; i++)
            {
                int x = 1 + ((i % 2) * LightmapConfig.TextureDims);
                int y = 1 + ((i / 2) * LightmapConfig.TextureDims);
                CalculateUV(uvCalcFaces, new Rectangle(x, y, LightmapConfig.TextureDims - 2, LightmapConfig.TextureDims - 2), out _, out _);
                lmCount++;
                if (uvCalcFaces.Count == 0)
                {
                    break;
                }
                totalTextureDims = LightmapConfig.TextureDims * 2;
            }

            if (uvCalcFaces.Count > 0)
            {
                throw new Exception("Could not fit lightmap into four textures; try increasing texture dimensions or downscale factor");
            }

            float[][] buffers = new float[4][];
            lock (textureCollection.Lightmaps)
            {
                for (int i = 0; i < 4; i++)
                {
                    textureCollection.Lightmaps[i]?.Dispose();
                    textureCollection.Lightmaps[i] = new Bitmap(totalTextureDims, totalTextureDims);
                    buffers[i] = new float[textureCollection.Lightmaps[i].Width * textureCollection.Lightmaps[i].Height * Bitmap.GetPixelFormatSize(PixelFormat.Format32bppArgb) / 8];
                }
            }

            foreach (LightmapGroup group in lmGroups)
            {
                foreach (LMFace face in group.Faces)
                {
                    faceCount++;
                    Thread newThread = CreateLightmapRenderThread(document, buffers, lightEntities, group, face, allBlockers);
                    FaceRenderThreads.Add(newThread);
                }
            }

            int faceNum = 0;
            UpdateProgress(exportForm, "Started calculating brightness levels...", 0.05f);
            while (FaceRenderThreads.Count > 0)
            {
                for (int i = 0; i < 8; i++)
                {
                    if (i >= FaceRenderThreads.Count)
                    {
                        break;
                    }
                    if (FaceRenderThreads[i].ThreadState == ThreadState.Unstarted)
                    {
                        FaceRenderThreads[i].Start();
                    }
                    else if (!FaceRenderThreads[i].IsAlive)
                    {
                        FaceRenderThreads.RemoveAt(i);
                        i--;
                        faceNum++;
                        UpdateProgress(exportForm, faceNum.ToString() + "/" + faceCount.ToString() + " faces complete", 0.05f + ((float)faceNum / (float)faceCount) * 0.85f);
                    }
                }

                if (threadExceptions.Count > 0)
                {
                    for (int i = 0; i < FaceRenderThreads.Count; i++)
                    {
                        if (FaceRenderThreads[i].IsAlive)
                        {
                            FaceRenderThreads[i].Abort();
                        }
                    }
                    throw new Exception(threadExceptions[0].Message + "\n" + threadExceptions[0].StackTrace);
                }
                Thread.Yield();
            }

            //blur the lightmap so it doesn't look too pixellated
            UpdateProgress(exportForm, "Blurring lightmap...", 0.95f);
            float[] blurBuffer = new float[buffers[0].Length];
            for (int k = 0; k < 4; k++)
            {
                foreach (LightmapGroup group in lmGroups)
                {
                    int downscaledWidth  = (int)Math.Ceiling(group.Width / LightmapConfig.DownscaleFactor);
                    int downscaledHeight = (int)Math.Ceiling(group.Height / LightmapConfig.DownscaleFactor);

                    CoordinateF ambientNormal = new CoordinateF(LightmapConfig.AmbientNormalX,
                                                                LightmapConfig.AmbientNormalY,
                                                                LightmapConfig.AmbientNormalZ).Normalise();
                    float       ambientMultiplier = (group.Plane.Normal.Dot(ambientNormal) + 1.5f) * 0.4f;
                    CoordinateF mAmbientColor     = new CoordinateF((LightmapConfig.AmbientColorB * ambientMultiplier / 255.0f),
                                                                    (LightmapConfig.AmbientColorG * ambientMultiplier / 255.0f),
                                                                    (LightmapConfig.AmbientColorR * ambientMultiplier / 255.0f));
                    for (int y = group.writeY; y < group.writeY + downscaledHeight; y++)
                    {
                        if (y < 0 || y >= totalTextureDims)
                        {
                            continue;
                        }
                        for (int x = group.writeX; x < group.writeX + downscaledWidth; x++)
                        {
                            if (x < 0 || x >= totalTextureDims)
                            {
                                continue;
                            }
                            int offset = (x + y * totalTextureDims) * System.Drawing.Image.GetPixelFormatSize(PixelFormat.Format32bppArgb) / 8;

                            float accumRed    = 0;
                            float accumGreen  = 0;
                            float accumBlue   = 0;
                            int   sampleCount = 0;
                            for (int j = -LightmapConfig.BlurRadius; j <= LightmapConfig.BlurRadius; j++)
                            {
                                if (y + j < 0 || y + j >= totalTextureDims)
                                {
                                    continue;
                                }
                                if (y + j < group.writeY || y + j >= group.writeY + downscaledHeight)
                                {
                                    continue;
                                }
                                for (int i = -LightmapConfig.BlurRadius; i <= LightmapConfig.BlurRadius; i++)
                                {
                                    if (i * i + j * j > LightmapConfig.BlurRadius * LightmapConfig.BlurRadius)
                                    {
                                        continue;
                                    }
                                    if (x + i < 0 || x + i >= totalTextureDims)
                                    {
                                        continue;
                                    }
                                    if (x + i < group.writeX || x + i >= group.writeX + downscaledWidth)
                                    {
                                        continue;
                                    }
                                    int sampleOffset = ((x + i) + (y + j) * totalTextureDims) * System.Drawing.Image.GetPixelFormatSize(PixelFormat.Format32bppArgb) / 8;
                                    if (buffers[k][sampleOffset + 3] < 1.0f)
                                    {
                                        continue;
                                    }
                                    sampleCount++;
                                    accumRed   += buffers[k][sampleOffset + 0];
                                    accumGreen += buffers[k][sampleOffset + 1];
                                    accumBlue  += buffers[k][sampleOffset + 2];
                                }
                            }

                            if (sampleCount < 1)
                            {
                                sampleCount = 1;
                            }
                            accumRed   /= sampleCount;
                            accumGreen /= sampleCount;
                            accumBlue  /= sampleCount;

                            accumRed   = mAmbientColor.X + (accumRed * (1.0f - mAmbientColor.X));
                            accumGreen = mAmbientColor.Y + (accumGreen * (1.0f - mAmbientColor.Y));
                            accumBlue  = mAmbientColor.Z + (accumBlue * (1.0f - mAmbientColor.Z));

                            if (accumRed > 1.0f)
                            {
                                accumRed = 1.0f;
                            }
                            if (accumGreen > 1.0f)
                            {
                                accumGreen = 1.0f;
                            }
                            if (accumBlue > 1.0f)
                            {
                                accumBlue = 1.0f;
                            }

                            blurBuffer[offset + 0] = accumRed;
                            blurBuffer[offset + 1] = accumGreen;
                            blurBuffer[offset + 2] = accumBlue;
                            blurBuffer[offset + 3] = 1.0f;
                        }
                    }
                }

                blurBuffer.CopyTo(buffers[k], 0);
            }

            for (int i = 0; i < buffers[0].Length; i++)
            {
                if (i % 4 == 3)
                {
                    buffers[0][i] = 1.0f;
                    buffers[1][i] = 1.0f;
                    buffers[2][i] = 1.0f;
                    buffers[3][i] = 1.0f;
                }
                else
                {
                    float brightnessAdd = (buffers[0][i] + buffers[1][i] + buffers[2][i]) / (float)Math.Sqrt(3.0);
                    if (brightnessAdd > 0.0f) //normalize brightness to remove artifacts when adding together
                    {
                        buffers[0][i] *= buffers[3][i] / brightnessAdd;
                        buffers[1][i] *= buffers[3][i] / brightnessAdd;
                        buffers[2][i] *= buffers[3][i] / brightnessAdd;
                    }
                }
            }

            UpdateProgress(exportForm, "Copying bitmap data...", 0.99f);
            for (int k = 0; k < 4; k++)
            {
                byte[] byteBuffer = new byte[buffers[k].Length];
                for (int i = 0; i < buffers[k].Length; i++)
                {
                    byteBuffer[i] = (byte)Math.Max(Math.Min(buffers[k][i] * 255.0f, 255.0f), 0.0f);
                }
                lock (textureCollection.Lightmaps)
                {
                    BitmapData bitmapData2 = textureCollection.Lightmaps[k].LockBits(new Rectangle(0, 0, totalTextureDims, totalTextureDims), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
                    Marshal.Copy(byteBuffer, 0, bitmapData2.Scan0, byteBuffer.Length);
                    textureCollection.Lightmaps[k].UnlockBits(bitmapData2);
                }
            }

            faces.Clear();
            faces.AddRange(lmGroups.SelectMany(g => g.Faces));

            lock (textureCollection.Lightmaps)
            {
                document.TextureCollection.LightmapTextureOutdated = true;
            }

            UpdateProgress(exportForm, "Lightmapping complete!", 1.0f);
        }
Exemplo n.º 29
0
        private void btn_Export_Click(object sender, EventArgs e)
        {
            ExportForm ef = new ExportForm();

            ef.Show();
        }
Exemplo n.º 30
0
    public void ExportDataUnattended(string fileName)
    {
        string originalMinDuration = _dataViewerParametersDataViewer1.Columns["MinDuration"][4];
        string originalMaxDuration = _dataViewerParametersDataViewer1.Columns["MaxDuration"][4];
        string originalAvgDuration = _dataViewerParametersDataViewer1.Columns["AvgDuration"][4];
        string originalDevDuration = _dataViewerParametersDataViewer1.Columns["DevDuration"][4];
        string originalVarDuration = _dataViewerParametersDataViewer1.Columns["VarDuration"][4];
        string originalSumDuration = _dataViewerParametersDataViewer1.Columns["SumDuration"][4];
        string originalMinReads    = _dataViewerParametersDataViewer1.Columns["MinReads"][4];
        string originalMaxReads    = _dataViewerParametersDataViewer1.Columns["MaxReads"][4];
        string originalAvgReads    = _dataViewerParametersDataViewer1.Columns["AvgReads"][4];
        string originalDevReads    = _dataViewerParametersDataViewer1.Columns["DevReads"][4];
        string originalVarReads    = _dataViewerParametersDataViewer1.Columns["VarReads"][4];
        string originalSumReads    = _dataViewerParametersDataViewer1.Columns["SumReads"][4];
        string originalMinWrites   = _dataViewerParametersDataViewer1.Columns["MinWrites"][4];
        string originalMaxWrites   = _dataViewerParametersDataViewer1.Columns["MaxWrites"][4];
        string originalAvgWrites   = _dataViewerParametersDataViewer1.Columns["AvgWrites"][4];
        string originalDevWrites   = _dataViewerParametersDataViewer1.Columns["DevWrites"][4];
        string originalVarWrites   = _dataViewerParametersDataViewer1.Columns["VarWrites"][4];
        string originalSumWrites   = _dataViewerParametersDataViewer1.Columns["SumWrites"][4];
        string originalMinCPU      = _dataViewerParametersDataViewer1.Columns["MinCPU"][4];
        string originalMaxCPU      = _dataViewerParametersDataViewer1.Columns["MaxCPU"][4];
        string originalAvgCPU      = _dataViewerParametersDataViewer1.Columns["AvgCPU"][4];
        string originalDevCPU      = _dataViewerParametersDataViewer1.Columns["DevCPU"][4];
        string originalVarCPU      = _dataViewerParametersDataViewer1.Columns["VarCPU"][4];
        string originalSumCPU      = _dataViewerParametersDataViewer1.Columns["SumCPU"][4];
        string originalMinRows     = _dataViewerParametersDataViewer1.Columns["MinRows"][4];
        string originalMaxRows     = _dataViewerParametersDataViewer1.Columns["MaxRows"][4];
        string originalAvgRows     = _dataViewerParametersDataViewer1.Columns["AvgRows"][4];
        string originalDevRows     = _dataViewerParametersDataViewer1.Columns["DevRows"][4];
        string originalVarRows     = _dataViewerParametersDataViewer1.Columns["VarRows"][4];
        string originalSumRows     = _dataViewerParametersDataViewer1.Columns["SumRows"][4];

        _dataViewerParametersDataViewer1.Columns["MinDuration"][4] = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["MaxDuration"][4] = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["AvgDuration"][4] = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["DevDuration"][4] = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["VarDuration"][4] = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["SumDuration"][4] = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["MinReads"][4]    = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["MaxReads"][4]    = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["AvgReads"][4]    = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["DevReads"][4]    = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["VarReads"][4]    = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["SumReads"][4]    = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["MinWrites"][4]   = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["MaxWrites"][4]   = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["AvgWrites"][4]   = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["DevWrites"][4]   = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["VarWrites"][4]   = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["SumWrites"][4]   = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["MinCPU"][4]      = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["MaxCPU"][4]      = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["AvgCPU"][4]      = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["DevCPU"][4]      = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["VarCPU"][4]      = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["SumCPU"][4]      = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["MinRows"][4]     = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["MaxRows"][4]     = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["AvgRows"][4]     = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["DevRows"][4]     = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["VarRows"][4]     = "SearchableShow";
        _dataViewerParametersDataViewer1.Columns["SumRows"][4]     = "SearchableShow";

        ExportForm form = new ExportForm();

        form.DisableExportSql();
        form.DisableExportPtt();
        form.DisableExportSession();
        form.Initialize(_databaseOperation, dataViewer1, _dataViewerParametersDataViewer1);

        form.DoExportCsvAllPagesUnattended(fileName, _totalRows);

        _minStartTime = form.GetMinStartTime();
        _maxStartTime = form.GetMaxStartTime();

        _dataViewerParametersDataViewer1.Columns["MinDuration"][4] = originalMinDuration;
        _dataViewerParametersDataViewer1.Columns["MaxDuration"][4] = originalMaxDuration;
        _dataViewerParametersDataViewer1.Columns["AvgDuration"][4] = originalAvgDuration;
        _dataViewerParametersDataViewer1.Columns["DevDuration"][4] = originalDevDuration;
        _dataViewerParametersDataViewer1.Columns["VarDuration"][4] = originalVarDuration;
        _dataViewerParametersDataViewer1.Columns["SumDuration"][4] = originalSumDuration;
        _dataViewerParametersDataViewer1.Columns["MinReads"][4]    = originalMinReads;
        _dataViewerParametersDataViewer1.Columns["MaxReads"][4]    = originalMaxReads;
        _dataViewerParametersDataViewer1.Columns["AvgReads"][4]    = originalAvgReads;
        _dataViewerParametersDataViewer1.Columns["DevReads"][4]    = originalDevReads;
        _dataViewerParametersDataViewer1.Columns["VarReads"][4]    = originalVarReads;
        _dataViewerParametersDataViewer1.Columns["SumReads"][4]    = originalSumReads;
        _dataViewerParametersDataViewer1.Columns["MinWrites"][4]   = originalMinWrites;
        _dataViewerParametersDataViewer1.Columns["MaxWrites"][4]   = originalMaxWrites;
        _dataViewerParametersDataViewer1.Columns["AvgWrites"][4]   = originalAvgWrites;
        _dataViewerParametersDataViewer1.Columns["DevWrites"][4]   = originalDevWrites;
        _dataViewerParametersDataViewer1.Columns["VarWrites"][4]   = originalVarWrites;
        _dataViewerParametersDataViewer1.Columns["SumWrites"][4]   = originalSumWrites;
        _dataViewerParametersDataViewer1.Columns["MinCPU"][4]      = originalMinCPU;
        _dataViewerParametersDataViewer1.Columns["MaxCPU"][4]      = originalMaxCPU;
        _dataViewerParametersDataViewer1.Columns["AvgCPU"][4]      = originalAvgCPU;
        _dataViewerParametersDataViewer1.Columns["DevCPU"][4]      = originalDevCPU;
        _dataViewerParametersDataViewer1.Columns["VarCPU"][4]      = originalVarCPU;
        _dataViewerParametersDataViewer1.Columns["SumCPU"][4]      = originalSumCPU;
        _dataViewerParametersDataViewer1.Columns["MinRows"][4]     = originalMinRows;
        _dataViewerParametersDataViewer1.Columns["MaxRows"][4]     = originalMaxRows;
        _dataViewerParametersDataViewer1.Columns["AvgRows"][4]     = originalAvgRows;
        _dataViewerParametersDataViewer1.Columns["DevRows"][4]     = originalDevRows;
        _dataViewerParametersDataViewer1.Columns["VarRows"][4]     = originalVarRows;
        _dataViewerParametersDataViewer1.Columns["SumRows"][4]     = originalSumRows;
    }