Esempio n. 1
0
        /// <summary>
        /// 开始导出
        /// </summary>
        /// <param name="uidoc"></param>
        /// <param name="view"></param>
        /// <param name="localConfig"></param>
        /// <param name="exportType"></param>
        /// <param name="outputStream"></param>
        /// <param name="features"></param>
        /// <param name="useShareTexture"></param>
        /// <param name="progressCallback"></param>
        /// <param name="cancellationToken"></param>
        private void StartExport(UIDocument uidoc, View3D view, AppLocalConfig localConfig, ExportType exportType, Stream outputStream, Dictionary <FeatureType, bool> features, bool useShareTexture, Action <int> progressCallback, CancellationToken cancellationToken)
        {
            using (var log = new RuntimeLog())
            {
                var config = new ExportConfig();
                config.TargetPath      = localConfig.LastTargetPath;
                config.ExportType      = exportType;
                config.UseShareTexture = useShareTexture;
                config.OutputStream    = outputStream;
                config.Features        = features ?? new Dictionary <FeatureType, bool>();
                config.Trace           = log.Log;
                config.ElementIds      = (features?.FirstOrDefault(x => x.Key == FeatureType.OnlySelected).Value ?? false)
                    ? _ElementIds
                    : null;
                config.LevelOfDetail = localConfig.LevelOfDetail;

                #region Add Plugin - CreatePropDb
                {
                    var cliPath = Path.Combine(
                        App.GetHomePath(),
                        @"Tools",
                        @"CreatePropDb",
                        @"CreatePropDbCLI.exe");

                    if (File.Exists(cliPath))
                    {
                        config.Addins.Add(new ExportPlugin(
                                              FeatureType.GenerateModelsDb,
                                              cliPath,
                                              new[] { @"-i", config.TargetPath }
                                              ));
                    }
                }
                #endregion

                #region Add Plugin - CreateThumbnail
                {
                    var cliPath = Path.Combine(
                        App.GetHomePath(),
                        @"Tools",
                        @"CreateThumbnail",
                        @"CreateThumbnailCLI.exe");

                    if (File.Exists(cliPath))
                    {
                        config.Addins.Add(new ExportPlugin(
                                              FeatureType.GenerateThumbnail,
                                              cliPath,
                                              new[] { @"-i", config.TargetPath }
                                              ));
                    }
                }
                #endregion

                Exporter.ExportToSvf(uidoc, view, config, x => progressCallback?.Invoke((int)x), cancellationToken);
            }
        }
Esempio n. 2
0
 public AppConfig Clone()
 {
     return(new AppConfig()
     {
         MaxRecentFileHistory = MaxRecentFileHistory,
         ExportConfig = ExportConfig.Clone(),
         DisplayConfig = DisplayConfig.Clone()
     });
 }
        public static void Run(string host = Constants.DEFAULT_HOST, int port = Constants.DEFAULT_PORT)
        {
            // Instantiate the ExportConfig class and add the required configurations
            ExportConfig  exportConfig = new ExportConfig();
            List <string> results      = new List <string>();

            string chartConfig = @"{
                        ""type"": ""column2d"",
                        ""renderAt"": ""chart-container"",
                        ""width"": ""600"",
                        ""height"": ""400"",
                        ""dataFormat"": ""json"",
                        ""dataSource"": {
                            ""chart"": {
                                ""caption"": ""Number of visitors last week"",
                                ""subCaption"": ""Bakersfield Central vs Los Angeles Topanga""
                            },
                            ""data"": [{
                                    ""label"": ""Mon"",
                                    ""value"": ""15123""
                                },{
                                    ""label"": ""Tue"",
                                    ""value"": ""14233""
                                },{
                                    ""label"": ""Wed"",
                                    ""value"": ""25507""
                                }
                            ]
                        }
                    }";

            string chartConfigFile  = System.Environment.CurrentDirectory + "\\resources\\dashboard_charts.json";
            string templateFilePath = System.Environment.CurrentDirectory + "\\resources\\template.html";

            // Instantiate the ExportManager class
            using (ExportManager exportManager = new ExportManager())
            {
                exportConfig.Set("chartConfig", chartConfigFile);
                exportConfig.Set("templateFilePath", templateFilePath);
                exportConfig.Set("templateFormat", "letter");
                exportConfig.Set("header", "yugyitfty");
                exportConfig.Set("subheader", "Rishav");


                // Call the Export() method with the export config
                //results.AddRange(exportManager.Export(exportConfig, @"D:\temp\exported-charts", true));
                results.AddRange(exportManager.Export(exportConfig, System.Environment.GetEnvironmentVariable("%TMP%", EnvironmentVariableTarget.User), true));
            }

            foreach (string path in results)
            {
                Console.WriteLine(path);
            }

            Console.Read();
        }
