Ejemplo n.º 1
0
        public void Pack_and_unpack_manifest()
        {
            // Arrange
            string directory = Path.Combine(Path.GetTempPath(), StringUtil.CreateAlphaNumericKey(6));

            Directory.CreateDirectory(directory);
            List <XDoc> docs = new List <XDoc>();

            docs.Add(new XDoc("doc1").Attr("dataid", "a"));
            docs.Add(new XDoc("doc2").Attr("dataid", "b"));
            docs.Add(new XDoc("doc3").Attr("dataid", "c"));
            List <Tuplet <string, MemoryStream> > data = new List <Tuplet <string, MemoryStream> >();

            foreach (XDoc doc in docs)
            {
                string id = doc["@dataid"].AsText;
                data.Add(new Tuplet <string, MemoryStream>(id, new MemoryStream(doc.ToBytes())));
            }
            XDoc manifest = new XDoc("manifest")
                            .Start("page").Attr("dataid", "a").End()
                            .Start("page").Attr("dataid", "b").End()
                            .Start("page").Attr("dataid", "c").End();

            // Act
            using (FilePackageWriter packageWriter = new FilePackageWriter(directory)) {
                foreach (Tuplet <string, MemoryStream> tuple in data)
                {
                    var item = new ExportItem(tuple.Item1, tuple.Item2, tuple.Item2.Length, new XDoc("item").Elem("path", "abc"));
                    packageWriter.WriteDataAsync(item, new Result()).Wait();
                }
                packageWriter.WriteManifest(manifest, new Result()).Wait();
            }

            XDoc        manifest2;
            List <XDoc> docs2 = new List <XDoc>();

            using (FilePackageReader packageReader = new FilePackageReader(directory)) {
                manifest2 = packageReader.ReadManifest(new Result <XDoc>()).Wait();
                foreach (XDoc id in manifest2["*/@dataid"])
                {
                    using (ImportItem item = packageReader.ReadData(new ImportItem(id.AsText, null, null), new Result <ImportItem>()).Wait()) {
                        using (StreamReader reader = new StreamReader(item.Data)) {
                            docs2.Add(XDocFactory.From(reader, MimeType.TEXT_XML));
                        }
                    }
                }
            }

            // Assert
            Assert.IsTrue(File.Exists(Path.Combine(directory, "package.xml")));
            Assert.AreEqual(ToCanonical(manifest), ToCanonical(manifest2));
            Assert.AreEqual(docs.Count, docs2.Count);
            foreach (var doc in docs)
            {
                Assert.IsTrue(docs2.Select(x => x == doc).Any());
            }
        }
    public override void Commit(DbItem dbitem)
    {
        ExportItem item = dbitem as ExportItem;

        Database.ExecuteNonQuery(new DbCommand("UPDATE exports SET image_id = :image_id, image_version_id = :image_version_id, export_type = :export_type SET export_token = :export_token WHERE id = :item_id",
                                               "item_id", item.Id, "image_id", item.ImageId, "image_version_id", item.ImageVersionId, "export_type", item.ExportType, "export_token", item.ExportToken));

        EmitChanged(item);
    }
Ejemplo n.º 3
0
        public void Test_GetNewStatus_Invalid()
        {
            ExportItem testInvalidItem = new ExportItem {
                Status = "Invalid"
            };
            byte newStatus = AzureImporter.GetNewStatus(testInvalidItem, (byte)ExportStatus.SentForCreation);

            Assert.Equal((byte)ExportStatus.SentForCreation, newStatus);
        }
        public Dictionary <string, object> GetFormatValues(ExportItem item, FileItem fileItem, Profile profile)
        {
            Dictionary <string, object> values = new Dictionary <string, object>();

            values.Add("ImageNumber", fileItem.ImageNumber);
            values.Add("CaptureDate", fileItem.DateTime);
            values.Add("SessionName", profile.SessionName);
            values.Add("SessionCounter", profile.SessionCounter);
            return(values);
        }
