コード例 #1
0
ファイル: ImportModelCommand.cs プロジェクト: cg123/xenko
 protected ImportModelCommand()
 {
     // Set default values
     Mode = ExportMode.Model;
     AnimationRepeatMode = AnimationRepeatMode.LoopInfinite;
     ScaleImport = 1.0f;
 }
コード例 #2
0
ファイル: ViewExportService.cs プロジェクト: JaysonJG/Catel
        /// <summary>
        /// Exports the <paramref name="viewModel" />'s view to the print or clipboard or file.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        /// <param name="exportMode">The export mode.</param>
        /// <param name="dpiX">The dpi X.</param>
        /// <param name="dpiY">The dpi Y.</param>
        /// <exception cref="System.InvalidOperationException"></exception>
        /// <exception cref="System.ArgumentNullException">The <paramref name="viewModel" /> is <c>null</c>.</exception>
        /// <remarks>If <paramref name="exportMode" /> is <see cref="ExportMode.Print" /> then the <paramref name="dpiX" /> and <paramref name="dpiY" /> argument will be ignored.</remarks>
        public virtual void Export(IViewModel viewModel, ExportMode exportMode = ExportMode.Print, double dpiX = 96, double dpiY = 96)
        {
            Argument.IsNotNull(() => viewModel);

            var view = _viewManager.GetViewsOfViewModel(viewModel).OfType<UIElement>().FirstOrDefault();
            if (view == null)
            {
                string message = string.Format(CultureInfo.InvariantCulture, "There no an active view for this view model of type '{0}'", viewModel.GetType().FullName);

                Log.Error(message);

                throw new InvalidOperationException(message);
            }

            if (exportMode == ExportMode.Print)
            {
                Print(view);
            }
            else
            {
                var bitmap = CreateImageFromUIElement(view, dpiX, dpiY);
#if !SILVERLIGHT 
                if (exportMode == ExportMode.File)
                {
                    SaveToFile(bitmap);
                }
                else
                {
                    Clipboard.SetImage(bitmap);
                }
#else
                SaveToFile(bitmap);
#endif
            }
        }
コード例 #3
0
ファイル: ViewExportService.cs プロジェクト: Catel/Catel
        /// <summary>
        /// Exports the <paramref name="viewModel" />'s view to the print or clipboard or file.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        /// <param name="exportMode">The export mode.</param>
        /// <param name="dpiX">The dpi X.</param>
        /// <param name="dpiY">The dpi Y.</param>
        /// <exception cref="System.InvalidOperationException"></exception>
        /// <exception cref="System.ArgumentNullException">The <paramref name="viewModel" /> is <c>null</c>.</exception>
        /// <remarks>If <paramref name="exportMode" /> is <see cref="ExportMode.Print" /> then the <paramref name="dpiX" /> and <paramref name="dpiY" /> argument will be ignored.</remarks>
        public virtual void Export(IViewModel viewModel, ExportMode exportMode = ExportMode.Print, double dpiX = 96, double dpiY = 96)
        {
            Argument.IsNotNull("viewModel", viewModel);

            var view = _viewManager.GetViewsOfViewModel(viewModel).OfType<UIElement>().FirstOrDefault();
            if (view == null)
            {
                throw Log.ErrorAndCreateException < InvalidOperationException >("There no an active view for this view model of type '{0}'", viewModel.GetType().FullName);
            }

            var bitmap = CreateImageFromUIElement(view, dpiX, dpiY);

            if (exportMode == ExportMode.Print)
            {
                Print(bitmap);
            }
            else
            {
#if !SILVERLIGHT 
                if (exportMode == ExportMode.File)
                {
                    SaveToFile(bitmap);
                }
                else
                {
                    Clipboard.SetImage(bitmap);
                }
#else
                SaveToFile(bitmap);
#endif
            }
        }
コード例 #4
0
ファイル: Boot.cs プロジェクト: And-G/Magellan
        public static void ImportProvince( string source, string target, ExportMode mode )
        {
            Console.WriteLine( "Opening source file \"{0}\"...", Path.GetFileName( source ) );
            ProvinceList provinces = new ProvinceList();
            FileStream stream = null;
            try {
                stream = new FileStream( source, FileMode.Open, FileAccess.Read, FileShare.Read );
                if ( mode == ExportMode.XML ) {
                    System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                    doc.Load( stream );
                    provinces.ReadFrom( doc );
                }
                else {
                    provinces.ReadFrom( new EU2.IO.CSVReader( stream ) );
                }
            }
            finally {
                if ( stream != null ) stream.Close();
            }

            Console.WriteLine( "Opening target file \"{0}\"...", Path.GetFileName( target ) );
            EU2.Edit.File file = new EU2.Edit.File();
            try {
                file.ReadFrom( target );
            }
            catch ( EU2.Edit.InvalidFileFormatException ) {
                Console.WriteLine( "The specified target file is not an EU2Map file, or is corrupt." );
                return;
            }

            file.Provinces = provinces;

            file.WriteTo( target );
            Console.WriteLine( "Import successful." );
        }
コード例 #5
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            btnStart.Visible = false;
            pBar.Visible = true;

            string path = ((ModelDoc2)iSwApp.ActiveDoc).GetPathName();

            Repository.Instance.OrderNumber = Path.GetFileName(Path.GetDirectoryName(path));

            lstbReport.Items.Add("Проверка заполнения заказа...");
            bool isEmpty = true;
            try
            {
                isEmpty = Repository.Instance.IsOrderEmpty(iSwApp);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Не удалось выполнить процедуру проверки заполнения заказа. Ошибка: " + ex.Message);
                return;
            }
            lstbReport.Items.Add("Готово.");

            if (isEmpty)
            {
                //пустой
                mode = ExportMode.Add;
            }
            else
            {
                //заполнен
                frmPurchaseExportMessageBox fpmb = new frmPurchaseExportMessageBox();
                switch (fpmb.ShowDialog())
                {
                    case DialogResult.Yes:
                        lstbReport.Items.Add("Добавление содержимого...");
                        mode = ExportMode.Add;
                        break;
                    case DialogResult.No:
                        lstbReport.Items.Add("Замена содержимого...");
                        mode = ExportMode.Replace;
                        break;
                    case DialogResult.Cancel:
                        lstbReport.Items.Add("Отмена...");
                        this.Close();
                        break;
                }
            }

            worker = new Thread(export);
            worker.Start();
        }
コード例 #6
0
ファイル: Boot.cs プロジェクト: And-G/Magellan
        public static void ExportAdjacencies(string source, string target, ExportMode mode)
        {
            Console.WriteLine( "Opening source file \"{0}\"...", Path.GetFileName( source ) );

            EU2.Edit.File file = new EU2.Edit.File();
            try {
                file.ReadFrom( source );
            }
            catch ( EU2.Edit.InvalidFileFormatException ) {
                Console.WriteLine( "The specified source file is not an EU2Map file, or is corrupt." );
                return;
            }

            EU2.Map.AdjacencyTable adj = null;
            if ( file.AdjacencyTable == null ) {
                if (file.IDMap == null) {
                    Console.WriteLine( "Error: The file does not contain adjacency info, and no IDMap info. Can't calculate adjacencies." );
                    return;
                }
                if (file.Provinces == null) {
                    Console.WriteLine( "Error: The file does not contain adjacency info, and no Province info. Can't calculate adjacencies." );
                    return;
                }
                Console.WriteLine( "The file does not contain boundbox info. Will calculate them now from the IDMap." );
                Console.Write( "Calculating... " );
                adj = file.IDMap.BuildAdjacencyTable(file.Provinces);
                Console.WriteLine( "done!" );
            }
            else {
                adj = file.AdjacencyTable;
            }

            // -- Write the file
            Console.WriteLine( "Exporting to \"{0}\"...", Path.GetFileName( target ) );
            FileStream stream = null;
            try {
                stream = new FileStream( target, FileMode.Create, FileAccess.Write, FileShare.None );
                if ( mode == ExportMode.XML ) {
                    WriteAdjacencies(adj, file.Provinces, new System.Xml.XmlTextWriter(stream, System.Text.Encoding.UTF8));
                }
                else {
                    WriteAdjacencies(adj, file.Provinces, new EU2.IO.CSVWriter(stream));
                }
            }
            finally {
                if ( stream != null ) stream.Close();
            }

            Console.WriteLine( "Export successful." );
        }
