当前位置: 首页>>代码示例>>C#>>正文


C# SourceType.ToString方法代码示例

本文整理汇总了C#中SourceType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SourceType.ToString方法的具体用法?C# SourceType.ToString怎么用?C# SourceType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SourceType的用法示例。


在下文中一共展示了SourceType.ToString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Log

        /// <summary>
        /// Logs the specified messageto EventLog.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="source">The source type.</param>
        /// <param name="logType">Type of the log.</param>
        public void Log(string message, SourceType source, LogType logType = LogType.Information)
        {
            var logEntry = new LogEntry
            {
                Message = message,
                Source = source.ToString(),
                Type = logType
            };

            Log(logEntry);
        }
开发者ID:radata,项目名称:lsolilo-sharepoint,代码行数:17,代码来源:Logger.cs

示例2: SerializeIcalEventsToIcs

 // save the intermediate ics file for the source type represented in ical
 private BlobStorageResponse SerializeIcalEventsToIcs(iCalendar ical, SourceType type)
 {
     var serializer = new DDay.iCal.Serialization.iCalendar.iCalendarSerializer();
     var ics_text = serializer.SerializeToString(ical);
     var ics_bytes = Encoding.UTF8.GetBytes(ics_text);
     var containername = this.id;
     return bs.PutBlob(containername, containername + "_" + type.ToString() + ".ics", new Hashtable(), ics_bytes, "text/calendar");
 }
开发者ID:jalbertbowden,项目名称:elmcity,代码行数:9,代码来源:EventCollector.cs

示例3: SerializeStatsAndIntermediateOutputs

        private void SerializeStatsAndIntermediateOutputs(FeedRegistry fr, EventStore es, iCalendar ical, NonIcalStats stats, SourceType type)
        {
            BlobStorageResponse bsr;
            HttpResponse tsr;

            if (BlobStorage.ExistsContainer(this.id) == false)
                bs.CreateContainer(this.id, is_public: true, headers: new Hashtable());

            if (type == SourceType.ical) // NonIcalStats is null in this case, and not used
            {
                bsr = fr.SerializeIcalStatsToJson();
                GenUtils.LogMsg("info", this.id + ": SerializeIcalStatsToJson",  bsr.HttpResponse.status.ToString());
                tsr = fr.SaveStatsToAzure();
                GenUtils.LogMsg("info", this.id + ": FeedRegistry.SaveStatsToAzure", tsr.status.ToString());
            }
            else
            {

                bsr = Utils.SerializeObjectToJson(stats, this.id, stats.blobname + ".json");
                GenUtils.LogMsg("info", this.id + ": Collector: SerializeObjectToJson: " + stats.blobname + ".json", bsr.HttpResponse.status.ToString());
                tsr = this.SaveStatsToAzure(type);
                GenUtils.LogMsg("info", this.id + ": Collector: SaveStatsToAzure", tsr.status.ToString());

            }

            bsr = this.SerializeIcalEventsToIcs(ical, type);
            GenUtils.LogMsg("info", this.id + ": SerializeIcalStatsToIcs: " + id + "_" + type.ToString() + ".ics", bsr.HttpResponse.status.ToString());

            bsr = es.Serialize();
            GenUtils.LogMsg("info", this.id + ": EventStore.Serialize: " + es.objfile, bsr.HttpResponse.status.ToString());
        }
开发者ID:jalbertbowden,项目名称:elmcity,代码行数:31,代码来源:EventCollector.cs

示例4: Save

        /// <summary>
        /// 存储
        /// </summary>
        /// <param name="files">文件流</param>
        /// <param name="createdUid">created userid</param>
        /// <param name="defaultNum"></param>
        /// <param name="sourceId">来源ID</param>
        /// <param name="sourceType">来源类型</param>
        /// <returns></returns>
        public List<ResourceEntity> Save(HttpFileCollectionBase files, int createdUid, int defaultNum, int sourceId,
                                         SourceType sourceType)
        {
            if (files == null || files.Count == 0)
            {
                return new List<ResourceEntity>(0);
            }

            var list = new List<ResourceEntity>(files.Count);
            var count = files.Count;
            //检查扩展名
            foreach (string upload in files)
            {
                if (!files[upload].HasFile()) continue;

                /*
                 *  1.获取存储的文件名
                 *  2.存储文件
                 *  3.存储到数据库
                 *  4.返回
                //*/
                FileInfor fileInfor;
                FileMessage fileuploadResult;
                
                
                var fileExt = files[upload].FileName.Substring(files[upload].FileName.LastIndexOf(".", System.StringComparison.Ordinal) + 1).ToLower();

                switch (sourceType)
                {
                    case SourceType.Product:
                    case SourceType.Promotion:
                        //Logger.Warn("switch:" + upload + " ext:" + fileExt + ",ct:" + files[upload].ContentType);
                        if (files[upload].ContentType.IndexOf("audio/x-m4a", StringComparison.OrdinalIgnoreCase) > -1 || fileExt.IndexOf("m4a", System.StringComparison.OrdinalIgnoreCase) > -1 || upload.LastIndexOf("audio", StringComparison.OrdinalIgnoreCase) > -1)
                        {
                            //Logger.Warn("RUN");
                            var entity2 = InnerSave(files[upload], (sourceType.ToString() + "audio").ToLower(), sourceId, sourceType, createdUid,
          count, defaultNum);

                            if (entity2 != null)
                                list.Add(entity2);

                            continue;
                        }
                        break;
                    default:

                        break;
                }

                var entity = InnerSave(files[upload], sourceType.ToString().ToLower(), sourceId, sourceType, createdUid,
count--, defaultNum);

                if (entity != null)
                    list.Add(entity);

            }

            if (list.Count > 0)
            {
                return _resourceRepository.Insert(list);
            }

            return new List<ResourceEntity>(0);
        }
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:73,代码来源:ResourceService.cs