Ejemplo n.º 5
0
        public void Test_GetNewStatus_Successful()
        {
            ExportItem testSuccessfulItem = new ExportItem {
                Status = Status_Successful
            };
            byte newStatus = AzureImporter.GetNewStatus(testSuccessfulItem, (byte)ExportStatus.SentForUpdate);

            Assert.Equal((byte)ExportStatus.ExportSuccessful, newStatus);
            newStatus = AzureImporter.GetNewStatus(testSuccessfulItem, (byte)ExportStatus.NewItem);
            Assert.Equal((byte)ExportStatus.NewItem, newStatus);
        }
    public ExportItem Create(uint image_id, uint image_version_id, string export_type, string export_token)
    {
        int id = Database.Execute(new DbCommand("INSERT INTO exports (image_id, image_version_id, export_type, export_token) VALUES (:image_id, :image_version_id, :export_type, :export_token)",
                                                "image_id", image_id, "image_version_id", image_version_id, "export_type", export_type, "export_token", export_token));

        ExportItem item = new ExportItem((uint)id, image_id, image_version_id, export_type, export_token);

        AddToCache(item);
        EmitAdded(item);

        return(item);
    }
Ejemplo n.º 7
0
        public void Test_GetNewStatus_Failure()
        {
            ExportItem testFailureItem = new ExportItem {
                Status = Status_Failure
            };
            byte newStatus = AzureImporter.GetNewStatus(testFailureItem, (byte)ExportStatus.SentForUpdate);

            Assert.Equal((byte)ExportStatus.FailedToUpdate, newStatus);
            newStatus = AzureImporter.GetNewStatus(testFailureItem, (byte)ExportStatus.SentForCreation);
            Assert.Equal((byte)ExportStatus.FailedToCreate, newStatus);
            newStatus = AzureImporter.GetNewStatus(testFailureItem, (byte)ExportStatus.NewItem);
            Assert.Equal((byte)ExportStatus.NewItem, newStatus);
        }
        private void UpdateExportEncodingType()
        {
            ExportItem exportItem = CoreDataLibrary.Data.Get.GetExportItemByName(DropDownListExportFile.SelectedItem.Text);

            if (exportItem.ExportType != "xml")
            {
                exportEncoding.Visible          = true;
                DropDownListExportEncoding.Text = exportItem.ExportEncoding;
            }
            else
            {
                exportEncoding.Visible = false;
            }
        }