コード例 #7
0
ファイル: ReportExportPdf.cs プロジェクト: san90279/UK_OAS
        public PdfReportExporter(IReport rpt, ExportMode eMode, bool dMode)
        {
            report = rpt;
            exportMode = eMode;
            designMode = dMode;
            log = new EasilyReportLog("Pdf Report", this.GetType().FullName, LogFileInfo.logFileName, rpt);

            if (rpt.Format.PageHeight != 0.0)
            {
                exportByHeight = true;
            }
            else
            {
                exportByHeight = false;
            }
        }
コード例 #8
0
ファイル: Boot.cs プロジェクト: And-G/Magellan
        public static void ExportProvince( string source, string target, ExportMode mode, bool allowTOT )
        {
            Console.WriteLine( "Opening source file \"{0}\"...", Path.GetFileName( source ) );

            EU2.Edit.File file = new EU2.Edit.File();
            try {
                file.ReadFrom( source );
            }
            catch ( EU2.Edit.InvalidFileFormatException ) {
                Console.WriteLine( "The specified source file is not an EU2Map file, or is corrupt." );
                return;
            }

            if ( file.Provinces == null ) {
                Console.WriteLine( "Error: The file does not contain province info." );
                return;
            }

            // -- Write the file
            Console.WriteLine( "Exporting to \"{0}\"...", Path.GetFileName( target ) );
            FileStream stream = null;
            try {
                stream = new FileStream( target, FileMode.Create, FileAccess.Write, FileShare.None );
                using ( GlobalConfigChange gcc = new GlobalConfigChange() ) {
                    gcc.AllowTOTAndHREInProvinceList = allowTOT;
                    if ( mode == ExportMode.XML ) {
                        file.Provinces.WriteTo( new System.Xml.XmlTextWriter( stream, System.Text.Encoding.UTF8 ) );
                    }
                    else {
                        file.Provinces.WriteTo( stream );
                    }
                }
            }
            finally {
                if ( stream != null ) stream.Close();
            }

            Console.WriteLine( "Export successful." );
        }
コード例 #9
0
ファイル: CharonCli.cs プロジェクト: shi377034/charon-unity3d
        public static Promise <RunResult> ExportAsync(string gameDataPath, string[] entities, string[] attributes, CultureInfo[] languages, CommandOutput output, ExportMode mode)
        {
            if (gameDataPath == null)
            {
                throw new ArgumentNullException("gameDataPath");
            }
            if (entities == null)
            {
                throw new ArgumentNullException("entities");
            }
            if (attributes == null)
            {
                throw new ArgumentNullException("attributes");
            }
            if (languages == null)
            {
                throw new ArgumentNullException("languages");
            }
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }

            if (Enum.IsDefined(typeof(ExportMode), mode) == false)
            {
                throw new ArgumentException("Unknown export mode.", "mode");
            }
            if (File.Exists(gameDataPath) == false)
            {
                throw new IOException(String.Format("GameData file '{0}' doesn't exists.", gameDataPath));
            }

            var runTask = RunInternal
                          (
                RunOptions.FlattenArguments(
                    "DATA", "EXPORT", gameDataPath,
                    "--entities", entities,
                    "--attributes", attributes,
                    "--languages", Array.ConvertAll(languages, l => l.Name),
                    "--mode", mode,
                    "--output", output.Target,
                    "--outputFormat", output.Format,
                    "--outputFormattingOptions", output.FormattingOptions
                    )
                          );

            return(runTask);
        }
コード例 #10
0
ファイル: ExportUsfm.cs プロジェクト: bbriggs/FieldWorks
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Write out the given run using an appropriate marker for the given footnote character
		/// style. If doing Toolbox markup, we write out each run on its own line.
		/// </summary>
		/// <param name="containingParaStyleContext">Name of the Paragraph style of the
		/// containing footnote</param>
		/// <param name="fLookupBasedOnParaStyleContext">If <c>true</c>, then the marker
		/// is context-dependent (i.e., based on which type of footnote is being output) and will
		/// be looked up based on the para style supplied.</param>
		/// <param name="styleName">Name of the character style</param>
		/// <param name="runText">The run text.</param>
		/// <param name="exportMode">The export mode.</param>
		/// <param name="iWs">index into the available analysis writing systems (should be -1 if
		/// exportMode is ExportMode.VernacularOnly</param>
		/// <param name="fInFootnoteContentField">Flag indicating whether we're already in the
		/// context of a footnote content field (e.g., \ft, \fk, \fq, \xt, etc.). This is
		/// always false for Toolbox export, which doesn't nest field, but rather outputs every
		/// field on its own line</param>
		/// <param name="fNormalCharStyle">if set to <c>true</c> if normal character style output
		/// in this method.</param>
		/// ------------------------------------------------------------------------------------
		private void OutputFootnoteCharStyleRun(string containingParaStyleContext,
			bool fLookupBasedOnParaStyleContext, string styleName, string runText,
			ExportMode exportMode, int iWs, ref bool fInFootnoteContentField,
			ref bool fNormalCharStyle)
		{
			if (fLookupBasedOnParaStyleContext)
				styleName = containingParaStyleContext + "\uffff" + styleName;
			string marker = GetMarkerForStyle(styleName);

			if (m_footnoteContentMarkers.Contains(marker))
			{
				if (exportMode == ExportMode.InterleavedVernAndBt && iWs != -1)
					marker = kBackTransMarkerPrefix + marker.Substring(1) + GetIcuSuffix(iWs);

				string sfField = marker + " " + runText;
				if (MarkupSystem == MarkupType.Toolbox)
					m_file.WriteLine(sfField);
				else
				{
					m_file.Write(sfField);
					fInFootnoteContentField = true;
				}
				fNormalCharStyle = false;
			}
			else // Normal character style used in a footnote.
			{
				if (!fInFootnoteContentField && MarkupSystem == MarkupType.Paratext)
				{
					OutputFootnoteCharStyleRun(containingParaStyleContext, true,
						ksDefaultFootnoteCharacters, string.Empty, exportMode, iWs,
						ref fInFootnoteContentField, ref fNormalCharStyle);
				}
				OutputCharField(runText, marker);
				fNormalCharStyle = true;
			}
		}
コード例 #11
0
ファイル: PdfController.cs プロジェクト: san90279/UK_OAS
        public PdfController(IReport rpt, ExportMode exportMode, bool mExportByHeight, bool designTime, int pageWidth)
        {
            string filePath = String.Empty;
            this.report = rpt;
            mDesignTime = designTime;
            mPageWidth = pageWidth;

            ExportByHeight = mExportByHeight;

            log = new EasilyReportLog("Pdf Report", this.GetType().FullName, LogFileInfo.logFileName, rpt);

            string path = String.Empty;

            //System.Drawing.Font font = new System.Drawing.Font("Arial", 9.0f);
            //int left = Convert.ToInt32(Math.Ceiling(UnitConversion.GetPdfLetterWidth(this.report.Format.MarginLeft, font)));
            //int right = Convert.ToInt32(Math.Ceiling(UnitConversion.GetPdfLetterWidth(this.report.Format.MarginRight, font)));
            //int top = Convert.ToInt32(Math.Ceiling(UnitConversion.GetPdfLetterWidth(this.report.Format.MarginTop, font)));
            //int bottom = Convert.ToInt32(Math.Ceiling(UnitConversion.GetPdfLetterWidth(this.report.Format.MarginBottom, font)));
            double left = UnitConversion.InchToPound(this.report.Format.MarginLeft);
            double right = UnitConversion.InchToPound(this.report.Format.MarginRight);
            double top = UnitConversion.InchToPound(this.report.Format.MarginTop);
            double bottom = UnitConversion.InchToPound(this.report.Format.MarginBottom);
            pdfDoc = new Document(this.GetPageSize(rpt.Format.PageSize, rpt.Format.Orientation),
                (float)left, (float)right, (float)top, (float)bottom);

            if (exportMode == ExportMode.Export)
            {
                filePath = this.report.FilePath;
            }
            else
            {
                filePath = ExportFileInfo.PdfPreviewFilePath;
            }

            writer = PdfWriter.GetInstance(pdfDoc, new FileStream(filePath, FileMode.Create));

            pdfDoc.Open();

            //path = Application.StartupPath + "\\" + CliUtils.fCurrentProject + "\\";
            //BaseFont.AddToResourceSearch(path + "iTextAsian.dll");
            //BaseFont.AddToResourceSearch(path + "iTextAsianCmaps.dll");

            //baseFont = BaseFont.CreateFont("STSong-Light", "UniGB-UCS2-H", BaseFont.EMBEDDED);

            fontPath = Environment.GetFolderPath(Environment.SpecialFolder.System).Substring(0, Environment.GetFolderPath(Environment.SpecialFolder.System).LastIndexOf("\\")) + @"\Fonts";

            FontFactory.RegisterDirectory(fontPath);
        }
