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


C# System.IO.FileInfo.Insert方法代码示例

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


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

示例1: Update

        public void Update(string evt, params object[] data)
        {

            if (evt == LMSNotifications.ApplicationStart)
            {
                if (!isRun)
                {

                    //mTimer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed);
                    //mTimer.Start();
                    string root = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FullName;
                    int index = root.IndexOf("\\Plugins");
                    root = root.Substring(0, index);
                    serverPath = root.Insert(index, "\\Data\\Index");

                    RebuildIndex(data[0] as ILmsService);

                    //var thread = new Thread(startMyTimer);
                    //thread.Start(((IWindsorContainer)data[0]).Resolve<ILmsService>());
                    //isRun = true;
                }
            }

            if (evt == UserNotifications.UserCreate)
            {
                User user = (User)data[0];

                Document document = new Document();
                document.Add(new Field("Type", "User", Field.Store.YES, Field.Index.NO));
                document.Add(new Field("UserID", user.Id.ToString(), Field.Store.YES, Field.Index.ANALYZED));
                document.Add(new Field("User", user.Name.ToString(), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES));

                AddToIndex(document);
            }

            if (evt == UserNotifications.UserEdit)
            {
                Update(UserNotifications.UserDelete, data[0]);
                Update(UserNotifications.UserCreate, data[1]);
            }

            if (evt == UserNotifications.UserDelete)
            {
                User user = (User)data[0];
                Term term = new Term("UserID", user.Id.ToString());
                DeleteFromIndex(term);
            }

            if (evt == DisciplineNotifications.DisciplineCreate)
            {
                Discipline discipline = (Discipline)data[0];
                Document document = new Document();
                document.Add(new Field("Type", "Discipline", Field.Store.YES, Field.Index.NO));
                document.Add(new Field("DisciplineID", discipline.Id.ToString(), Field.Store.YES, Field.Index.ANALYZED));
                document.Add(new Field("Owner", discipline.Owner, Field.Store.YES, Field.Index.NO));
                document.Add(new Field("Discipline", discipline.Name.ToString(), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES));

                AddToIndex(document);
            }

            if (evt == DisciplineNotifications.DisciplineEdit)
            {
                Update(DisciplineNotifications.DisciplineDelete, data[0]);
                Update(DisciplineNotifications.DisciplineCreate, data[1]);
            }

            if (evt == DisciplineNotifications.DisciplineDelete)
            {
                Discipline discipline = (Discipline)data[0];
                Term term = new Term("DisciplineID", discipline.Id.ToString());
                DeleteFromIndex(term);
            }

            if (evt == DisciplineNotifications.TopicCreate)
            {
                Topic topic = (Topic)data[0];
                Document document = new Document();
                document = new Document();
                document.Add(new Field("Type", "Topic", Field.Store.YES, Field.Index.NO));
                document.Add(new Field("TopicID", topic.Id.ToString(), Field.Store.YES, Field.Index.ANALYZED));
                document.Add(new Field("Topic", topic.Name.ToString(), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES));
                if (topic.CourseRef == null)
                {
                    document.Add(new Field("CourseRef", "null", Field.Store.YES, Field.Index.NO));
                }
                else
                {
                    document.Add(new Field("CourseRef", topic.CourseRef.ToString(), Field.Store.YES, Field.Index.NO));
                }

                AddToIndex(document);
            }

            if (evt == DisciplineNotifications.TopicEdit)
            {
                Update(DisciplineNotifications.TopicDelete, data[0]);
                Update(DisciplineNotifications.TopicCreate, data[1]);
            }

            if (evt == DisciplineNotifications.TopicDelete)
//.........这里部分代码省略.........
开发者ID:supermuk,项目名称:iudico,代码行数:101,代码来源:SearchPlugin.cs


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