Esempio n. 4
0
 public ExportSceneWizard()
 {
     config = ExportConfig.Load();
     if (EditorPrefs.HasKey("FFWD XNA dir " + PlayerSettings.productName))
     {
         xnaBaseDir = EditorPrefs.GetString("FFWD XNA dir " + PlayerSettings.productName);
     }
     if (EditorPrefs.HasKey("FFWD active group"))
     {
         activeGroup = EditorPrefs.GetInt("FFWD active group");
     }
 }
Esempio n. 5
0
 public ExportSceneWizard()
 {
     config = ExportConfig.Load();
     if (EditorPrefs.HasKey("FFWD XNA dir " + PlayerSettings.productName))
     {
         xnaBaseDir = EditorPrefs.GetString("FFWD XNA dir " + PlayerSettings.productName);
     }
     if (EditorPrefs.HasKey("FFWD active group"))
     {
         activeGroup = EditorPrefs.GetInt("FFWD active group");
     }
 }
        /// <summary>
        /// データ作成(Projectウィンドウで名前入力)
        /// </summary>
        public static T CreateData <T>(string dataName) where T : ScriptableObject
        {
            var directory = ExportConfig.GetDataExportDirectory();
            var path      = directory + "/" + dataName + ".asset";

            Debug.Log(path);
            var instance = ScriptableObject.CreateInstance <T>();

            ProjectWindowUtil.CreateAsset(instance, path);

            return(instance);
        }
Esempio n. 7
0
    /// <summary>
    /// Async. Uses the download service to initiate a download of selected
    /// basket images, given a particular config - e.g., whether the images
    /// should be resized, watermarked, etc.
    /// </summary>
    /// <param name="config">Download configuration with size and watermark settings</param>
    /// <param name="keepPaths">True to keep folder structure, false for a flat zip of images.</param>
    /// <param name="OnProgress">Callback to give progress information to the UI</param>
    /// <returns>String path to the generated file, which is passed back to the doanload request</returns>
    /// TODO: Maybe move this elsewhere.
    public async Task <string> DownloadSelection(ExportConfig config)
    {
        var virtualZipPath = await _downloadService.CreateDownloadZipAsync(BasketImages, config);

        if (!string.IsNullOrEmpty(virtualZipPath))
        {
            _statusService.StatusText = $"Basket selection downloaded to {virtualZipPath}.";
            Logging.Log($"Basket selection downloaded to {virtualZipPath}.");

            return(virtualZipPath);
        }

        return(string.Empty);
    }
Esempio n. 8
0
        /// <summary>
        /// 开始导出
        /// </summary>
        /// <param name="view"></param>
        /// <param name="targetPath"></param>
        /// <param name="exportType"></param>
        /// <param name="outputStream"></param>
        /// <param name="features"></param>
        private void StartExport(string targetPath, ExportType exportType, Stream outputStream, Dictionary <FeatureType, bool> features)
        {
            using (var log = new RuntimeLog())
            {
                var config = new ExportConfig();
                config.TargetPath   = targetPath;
                config.ExportType   = exportType;
                config.OutputStream = outputStream;
                config.Features     = features?.Keys.ToList() ?? new List <FeatureType>();
                config.Trace        = log.Log;

                Exporter.ExportToSvf(config);
            }
        }