コード例 #12
0
 public static Promise <RunResult> ExportAsync(string gameDataPath, string[] entities, CommandOutput output, ExportMode mode)
 {
     return(ExportAsync(gameDataPath, entities, new string[0], output, mode));
 }
コード例 #13
0
 public void SetExportMode(int i)
 {
     exportMode = (ExportMode)i;
 }
コード例 #14
0
        void ExportFrameToExr(ExportMode mode)
        {
            string path = EditorUtility.SaveFilePanel("Export EXR...", "", "Frame", "exr");

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            EditorUtility.DisplayProgressBar("Export EXR", "Rendering...", 0f);

            var camera = m_Target.GetComponent <Camera>();
            var w      = camera.pixelWidth;
            var h      = camera.pixelHeight;

            var texOut = new Texture2D(w, h, TextureFormat.RGBAFloat, false, true);
            var target = RenderTexture.GetTemporary(w, h, 24, RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Linear);

            var lastActive                 = RenderTexture.active;
            var lastTargetSet              = camera.targetTexture;
            var lastPostFXState            = m_Target.enabled;
            var lastBreakColorGradingState = m_Target.breakBeforeColorGrading;

            if (mode == ExportMode.DisablePost)
            {
                m_Target.enabled = false;
            }
            else if (mode == ExportMode.BreakBeforeColorGradingLinear || mode == ExportMode.BreakBeforeColorGradingLog)
            {
                m_Target.breakBeforeColorGrading = true;
            }

            camera.targetTexture = target;
            camera.Render();
            camera.targetTexture = lastTargetSet;

            EditorUtility.DisplayProgressBar("Export EXR", "Reading...", 0.25f);

            m_Target.enabled = lastPostFXState;
            m_Target.breakBeforeColorGrading = lastBreakColorGradingState;

            if (mode == ExportMode.BreakBeforeColorGradingLog)
            {
                // Convert to log
                var material  = new Material(Shader.Find("Hidden/PostProcessing/Editor/ConvertToLog"));
                var newTarget = RenderTexture.GetTemporary(w, h, 0, RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Linear);
                Graphics.Blit(target, newTarget, material, 0);
                RenderTexture.ReleaseTemporary(target);
                DestroyImmediate(material);
                target = newTarget;
            }

            RenderTexture.active = target;
            texOut.ReadPixels(new Rect(0, 0, w, h), 0, 0);
            texOut.Apply();
            RenderTexture.active = lastActive;

            EditorUtility.DisplayProgressBar("Export EXR", "Encoding...", 0.5f);

            var bytes = texOut.EncodeToEXR(EXRFlags.OutputAsFloat | EXRFlags.CompressZIP);

            EditorUtility.DisplayProgressBar("Export EXR", "Saving...", 0.75f);

            File.WriteAllBytes(path, bytes);

            EditorUtility.ClearProgressBar();
            AssetDatabase.Refresh();

            RenderTexture.ReleaseTemporary(target);
            DestroyImmediate(texOut);
        }
コード例 #15
0
 public ModDefinitionIdentifier(string modName, ExportMode exportMode, AccurateVersion version)
 => (ModName, ExportMode, Version) = (modName, exportMode, version);
コード例 #16
0
ファイル: Export.cs プロジェクト: Mokrynskiy/Vodovoz
        private void SendFileXMLDoc(RestClient client, string path, string filename, Root root, ExportMode mode)
        {
            //Внимание здесь "/" после 1c_exchange.php не случаен в документации его нет, но если его не написать то на запрос без слеша,
            // приходит ответ 301 то есть переадресация на такую же строку но со слешем, но RestSharp после переадресации уже отправляет
            // не POST запрос а GET, из за чего, файл не принимается нормально сервером.
            var beginOfUrl = path + (mode == ExportMode.Umi ? "/" : "") + "?type=catalog&mode=file&filename=";
            var request    = new RestRequest(beginOfUrl + filename, Method.POST);

            using (MemoryStream stream = new MemoryStream())
            {
                root.WriteToStream(stream);
                stream.Position = 0;
                var file = stream.ToArray();

                request.AddParameter("application/xml", file, ParameterType.RequestBody);
            }

            var response = client.Execute(request);

            DebugResponse(response);
        }
コード例 #17
0
ファイル: Export.cs プロジェクト: Mokrynskiy/Vodovoz
        public void RunToSite()
        {
            Errors.Clear();
            TotalTasks = 12;
            ExportMode mode = ParametersProvider.Instance.ContainsParameter(OnlineStoreExportMode)
                                ? (ExportMode)Enum.Parse(typeof(ExportMode), ParametersProvider.Instance.GetParameterValue(OnlineStoreExportMode))
                                : ExportMode.Umi;

            OnProgressPlusOneTask("Соединяемся с сайтом");
            //Проверяем связь с сервером
            var configuredUrl = ParametersProvider.Instance.GetParameterValue(OnlineStoreUrlParameterName);
            var parsedUrl     = new Uri(configuredUrl);
            var path          = parsedUrl.LocalPath;
            var client        = new RestClient(configuredUrl.Replace(path, ""));

            client.CookieContainer = new System.Net.CookieContainer();
            client.Authenticator   = new HttpBasicAuthenticator(ParametersProvider.Instance.GetParameterValue(OnlineStoreLoginParameterName),
                                                                ParametersProvider.Instance.GetParameterValue(OnlineStorePasswordParameterName));
            var           request  = new RestRequest(path + "?type=catalog&mode=checkauth", Method.GET);
            IRestResponse response = client.Execute(request);

            DebugResponse(response);
            if (!response.Content.StartsWith("success"))
            {
                Errors.Add($"Не возможно связаться с сайтом. Ответ Сайта:{response.Content}");
                return;
            }

            CreateObjects();

            OnProgressPlusOneTask("Инициализация процесса обмена");
            //Инициализируем передачу. Ответ о сжатии и размере нас не интересует. Мы не умеем других вариантов.
            request  = new RestRequest(path + "?type=catalog&mode=init", Method.GET);
            response = client.Execute(request);
            DebugResponse(response);

            OnProgressPlusOneTask("Выгружаем каталог");
            SendFileXMLDoc(client, path, "import.xml", rootCatalog, mode);

            OnProgressPlusOneTask("Выгружаем изображения");
            var exportedImages = Catalog.Goods.Nomenclatures.SelectMany(x => x.Images);
            //Внимание здесь "/" после 1c_exchange.php в выгрузке для umi не случаен, в документации его нет, но если его не написать то на запрос без слеша,
            // приходит ответ 301 то есть переадресация на такую же строку но со слешем, но RestSharp после переадресации уже отправляет
            // не POST запрос а GET, из за чего, файл не принимается нормально сервером.
            var beginOfUrl = path + (mode == ExportMode.Umi ? "/" : "") + "?type=catalog&mode=file&filename=";

            foreach (var img in exportedImages)
            {
                var imgFileName    = $"img_{img.Id:0000000}.jpg";
                var dirImgFileName = $"import_files/" + imgFileName;
                OnProgressTextOnly("Отправляем " + imgFileName);
                request = new RestRequest(beginOfUrl + dirImgFileName, Method.POST);
                request.AddParameter("image/jpeg", img.Image, ParameterType.RequestBody);
                response = client.Execute(request);
                DebugResponse(response);
            }
            Results.Add("Выгружено изображений: " + exportedImages.Count());

            OnProgressPlusOneTask("Выгружаем склад");
            SendFileXMLDoc(client, path, "offers.xml", rootOffers, mode);

            Results.Add("Выгрузка каталога товаров:");
            OnProgressPlusOneTask("Импорт каталога товаров на сайте.");
            SendImportCommand(client, path, "import.xml");
            Results.Add("Выгрузка склада и цен:");
            OnProgressPlusOneTask("Импорт склада и цен на сайте.");
            SendImportCommand(client, path, "offers.xml");
        }