Ejemplo n.º 9
0
        public void Exporter_can_retrieve_items_by_dataid()
        {
            // Arrange
            XUri dekiApiUri     = new XUri("http://mock/@api/deki");
            XDoc exportDocument = new XDoc("export");
            XUri item1Uri       = dekiApiUri.At("foo", "bar", "abc");
            XDoc item1Doc       = new XDoc("item1");
            XUri item2Uri       = dekiApiUri.At("foo", "bar", "def");
            XDoc item2Doc       = new XDoc("item2");
            XDoc exportResponse = new XDoc("export")
                                  .Start("requests")
                                  .Start("request")
                                  .Attr("method", "GET")
                                  .Attr("dataid", "abc")
                                  .Attr("href", item1Uri)
                                  .Start("header").Attr("name", "h_1").Attr("value", "v_1").End()
                                  .Start("header").Attr("name", "h_2").Attr("value", "v_2").End()
                                  .End()
                                  .Start("request")
                                  .Attr("method", "GET")
                                  .Attr("dataid", "def")
                                  .Attr("href", item2Uri)
                                  .End()
                                  .End()
                                  .Start("manifest")
                                  .Start("foo").Attr("dataid", "abc").End()
                                  .Start("bar").Attr("dataid", "def").End()
                                  .End();
            AutoMockPlug mock = MockPlug.Register(dekiApiUri);

            mock.Expect().Verb("POST").Uri(dekiApiUri.At("site", "export").With("relto", "0")).RequestDocument(exportDocument).Response(DreamMessage.Ok(exportResponse));
            mock.Expect().Verb("GET").Uri(item1Uri).RequestHeader("h_1", "v_1").RequestHeader("h_2", "v_2").Response(DreamMessage.Ok(item1Doc));
            mock.Expect().Verb("GET").Uri(item2Uri).Response(DreamMessage.Ok(item2Doc));

            // Act
            Exporter   exporter = Exporter.CreateAsync(Plug.New(dekiApiUri), exportDocument, 0, new Result <Exporter>()).Wait();
            ExportItem item1    = exporter.GetItemAsync("abc", new Result <ExportItem>()).Wait();
            ExportItem item2    = exporter.GetItemAsync("def", new Result <ExportItem>()).Wait();

            //Assert
            Assert.IsTrue(mock.WaitAndVerify(TimeSpan.FromSeconds(1)));
            Assert.AreEqual(exportResponse["manifest"], exporter.Manifest);
            Assert.AreEqual(new string[] { "abc", "def" }, exporter.DataIds);
            Assert.AreEqual(exporter.Manifest["*[@dataid='abc']"], item1.ItemManifest);
            Assert.AreEqual(exporter.Manifest["*[@dataid='def']"], item2.ItemManifest);
            Assert.AreEqual(item1Doc, XDocFactory.From(new StreamReader(item1.Data), MimeType.TEXT_XML));
            Assert.AreEqual(item2Doc, XDocFactory.From(new StreamReader(item2.Data), MimeType.TEXT_XML));
        }
    static void Main(string[] args)
    {
        //Initialize scenario
        var item1 = new ExportItem();
        var item2 = new ExportItem();
        var item3 = new ExportItem();

        item1.Container["ID"]          = Guid.NewGuid();
        item1.Container["Name"]        = "John Smith";
        item1.Container["DateOfBirth"] = new DateTime(2002, 10, 10);
        item2.Container["Name"]        = "Alice";
        item2.Container["DateOfBirth"] = new DateTime(2004, 10, 20);
        item2.Container["ID"]          = Guid.NewGuid();
        item3.Container["ID"]          = Guid.NewGuid();
        item3.Container["Name"]        = "Bob";
        item3.Container["DateOfBirth"] = "Invalid Date";
        List <ExportItem> myExportItems = new List <ExportItem>()
        {
            item1, item2, item3
        };
        //Initialize filter (older than 12 years)
        Int32    myAge      = 12;
        DateTime myAgeLimit = DateTime.Today.AddYears(myAge * -1);
        Predicate <KeyValuePair <String, Object> > myFilter = (x => (x.Key == "DateOfBirth") && (x.Value is DateTime) && ((DateTime)x.Value) < myAgeLimit);
        //Filter the according items
        var myResult = (from e in myExportItems from e2 in e.Container where myFilter(e2) select e);

        //Execute something
        Console.Out.WriteLine($"Older than {myAge} years old:");
        foreach (var myExportItem in myResult)
        {
            var    myContainer   = myExportItem.Container;
            String myID          = "unknown";
            String myName        = "unknown";
            String myDateOfBirth = ((DateTime)myContainer["DateOfBirth"]).ToString("yyyy-MM-dd");
            try {
                myID = ((Guid)myContainer["ID"]).ToString("D");
            } catch { }
            try {
                myName = ((String)myContainer["Name"]);
            } catch { }
            Console.WriteLine($"myID={myID}");
            Console.WriteLine($"myID={myName}");
            Console.WriteLine($"myID={myDateOfBirth}");
            Console.WriteLine();
        }
    }
Ejemplo n.º 11
0
        private void LoadedExport(object sender, RoutedEventArgs e)
        {
            var btn = sender as Button;
            var ctx = btn.DataContext as ExportItem;

            if (Selected == null)
            {
                btn.IsEnabled = false;
                SelectExport(btn, ctx);
                Selected    = ctx;
                SelectedBtn = btn;
            }
            else
            {
                btn.IsEnabled = true;
            }
        }
Ejemplo n.º 12
0
        private void View_CoverChanged(object sender, EventArgs e)
        {
            var exportItem = new ExportItem()
            {
                Subject = currentSubject.Subject,
                Cover   = view.CoverImage,
                Photos  = view.SubjectPhotos
            };

            foreach (var publisherType in currentSubject.AvailableExportTypes)
            {
                foreach (var exportType in publisherType.Value)
                {
                    exportItem.ExportType = exportType;
                    view.SetAvailableItemPreview(publishersInfo[publisherType.Key], exportType, publisherType.Key.ImageHandler?.HandleMainPhoto(exportItem) ?? exportItem.Cover);
                }
            }
        }