Esempio n. 9
0
        private static string[] GetAssetPathsToExport(ExportConfig config)
        {
            string root = config.AssetDirectory;

            if (root.Last() != '/')
            {
                root = root + '/';
            }

            string[] assetPathsInRootDirectory = AssetDatabase.GetAllAssetPaths().Where(assetPath => assetPath.StartsWith(root)).ToArray();
            string[] assetPathsIncludedOnly    = assetPathsInRootDirectory.Where(filePath => config.Includes.Any(includingPattern => Regex.IsMatch(filePath, WildcardToRegular(includingPattern)))).ToArray();
            string[] assetPathsWithoutExcluded = assetPathsIncludedOnly.Where(filePath => config.Excludes.Any(excludingPattern => Regex.IsMatch(filePath, WildcardToRegular(excludingPattern))) == false).ToArray();
            return(assetPathsWithoutExcluded);
        }
Esempio n. 10
0
        /// <summary>
        /// 开始导出
        /// </summary>
        /// <param name="localConfig"></param>
        /// <param name="exportType"></param>
        /// <param name="outputStream"></param>
        /// <param name="features"></param>
        /// <param name="useShareTexture"></param>
        /// <param name="progressCallback"></param>
        /// <param name="cancellationToken"></param>
        private void StartExport(AppLocalConfig localConfig, ExportType exportType, Stream outputStream, Dictionary <FeatureType, bool> features, bool useShareTexture, Action <int> progressCallback, CancellationToken cancellationToken)
        {
            using (var log = new RuntimeLog())
            {
                var config = new ExportConfig();
                config.TargetPath   = localConfig.LastTargetPath;
                config.ExportType   = exportType;
                config.OutputStream = outputStream;
                config.Features     = features?.Keys.ToList() ?? new List <FeatureType>();
                config.Trace        = log.Log;

                #region Add Plugin - CreatePropDb
                {
                    var cliPath = Path.Combine(
                        App.GetHomePath(),
                        @"Tools",
                        @"CreatePropDb",
                        @"CreatePropDbCLI.exe");
                    if (File.Exists(cliPath))
                    {
                        config.Addins.Add(new ExportPlugin(
                                              FeatureType.GenerateModelsDb,
                                              cliPath,
                                              new[] { @"-i", config.TargetPath }
                                              ));
                    }
                }
                #endregion

                #region Add Plugin - CreateThumbnail
                {
                    var cliPath = Path.Combine(
                        App.GetHomePath(),
                        @"Tools",
                        @"CreateThumbnail",
                        @"CreateThumbnailCLI.exe");
                    if (File.Exists(cliPath))
                    {
                        config.Addins.Add(new ExportPlugin(
                                              FeatureType.GenerateThumbnail,
                                              cliPath,
                                              new[] { @"-i", config.TargetPath }
                                              ));
                    }
                }
                #endregion

                Exporter.ExportToSvf(config, x => progressCallback?.Invoke((int)x), cancellationToken);
            }
        }
Esempio n. 11
0
    /// <summary>
    /// Upload the basket imagesconfigured Wordpress  site's media library
    /// TODO: Add option to watermark and resize images when uploading
    /// </summary>
    /// <returns></returns>
    public async Task UploadBasketToWordpress(List <Image> images)
    {
        try
        {
            _statusService.StatusText = $"Uploading {images.Count()} to Wordpress...";

            Logging.LogVerbose($"Checking token validity...");

            bool validToken = await CheckTokenValidity();

            if (validToken)
            {
                foreach (var image in images)
                {
                    using var memoryStream = new MemoryStream();

                    // We shrink the images a bit before upload to Wordpress.
                    // TODO: Support watermarks for WP Upload in future.
                    ExportConfig wpConfig = new ExportConfig {
                        Size = ExportSize.Large, WatermarkText = null
                    };

                    // This saves to the memoryStream with encoder
                    await _imageProcessService.TransformDownloadImage(image.FullPath, memoryStream, wpConfig);

                    // The position needs to be reset, before we push it to Wordpress
                    memoryStream.Position = 0;

                    _statusService.StatusText = $"Uploading {image.FileName} to Wordpress.";

                    await _client.Media.CreateAsync(memoryStream, image.FileName);

                    Logging.LogVerbose($"Image uploaded: {image.FullPath} successfully.");
                }

                _statusService.StatusText = $"{images.Count()} images uploaded to Wordpress.";
            }
            else
            {
                Logging.LogError($"Token was invalid.");
                _statusService.StatusText = $"Authentication error uploading to Wordpress.";
            }
        }
        catch (Exception e)
        {
            Logging.LogError($"Error uploading to Wordpress: {e.Message}");
            _statusService.StatusText = $"Error uploading images to Wordpress. Please check the logs.";
        }
    }