コード例 #18
0
 public abstract ExportTable GetExportedTable(ExportMode mode);
コード例 #19
0
ファイル: NotesAccessor.cs プロジェクト: Maxiaozhe/CodeBank
        /// <summary>
        /// DXLへ出力
        /// </summary>
        /// <param name="db"></param>
        /// <returns></returns>
        public string ExportDxl(IDatabase db, ExportMode mode)
        {
            EnsureSession();
            bool isColned = false;

            Domino.NotesDXLExporter exporter = this._session.CreateDXLExporter();
            exporter.ForceNoteFormat          = false;
            exporter.OutputDOCTYPE            = false;
            exporter.ConvertNotesbitmapsToGIF = true;
            Domino.NotesDatabase ndb = db.InnerObject as Domino.NotesDatabase;
            if (!string.IsNullOrEmpty(ndb.Server))
            {
                //Server中のファイルをコピーする
                ndb      = this.CloneDatabase(ndb);
                isColned = true;
            }
            try
            {
                Domino.NotesNoteCollection coll = ndb.CreateNoteCollection(false);
                switch (mode)
                {
                case ExportMode.Forms:
                    coll.SelectSharedFields = true;
                    coll.SelectForms        = true;
                    coll.SelectSubforms     = true;
                    break;

                case ExportMode.Icon:
                    coll.SelectIcon = true;
                    break;

                case ExportMode.Views:
                    coll.SelectViews = true;
                    break;

                case ExportMode.Resources:
                    coll.SelectImageResources = true;
                    break;

                case ExportMode.All:
                    coll.SelectAllDesignElements(true);
                    break;

                default:
                    break;
                }
                coll.BuildCollection();
                string xml = exporter.Export(coll);
                return(xml);
            }
            finally
            {
                if (isColned && ndb != null)
                {
                    try
                    {
                        string tempfile = ndb.FilePath;
                        if (System.IO.File.Exists(tempfile))
                        {
                            System.IO.File.Delete(tempfile);
                        }
                    }
                    catch
                    {
                        //一時ファイル削除できない
                    }
                }
            }
        }
コード例 #20
0
 public LocationExtractor(string mainGameFolder, string outputFolderPath, ExportMode exportMode, ExportType exportType) : base(mainGameFolder, outputFolderPath, exportMode, exportType)
 {
 }
コード例 #21
0
ファイル: ViewExportService.cs プロジェクト: qinfengzhu/Catel
 public virtual async void Export(IViewModel viewModel, ExportMode exportMode = ExportMode.Print, double dpiX = 96, double dpiY = 96)
 {
     await ExportAsync(viewModel, exportMode, dpiX, dpiY);
 }
コード例 #22
0
 public override int GetHashCode()
 => ModName.GetHashCode() ^ ExportMode.GetHashCode() ^ Version.GetHashCode();
コード例 #23
0
ファイル: ExportEntryExt.cs プロジェクト: CHMP-HLab/HLab
 public static IConfigurator SetMode(this IConfigurator c, ExportMode mode)
 {
     c.Entries.Last().AddMode(mode);
     return(c);
 }
コード例 #24
0
        public void Enum_HasPlaylistContents_FindsPlaylistContentsFlag()
        {
            ExportMode sut = ExportMode.PlaylistContents;

            Assert.True((sut & ExportMode.PlaylistContents) == ExportMode.PlaylistContents);
        }
コード例 #25
0
 private void MapProvinceParsedArguments_ProcessOption(ParsedArguments sender, ProcessArgumentEventArgs e)
 {
     switch ( e.Value.ToLower() ) {
         case "i": case "import":
             action = Action.ImportProvince;
             break;
         case "e": case "export":
             action = Action.ExportProvince;
             break;
         case "x": case "xml":
             mode = ExportMode.XML;
             break;
         case "c": case "csv":
             mode = ExportMode.Plain;
             break;
         case "o":
             overwrite = true;
             break;
         case "notot":
             noTOT = true;
             break;
     }
 }
コード例 #26
0
        public void Enum_HasNone_DoesntFindPlaylistFileFlag()
        {
            ExportMode sut = ExportMode.None;

            Assert.False((sut & ExportMode.PlaylistFile) == ExportMode.PlaylistFile);
        }
コード例 #27
0
            /// <summary>
            /// Renders the Window
            /// </summary>
            protected override void Render(Int32 id)
            {
                // Call base
                base.Render(id);

                // Scroll
                BeginScrollView(250, Utils.GetScrollSize <MeshFilter>() + Utils.GetScrollSize <MeshRenderer>() + Utils.GetScrollSize <ScaledSpaceFader>() + distance * 9, 20);

                // Index
                index = 0;

                // Render Objects
                RenderObject(Current.GetComponent <ScaledSpaceFader>());
                RenderObject(Current.GetComponent <MeshRenderer>());
                RenderObject(Current.GetComponent <MeshFilter>());

                // Map Data
                CelestialBody body = Utils.FindCB(Current.name);

                if (body.pqsController != null)
                {
                    Label("mapFilesize");
                    index--;
                    TextField(body.pqsController.mapFilesize, v => body.pqsController.mapFilesize = v, new Rect(200, index * distance + 10, 170, 20));
                    Label("mapMaxHeight");
                    index--;
                    TextField(body.pqsController.mapMaxHeight, v => body.pqsController.mapMaxHeight = v, new Rect(200, index * distance + 10, 170, 20));
                    Label("normalStrength");
                    index--;
                    TextField(UIController.NormalStrength, v => UIController.NormalStrength = v, new Rect(200, index * distance + 10, 170, 20));
                    Label("transparentMaps");
                    index--;
                    TextField(transparentMaps, v => transparentMaps = v, new Rect(200, index * distance + 10, 170, 20));
                    Label("exportMode");
                    index--;
                    Button(Localization.LOC_KITTOPIATECH_EDIT, () => {
                        UIController.Instance.SetEditedObject(KittopiaWindows.Enum, exportMode, c => exportMode = c);
                        UIController.Instance.EnableWindow(KittopiaWindows.Enum);
                    }, new Rect(200, index * distance + 10, 170, 20));
                }

                // Update Orbit
                index++;
                Button(Localization.LOC_KITTOPIATECH_SCALEDEDITOR_UPDATEMESH, () => Utils.GenerateScaledSpace(Utils.FindCB(Current.name), Current.GetComponent <MeshFilter>().sharedMesh));
                Enabled(() => body.pqsController != null, () => Button(Localization.LOC_KITTOPIATECH_SCALEDEDITOR_UPDATETEX, () => UIController.Instance.StartCoroutine(Utils.GeneratePQSMaps(Utils.FindCB(Current.name), transparentMaps, exportMode))));

                // End Scroll
                EndScrollView();
            }
