protected void GenerateFor(MethodInfo actionMethod, string outputDirectory)
        {
            var fileName        = OperationsProvider.GetOperationId(actionMethod);
            var operationPolicy = CreatePolicyGenerator().Generate(actionMethod);

            FileExporter.ExportToFile(operationPolicy, outputDirectory, fileName);
        }
Beispiel #2
0
            public static void Export(string path, string name, Texture2D texture, bool forRelease, UTinyTextureSettings settings, List <FileInfo> output)
            {
                switch (settings.FormatType)
                {
                case TextureFormatType.Source:
                    // Use the basic file exporter
                    FileExporter.Export(path, name, texture, output);
                    break;

                case TextureFormatType.PNG:
                    ExportPng(path, name, texture, output);
                    break;

                case TextureFormatType.JPG:
                    if (forRelease)
                    {
                        ExportJpgOptimized(path, name, texture, settings.JpgCompressionQuality, output);
                    }
                    else
                    {
                        ExportJpg(path, name, texture, settings.JpgCompressionQuality, output);
                    }
                    break;

                case TextureFormatType.WebP:
                    ExportWebP(path, name, texture, settings.WebPCompressionQuality, output);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
Beispiel #3
0
        private void mnuExport_Click(object sender, EventArgs e)
        {
            string filename = loadedUserFile;

            if (!string.Equals(Path.GetExtension(filename), ".asm", StringComparison.OrdinalIgnoreCase))
            {
                filename = Path.ChangeExtension(filename, ".asm");
            }

            FileExporter.FileName = filename;
            if (FileExporter.ShowDialog() == DialogResult.OK)
            {
                string error = null;
                try {
                    File.WriteAllText(FileExporter.FileName, editor.Text);
                } catch (IOException) {
                    error = "An IO error occurred";
                } catch (NotSupportedException) {
                    error = "Invalid path or unsupported operation";
                } catch (UnauthorizedAccessException) {
                    error = "Unauthorized access";
                }

                if (error != null)
                {
                    MessageBox.Show("Failed to export file:" + error, "Export Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Beispiel #4
0
        private void ExportRouteFiles(object sender, EventArgs e)
        {
            if (Route == null)
            {
                parentForm.ShowWarning("Please find or analyze a route first.");
                return;
            }

            var cmds   = AppSettings.ExportCommands.Values;
            var writer = new FileExporter(Route.Expanded, AirportList, cmds);

            IEnumerable <FileExporter.Status> reports = null;

            try
            {
                reports = writer.Export();
            }
            catch (Exception ex)
            {
                parentForm.ShowWarning(ex.Message);
                return;
            }

            ShowReports(reports.ToList());
        }
Beispiel #5
0
        private static UTinyExportInfo Export(UTinyProject project, string path, UTinyAssetInfo assetInfo)
        {
            var export    = new UTinyExportInfo(assetInfo);
            var assetName = GetAssetName(project, assetInfo.Object);
            var isDebug   = UTinyEditorApplication.EditorContext.Workspace.BuildConfiguration == UTinyBuildConfiguration.Debug;

            var texture = assetInfo.Object as Texture2D;

            if (texture != null)
            {
                var settings = UTinyUtility.GetAssetExportSettings(project, texture) as UTinyTextureSettings;
                TextureExporter.Export(path, assetName, texture, !isDebug, settings, export.Exported);
                return(export);
            }

            var audioClip = assetInfo.Object as AudioClip;

            if (audioClip != null)
            {
                FileExporter.Export(path, assetName, audioClip, export.Exported);
                return(export);
            }

            var font = assetInfo.Object as Font;

            if (font != null)
            {
                FontExporter.Export(path, assetName, font, export.Exported);
                return(export);
            }

            // Export the object as is
            FileExporter.Export(path, assetName, assetInfo.Object, export.Exported);
            return(export);
        }
        public static void ExportRouteFiles(
            IMessageDisplay view,
            RouteGroup Route,
            IEnumerable <ExportCommand> cmds,
            AirportManager airportList)
        {
            if (Route == null)
            {
                view.ShowMessage("Please find or analyze a route first.", MessageLevel.Info);
                return;
            }

            var writer = new FileExporter(Route.Expanded, airportList, cmds);
            IEnumerable <FileExporter.Status> reports = null;

            try
            {
                reports = writer.Export();
            }
            catch (Exception ex)
            {
                view.ShowMessage(ex.Message, MessageLevel.Warning);
                return;
            }

            ShowReports(view, reports.ToList());
        }
Beispiel #7
0
            public static void Export(string path, string name, Font font, ICollection <FileInfo> output)
            {
                if (IncludedByTargetPlatform(font))
                {
                    return;
                }

                FileExporter.Export(path, name, font, output);
            }
    public void ExportAsFile(string filetype)
    {
        string filename = System.DateTime.Now.ToString("yyyyMMddHHmmss");
        string path     = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);

        if (!Directory.Exists(Path.Combine(path, "CalcflowExports")))
        {
            Directory.CreateDirectory(Path.Combine(path, "CalcflowExports"));
        }
        FileExporter.SaveMesh(meshVisuals, Path.Combine(Path.Combine(path, "CalcflowExports"), filename), filetype);
    }
        public void TestStartForFileNotExisting()
        {
            //Arrange
            FileExporter import = new FileExporter(CreateModel(), _fileHandler);

            IFileInfo file = _fileHandler.FileSys.FileInfo.FromFileName(@"C:\NotExisting.txt");
            //Act
            Action a = () => import.Start(new ExportFile(file));

            //Assert
            Assert.Throws <FileNotFoundException>(a);
        }
        private void GenerateAllOperationsPolicy(string outputDirectory, Assembly assembly)
        {
            var allOperationsMethodInfo = OperationsProvider.GetAllOperations(assembly);

            if (allOperationsMethodInfo == null)
            {
                return;
            }

            var allOperationsPolicy = CreatePolicyGenerator().Generate(allOperationsMethodInfo);

            FileExporter.ExportToFile(allOperationsPolicy, outputDirectory, AllOperationsFileName);
        }
Beispiel #11
0
 public MainWindow()
 {
     lilyADPConverter = new LilyADPConverter();
     fileExporter     = new FileExporter();
     this.MidiTracks  = new ObservableCollection <MidiTrack>();
     keyHandler       = new ADPKeyHandler(this);
     psamAdapter      = new PSAMAdapter();
     InitializeComponent();
     DataContext = MidiTracks;
     showSampleVisualisation();
     initializeEditor();
     initializeFileConverters();
     needsSaving = false;
 }
        public bool ExportInFile(Model3d model, ExportParameters parameters)
        {
            var exporter = new FileExporter();

            switch (parameters.ModelFormat)
            {
            case ModelFormat.OBJ:
                return(exporter.ObjExport(model, parameters));

            case ModelFormat.STL:
                return(exporter.StlExport(model, parameters));
            }
            return(false);
        }
        public void TestStartForZip()
        {
            //Arrange
            FileExporter import = new FileExporter(CreateModel(), _fileHandler);
            IFileInfo    file   = _fileHandler.FileSys.FileInfo.FromFileName(@"c:\NotfallImporter\Error\vmi_20190304121156_99998_0000798569_0170631125_0123456789.zip");

            //Act
            import.Start(new ExportFile(file));

            //Assert
            Assert.True(_fileHandler.FileSys.File.Exists(@"c:\NotfallImporter\Import\vmi_20190304121156_99998_0000798569_0170631125_0123456789.zip"));
            Assert.True(_fileHandler.FileSys.File.Exists(@"c:\NotfallImporter\Import\vmi_20190304121156_99998_0000798569_0170631125_0123456789.rdy"));
            Assert.True(_fileHandler.FileSys.File.Exists(@"c:\NotfallImporter\Import\vmi_20190304121156_99998_0000798569_0170631125_0123456789.idx"));
        }
        public void TestStartForEml()
        {
            //Arrange
            FileExporter import = new FileExporter(CreateModel(), _fileHandler);

            IFileInfo file = _fileHandler.FileSys.FileInfo.FromFileName(@"c:\NotfallImporter\Error\eml_20190220123417_99802_0000009200.eml");

            //Act
            import.Start(new ExportFile(file));

            //Assert
            Assert.True(_fileHandler.FileSys.File.Exists(@"c:\NotfallImporter\Import\eml_20190220123417_99802_0000009200.zip"));
            Assert.True(_fileHandler.FileSys.File.Exists(@"c:\NotfallImporter\Import\eml_20190220123417_99802_0000009200.idx"));
            Assert.True(_fileHandler.FileSys.File.Exists(@"c:\NotfallImporter\Import\eml_20190220123417_99802_0000009200.rdy"));
        }
Beispiel #15
0
    private static void Export(int linesCount = 30)
    {
        var rnd     = new Random();
        var symbols = new string[] { "ABC", "DEF", "GHI", "JKL" };

        int itemsTotal       = linesCount;
        int itemsCountByLine = 3;

        if (itemsTotal < itemsCountByLine)
        {
            Console.WriteLine("Sorry :-(");
            return;
        }

        int counting = itemsTotal / itemsCountByLine;

        SetupPushBasedStreams();

        var sub1 = ResponseStream
                   .Buffer(itemsCountByLine)
                   .Subscribe(xs => {
            StringBuilder sb = new StringBuilder();
            sb.Append(symbols[rnd.Next(symbols.Length)]);
            foreach (var x in xs)
            {
                sb.AppendFormat(" {0,18:0.000000000000000}", x);
            }

            ReadyStreamW.OnNext(sb.ToString());
            if (--counting == 0)
            {
                ReadyStreamW.OnCompleted();
            }
        });

        //var sub2 = ReadyStream.Subscribe(s => Console.WriteLine(s));

        string path         = @".\ExportedFile.txt";
        var    fileExporter = new FileExporter(path);
        var    sub2         = ReadyStream.Subscribe(fileExporter);

        Send(itemsTotal, 10, 2);

        fileExporter.Wait();

        sub2.Dispose();
        sub1.Dispose();
    }
Beispiel #16
0
        private void ExportFiles(object sender, EventArgs e)
        {
            var o = UpdatedOption();

            UpdateOption(o);

            var writer = new FileExporter(Route.Expanded, AirportList, o.ExportCommands,
                                          () => appOption.Instance);
            IEnumerable <FileExporter.Status> reports = null;

            try
            {
                reports = writer.Export();
            }
            catch (Exception ex)
            {
                this.ShowMessage(ex.Message, MessageLevel.Warning);
                return;
            }

            ShowReports(this, reports.ToList());
        }
Beispiel #17
0
        private async Task OnExportFiles()
        {
            this.CancelToken = new CancellationTokenSource();
            IsExporting      = true;
            ConsoleOutput.SendStandard("Starting Export");
            var exportedProgress = new Progress <ReportMessage>(OnExportProgress);

            try
            {
                await FileExporter.ExportFiles(_dbConnectionString, SqlQuery, FolderPath, this.CancelToken.Token, exportedProgress);

                ConsoleOutput.SendSuccess("Export finished");
            }
            catch (OperationCanceledException)
            {
                Message = "Cancelled";
                ConsoleOutput.SendStandard("Export cancelled");
            }
            finally
            {
                IsExporting = false;
            }
        }
Beispiel #18
0
 public static void Setup(TestContext context)
 {
     importer = new IAFileExporter(SourceFile);
 }
 public FbxExporter()
 {
     m_pFileExporter = new FileExporter();
     m_pMaterialDict = new Dictionary<int, BoldarcManagedFbx.Material>();
 }
Beispiel #20
0
 public static void Setup(TestContext context)
 {
     importer = new GDFileExporter(SourceFile, IsExpansion1, ModName);
 }
Beispiel #21
0
 public FbxExporter()
 {
     m_pFileExporter = new FileExporter();
     m_pMaterialDict = new Dictionary <int, BoldarcManagedFbx.Material>();
 }