Esempio n. 12
0
        /// <summary>
        /// Async. Uses the download service to initiate a download of selected
        /// basket images, given a particular config - e.g., whether the images
        /// should be resized, watermarked, etc.
        /// </summary>
        /// <param name="config">Download configuration with size and watermark settings</param>
        /// <param name="keepPaths">True to keep folder structure, false for a flat zip of images.</param>
        /// <param name="OnProgress">Callback to give progress information to the UI</param>
        /// <returns>String path to the generated file, which is passed back to the doanload request</returns>
        public async Task <string> DownloadSelection(ExportConfig config, bool keepPaths)
        {
            var images = SelectedImages.Select(x => new FileInfo(x.FullPath)).ToArray();

            var virtualZipPath = await DownloadService.Instance.CreateDownloadZipAsync(images, config, keepPaths);

            if (!string.IsNullOrEmpty(virtualZipPath))
            {
                StatusService.Instance.StatusText = $"Basket selection downloaded to {virtualZipPath}.";

                return(virtualZipPath);
            }

            return(string.Empty);
        }
Esempio n. 13
0
        public void Generate(Data buildData, ExportConfig exportConfig)
        {
            this.exportConfig = exportConfig;

            if (exportConfig.isArrayOfObjects)
            {
                GenerateArrayOfObjects(buildData);
            }
            else if (exportConfig.isSingleObject)
            {
                GenerateSingleObject(buildData);
            }

            Logger.LogLine($"Generated content: \n{GeneratedContent}");
        }
Esempio n. 14
0
        public void Init()
        {
            // Init mocks and lexer
            mockParser       = new MockParser();
            lexer            = new Lexer(mockParser);
            mockExportConfig = new ExportConfig();

            // Init mock data
            keys = new List <object> {
                "sampleKey"
            };
            // ugly annotation imposed by the Google API
            values = new List <IList <object> > {
                new List <object>()
            };
        }
Esempio n. 15
0
        public void GenerateProLib()
        {
            //make output directory
            path_root_ = ExportConfig.Instance().Export2CPath;
            FileUtil.DelDir(path_root_);
            Thread.Sleep(3000);
            FileUtil.MakeDir(ref path_root_);

            //generate macro define
            GenerateMacroDefine();

            GenerateEnumStruct();

            GenerateGlobalStruct();

            GenerateProtocols();
        }
Esempio n. 16
0
        /// <summary>
        /// Saves an export config to the DB. Will update the config
        /// if an entry with that name already exists
        /// </summary>
        /// <param name="config"></param>
        public async Task SaveDownloadConfig(ExportConfig config)
        {
            using var db = new ImageContext();

            var existing = db.DownloadConfigs.SingleOrDefault(x => x.Name.Equals(config.Name));

            if (existing != null)
            {
                config.ExportConfigId = existing.ExportConfigId;
                db.DownloadConfigs.Update(config);
            }
            else
            {
                db.DownloadConfigs.Add(config);
            }

            await Task.FromResult(db.SaveChanges("SaveExportConfig"));
        }
        /// <summary>
        /// データ作成(名前入力無しですぐに作成)
        /// </summary>
        public static T CreateDataImmediately <T>(string dataName) where T : ScriptableObject
        {
            // return CreateDataImmediately_Project<T>(rootFolderName, saveFolderRelativePath, dataName);
            var directory = ExportConfig.GetDataExportDirectory();
            var path      = Path.Combine(directory, dataName + ".asset");

            path = AssetDatabase.GenerateUniqueAssetPath(path);

            var instance = ScriptableObject.CreateInstance <T>();

            Debug.Log("Create: " + path, instance);

            AssetDatabase.CreateAsset(instance, path);

            EditorGUIUtility.PingObject(instance);

            return(instance);
        }