コード例 #28
0
ファイル: ExportUsfm.cs プロジェクト: bbriggs/FieldWorks
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Export whatever goes with an ORC (e.g. footnote, picture, etc.)
		/// </summary>
		/// <param name="ttp">Text properties of the run containing the ORC (from which we get
		/// the footnote GUID).</param>
		/// <param name="exportMode">The export mode.</param>
		/// <param name="iWs">index into the available analysis writing systems (should be -1 if
		/// exportMode is ExportMode.VernacularOnly; should  be 0 if exportMode is
		/// ExportMode.BackTransOnly)</param>
		/// <param name="vernFootnotes">If this is a non-interleaved back translation, this is
		/// the list of footnotes in the (vernacular) paragraph being exported.</param>
		/// ------------------------------------------------------------------------------------
		private void ExportOrcRun(ITsTextProps ttp, ExportMode exportMode, int iWs,
			List<IScrFootnote> vernFootnotes)
		{
			Debug.Assert(exportMode != ExportMode.VernacularOnly || iWs == -1);
			Debug.Assert(exportMode != ExportMode.BackTransOnly || iWs == 0);
			string objData = ttp.GetStrPropValue((int)FwTextPropType.ktptObjData);

			if (objData == null)
			{
				// We encountered a bogus ORC. Ignore it.
				return;
			}

			switch (objData[0])
			{
				case (char)FwObjDataTypes.kodtNameGuidHot:
				case (char)FwObjDataTypes.kodtOwnNameGuidHot:
					{
						Guid footnoteGuid = MiscUtils.GetGuidFromObjData(objData.Substring(1));
						IScrFootnote footnote;
						if (m_cache.ServiceLocator.GetInstance<IScrFootnoteRepository>().TryGetFootnote(footnoteGuid, out footnote))
						{
							ExportFootnote(footnote, exportMode, iWs);
							if (vernFootnotes != null)
								vernFootnotes.Remove(footnote);
						}
						break;
					}
				case (char)FwObjDataTypes.kodtGuidMoveableObjDisp:
					{
						Guid pictureGuid = MiscUtils.GetGuidFromObjData(objData.Substring(1));
						ICmPicture picture;
						if (m_cache.ServiceLocator.GetInstance<ICmPictureRepository>().TryGetObject(pictureGuid, out picture))
						{
							// TODO (TE-3619): Need to pass export mode once we can handle putting picture ORCs in back translations.
							ExportPicture(picture);
						}
						break;
					}
			}
		}
コード例 #29
0
ファイル: ExportUsfm.cs プロジェクト: bbriggs/FieldWorks
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Export the fields of a single paragraph (either vernacular or a back translation),
		/// with either Paratext or Toolbox markup. Typcial scripture markers such as \c \v etc.
		/// are used, plus \vt markers if we're doing Toolbox markup.
		/// Also (only if para is vernacular, not a heading, and doing Toolbox markup) we
		/// optionally interleave its back translation verse-by-verse using special \btxx
		/// markers.
		/// </summary>
		/// <param name="paraMarker">the paragraph marker for this paragraph (or translation)
		/// </param>
		/// <param name="tssPara">the paragraph's (or translation's) structured string to output
		/// </param>
		/// <param name="backTranslation">the back translation, if we are to export it
		/// interleaved, or null if not; if provided, we assume that <c>tssPara</c> is from a
		/// vernacular paragraph.</param>
		/// <param name="paraHvo">Hvo for the vernacular paragraph</param>
		/// <param name="exportMode">The export mode.</param>
		/// <param name="vernFootnotes">If this is a non-interleaved back translation, this is
		/// the list of footnotes in the (vernacular) paragraph being exported.</param>
		/// <remarks>For heading paragraphs we do not interleave the back translation
		/// verse-by-verse (it has no verses, silly) but rather we output the BT after the
		/// paragraph string.</remarks>
		/// ------------------------------------------------------------------------------------
		private void ExportParagraphDetails(string paraMarker, ITsString tssPara,
			ICmTranslation backTranslation, int paraHvo, ExportMode exportMode,
			List<IScrFootnote> vernFootnotes)
		{
			// If we are exporting interleaved back translation, we assume that toolbox markers
			//  are necessary and also that we have info on analysis writing systems.
			if (backTranslation != null)
			{
				Debug.Assert(exportMode == ExportMode.InterleavedVernAndBt);
				Debug.Assert(m_markupSystem == MarkupType.Toolbox);
				Debug.Assert(m_requestedAnalWS.Length > 0);
			}

			bool fParaMarkerWritten = false;
			bool fIntro = m_currentSectionIsIntro;

			// In Toolbox markup, we want to enable verse-by-verse interleave of back
			//  translation and annotations for verse text paragraphs only.
			// When enabled, the BT data will be output with
			//  \btvt markers within the current paragraph, ie without a bt paragraph marker.
			// We want to disable verse interleave for titles, headings, and intro paragraphs.
			// When disabled, the back translation data will be output with
			//  its own bt paragraph marker, eg \btmt, \bts, \btip
			//  (i.e. paragraph-by-paragraph interleave).
			// This bool controls verse interleaved output mode for this paragraph
			bool fEnableVerseInterleaved = (MarkupSystem == MarkupType.Toolbox &&
				!m_currentParaIsHeading && !fIntro);

			// Gather back translation info if needed
			List<ChapterVerseInfo>[] btVersesByWs = null;
			if (backTranslation != null && fEnableVerseInterleaved)
				btVersesByWs = ParseBackTranslationVerses(backTranslation);

			string prevCharStyle = null;
			bool fLastRunWasOrc = false;
			// Process all of the runs in the string
			for (int iRun = 0; iRun < tssPara.RunCount; iRun++)
			{
				string runText = tssPara.get_RunText(iRun);
				if (runText == null)
					continue;

				// because TeImport may add a hard line break (e.g. in a title), remove it before export.
				if (runText.Length > 0 && runText[0] == StringUtils.kChHardLB)
				{
					runText = runText.Substring(1);  // remove hard line break character
					if (runText.Length == 0)
						continue;
				}

				// because Toolbox export currently puts each run on its own line, we trim the
				// start; we don't want to see extra spaces between the marker and the run text
				if (MarkupSystem == MarkupType.Toolbox)
					runText = runText.TrimStart();

				// get the run's char style
				ITsTextProps runProps = tssPara.get_Properties(iRun);
				string charStyleName = runProps.GetStrPropValue(
					(int)FwTextPropType.ktptNamedStyle);

				// handle secondary and tertiary title styles as if they were paragraph styles.
				// This may happen before we output the \mt paragraph marker.
				// ENHANCE: If in the future we create distinctive TE styles to handle the
				// paragraph/character distinction properly, we might need to change the logic of
				// this condition.
				if (charStyleName == ScrStyleNames.SecondaryBookTitle ||
					charStyleName == ScrStyleNames.TertiaryBookTitle)
				{
					if (fParaMarkerWritten)
						m_file.WriteLine();
					m_file.WriteLine(GetMarkerForStyle(charStyleName) + " " + runText);
					prevCharStyle = null;
					fLastRunWasOrc = false;
					continue; // done with this run
				}

				// Output the paragraph marker now (if we haven't already)
				if (!fParaMarkerWritten)
				{
					// Toolbox markup normally needs the paragraph marker on a separate line.
					// Except for a title or heading, when the text stays with the paragraph
					// marker (e.g. "\s This is My Section Head").
					if (MarkupSystem == MarkupType.Toolbox && !m_currentParaIsHeading && !fIntro)
						m_file.WriteLine(paraMarker); //on a line by itself
					else
						m_file.Write(paraMarker + " ");
					fParaMarkerWritten = true;
				}

				if (charStyleName == ScrStyleNames.VerseNumber)
				{
					// Handle run with verse number style specially
					OutputVerseNumberRun(runText, fEnableVerseInterleaved, backTranslation,
						btVersesByWs, vernFootnotes);
					//					m_textOutputBegunInCurrentSection = true; //remember that verse output has begun
					prevCharStyle = null;
					fLastRunWasOrc = false;
				}
				else if (charStyleName == ScrStyleNames.ChapterNumber)
				{
					// Handle run with chapter number style specially
					if (OutputChapterNumberRun(runText, fEnableVerseInterleaved, backTranslation,
						btVersesByWs, vernFootnotes))
					{
						// See if the chapter we just wrote out needs to get an
						//  implicit first verse marker.
						m_v1NeededForImplicitFirstVerse = ParaBeginsWithImplicitFirstVerse(tssPara, iRun);
					}
					prevCharStyle = null;
					fLastRunWasOrc = false;
				}
				else
				{
					// If verse number one is inferred (was not physically present in the data)
					// we explicitly export verse number 1 before the text is output
					if (!m_currentParaIsHeading && !fIntro && m_v1NeededForImplicitFirstVerse)
					{
						// Note that we do not want to process the back translation text for
						//  this case.
						m_currentVerseNumString = m_scr.ConvertToString(1);
						m_lastNumericBeginVerseNum = m_lastNumericEndVerseNum = 1;
						OutputVerseNumberRun(m_currentVerseNumString, false, null, btVersesByWs, vernFootnotes);
					}

					if (charStyleName != null)
					{
						if (fLastRunWasOrc && charStyleName != null && charStyleName == prevCharStyle)
							m_file.WriteLine(kVerseTextMarker);
						// Handle run with typical character style
						OutputTypicalCharStyleRun(runText, charStyleName);
						prevCharStyle = charStyleName;
						fLastRunWasOrc = false;
					}
					else
					{
						// Handle run with no character style
						// check to see if the run is an ORC.
						if (runText.Length == 1 && runText[0] == StringUtils.kChObject)
						{
							ExportOrcRun(runProps, exportMode, (exportMode == ExportMode.BackTransOnly) ? 0 : -1, vernFootnotes);
							fLastRunWasOrc = true;
						}
						else //no character style, and not a valid ORC--export as plain paragraph run
							OutputPlainParagraphRun(runText, (!m_currentParaIsHeading && !fIntro));
					}

					// remember if output of real text (not chapter/verse nums) from section
					//  content has begun in this section
					if (!m_currentParaIsHeading)
						m_textOutputBegunInCurrentSection = true;
				}
			}

			// Finish up remaining footnotes for this paragraph.
			if (vernFootnotes != null)
			{
				foreach (IScrFootnote footnote in vernFootnotes)
					ExportFootnote(footnote, ExportMode.BackTransOnly, 0);
				vernFootnotes.Clear();
			}

			// In case the paragraph string is empty, we still need to output the lone para marker
			if (!fParaMarkerWritten)
				m_file.WriteLine(paraMarker);
			else
				m_file.WriteLine(); // Close out the last line (for Paratext markup).

			// Finish up the back translation if needed
			if (backTranslation != null)
			{
				if (fEnableVerseInterleaved)
				{
					// output any remaining verse-by-verse back translation fields, within the
					//  current paragraph.
					ExportBackTransForPriorVerse(backTranslation, btVersesByWs, RefElement.None, string.Empty, vernFootnotes);
				}
				else
				{
					// for a heading or intro paragraph, export its back translation paragraph now
					ExportBackTransForHeadingPara(paraMarker, backTranslation);
				}
			}

			// Finish up remaining annotations that match this paragraph's hvo.
			ExportNotesForThisPara(paraHvo);
		}