Ejemplo n.º 13
0
    static List <ExportItem> parseConfigFile()
    {
        List <ExportItem> ls        = new List <ExportItem>();
        string            configXml = workPath + "/DllExport.xml";

        if (!File.Exists(configXml))
        {
            UnityEngine.Debug.LogError("找不到DllExport.xml配置文件");
            return(ls);
        }

        XmlDocument x = new XmlDocument();

        x.Load(configXml);
        XmlNodeList md = x.SelectNodes("Root/Module");

        for (int i = 0; i < md.Count; ++i)
        {
            ExportItem ei = new ExportItem();
            XmlNode    n  = md[i];
            XmlNode    m  = n.SelectSingleNode("./Export");
            ei.outPathName = m.Attributes["path"].Value;

            XmlNodeList ms = null;
            ms = n.SelectNodes("./RefFile");
            for (int j = 0; j < ms.Count; ++j)
            {
                ei.refFiles.Add("\"" + ms[j].Attributes["path"].Value + "\"");
            }

            ms = n.SelectNodes("./SourceFile");
            for (int j = 0; j < ms.Count; ++j)
            {
                List <string> files = getSourceFile(ms[j]);
                ei.sourceFiles.AddRange(files);
            }

            m = n.SelectSingleNode("./Define");
            //ei.defines = m.InnerText;

            ls.Add(ei);
        }
        return(ls);
    }
Ejemplo n.º 14
0
        private bool ImportPdeTag(PdeContentItem pdeContentItem, string domainName, string tableExcelName, string columnExcelName)
        {
            if (pdeContentItem == null || pdeContentItem.ExportData == null || pdeContentItem.ExportData.Items == null)
            {
                return(false);
            }

            // validate export domain information
            DomainExportItem expDomain = pdeContentItem.ExportData.Items.FirstOrDefault(
                c => string.Equals(c.DomainName, domainName, StringComparison.OrdinalIgnoreCase));

            if (expDomain == null || expDomain.Items == null)
            {
                return(false);
            }

            // validate export item information
            ExportItem expItem = expDomain.Items.FirstOrDefault(
                c => string.Equals(c.ExcelName, tableExcelName, StringComparison.OrdinalIgnoreCase));

            if (expItem == null)
            {
                return(false);
            }

            // validate export column
            if (!string.IsNullOrWhiteSpace(columnExcelName))
            {
                if (expItem.Columns == null)
                {
                    return(false);
                }
                ColumnExportItem expColumn = expItem.Columns.FirstOrDefault(
                    c => string.Equals(c.ExcelName, columnExcelName, StringComparison.OrdinalIgnoreCase));
                if (expColumn == null)
                {
                    return(false);
                }
                expColumn.IsUsed = true;
            }
            expItem.IsUsed = true;
            return(true);
        }