Esempio n. 18
0
        public void DeployProLib()
        {
            string targetpath = ExportConfig.Instance().Target2CPath;

            FileUtil.DelDir(targetpath);
            Thread.Sleep(3000);
            FileUtil.MakeDir(ref targetpath);

            //copy generate files into target dir
            List <string> allfile = FileUtil.ListFilesOfDir(path_root_, "*.*");

            foreach (string f in allfile)
            {
                string src = FileUtil.GetFile(path_root_, f);
                string des = FileUtil.GetFile(targetpath, f);
                File.Copy(src, des, true);
            }
        }
        /// <summary>
        /// 开始导出
        /// </summary>
        /// <param name="view"></param>
        /// <param name="targetPath"></param>
        /// <param name="exportType"></param>
        /// <param name="outputStream"></param>
        /// <param name="features"></param>
        /// <param name="useShareTexture"></param>
        private void StartExport(View3D view, string targetPath, ExportType exportType, Stream outputStream, Dictionary <FeatureType, bool> features, bool useShareTexture)
        {
            using (var log = new RuntimeLog())
            {
                var config = new ExportConfig();
                config.TargetPath      = targetPath;
                config.ExportType      = exportType;
                config.UseShareTexture = useShareTexture;
                config.OutputStream    = outputStream;
                config.Features        = features ?? new Dictionary <FeatureType, bool>();
                config.Trace           = log.Log;
                config.ElementIds      = (features?.FirstOrDefault(x => x.Key == FeatureType.OnlySelected).Value ?? false)
                    ?  _ElementIds
                    : null;

                Exporter.ExportToSvf(view, config);
            }
        }