コード例 #30
0
ファイル: UIAttribute.cs プロジェクト: surfsky/App.Utils
 public UIAttribute(string group, string title, ExportMode export)
 {
     this.Group  = group;
     this.Title  = title;
     this.Export = export;
 }
コード例 #31
0
 private void MapStatsParsedArguments_ProcessOption(ParsedArguments sender, ProcessArgumentEventArgs e)
 {
     switch ( e.Value.ToLower() ) {
         case "bb": case "boundbox":
             action = Action.BoundBoxes;
             break;
         case "adj": case "adjacent": case "adjacency": case "adjacencies":
             action = Action.Adjacencies;
             break;
         case "r": case "regions":
             action = Action.Regions;
             break;
         case "x": case "xml":
             mode = ExportMode.XML;
             break;
         case "c": case "csv":
             mode = ExportMode.Plain;
             break;
         case "o":
             overwrite = true;
             break;
     }
 }
コード例 #32
0
 /// <summary>导出json</summary>
 public string ExportJson(ExportMode type = ExportMode.Normal)
 {
     return(Export(type).ToJson());
 }
コード例 #33
0
        private string WriteXML(CanonicalPoseClip asapClip, ExportMode mode, CanonicalRepresentation.HAnimBones[] boneSet, SyncPoint[] syncPoints)
        {
            string characterId = "COUCH_M_1";

            string encoding = "R";

            if (!ignoreRootTranslation && boneSet.Contains(CanonicalRepresentation.HAnimBones.HumanoidRoot))
            {
                encoding = "T1R";
            }
            // TODO: should probably check if there is actual translation data in clip?
            string rotationEncoding = "quaternions";
            string parts            = "";

            foreach (CanonicalRepresentation.HAnimBones canonicalBone in System.Enum.GetValues(typeof(CanonicalRepresentation.HAnimBones)))
            {
                if (!boneSet.Contains(canonicalBone))
                {
                    continue;
                }
                if (parts.Length > 0)
                {
                    parts += " ";
                }
                parts += canonicalBone.ToString();
            }

            MemoryStream      ms       = new MemoryStream();
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent             = true;
            settings.IndentChars        = "  ";
            settings.OmitXmlDeclaration = true;

            using (XmlWriter w = XmlWriter.Create(ms, settings)) {
                w.WriteStartDocument();

                if (mode == ExportMode.Keyframes || mode == ExportMode.ProcAnimationGesture)
                {
                    w.WriteStartElement("bml", "http://www.bml-initiative.org/bml/bml-1.0"); // <bml ...>
                    w.WriteAttributeString("id", "exportedBml1");
                    w.WriteAttributeString("characterId", characterId);
                    w.WriteAttributeString("xmlns", "bmlt", null, "http://hmi.ewi.utwente.nl/bmlt");
                }

                if (mode == ExportMode.Keyframes)
                {
                    //w.WriteStartElement("bmlt:keyframe"); // <bmlt:keyframe ...>
                    w.WriteStartElement("bmlt", "keyframe", null); // <bmlt:keyframe ...>
                    w.WriteAttributeString("id", "keyframes1");

                    w.WriteStartElement("SkeletonInterpolator");  // <SkeletonInterpolator ...>
                    w.WriteAttributeString("encoding", encoding); // ... xmlns=""
                    w.WriteAttributeString("rotationEncoding", rotationEncoding);
                    w.WriteAttributeString("parts", parts);

                    WriteFrames(w, asapClip.frames, boneSet, encoding == "T1R", true, false);

                    w.WriteEndElement(); // </SkeletonInterpolator>
                    w.WriteEndElement(); // </bmlt:keyframe>
                }
                else if (mode == ExportMode.ProcAnimationGesture)
                {
                    // w.WriteStartElement("bmlt:procanimationgesture"); // <bmlt:procanimationgesture ...>
                    w.WriteStartElement("bmlt", "procanimationgesture", null); // <bmlt:procanimationgesture ...>
                    w.WriteAttributeString("id", "procgesture1");

                    w.WriteStartElement("ProcAnimation");  // < ProcAnimation ...>
                    float clipDuration = asapClip.frames.Max(frame => frame.timestamp);

                    SyncPoint start       = syncPoints.FirstOrDefault(s => s.name == "start");
                    SyncPoint ready       = syncPoints.FirstOrDefault(s => s.name == "ready");
                    SyncPoint strokeStart = syncPoints.FirstOrDefault(s => s.name == "strokeStart");
                    SyncPoint stroke      = syncPoints.FirstOrDefault(s => s.name == "stroke");
                    SyncPoint strokeEnd   = syncPoints.FirstOrDefault(s => s.name == "strokeEnd");
                    SyncPoint relax       = syncPoints.FirstOrDefault(s => s.name == "relax");
                    SyncPoint end         = syncPoints.FirstOrDefault(s => s.name == "end");

/*
 *                  if (System.Array.IndexOf(null, new SyncPoint[] { start, ready, strokeStart, strokeEnd, relax, end }) >= 0) {
 *                      Debug.LogWarning("Please define all syncpoints/animation events.");
 *                      return null;
 *                  }
 */

                    float            frameMin        = asapClip.frames.Select(f => f.timestamp).Last(t => t <= start.relativeTime * clipDuration);
                    float            frameMax        = asapClip.frames.Select(f => f.timestamp).First(t => t >= end.relativeTime * clipDuration);
                    float            gestureDuration = (1 - (strokeStart.relativeTime + (1 - strokeEnd.relativeTime))) * clipDuration;
                    List <SyncPoint> _syncPoints     = new List <SyncPoint>();

                    _syncPoints.Add(new SyncPoint("start", Remap(start.relativeTime, start.relativeTime, end.relativeTime, 0f, 1f)));
                    _syncPoints.Add(new SyncPoint("ready", Remap(ready.relativeTime, start.relativeTime, end.relativeTime, 0f, 1f)));
                    _syncPoints.Add(new SyncPoint("strokeStart", Remap(strokeStart.relativeTime, start.relativeTime, end.relativeTime, 0f, 1f)));
                    _syncPoints.Add(new SyncPoint("stroke", Remap(stroke.relativeTime, start.relativeTime, end.relativeTime, 0f, 1f)));
                    _syncPoints.Add(new SyncPoint("strokeEnd", Remap(strokeEnd.relativeTime, start.relativeTime, end.relativeTime, 0f, 1f)));
                    _syncPoints.Add(new SyncPoint("relax", Remap(relax.relativeTime, start.relativeTime, end.relativeTime, 0f, 1f)));
                    _syncPoints.Add(new SyncPoint("end", Remap(end.relativeTime, start.relativeTime, end.relativeTime, 0f, 1f)));
                    syncPoints = _syncPoints.ToArray();

                    w.WriteAttributeString("prefDuration", gestureDuration.ToString("0.0##"));
                    w.WriteAttributeString("minDuration", (gestureDuration / 2).ToString("0.0##"));
                    w.WriteAttributeString("maxDuration", (gestureDuration * 2).ToString("0.0##"));
                    w.WriteStartElement("SkeletonInterpolator");  // <SkeletonInterpolator ...>
                    w.WriteAttributeString("encoding", encoding); // ...
                    w.WriteAttributeString("rotationEncoding", rotationEncoding);
                    w.WriteAttributeString("parts", parts);

                    WriteFrames(w, asapClip.frames, boneSet, encoding == "T1R", true, true, frameMin, frameMax);

                    w.WriteEndElement(); // </SkeletonInterpolator>

                    WriteSyncPoints(w, syncPoints);

                    w.WriteEndElement(); // </ProcAnimation>
                    w.WriteEndElement(); // </bmlt:procanimationgesture>
                }
                else if (mode == ExportMode.GestureBindingRestPose)
                {
                    w.WriteStartElement("SkeletonPose");          // <SkeletonPose ...>
                    w.WriteAttributeString("encoding", encoding); // ... encoding=""
                    w.WriteAttributeString("rotationEncoding", rotationEncoding);
                    w.WriteAttributeString("parts", parts);

                    WriteFrames(w, asapClip.frames, boneSet, encoding == "T1R", false);

                    w.WriteEndElement(); // </SkeletonPose>
                }
                else if (mode == ExportMode.GestureBindingKeyFrames)
                {
                    w.WriteStartElement("SkeletonInterpolator");  // <SkeletonInterpolator ...>
                    w.WriteAttributeString("encoding", encoding); // ... xmlns=""
                    w.WriteAttributeString("rotationEncoding", rotationEncoding);
                    w.WriteAttributeString("parts", parts);
                    WriteFrames(w, asapClip.frames, boneSet, encoding == "T1R", true, false);
                    w.WriteEndElement(); // </SkeletonInterpolator>
                }
                else if (mode == ExportMode.GestureBindingProcAnim)
                {
                    w.WriteStartElement("ProcAnimation");  // < ProcAnimation ...>
                    float     gestureDuration = asapClip.frames.Max(frame => frame.timestamp);
                    SyncPoint strokeStart     = syncPoints.FirstOrDefault(s => s.name == "strokeStart");
                    SyncPoint strokeEnd       = syncPoints.FirstOrDefault(s => s.name == "strokeEnd");
                    if (strokeStart != null && strokeEnd != null && strokeEnd.relativeTime > strokeStart.relativeTime)
                    {
                        gestureDuration = (1 - (strokeStart.relativeTime + (1 - strokeEnd.relativeTime))) * gestureDuration;
                    }
                    w.WriteAttributeString("prefDuration", gestureDuration.ToString("0.0##"));
                    w.WriteAttributeString("minDuration", (gestureDuration / 4).ToString("0.0##"));
                    w.WriteAttributeString("maxDuration", (gestureDuration * 4).ToString("0.0##"));
                    w.WriteStartElement("SkeletonInterpolator");  // <SkeletonInterpolator ...>
                    w.WriteAttributeString("encoding", encoding); // ...
                    w.WriteAttributeString("rotationEncoding", rotationEncoding);
                    w.WriteAttributeString("parts", parts);

                    WriteFrames(w, asapClip.frames, boneSet, encoding == "T1R", true);

                    w.WriteEndElement(); // </SkeletonInterpolator>

                    WriteSyncPoints(w, syncPoints);

                    w.WriteEndElement(); // </ProcAnimation>
                }

                if (mode == ExportMode.Keyframes || mode == ExportMode.ProcAnimationGesture)
                {
                    w.WriteEndElement(); // </bml>
                }
                w.WriteEndDocument();
            }

            StreamReader sr = new StreamReader(ms);

            ms.Seek(0, SeekOrigin.Begin);
            string xml = sr.ReadToEnd();

            sr.Dispose();
            return(xml);
        }
