public static void Run()
        {
            var configuration = new Configuration
            {
                AppSid = Common.MyAppSid,
                AppKey = Common.MyAppKey
            };

            var apiInstance = new ClassificationApi(configuration);

            try
            {
                var request = new GetSupportedFileFormatsRequest();

                // Get supported file formats results
                FormatCollection response = apiInstance.GetSupportedFileFormats(request);

                foreach (Format formatval in response.Formats)
                {
                    Console.WriteLine("FileFormat: " + formatval.FileFormat + "  Ext: " + formatval.Extension);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling ClassificationApi: " + e.Message);
            }
        }
Exemplo n.º 2
0
 public void SetFormat(FormatCollection value)
 {
     foreach (TextObjectBase text in ModifyList)
     {
         text.Formats.Assign(value);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextObjectBase"/> class with default settings.
 /// </summary>
 public TextObjectBase()
 {
     allowExpressions = true;
     brackets         = "[,]";
     padding          = new Padding(2, 0, 2, 0);
     hideValue        = "";
     nullValue        = "";
     text             = "";
     formats          = new FormatCollection();
     formats.Add(new GeneralFormat());
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextObjectBase"/> class with default settings.
 /// </summary>
 public TextObjectBase()
 {
     FAllowExpressions = true;
     FBrackets         = "[,]";
     FPadding          = new Padding(2, 0, 2, 0);
     FHideValue        = "";
     FNullValue        = "";
     FText             = "";
     FFormats          = new FormatCollection();
     FFormats.Add(new GeneralFormat());
 }
 public static string GetFormat(FormatCollection formatCollection, string[] acceptTypes)
 {
     foreach (var mimeType in MimeTypes.Parse(acceptTypes))
     {
         foreach (var key in formatCollection.Keys)
         {
             if (mimeType.Format == key)
                 return key;
         }
     }
     return null;
 }
        public static ActionResult GetResult(FormatCollection formatCollection, RouteValueDictionary routeValues, string[] acceptTypes)
        {
            var format = "html"; // default to html if no format extension is specified
            if (routeValues["format"] == null)
            {
                if (acceptTypes.Any())
                {
                    format = GetFormat(formatCollection, acceptTypes);
                    if (string.IsNullOrEmpty(format))
                    {
                        if (formatCollection.Default != null)
                            return formatCollection.Default;
                        if (formatCollection["html"] != null && acceptTypes.Length == 1 && acceptTypes.First() == "*/*")
                            return formatCollection["html"].Invoke();
                        return new HttpStatusCodeResult(406);
                    }
                }
                else if (!formatCollection.Any())
                {
                    return new HttpStatusCodeResult(406);
                }
            }
            else
            {
                format = routeValues["format"].ToString();
            }

            if (!formatCollection.ContainsKey(format))
            {
                if (formatCollection.Default != null)
                    return formatCollection.Default;
                return new HttpNotFoundResult();
            }

            return formatCollection[format].Invoke();
        }
Exemplo n.º 7
0
 public ActionResultExposer(FormatCollection formatCollection)
 {
     this.formatCollection = formatCollection;
 }
Exemplo n.º 8
0
 public static void Add <T, TWriter>(this FormatCollection <IWriteFormat <TWriter> > formats, WriteDelegate <T, TWriter> writer)
 {
     formats.Add(new DelegateWriteFormat <T, TWriter>(writer));
 }
Exemplo n.º 9
0
 public static void Add <T, TReader>(this FormatCollection <IReadFormat <TReader> > formats, ReadDelegate <T, TReader> reader)
 {
     formats.Add(new DelegateReadFormat <T, TReader>(reader));
 }
Exemplo n.º 10
0
        private void Load(CompoundFile doc)
        {
            Stream stream;
            try
            {
                // see if workbook works
                stream = doc.OpenStream("Workbook");
            }
            catch (IOException)
            {
                // see if book works, if not then leak the exception
                stream = doc.OpenStream("Book");
            }

            SstRecord sst = null;
            /* long sstPos = 0; */

            // record position dictionary
            SortedList<long, Biff> records = new SortedList<long, Biff>();

            _styles = new StyleCollection(this);
            _formats = new FormatCollection(this);
            _fonts = new FontCollection(this);
            _palette = new Palette(this);
            _hyperLinks = new HyperLinkCollection(this);

            while (stream.Length - stream.Position >= GenericBiff.MinimumSize)
            {
                // capture the current stream position
                long pos = stream.Position;

                // decode the record if possible
                Biff record = GetCorrectRecord(new GenericBiff(stream), stream, sst);

                // capture 
                // shared string table 
                if (record is SstRecord)
                {
                    Debug.Assert(sst == null);
                    sst = (SstRecord)record;
                    /* sstPos = pos; */
                }
                // formatting records
                else if (record is FormatRecord)
                {
                    FormatRecord f = (FormatRecord)record;
                    _formats.Add(f.Index, new Format(this, f));
                }
                else if (record is FontRecord)
                    _fonts.Add(new Font(this, (FontRecord)record));
                else if (record is PaletteRecord)
                    _palette.Initialize((PaletteRecord)record);
                else if (record is XfRecord)
                    _styles.Add(new Style(this, (XfRecord)record));
                else if (record is HyperLinkRecord)
                    _hyperLinks.Add((HyperLinkRecord)record);

                Debug.Assert(!records.ContainsKey(pos));
                // store the position and corresponding record
                records[pos] = record;
            }

            // generate the worksheets
            _sheets = new WorksheetCollection();
            foreach (Biff record in records.Values)
            {
                if (record is BoundSheetRecord)
                    _sheets.Add(new Worksheet(this, (BoundSheetRecord)record, records));
            }
        }
Exemplo n.º 11
0
 public ActionResultExposer(FormatCollection formatCollection)
 {
     this.formatCollection = formatCollection;
 }