Esempio n. 20
0
        public static void Run(string host = Constants.DEFAULT_HOST, int port = Constants.DEFAULT_PORT)
        {
            // Instantiate the ExportConfig class and add the required configurations
            ExportConfig  exportConfig = new ExportConfig();
            List <string> results      = new List <string>();

            // Instantiate the ExportManager class
            using (ExportManager exportManager = new ExportManager())
            {
                exportConfig.Set("chartConfig", File.ReadAllText("./resources/dashboard_charts.json"));
                exportConfig.Set("templateFilePath", "./resources/template.html");
                // Call the Export() method with the export config
                results.AddRange(exportManager.Export(exportConfig));
            }

            try
            {
                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient("smtp.gmaill.com");
                SmtpServer.Port        = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential("<USERNAME>", "<PASSWORD>");
                SmtpServer.EnableSsl   = true;

                mail.From = new MailAddress("<SENDER'S EMAIL>");
                mail.To.Add("<RECEIVERS'S EMAIL>");
                mail.Subject = "FusionExport";
                mail.Body    = "Hello,\n\nKindly find the attachment of FusionExport exported files.\n\nThank you!";

                System.Net.Mail.Attachment attachment;

                results.ForEach(i =>
                {
                    attachment = new System.Net.Mail.Attachment(i);
                    mail.Attachments.Add(attachment);
                });

                SmtpServer.Send(mail);
                Console.WriteLine("FusionExport C# Client: Email Sent");
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR: " + ex.Message + " " + ex.InnerException.Message);
            }
        }
 ConfigData(string iFilename = "")
 {
     this.DamageMath.Calculate   = ConfigData.EDamageMath.Average;
     this.DamageMath.ReturnValue = ConfigData.EDamageReturn.Numeric;
     this.Inc.PvE                   = true;
     this.I9.DefaultIOLevel         = 49;
     this.I9.DisplayIOLevels        = true;
     this.I9.CalculateEnahncementFX = true;
     this.I9.CalculateSetBonusFX    = true;
     this.I9.PrintIOLevels          = true;
     this.I9.ExportIOLevels         = false;
     this.I9.ExportCompress         = true;
     this.I9.ExportDataChunk        = true;
     this.I9.ExportStripEnh         = false;
     this.I9.ExportStripSetNames    = false;
     this.I9.ExportExtraSep         = false;
     this.UpdatePath                = "";
     this.DefaultSaveFolder         = OS.GetDefaultSaveFolder();
     this.RtFont.SetDefault();
     this.Tips         = new Tips();
     this.Export       = new ExportConfig();
     this.CompOverride = new Enums.CompOverride[0];
     this.RTF          = new RTF();
     if (!string.IsNullOrEmpty(iFilename))
     {
         try
         {
             this.Load(iFilename);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     this.RelocateSaveFolder(false);
     try
     {
         this.LoadOverrides();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 22
0
        public static ExportConfig Load()
        {
            ExportConfig config;

            try
            {
                using (StreamReader sr = new StreamReader(Path.Combine(Application.dataPath, @"Editor\FFWD\ExportSceneWizard.config")))
                {
                    config = (ExportConfig)xmlSer.Deserialize(sr);
                }
            }
            catch (Exception ex)
            {
                Debug.LogError("Could not read configuration data. " + ex.Message);
                config = new ExportConfig();
                config.Save();
            }
            return(config);
        }
Esempio n. 23
0
        void csPopulateList(int HighlightID = -1)
        {
            this.csList.Items.Clear();
            ExportConfig export = MidsContext.Config.Export;
            int          num    = export.ColorSchemes.Length - 1;

            for (int index = 0; index <= num; index++)
            {
                this.csList.Items.Add(export.ColorSchemes[index].SchemeName);
            }
            if (this.csList.Items.Count > 0 & HighlightID == -1)
            {
                this.csList.SelectedIndex = 0;
            }
            if (HighlightID <this.csList.Items.Count& HighlightID> -1)
            {
                this.csList.SelectedIndex = HighlightID;
            }
        }
        void fcPopulateList(int HighlightID = -1)
        {
            this.fcList.Items.Clear();
            ExportConfig export = MidsContext.Config.Export;
            int          num    = export.FormatCode.Length - 1;

            for (int index = 0; index <= num; ++index)
            {
                this.fcList.Items.Add(export.FormatCode[index].Name);
            }
            if (this.fcList.Items.Count > 0 & HighlightID == -1)
            {
                this.fcList.SelectedIndex = 0;
            }
            if (!(HighlightID <this.fcList.Items.Count& HighlightID> -1))
            {
                return;
            }
            this.fcList.SelectedIndex = HighlightID;
        }
Esempio n. 25
0
    public static void BuildHotFixDllBundle()
    {
        BuildTarget bt   = ExportConfig.GetBuildPlatform();
        string      root = "Assets/StreamingAssets";

        AssetBundleBuild lib = new AssetBundleBuild()
        {
            assetBundleName    = "flymodel.dll" + ResourceLoader.bundleExtension,
            assetBundleVariant = null,
            assetNames         = new string[] { "Assets/HotFix/FlyModel.dll.bytes" }
        };
        AssetBundleBuild pdb = new AssetBundleBuild()
        {
            assetBundleName    = "flymodel.pdb" + ResourceLoader.bundleExtension,
            assetBundleVariant = null,
            assetNames         = new string[] { "Assets/HotFix/FlyModel.pdb.bytes" }
        };

        BuildPipeline.BuildAssetBundles(root, new AssetBundleBuild[] { lib, pdb }, BuildAssetBundleOptions.ForceRebuildAssetBundle, bt);
    }
Esempio n. 26
0
        public static void Export(string configPath)
        {
            if (File.Exists(configPath) == false)
            {
                string msg = string.Format("config in path '{0}' is not found!", configPath);
                throw new ArgumentException(msg);
            }

            ExportConfig config = new ExportConfig();

            try
            {
                string jsonFile = File.ReadAllText(configPath);
                config = JsonConvert.DeserializeObject <ExportConfig>(jsonFile);

                Debug.Log("Config file successfully loaded");
            }
            catch (Exception e)
            {
                Debug.LogWarningFormat("Config file at {0} found, but could not be read. Using default configuration. Exception occuring: '{1}'", configPath, e.GetType().Name);
            }

            if (string.IsNullOrEmpty(config.VersionFilename) == false)
            {
                UpdateVersionFile(config.AssetDirectory + "/" + config.VersionFilename, config.Version);
            }

            // Create the output directory if it doesn't exist yet.
            string outputDirectory = Path.GetDirectoryName(config.OutputPath.Replace('/', '\\'));

            if (string.IsNullOrEmpty(outputDirectory) == false && Directory.Exists(outputDirectory) == false)
            {
                Directory.CreateDirectory(outputDirectory);
            }

            string[] exportedPaths = GetAssetPathsToExport(config);
            Debug.LogFormat("Exporting {0} paths to {1}", exportedPaths.Length, outputDirectory);
            AssetDatabase.ExportPackage(exportedPaths, config.OutputPath.Replace('/', '\\'), ExportPackageOptions.Default);
            Debug.Log("Export completed");
        }
Esempio n. 27
0
        /// <summary>
        /// Uses logic from ConvertFrom-FIMResource cmdlet to fetch export objects
        /// and xml-serializes them to a given stream
        /// </summary>
        public void WriteXml(Stream stream, string xpath)
        {
            _log.Debug("Fetching export objects for query {0}", xpath);

            string url = ConfigurationManager.AppSettings["fimAddress"] + ":5725";

            var exportConfig = new ExportConfig
            {
                CustomConfig = new[] { xpath },
                Uri = url,
            };

            var results = exportConfig.Invoke<ExportObject>()
                .ToList();

            _log.Debug("Fetched {0} export objects for query {1}", results.Count, xpath);

            // code copied from ConvertFrom-FIMResource cmdlet
            var root = new XmlRootAttribute("Results");
            var serializer = new XmlSerializer(typeof(ExportObject[]), root);
            serializer.Serialize(stream, results.ToArray());
        }
Esempio n. 28
0
        private static List <Task> StartEnumerationTasks(
            ExportConfig config, ExportStatus status)
        {
            return(Enumerable
                   .Range(0, config.EnumerationTasks)
                   .Select(_ => Task.Factory.StartNew(() =>
            {
                while (status.DirQueue.TryDequeue(out var dir))
                {
                    if (!config.Shallow)
                    {
                        FillQueue(
                            status.DirQueue,
                            dir.Directories.Values);
                    }

                    status.ReportFilesDiscovered(dir.Files.Values);
                    FillQueue(status.FileQueue, dir.Files.Values);
                }
                status.IsEnumerationDone = true;
            })).ToList());
        }
Esempio n. 29
0
        public static void Run(string host = Constants.DEFAULT_HOST, int port = Constants.DEFAULT_PORT)
        {
            // Instantiate the ExportConfig class and add the required configurations
            ExportConfig  exportConfig = new ExportConfig();
            List <string> results      = new List <string>();

            // Instantiate the ExportManager class
            using (ExportManager exportManager = new ExportManager())
            {
                exportConfig.Set("chartConfig", "./resources/bulk.json");

                // Call the Export() method with the export config
                results.AddRange(exportManager.Export(exportConfig));
            }

            foreach (string path in results)
            {
                Console.WriteLine(path);
            }

            Console.Read();
        }
Esempio n. 30
0
        public ExportCommands(string progressTitle)
        {
            config = ExportConfig.Load();
            if (EditorPrefs.HasKey("FFWD XNA dir " + PlayerSettings.productName))
            {
                xnaBaseDir = EditorPrefs.GetString("FFWD XNA dir " + PlayerSettings.productName);
                if (String.IsNullOrEmpty(xnaBaseDir))
                {
                    xnaBaseDir = "..\\XNA";
                }
            }
            if (EditorPrefs.HasKey("FFWD active group"))
            {
                activeGroup = EditorPrefs.GetInt("FFWD active group");
            }

            string configPath = Path.Combine(Application.dataPath, config.configSource);

            if (File.Exists(configPath))
            {
                resolver = TypeResolver.ReadConfiguration(configPath);
            }
            if (resolver == null)
            {
                Debug.LogWarning("We have no TypeResolver so we will not export any components");
            }

            assets            = new AssetHelper();
            assets.TextureDir = Path.Combine(xnaBaseDir, config.xnaAssets.TextureDir);
            assets.ScriptDir  = Path.Combine(xnaBaseDir, config.xnaAssets.ScriptDir);
            assets.MeshDir    = Path.Combine(xnaBaseDir, config.xnaAssets.MeshDir);
            assets.AudioDir   = Path.Combine(xnaBaseDir, config.xnaAssets.AudioDir);
            assets.XmlDir     = Path.Combine(xnaBaseDir, config.exportDir);

            progress = new ExportProgress()
            {
                Title = progressTitle
            };
        }
Esempio n. 31
0
        /// <summary>
        /// Uses logic from ConvertFrom-FIMResource cmdlet to fetch export objects
        /// and xml-serializes them to a given stream
        /// </summary>
        public void WriteXml(Stream stream, string xpath)
        {
            _log.Debug("Fetching export objects for query {0}", xpath);

            string url = ConfigurationManager.AppSettings["fimAddress"] + ":5725";

            var exportConfig = new ExportConfig
            {
                CustomConfig = new[] { xpath },
                Uri          = url,
            };

            var results = exportConfig.Invoke <ExportObject>()
                          .ToList();

            _log.Debug("Fetched {0} export objects for query {1}", results.Count, xpath);

            // code copied from ConvertFrom-FIMResource cmdlet
            var root       = new XmlRootAttribute("Results");
            var serializer = new XmlSerializer(typeof(ExportObject[]), root);

            serializer.Serialize(stream, results.ToArray());
        }
Esempio n. 32
0
        /// <summary>
        /// Load and parse the "XML" file that configures
        /// this export
        /// </summary>
        /// <param name="xmlPath">Path of the XML configuration file</param>
        /// <returns>True if the Loading worked; False otherwise</returns>
        public static bool LoadExportLayout(string xmlPath)
        {
            // XML Deserializer
            XmlSerializer deserializer = new XmlSerializer(typeof(ExportConfig));
            StreamReader  xmlReader    = new StreamReader(xmlPath);

            // Reading Content
            try
            {
                _configuration = (ExportConfig)deserializer.Deserialize(xmlReader);
                return(true);
            }
            catch (Exception ex)
            {
                // Control Variables
                error        = true;
                errorMessage = ex.Message;

                // Null Value - Error
                _configuration = null;
                return(false);
            }
        }
Esempio n. 33
0
        public ExportCommands(string progressTitle)
        {
            config = ExportConfig.Load();
            if (EditorPrefs.HasKey("FFWD XNA dir " + PlayerSettings.productName))
            {
                xnaBaseDir = EditorPrefs.GetString("FFWD XNA dir " + PlayerSettings.productName);
                if (String.IsNullOrEmpty(xnaBaseDir))
                {
                    xnaBaseDir = "..\\XNA";
                }
            }
            if (EditorPrefs.HasKey("FFWD active group"))
            {
                activeGroup = EditorPrefs.GetInt("FFWD active group");
            }

            string configPath = Path.Combine(Application.dataPath, config.configSource);
            if (File.Exists(configPath))
            {
                resolver = TypeResolver.ReadConfiguration(configPath);
            }
            if (resolver == null)
            {
                Debug.LogWarning("We have no TypeResolver so we will not export any components");
            }

            assets = new AssetHelper();
            assets.TextureDir = Path.Combine(xnaBaseDir, config.xnaAssets.TextureDir);
            assets.ScriptDir = Path.Combine(xnaBaseDir, config.xnaAssets.ScriptDir);
            assets.MeshDir = Path.Combine(xnaBaseDir, config.xnaAssets.MeshDir);
            assets.AudioDir = Path.Combine(xnaBaseDir, config.xnaAssets.AudioDir);
            assets.XmlDir = Path.Combine(xnaBaseDir, config.exportDir);

            progress = new ExportProgress() { Title = progressTitle };
        }
Esempio n. 34
0
 public static ExportConfig Load()
 {
     ExportConfig config;
     try
     {
         using (StreamReader sr = new StreamReader(Path.Combine(Application.dataPath, @"Editor\FFWD\ExportSceneWizard.config")))
         {
             config = (ExportConfig)xmlSer.Deserialize(sr);
         }
     }
     catch (Exception ex)
     {
         Debug.LogError("Could not read configuration data. " + ex.Message);
         config = new ExportConfig();
         config.Save();
     }
     return config;
 }