コード例 #34
0
ファイル: ExportUsfm.cs プロジェクト: bbriggs/FieldWorks
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Export a footnote object.
		/// </summary>
		/// <param name="footnote">the footnote</param>
		/// <param name="exportMode">The export mode.</param>
		/// <param name="iWs">index into the available analysis writing systems (should be -1 if
		/// exportMode is ExportMode.VernacularOnly</param>
		/// ------------------------------------------------------------------------------------
		private void ExportFootnote(IScrFootnote footnote, ExportMode exportMode, int iWs)
		{
			int nParas = footnote.ParagraphsOS.Count;
			Debug.Assert(nParas > 0);

			string paraStyleName = null;
			string footnoteMarker = null;
			ITsString tss;
			bool fNormalCharStyle = false; // whether previous run was a normal character style

			// Eventually we might support multiple paragraphs...
			for (int iPara = 0; iPara < nParas; iPara++)
			{
				// Get the footnote paragraph
				IStTxtPara para = (IStTxtPara)footnote.ParagraphsOS[iPara];
				if (iWs == -1) // get the vernacular para
					tss = para.Contents;
				else
				{
					// get the specified back translation
					ICmTranslation trans = para.GetBT();
					int wsAlt = m_requestedAnalWS[iWs];
					tss = (trans != null) ? trans.Translation.get_String(wsAlt) : null;
				}

				if (iPara == 0)
				{
					// Map the style name to a marker.
					paraStyleName = footnote.ParaStyleId;

					// Output the opening sf marker for the footnote.
					string fm = GetMarkerForStyle(paraStyleName).Substring(1);
					if (exportMode == ExportMode.InterleavedVernAndBt && iWs != -1)
						footnoteMarker = kBackTransMarkerPrefix + fm + GetIcuSuffix(iWs);
					else
						footnoteMarker = @"\" + fm;
					string footnoteField = footnoteMarker + " ";

					// Output the footnote caller (footnote marker type or literal marker)
					string sCaller;
					switch (m_scr.DetermineFootnoteMarkerType(paraStyleName))
					{
						// output character specified by USFM 2.0 standard
						case FootnoteMarkerTypes.AutoFootnoteMarker:
							sCaller = "+";
							break;
						case FootnoteMarkerTypes.NoFootnoteMarker:
							sCaller = "-";
							break;
						case FootnoteMarkerTypes.SymbolicFootnoteMarker:
						default:
							sCaller = m_scr.DetermineFootnoteMarkerSymbol(paraStyleName);
							break;
					}
					footnoteField += sCaller + " ";
					if (MarkupSystem == MarkupType.Paratext)
						m_file.Write(footnoteField);
					else
					{
						m_file.WriteLine();
						m_file.WriteLine(footnoteField);
					}
					// Output the chapter/verse reference if the footnote displays it.
					// But never output the ref for footnotes in a title or section heading.
					// And never output the ref for footnotes in an intro paragraph (which will
					// be the case when the verse number is zero).
					string reference = footnote.RefAsString;
					if (footnote.DisplayFootnoteReference && reference != null && reference != string.Empty)
					{
						bool dummy = false;
						OutputFootnoteCharStyleRun(footnote.ParaStyleId, true,
							ScrStyleNames.FootnoteTargetRef, reference, exportMode, iWs, ref dummy,
							ref fNormalCharStyle);
					}
					// ENHANCE: First run of footnote paragraph may not be normal footnote text; If it is
					// a general character style (or default para chars), we want to precede it with an \ft;
					// but if it's a footnote character style, we don't. In order to know the difference,
					// we would need to access the stylesheet to get the context, so for now we'll just
					// output the \ft all the time since it doesn't seem to cause any problems in Paratext.
					//if (MarkupSystem == MarkupType.Paratext)
					//    OutputFootnoteCharStyleRun(footnote.ParaStyleId, ksDefaultFootnoteCharacters, string.Empty);
				}

				if (tss == null)
				{
					Debug.Assert(iWs != -1, "tss can only be null if this is a BT export (this footnote never had a BT created)");
					continue;
				}

				// Flag indicating whether we're already in the context of an \ft, \fk, fqa, \xt, etc. field
				bool fInFootnoteContentField = false;

				// Output all of the runs in the footnote string.
				for (int iRun = 0; iRun < tss.RunCount; iRun++)
				{
					ITsTextProps runProps = tss.get_Properties(iRun);
					string runText = tss.get_RunText(iRun);
					if (runText == null)
						continue;
					string styleName = runProps.GetStrPropValue(
						(int)FwTextPropType.ktptNamedStyle);

					// Output the run text within char style markers
					if (styleName == null)
					{
						if (fInFootnoteContentField)
						{
							// If we are in a footnote content field in Paratext format and
							// the previous run was not a standard character style,
							// then we need to insert a marker to indicate the next content field.
							if (MarkupSystem == MarkupType.Paratext && !fNormalCharStyle)
							{
								Debug.Assert(paraStyleName != null);
								Debug.Assert(m_markerMappings.ContainsKey(paraStyleName + "\uffff" +
									ksDefaultFootnoteCharacters));
								m_file.Write(m_markerMappings[paraStyleName + "\uffff" +
									ksDefaultFootnoteCharacters] + " ");
							}
							m_file.Write(runText);
						}
						else
						{
							OutputFootnoteCharStyleRun(footnote.ParaStyleId, true,
								ksDefaultFootnoteCharacters, runText, exportMode, iWs,
								ref fInFootnoteContentField, ref fNormalCharStyle);
						}
					}
					else
					{
						// if the style has a customized mapping based on the type of the
						// note (either General Footnote or Cross-Reference), use it.
						bool fLookupBasedOnParaStyleContext = m_markerMappings.ContainsKey(
							paraStyleName + "\uffff" + styleName);
						OutputFootnoteCharStyleRun(footnote.ParaStyleId, fLookupBasedOnParaStyleContext,
							styleName, runText, exportMode, iWs, ref fInFootnoteContentField,
							ref fNormalCharStyle);
					}
				}
			}

			// if there were no paragraphs for the footnote, bail out, nothing happened
			if (nParas == 0)
				return;

			// Close the footnote - Paratext markup needs an end marker
			if (MarkupSystem == MarkupType.Paratext)
				m_file.Write(footnoteMarker + "*");
		}