Ejemplo n.º 15
0
        private void listViewItems_ItemClick(object sender, ItemClickEventArgs e)
        {
            ListView   listView   = sender as ListView;
            ExportItem exportItem = e.ClickedItem as ExportItem;

            if (listView.ContainerFromItem(exportItem) is ListViewItem container)
            {
                var templateRoot = (FrameworkElement)container.ContentTemplateRoot;
                ExportItemControl exportItemControl = templateRoot.FindName("exportItemControl") as ExportItemControl;
                exportItemControl.AnimateIn();
            }

            DataPackage dataPackage = new DataPackage();

            dataPackage.SetText(exportItem.Value);
            dataPackage.RequestedOperation = DataPackageOperation.Copy;
            Clipboard.SetContent(dataPackage);

            textBoxSearch.Focus(FocusState.Keyboard);
        }
        protected void ButtonSaveExport_Click(object sender, EventArgs e)
        {
            try
            {
                if (TextBoxFilename.Text == "")
                {
                    ShowMessageBox("Invalid filename.");
                }
                else
                {
                    s_exportItem = Get.GetExportItem(TextBoxFilename.Text);
                    if (s_exportItem == null)
                    {
                        s_exportItem = new ExportItem();
                    }

                    s_exportItem.ExportItemName    = TextBoxFilename.Text;
                    s_exportItem.ExportItemFtpId   = Convert.ToInt32(DropDownListFTPSites.SelectedValue);
                    s_exportItem.ExportItemRunTime = Convert.ToInt32(DropDownRunTime.SelectedItem.Text);
                    s_exportItem.ExportType        = DropDownListExportType.SelectedItem.Text;
                    s_exportItem.ExportEncoding    = DropDownListExportEncoding.Text;
                    if (CheckBoxExportEnabled.Checked)
                    {
                        s_exportItem.ExportEnabled = 1;
                    }
                    else
                    {
                        s_exportItem.ExportEnabled = 0;
                    }

                    PopulateValues(s_exportItem);
                    s_exportItem.Save();
                    UpdateExportedItems();
                    UpdateExportType();
                }
            }
            catch (Exception exception)
            {
                Emailer.SendEmail("*****@*****.**", "CoreDataReportService : Error ", "ReportCreator->ButtonSaveExport_Click", exception);
            }
        }
        internal static void CheckQueItems()
        {
            List <string> queItems = CoreDataLibrary.Data.Get.GetQueItems();

            Parallel.ForEach(queItems, currentExportItem =>
            {
                ReportLogger reportLogger = new ReportLogger(currentExportItem);
                try
                {
                    ExportItem exportItem = Get.GetExportItem(currentExportItem);
                    reportLogger          = new ReportLogger(exportItem.ExportItemName);
                    reportLogger.StartLog("Exporting : " + exportItem.ExportItemName);
                    exportItem.Export(reportLogger);
                    reportLogger.EndLog(exportItem.ExportItemName + " : Exported");
                }
                catch (Exception e)
                {
                    reportLogger.EndLog(e);
                    Emailer.SendEmail("*****@*****.**", "CoreDataReportService", "MainProcess->Run", e);
                }
            });
        }
        protected void ButtonExport_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_exportItem == null)
                {
                    m_exportItem = new ExportItem();
                }

                m_exportItem.ExportItemName  = TextBoxFilename.Text;
                m_exportItem.ExportItemFtpId = Convert.ToInt32(DropDownListFTPSites.SelectedValue);
                PopulateValues(m_exportItem);

                m_exportItem.SelectStatementBuilder.SelectStatement();
                CsvDataExporter dataExporter = new CsvDataExporter(m_exportItem);
                dataExporter.CsvExport();
            }
            catch (Exception exception)
            {
                Emailer.SendEmail("*****@*****.**", "CoreDataReprtService : Error ", "ReportCreator->ButtonExport_Click", exception);
            }
        }
        private void UpdateExportedItems()
        {
            int i = 0;

            DropDownListExportFile.Items.Clear();
            DropDownListExportFile.Items.Add(new ListItem("None", "0"));
            List <ListItem> exportedItemsList = Get.GetExportItems();
            ExportItem      exportItem        = Get.GetExportItem(TextBoxFilename.Text);

            DropDownListExportFile.Items.AddRange(exportedItemsList.ToArray());
            if (exportItem != null)
            {
                foreach (ListItem item in DropDownListExportFile.Items)
                {
                    if (item.Text == exportItem.ExportItemName)
                    {
                        break;
                    }
                    i++;
                }
                DropDownListExportFile.SelectedIndex = i;
            }
        }