示例5: SaveStage

        /// <summary>
        /// implement the saveStage
        /// </summary>
        /// <param name="file"></param>
        /// <param name="sourceType"></param>
        /// <returns></returns>
        public FileInfor SaveStage(FileInfo file, int createUser, SourceType sourceType)
        {
            if (file == null)
                return null;


            FileInfor fileInfor;

            var fileuploadResult = FileUploadServiceManager.UploadFile(file, sourceType.ToString().ToLower(),
                                                        out fileInfor, string.Empty);

            if (fileuploadResult == FileMessage.Success)
            {

                return fileInfor;
            }
            else
                return null;


        }
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:27,代码来源:ResourceService.cs

示例6: GetSourceTypeFile

 private string GetSourceTypeFile(SourceType sourceType)
 {
     string fileName = sourceType.ToString() + ".xml";
     string folder = GetFolder();
     return Path.Combine(folder, fileName);
 }
开发者ID:hamstercat,项目名称:perfect-media,代码行数:6,代码来源:SourceRepository.cs

示例7: ReadTorrent

        public LoadRespData ReadTorrent(string file, SourceType source)
        {
            if (source == SourceType.Torrent)
            {
                if (string.IsNullOrEmpty(file))
                {
                    P2pProxyApp.Log.Write("Не верная ссылка на торрент", TypeMessage.Error);
                    throw new Exception("Не верная ссылка на торрент");
                }
                file = new Uri(file).ToString();
            }
            Random rand = new Random(DateTime.Now.Millisecond);
            string req = String.Format("LOADASYNC {2} {0} {1}", source.ToString().ToUpper(), file, rand.Next(100000, 200000));
            if (source != SourceType.ContentId)
                req = req + " 0 0 0";
            req = req.Replace("CONTENTID", "PID");
            //SendMessage("LOADASYNC 126500 PID 1ccf192064ee2d95e91a79f91c6097273d582827");
            SendMessage(req.Replace("CONTENTID", "PID"));
            int cwait = 0;
            bool exit = false;
            LoadRespData files = null;
            try
            {
                while (!exit)
                {
                    Thread.Sleep(24);
                    cwait += 24;
                    if (cwait >= 1000)
                        break;
                    lock (_messagePool)
                    {
                        if (!_messagePool.Any())
                            continue;
                        foreach (var msg in _messagePool)
                        {
                            if (msg.Type == MSG_LOADRESP)
                            {
                                exit = true;
                                var data = (msg.InnerData as LoadRespData);
                                if (data == null)
                                    break;
                                files = msg.InnerData as LoadRespData;
                                break;
                                //resp.files.AddRange(new String[(msg.InnerData as LoadRespData).Files.Count]);
                                //foreach (var f in (msg.InnerData as LoadRespData).Files)
                                //    resp.files[(int)f[1]] = f[0].ToString();

                            }
                        }
                        _messagePool.Clear();
                    }
                    
                }
            }
            catch (Exception)
            {
            }
            
            return files;
        }
开发者ID:northspb,项目名称:p2pproxy,代码行数:60,代码来源:TorrentStream.cs

示例8: Play

 public Task<string> Play(string file, SourceType source, int index = 0)
 {
     if (source == SourceType.Torrent)
     {
         if (string.IsNullOrEmpty(file))
         {
             P2pProxyApp.Log.Write("Не верная ссылка на торрент", TypeMessage.Error);
             throw new Exception("Не верная ссылка на торрент");
         }
         file = new Uri(file).ToString();
     }
     string req = String.Format("START {0} {1} ", source.ToString().ToUpper(), file);
     if (source == SourceType.ContentId)
         req = req + index;
     else
         req = req + index + " 0 0 0";
     _playdTask = new Task<string>(WaytingPlay);
     _playdTask.Start();
     SendMessage(req.Replace("CONTENTID", "PID"));
     PlayedFile = file;
     return _playdTask;
 }
开发者ID:northspb,项目名称:p2pproxy,代码行数:22,代码来源:TorrentStream.cs

示例9: ZonedEventStore

 public ZonedEventStore(Calinfo calinfo, SourceType type)
     : base(calinfo)
 {
     // qualifier is "ical" or one of the non-ical types, so for example:
     // http://elmcity.blob.core.windows.net/a2cal/a2cal.ical.zoned.obj
     // http://elmcity.blob.core.windows.net/a2cal/a2cal.eventful.zoned.obj
     this.objfile = this.id + "." + type.ToString() + ".zoned.obj";
     this.uri = BlobStorage.MakeAzureBlobUri(this.id, this.objfile, false);
 }
开发者ID:jalbertbowden,项目名称:elmcity,代码行数:9,代码来源:EventStore.cs

示例10: BuildSourceTypeValue

 private string BuildSourceTypeValue(SourceType sources)
 {
     string value = sources.ToString();
     return value.Replace(", ", "+");
 }
开发者ID:ogazitt,项目名称:zaplify,代码行数:5,代码来源:BingSearch.cs


注:本文中的SourceType.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。