コード例 #35
0
        public void Enum_HasPlaylistFile_FindsPlaylistFileFlag()
        {
            ExportMode sut = ExportMode.PlaylistFile;

            Assert.True((sut & ExportMode.PlaylistFile) == ExportMode.PlaylistFile);
        }
コード例 #36
0
ファイル: UIAttribute.cs プロジェクト: surfsky/App.Utils
 public UIAttribute(string title, ExportMode export) : this("", title, export)
 {
 }
コード例 #37
0
 //---------------------------------------------
 // 导出
 //---------------------------------------------
 /// <summary>获取导出对象(可用于接口数据输出)</summary>
 /// <param name="type">导出详细信息还是概述信息</param>
 ///
 /// <example>
 /// var item = User.Get(..).Export();
 /// var items = User.Search(....).ToList().Cast(t => t.Export());
 /// </example>
 ///
 /// <remarks>
 /// - 统一用 IExport 接口,以功能换性能。
 /// - 不采用 Expression 的原因:有些复杂导出属性要用方法生成,无法被EF解析。
 /// - 对于字段实在太多的类,如有有性能问题,可先 Select 后自己写 Export 逻辑。
 ///
 /// 关于导出数据有三态
 /// - 导出数据有三态:Detail 包含 Normal, Normal 包含 Simple。但大部分只用到了2态。
 /// - 此项目仅 User 用到了三态(可考虑为 User单独写 ExportSimple() 方法)
 /// - 在找到其它解决方法之前,先保持此结构
 ///
 /// 考虑自动拼装属性,逻辑如:
 /// - 子类根据 ExportType 分别导出各自属性(不重叠),如用3个方法实现
 /// - 基类的方法自动组装这些字段(Detail包含Normal, Normal包含Simple)
 /// - 可用字典,或用动态类实现该逻辑
 /// - 算了,太精巧了不容易维护,还是要求每个实体类都手工写 Export 方法
 ///
 /// </remarks>
 public virtual object Export(ExportMode type = ExportMode.Normal)
 {
     return(this);
 }
コード例 #38
0
ファイル: ExportUsfm.cs プロジェクト: sillsdev/WorldPad
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Export whatever goes with an ORC (e.g. footnote, picture, etc.)
		/// </summary>
		/// <param name="ttp">Text properties of the run containing the ORC (from which we get
		/// the footnote GUID).</param>
		/// <param name="exportMode">The export mode.</param>
		/// <param name="iWs">index into the available analysis writing systems (should be -1 if
		/// exportMode is ExportMode.VernacularOnly; should  be 0 if exportMode is
		/// ExportMode.BackTransOnly)</param>
		/// ------------------------------------------------------------------------------------
		private void ExportOrcRun(ITsTextProps ttp, ExportMode exportMode, int iWs)
		{
			Debug.Assert(exportMode != ExportMode.VernacularOnly || iWs == -1);
			Debug.Assert(exportMode != ExportMode.BackTransOnly || iWs == 0);
			string objData = ttp.GetStrPropValue((int)FwTextPropType.ktptObjData);

			if (objData == null)
			{
				// We encountered a bogus ORC. Ignore it.
				return;
			}

			switch (objData[0])
			{
				case (char)FwObjDataTypes.kodtNameGuidHot:
				case (char)FwObjDataTypes.kodtOwnNameGuidHot:
					{
						Guid footnoteGuid = MiscUtils.GetGuidFromObjData(objData.Substring(1));
						int hvoFootnote = m_cache.GetIdFromGuid(footnoteGuid);
						if (hvoFootnote > 0)
							ExportFootnote(new ScrFootnote(m_cache, hvoFootnote), exportMode, iWs);
						break;
					}
				case (char)FwObjDataTypes.kodtGuidMoveableObjDisp:
					{
						Guid pictureGuid = MiscUtils.GetGuidFromObjData(objData.Substring(1));
						int hvoPicture = m_cache.GetIdFromGuid(pictureGuid);
						// TODO (TE-3619): Need to pass export mode once we can handle putting picture ORCs in back translations.
						if (hvoPicture > 0)
							ExportPicture(new CmPicture(m_cache, hvoPicture));
						break;
					}
			}
		}