Ejemplo n.º 20
0
        public bool Export(ExportItem item, FileItem fileItem, Profile profile)
        {
            ExportItem = item;
            IMagickImage magickImage = null;

            Smart.Default.Settings.ConvertCharacterStringLiterals = false;

            string outFilename = Smart.Format(FileNameTemplate, GetFormatValues(item, fileItem, profile));

            if (string.IsNullOrWhiteSpace(Path.GetExtension(outFilename)))
            {
                outFilename += ".jpg";
            }
            outFilename = Path.Combine(Folder, outFilename);
            Utils.CreateFolder(outFilename);

            // check if the file is safe for open
            // not used by any other application
            Utils.WaitForFile(fileItem.TempFile);
            try
            {
                if (ImageSource == 0 && !Resize)
                {
                    File.Copy(fileItem.TempFile, outFilename);
                    return(true);
                }

                magickImage = GetImage(item, fileItem, profile);
                magickImage.Write(outFilename);
            }
            catch (Exception e)
            {
                Log.Debug("Export error ", e);
                return(false);
            }
            return(true);
        }
 public XmlExporter(ExportItem exportItem)
     : base(exportItem, ".xml")
 {
 }
 public CsvExporter(ExportItem exportItem, bool includeHeaders = false, string delimeter = "|")
     : base(exportItem, ".csv")
 {
     m_delimeter = delimeter;
     ExportItem  = exportItem;
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Saves a document as PDF or XPS format. (Available from Word 2007)
        /// </summary>
        /// <param name="OutputfileName">The path and file name name of the new PDF or XPS file.</param>
        /// <param name="ExportFormat">Specifies either PDF or XPS format.</param>
        /// <param name="OpenAfterExport">Opens the new file after exporting the contents.</param>
        /// <param name="OptimizeFor">Specifies whether to optimize for screen or print.</param>
        /// <param name="Range">Specifies whether the export range is the entire document, the current page, a range of text, or the current selection. the default is to export the entire document.</param>
        /// <param name="From">Specifies the starting page number, if the Range parameter is set to ExportFromTo.</param>
        /// <param name="To">Specifies the ending page number, if the Range parameter is set to ExportFromTo.</param>
        /// <param name="Item">Specifies whether the export process includes text only or includes text with markup.</param>
        /// <param name="IncludeDocProps">Specifies whether to include document properties in the newly exported file.</param>
        /// <param name="KeepIRM">Specifies whether to copy IRM permissions to an XPS document if the source document has IRM protections. Default value is True.</param>
        /// <param name="CreateBookmarks">Specifies whether to export bookmarks and the type of bookmarks to export.</param>
        /// <param name="DocStructureTags">Specifies whether to include extra data to help screen readers, for example information about the flow and logical organization of the content. Default value is True.</param>
        /// <param name="BitmapMissingFonts">Specifies whether to include a bitmap of the text. Set this parameter to True when font licenses do not permit a font to be embedded in the PDF file. If False, the font is referenced, and the viewer's computer substitutes an appropriate font if the authored one is not available. Default value is True.</param>
        /// <param name="UseISO19005_1">Specifies whether to limit PDF usage to the PDF subset standardized as ISO 19005-1. If True, the resulting files are more reliably self-contained but may be larger or show more visual artifacts due to the restrictions of the format. Default value is False.</param>
        public void ExportAsFixedFormat(string OutputfileName, ExportFormat ExportFormat, bool? OpenAfterExport = false, ExportOptimizeFor? OptimizeFor = ExportOptimizeFor.Print, ExportRange? Range = ExportRange.AllDocument, long? From = null, long? To = null, ExportItem? Item = ExportItem.Content, bool? IncludeDocProps = true, bool? KeepIRM = true, ExportCreateBookmarks? CreateBookmarks = ExportCreateBookmarks.CreateNoBookmarks, bool? DocStructureTags = true, bool? BitmapMissingFonts = true, bool? UseISO19005_1 = false)
        {
            if (String.IsNullOrEmpty(OutputfileName))
                throw new Exception("Output filename may not be blank");

            InternalObject.GetType().InvokeMember("ExportAsFixedFormat", System.Reflection.BindingFlags.InvokeMethod, null, InternalObject, new object[]
            {
                OutputfileName,
                ExportFormat,
                OpenAfterExport ?? (object)System.Reflection.Missing.Value,
                OptimizeFor ?? (object)System.Reflection.Missing.Value,
                Range ?? (object)System.Reflection.Missing.Value,
                From ?? (object)System.Reflection.Missing.Value,
                To ?? (object)System.Reflection.Missing.Value,
                Item ?? (object)System.Reflection.Missing.Value,
                IncludeDocProps ?? (object)System.Reflection.Missing.Value,
                KeepIRM ?? (object)System.Reflection.Missing.Value,
                CreateBookmarks ?? (object)System.Reflection.Missing.Value,
                DocStructureTags ?? (object)System.Reflection.Missing.Value,
                BitmapMissingFonts ?? (object)System.Reflection.Missing.Value,
                UseISO19005_1 ?? (object)System.Reflection.Missing.Value,
                (object)System.Reflection.Missing.Value
            });
        }
Ejemplo n.º 24
0
 protected override IEnumerator <IYield> WriteData_Helper(ExportItem item, Result result)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 25
0
 public virtual T Visit(ExportItem node)
 {
     Visit((UnitItem)node);
     return(traverse(node.formalparams));
 }
Ejemplo n.º 26
0
		private static string GetExportUrl (ExportItem export)
		{
			switch (export.ExportType) {
			case ExportStore.FlickrExportType:
				string[] split_token = export.ExportToken.Split (':');
				return String.Format ("http://www.{0}/photos/{1}/{2}/", split_token[2],
                                                      split_token[0], split_token[3]);
			case ExportStore.FolderExportType:
				Gnome.Vfs.Uri uri = new Gnome.Vfs.Uri (export.ExportToken);
				return (uri.HasParent) ? uri.Parent.ToString () : export.ExportToken;
			case ExportStore.Gallery2ExportType:
				string[] split_item = export.ExportToken.Split (':');
				return String.Format ("{0}:{1}?g2_itemId={2}",split_item[0], split_item[1], split_item[2]);
			case ExportStore.OldFolderExportType:	//This is obsolete and meant to be removed once db reach rev4
			case ExportStore.PicasaExportType:
			case ExportStore.SmugMugExportType:
				return export.ExportToken;
			default:
				return null;
			}
		}
Ejemplo n.º 27
0
 public string GetFilename(ExportItem item)
 {
     return(GetFilePath(item));
 }
Ejemplo n.º 28
0
 public FtpPluginViewModel()
 {
     ExportItem = new ExportItem();
 }
Ejemplo n.º 29
0
 public FtpPluginViewModel(ExportItem item)
 {
     ExportItem = item;
 }
Ejemplo n.º 30
0
		private static string GetExportLabel (ExportItem export)
		{
			switch (export.ExportType) {
			case ExportStore.FlickrExportType:
				string[] split_token = export.ExportToken.Split (':');
				return String.Format ("Flickr ({0})", split_token[1]);
			case ExportStore.OldFolderExportType:	//Obsolete, remove after db rev4
				return Catalog.GetString ("Folder");
			case ExportStore.FolderExportType:
				return Catalog.GetString ("Folder");
			case ExportStore.PicasaExportType:
				return Catalog.GetString ("Picasaweb");
			case ExportStore.SmugMugExportType:
				return Catalog.GetString ("SmugMug");
			case ExportStore.Gallery2ExportType:
				return Catalog.GetString ("Gallery2");
			default:
				return null;
			}
		}
Ejemplo n.º 31
0
 public ExportItem GetDefault()
 {
     ExportItem = new ExportItem();
     SetDefault();
     return(ExportItem);
 }
Ejemplo n.º 32
0
	public ExportItem Create (uint image_id, uint image_version_id, string export_type, string export_token)
	{
		int id = Database.Execute(new DbCommand("INSERT INTO exports (image_id, image_version_id, export_type, export_token) VALUES (:image_id, :image_version_id, :export_type, :export_token)",
		"image_id", image_id, "image_version_id", image_version_id, "export_type", export_type, "export_token", export_token));
		
		ExportItem item = new ExportItem ((uint)id, image_id, image_version_id, export_type, export_token);

		AddToCache (item);
		EmitAdded (item);

		return item;
	}
Ejemplo n.º 33
0
 public override bool Visit(ExportItem node)
 {
     Visit((UnitItem)node);
     TraversePrint(node.formalparams);
     return(true);
 }
Ejemplo n.º 34
0
 private void Duplicate(ExportItem obj)
 {
     Profile.ExportItems.Add(obj.Clone());
 }