Esempio n. 1
0
        public IActionResult DeleteConfirm(int id)
        {
            var _repo = new SourceManager();

            _repo.Remove(id);
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
 private void Recycle(SourceManager src)
 {
     src.source.gameObject.SetActive(false);
     src.source.transform.parent = holder;
     active.Remove(src);
     pool.Enqueue(src.source);
 }
        public ActionResult Index()
        {
            SourceManager sourceManager = new SourceManager();
            var           show          = sourceManager.GetAll();

            return(View(show));
        }
        public ActionResult Search(string TextBox)
        {
            SourceManager sourceManager = new SourceManager();
            var           result        = sourceManager.Search(TextBox);

            return(View(result));
        }
 protected override void PluginInitialize()
 {
     Console.WriteLine("Initializing Sample Plugin");
     timeout_id = GLib.Timeout.Add(5000, OnTimeout);
     source     = new SampleSource();
     SourceManager.AddSource(source);
 }
 // optional, this is a virtual override, only
 // only provide an implementation if there are
 // resources to dispose of or other objects that
 // need notification, etc.
 protected override void PluginDispose()
 {
     Console.WriteLine("Disposing Sample Plugin");
     GLib.Source.Remove(timeout_id);
     timeout_id = 0;
     SourceManager.RemoveSource(source);
 }
Esempio n. 7
0
        public async Task UpdateImageSourceAsync()
        {
            if (NativeView != null)
            {
                var token       = this.SourceManager.BeginLoad();
                var imageSource = _imageSourcePart();

                if (imageSource != null)
                {
#if __IOS__ || __ANDROID__ || WINDOWS
                    var result = await imageSource.UpdateSourceAsync(NativeView, ImageSourceServiceProvider, SetImage !, token)
                                 .ConfigureAwait(false);

                    SourceManager.CompleteLoad(result);
#else
                    await Task.CompletedTask;
#endif
                }
                else
                {
                    SetImage?.Invoke(null);
                    SourceManager.CompleteLoad(null);
                }
            }
        }
Esempio n. 8
0
        /*============Public Function=======*/

        public void Update()
        {
            SetUpdateProgress(0, 0, UpdateState.Checking);
            Source.Source            s         = SourceManager.GetSource(_novelTitle, 22590, SourceManager.Sources.web69);
            Tuple <string, string>[] menuItems = s.GetMenuURLs();
            int newlyAddedChapter = 0;



            for (int i = _chapters.Count; i < menuItems.Length; i++)
            {
                string chapterTitle = menuItems[i].Item1;
                string url          = menuItems[i].Item2;

                Chapter newChapter = new Chapter(chapterTitle, _novelTitle, false, i);
                AppendNewChapter(newChapter);
                newlyAddedChapter++;
                SetUpdateProgress(i, menuItems.Length, UpdateState.Fetching);
                string[] novelContent    = s.GetChapterContent(chapterTitle, url);
                string   chapterLocation = newChapter.GetTextFileLocation();
                System.IO.File.WriteAllLines(chapterLocation, novelContent);
            }
            SetUpdateProgress(0, 0, UpdateState.UpToDate);
            if (BackgroundService.Instance.novelListController.InvokeRequired)
            {
                BackgroundService.Instance.novelListController.BeginInvoke(new System.Windows.Forms.MethodInvoker(delegate
                {
                    NewChapterCount = _newChapterCount + newlyAddedChapter;
                    NotifyPropertyChanged("ChapterCount");
                }));
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Scans the external portion, i.e. the system identifier of the doctype.
        /// </summary>
        /// <param name="url">The url to use.</param>
        /// <param name="typeDefinitions">The type definitions to modify.</param>
        void ScanExternalSubset(String url, DtdContainer typeDefinitions)
        {
            if (Configuration.HasHttpRequester)
            {
                if (!Location.IsAbsolute(url))
                {
                    url = Location.MakeAbsolute(doc.BaseURI, url);
                }

                var http     = Configuration.GetHttpRequester();
                var response = http.Request(new DefaultHttpRequest {
                    Address = new Uri(url)
                });
                var stream    = new SourceManager(response.Content);
                var container = new DtdContainer(typeDefinitions)
                {
                    Url    = url,
                    Parent = doc
                };

                var dtd = new DtdParser(container, stream);
                dtd.IsInternal = false;
                dtd.Parse();
            }
        }
Esempio n. 10
0
        public IActionResult Index(string lastName)
        {
            // W przypadku podania pustego stringu do wyszukiwania wróć do trybu wyświetlania
            // wszystkich rekordów z paginacją
            if (string.IsNullOrEmpty(lastName))
            {
                return(RedirectToActionPermanent("Index", new { page = 1 }));
            }

            List <PersonModel> people = new List <PersonModel>();

            try
            {
                using SourceManager sourceManager = new SourceManager();
                lastName = string.IsNullOrWhiteSpace(lastName) ? "%" : lastName.Replace('*', '%');
                people   = sourceManager.Get(1, int.MaxValue, lastName);
            }
            catch
            {
                TempData["Error"] = "Błąd bazy danych";
                return(View("DataSourceErrorPage")); // wyświetl stronę błędu
            }
            // Żeby nie wyświetlać zbyt wielu kolumn, wyświetlana jest tylko data ostatniego zapisu rekordu
            // Jeśli brak daty aktualizacji => data aktualizacji = data utworzenia (tylko na potrzeby tego widoku)
            people.ForEach(p => { if (p.Updated == null)
                                  {
                                      p.Updated = p.Created;
                                  }
                           });
            return(View(people));
        }
    public void Init(VideoSourceModel videoSource, SourceManager delayTime)
    {
        foreach (Transform item in content.transform)
        {
            Destroy(item.gameObject);
        }

        foreach (CamPoseModel model in videoSource.points)
        {
            GameObject  go          = Instantiate(camPoseObject);
            VideoButton videoButton = go.GetComponent <VideoButton>();
            go.transform.SetParent(content.transform, false);
            videoButton.Init(model);
        }
        content.SetActive(false);
        string fileName = Application.persistentDataPath + "/Documents/video_" + videoSource.id + ".mp4";

        if (!File.Exists(fileName))
        {
            return;
        }

        videoPlayer.url = fileName;

        this.transform.rotation = Quaternion.Euler(0, -90, 0);
    }
Esempio n. 12
0
        private void sourceChecker_DoWork(object sender, DoWorkEventArgs e)
        {
            source = SourceManager.GetSource(sourceLocation, sourceID);
            Tuple <bool, string> result = source.VerifySource();

            e.Result = result;
        }
Esempio n. 13
0
 /// <summary>
 /// Creates a new tokenizer for XML documents.
 /// </summary>
 /// <param name="source">The source code manager.</param>
 public XmlTokenizer(SourceManager source)
     : base(source)
 {
     _dtd = new DtdContainer();
     _dtd.AddEntity(new Entity
     {
         NodeName  = "amp",
         NodeValue = "&"
     });
     _dtd.AddEntity(new Entity
     {
         NodeName  = "lt",
         NodeValue = "<"
     });
     _dtd.AddEntity(new Entity
     {
         NodeName  = "gt",
         NodeValue = ">"
     });
     _dtd.AddEntity(new Entity
     {
         NodeName  = "apos",
         NodeValue = "'"
     });
     _dtd.AddEntity(new Entity
     {
         NodeName  = "quot",
         NodeValue = "\""
     });
 }
Esempio n. 14
0
 private void Awake()
 {
     instance      = this;
     clipManager   = new ClipManager();
     sourceManager = new SourceManager(gameObject);
     InvokeRepeating("DelFreeSource", 10, 5);
 }
        public static void ImportClasses(this OGLContext context, bool applyKeywords = false)
        {
            if (context == null || context.Config == null)
            {
                return;
            }
            context.Classes.Clear();
            context.ClassesSimple.Clear();
            var files = SourceManager.EnumerateFiles(context, context.Config.Classes_Directory, SearchOption.TopDirectoryOnly);

            foreach (var f in files)
            {
                try
                {
                    using (TextReader reader = f.Value.GetReader())
                    {
                        ClassDefinition s = (ClassDefinition)ClassDefinition.Serializer.Deserialize(reader);
                        s.Source = f.Value.Source;
                        s.Register(context, f.Value.FullName, applyKeywords);
                    }
                }
                catch (Exception e)
                {
                    ConfigManager.LogError("Error reading " + f.ToString(), e);
                }
            }
        }
Esempio n. 16
0
 /// <summary>
 /// See 8.2.4 Tokenization
 /// </summary>
 /// <param name="source">The source code manager.</param>
 public HtmlTokenizer(SourceManager source)
     : base(source)
 {
     _model = HtmlParseMode.PCData;
     _acceptsCharacterData = false;
     _buffer = new StringBuilder();
 }
Esempio n. 17
0
        public IActionResult Edit(PersonModel model)
        {
            var _repo = new SourceManager();

            _repo.Update(model);
            return(RedirectToAction("Index"));
        }
Esempio n. 18
0
 public IActionResult Delete(PersonModel personModel)
 {
     SourceManager.Delete(personModel.ID);
     TempData["mess"]  = "Deleted";
     TempData["alert"] = "alert alert-danger";
     return(Redirect("/Person/index"));
 }
Esempio n. 19
0
 /// <summary>
 /// Creates a new DTD tokenizer with the given source and container.
 /// </summary>
 /// <param name="container">The container to use.</param>
 /// <param name="src">The source to inspect.</param>
 public DtdPlainTokenizer(DtdContainer container, SourceManager src)
     : base(src)
 {
     _container = container;
     _external  = true;
     _stream    = new IntermediateStream(src);
 }
Esempio n. 20
0
        public IActionResult Remove(int id)
        {
            var source = new SourceManager();
            var record = source.GetById(id);

            return(View(record));
        }
Esempio n. 21
0
        public SourceLibraryViewModel(
            SourceManager sourceManager,
            OpenDetailsCommand openDetailsCommand,
            GetDetailsCommand getDetailsCommand,
            InfiniteScrollCommand infiniteScrollCommand,
            GetFinalizedCommand getFinalizedCommand,
            ShowLetherCommand showLetherCommand)
        {
            _sourceManager         = sourceManager;
            _openDetailsCommand    = openDetailsCommand;
            _getDetailsCommand     = getDetailsCommand;
            _infiniteScrollCommand = infiniteScrollCommand;
            _getFinalizedCommand   = getFinalizedCommand;
            _showLetherCommand     = showLetherCommand;
            _hqsources             = _sourceManager.GetSources();

            Sources = new string[] {
                "MangaHost", "YesMangas",
                "UnionMangas", "MangasProject",
                "MangaLivre"
            };
            started        = false;
            SelectedSource = Sources[4];
            NavigationEventHub.Navigated += OnNavigated;
        }
Esempio n. 22
0
        public IActionResult Index(string lastName)
        {
            try
            {
                if (lastName.Length < 65 && lastName != "" && lastName != null)
                {
                    ViewBag.Title          = "Search Result | The Phone Book";
                    ViewBag.SearchLastName = lastName;
                    ViewBag.Subtitle       = $"Search by the surname: {ViewBag.SearchLastName}";
                    var searchList = SourceManager.GetByLastName(lastName);
                    return(View("List", searchList));
                }
            }
            catch (NullReferenceException)
            {
                TempData["WrongData"] = "Wrong data. Try again.";
                return(View());
            }
            catch (ArgumentNullException)
            {
                TempData["WrongData"] = "Wrong data. Try again.";
                return(View());
            }
            catch (Exception)
            {
                TempData["WrongData"] = "Wrong data. Try again.";
                return(View());
            }

            return(View());
        }
Esempio n. 23
0
 /// <summary>
 /// Creates a new DTD tokenizer with the given source and container.
 /// </summary>
 /// <param name="container">The container to use.</param>
 /// <param name="src">The source to inspect.</param>
 public DtdPlainTokenizer(DtdContainer container, SourceManager src)
     : base(src)
 {
     _container = container;
     _external = true;
     _stream = new IntermediateStream(src);
 }
Esempio n. 24
0
        public static void ImportItems(this OGLContext context)
        {
            if (context == null || context.Config == null)
            {
                return;
            }
            context.Items.Clear();
            context.ItemLists.Clear();
            context.ItemsSimple.Clear();
            var files = SourceManager.EnumerateFiles(context, context.Config.Items_Directory);

            foreach (var f in files)
            {
                try
                {
                    Uri source = new Uri(SourceManager.GetDirectory(f.Value, context.Config.Items_Directory).FullName);
                    Uri target = new Uri(f.Key.DirectoryName);
                    using (TextReader reader = new StreamReader(f.Key.FullName))
                    {
                        Item s = (Item)Item.Serializer.Deserialize(reader);
                        s.Category = Make(context, source.MakeRelativeUri(target));
                        s.Source   = f.Value;
                        s.Register(context, f.Key.FullName);
                    }
                }
                catch (Exception e)
                {
                    ConfigManager.LogError("Error reading " + f.ToString(), e);
                }
            }
        }
Esempio n. 25
0
        private void RemoveClutterFlow()
        {
            Clutter.Threads.Enter();
            music_library.Properties.Remove("Nereid.SourceContents");
            Clutter.Threads.Leave();
            clutter_flow_contents.Dispose();
            clutter_flow_contents = null;

            source_manager.ActiveSourceChanged -= HandleActiveSourceChanged;
            BrowserAction.Activated            -= OnToggleBrowser;
            BrowserAction.Active     = ClutterFlowSchemas.OldShowBrowser.Get();
            CfBrowsAction.Activated -= OnToggleClutterFlow;
            CfBrowsAction.Visible    = false;

            action_service.RemoveActionGroup("ClutterFlowView");
            action_service.UIManager.RemoveUi(ui_manager_id);
            clutterflow_actions = null;
            cfbrows_action      = null;

            preference_service = null;
            source_manager     = null;
            music_library      = null;
            action_service     = null;
            browser_action     = null;
            cfbrows_action     = null;
        }
Esempio n. 26
0
        public IActionResult Edit(int id)
        {
            var _repo = new SourceManager();
            var model = _repo.GetByID(id);

            return(View(model));
        }
Esempio n. 27
0
        public static void ImportConditions(this OGLContext context)
        {
            if (context == null || context.Config == null)
            {
                return;
            }
            context.Conditions.Clear();
            context.ConditionsSimple.Clear();
            var files = SourceManager.EnumerateFiles(context, context.Config.Conditions_Directory, SearchOption.TopDirectoryOnly);

            foreach (var f in files)
            {
                try
                {
                    using (TextReader reader = new StreamReader(f.Key.FullName))
                    {
                        Condition s = (Condition)Condition.Serializer.Deserialize(reader);
                        s.Source = f.Value;
                        s.Register(context, f.Key.FullName);
                    }
                }
                catch (Exception e)
                {
                    ConfigManager.LogError("Error reading " + f.ToString(), e);
                }
            }
        }
Esempio n. 28
0
        public IActionResult Delete(int id)
        {
            var         _repo = new SourceManager();
            PersonModel model = _repo.GetByID(id);

            return(View(model));
        }
Esempio n. 29
0
        public void NewspaperDtdComplete()
        {
            var s = new SourceManager(@"<!DOCTYPE NEWSPAPER [

 <!ELEMENT NEWSPAPER (ARTICLE+)>
 <!ELEMENT ARTICLE (HEADLINE,BYLINE,LEAD,BODY,NOTES)>
 <!ELEMENT HEADLINE (#PCDATA)>
 <!ELEMENT BYLINE (#PCDATA)>
 <!ELEMENT LEAD (#PCDATA)>
 <!ELEMENT BODY (#PCDATA)>
 <!ELEMENT NOTES (#PCDATA)>

 <!ATTLIST ARTICLE AUTHOR CDATA #REQUIRED>
 <!ATTLIST ARTICLE EDITOR CDATA #IMPLIED>
 <!ATTLIST ARTICLE DATE CDATA #IMPLIED>
 <!ATTLIST ARTICLE EDITION CDATA #IMPLIED>

 <!ENTITY NEWSPAPER ""Vervet Logic Times"">
 <!ENTITY PUBLISHER ""Vervet Logic Press"">
 <!ENTITY COPYRIGHT 'Copyright 1998 Vervet Logic Press'>

 ]>");
            var t = new XmlTokenizer(s);

            t.DTD.Reset();
            var e = t.Get();

            Assert.AreEqual(XmlTokenType.DOCTYPE, e.Type);
            var d = (XmlDoctypeToken)e;

            Assert.IsFalse(d.IsNameMissing);
            Assert.AreEqual("NEWSPAPER", d.Name);
            Assert.IsTrue(d.IsSystemIdentifierMissing);
            Assert.AreEqual(14, t.DTD.Count);
        }
Esempio n. 30
0
        public IActionResult Index(int id = 1, string name = "")
        {
            int count = SourceManager.GetCount(name);

            int prev = id - 1;
            int next = id + 1;

            if (id <= 1)
            {
                prev = 1;
            }

            if (count <= id * 5)
            {
                next = id;
            }

            ViewBag.Title = "Home";
            ViewBag.Name  = name;
            ViewBag.Prev  = prev;
            ViewBag.Next  = next;
            ViewBag.ID    = id;

            return(View(SourceManager.Get(id, 5, name)));
        }
Esempio n. 31
0
 /// <summary>
 /// Creates a new tokenizer for XML documents.
 /// </summary>
 /// <param name="source">The source code manager.</param>
 public XmlTokenizer(SourceManager source)
     : base(source)
 {
     _dtd = new DtdContainer();
     _dtd.AddEntity(new DOM.Entity
     {
         NotationName = "amp",
         NodeValue = "&"
     });
     _dtd.AddEntity(new DOM.Entity
     {
         NotationName = "lt",
         NodeValue = "<"
     });
     _dtd.AddEntity(new DOM.Entity
     {
         NotationName = "gt",
         NodeValue = ">"
     });
     _dtd.AddEntity(new DOM.Entity
     {
         NotationName = "apos",
         NodeValue = "'"
     });
     _dtd.AddEntity(new DOM.Entity
     {
         NotationName = "quot",
         NodeValue = "\""
     });
 }
Esempio n. 32
0
 public IActionResult RemoveConfirm(int id)
 {
     SourceManager.Remove(id);
     ViewBag.Title       = "Delete an entry | The Phone Book";
     TempData["deleted"] = "Successfully deleted!";
     return(View());
 }
        public static void ImportBackgrounds(this OGLContext context)
        {
            if (context == null || context.Config == null)
            {
                return;
            }
            context.Backgrounds.Clear();
            context.BackgroundsSimple.Clear();

            var files = SourceManager.EnumerateFiles(context, context.Config.Backgrounds_Directory, SearchOption.TopDirectoryOnly);

            foreach (var f in files)
            {
                try
                {
                    using (TextReader reader = f.Value.GetReader())
                    {
                        Background s = (Background)Background.Serializer.Deserialize(reader);
                        s.Source = f.Value.Source;
                        foreach (Feature fea in s.Features)
                        {
                            fea.Source = f.Value.Source;
                        }
                        s.Register(context, f.Value.FullName);
                    }
                }
                catch (Exception e)
                {
                    ConfigManager.LogError("Error reading " + f.ToString(), e);
                }
            }
        }
Esempio n. 34
0
 public void Dispose()
 {
     var sm = new SourceManager ();
     sm.Initialize ();
     sm.AddSource (new ErrorSource ("Baz"));
     Assert.IsFalse (sm.Sources.Count == 0);
     sm.Dispose ();
     Assert.IsTrue (sm.Sources.Count == 0);
 }
Esempio n. 35
0
 /// <summary>
 /// See 8.2.4 Tokenization
 /// </summary>
 /// <param name="source">The source code manager.</param>
 public HtmlTokenizer(SourceManager source)
 {
     src = source;
     model = HtmlParseMode.PCData;
     buffered = false;
     allowCdata = true;
     reference = new StringBuilder();
     stringBuffer = new StringBuilder();
     tokenBuffer = new Queue<HtmlToken>();
 }
Esempio n. 36
0
        void IExtensionService.Initialize ()
        {
            elements_service = ServiceManager.Get<GtkElementsService> ();
            interface_action_service = ServiceManager.Get<InterfaceActionService> ();
            source_manager = ServiceManager.SourceManager;
            player = ServiceManager.PlayerEngine;

            if (!ServiceStartup ()) {
                ServiceManager.ServiceStarted += OnServiceStarted;
            }
        }
Esempio n. 37
0
        /// <summary>
        /// Creates a new Dtd parser that uses the given container
        /// as the result for parsing the given source.
        /// </summary>
        /// <param name="container">The container to use.</param>
        /// <param name="source">The source to parse.</param>
        public DtdParser(DtdContainer container, SourceManager source)
        {
            _tokenizer = new DtdTokenizer(container, source);
            _result = container;
            _src = source;

            _tokenizer.ErrorOccurred += (s, ev) =>
            {
                if (ErrorOccurred != null)
                    ErrorOccurred(this, ev);
            };
        }
Esempio n. 38
0
        private void OnServiceStarted (ServiceStartedArgs args)
        {
            if (args.Service is Banshee.Gui.InterfaceActionService) {
                interface_action_service = (InterfaceActionService)args.Service;
            } else if (args.Service is GtkElementsService) {
                elements_service = (GtkElementsService)args.Service;
            } else if (args.Service is SourceManager) {
                source_manager = ServiceManager.SourceManager;
            } else if (args.Service is PlayerEngineService) {
                player = ServiceManager.PlayerEngine;
            }

            ServiceStartup ();
        }
Esempio n. 39
0
        /// <summary>
        /// Creates a new CSS parser instance parser with the specified stylesheet
        /// based on the given source manager.
        /// </summary>
        /// <param name="stylesheet">The stylesheet to be constructed.</param>
        /// <param name="source">The source to use.</param>
        internal CssParser(CSSStyleSheet stylesheet, SourceManager source)
        {
            ignore = true;
            buffer = new StringBuilder();
            tokenizer = new CssTokenizer(source);

            tokenizer.ErrorOccurred += (s, ev) =>
            {
                if (ErrorOccurred != null)
                    ErrorOccurred(this, ev);
            };

            started = false;
            sheet = stylesheet;
            open = new Stack<CSSRule>();
        }
Esempio n. 40
0
        /// <summary>
        /// Creates a new instance of the XML parser with the specified document
        /// based on the given source manager.
        /// </summary>
        /// <param name="document">The document instance to be constructed.</param>
        /// <param name="source">The source to use.</param>
        internal XmlParser(XMLDocument document, SourceManager source)
        {
            tokenizer = new XmlTokenizer(source);

            tokenizer.ErrorOccurred += (s, ev) =>
            {
                if (ErrorOccurred != null)
                    ErrorOccurred(this, ev);
            };

            started = false;
            doc = document;
            standalone = false;
            open = new List<Element>();
            insert = XmlTreeMode.Initial;
        }
Esempio n. 41
0
        public void AddRemove()
        {
            var sm = new SourceManager ();
            var src = new ErrorSource ("Foo");
            sm.AddSource (src, false);
            Assert.AreEqual (sm.Sources.Count, 1);

            var src2 = new ErrorSource ("Bar");
            sm.AddSource (src2, true);
            Assert.IsTrue (sm.Sources.Count == 2);
            Assert.AreEqual (src2, sm.DefaultSource);
            Assert.AreEqual (src2, sm.ActiveSource);

            sm.SetActiveSource (src);
            Assert.AreEqual (src, sm.ActiveSource);

            sm.RemoveSource (src);
            Assert.IsTrue (sm.Sources.Count == 1);
        }
Esempio n. 42
0
 /// <summary>
 /// Creates a new DTD tokenizer with the given source and container.
 /// </summary>
 /// <param name="container">The container to use.</param>
 /// <param name="src">The source to inspect.</param>
 public DtdTokenizer(DtdContainer container, SourceManager src)
     : base(container, src)
 {
     _includes = 0;
     IsExternal = true;
 }
        private void RemoveClutterFlow()
        {
            Clutter.Threads.Enter ();
            music_library.Properties.Remove ("Nereid.SourceContents");
            Clutter.Threads.Leave ();
            clutter_flow_contents.Dispose ();
            clutter_flow_contents = null;

            source_manager.ActiveSourceChanged -= HandleActiveSourceChanged;
            BrowserAction.Activated -= OnToggleBrowser;
            BrowserAction.Active = ClutterFlowSchemas.OldShowBrowser.Get ();
            CfBrowsAction.Activated -= OnToggleClutterFlow;
            CfBrowsAction.Visible = false;

            action_service.RemoveActionGroup ("ClutterFlowView");
            action_service.UIManager.RemoveUi (ui_manager_id);
            clutterflow_actions = null;
            cfbrows_action = null;

            preference_service = null;
            source_manager = null;
            music_library = null;
            action_service = null;
            browser_action = null;
            cfbrows_action = null;
        }
        void IExtensionService.Initialize()
        {
            ClutterHelper.Init ();

            preference_service = ServiceManager.Get<PreferenceService> ();
            action_service = ServiceManager.Get<InterfaceActionService> ();

            source_manager = ServiceManager.SourceManager;
            music_library = source_manager.MusicLibrary;

            if (!SetupPreferences () || !SetupInterfaceActions ()) {
                ServiceManager.ServiceStarted += OnServiceStarted;
            } else if (!SetupSourceContents ()) {
                source_manager.SourceAdded += OnSourceAdded;
            }

            //--> TODO Banshee.ServiceStack.Application. register Exit event to close threads etc.
        }
Esempio n. 45
0
 public DtdTokenizer(SourceManager src)
     : base(src)
 {
     End = Specification.EOF;
 }
Esempio n. 46
0
        /// <summary>
        /// Scans the external portion, i.e. the system identifier of the doctype.
        /// </summary>
        /// <param name="url">The url to use.</param>
        /// <param name="typeDefinitions">The type definitions to modify.</param>
        void ScanExternalSubset(String url, DtdContainer typeDefinitions)
        {
            if (Configuration.HasHttpRequester)
            {
                if (!Location.IsAbsolute(url))
                    url = Location.MakeAbsolute(doc.BaseURI, url);

                var http = Configuration.GetHttpRequester();
                var response = http.Request(new DefaultHttpRequest { Address = new Uri(url) });
                var stream = new SourceManager(response.Content);
                var container = new DtdContainer(typeDefinitions)
                {
                    Url = url,
                    Parent = doc
                };

                var dtd = new DtdParser(container, stream);
                dtd.IsInternal = false;
                dtd.Parse();
            }
        }
 public CssTokenizer(SourceManager source)
 {
     stringBuffer = new StringBuilder();
     src = source;
 }
Esempio n. 48
0
        public HTMLDocument Load(String url)
        {
            location = url;
            Cookie = new Cookie();

            for (int i = _children.Length - 1; i >= 0; i++)
                RemoveChild(_children[i]);

            ReadyState = Readiness.Loading;
            QuirksMode = QuirksMode.Off;
            var stream = Builder.Stream(url);
            var source = new SourceManager(stream);
            var parser = new HtmlParser(this, source);
            return parser.Result;
        }
Esempio n. 49
0
 public IntermediateStream(SourceManager src)
 {
     _start = src.InsertionPoint - 1;
     _pos = new Stack<Int32>();
     _params = new Stack<String>();
     _texts = new Stack<String>();
     _base = src;
 }
Esempio n. 50
0
 public XmlBaseTokenizer(SourceManager src)
     : base(src)
 {
 }
 /// <summary>
 /// Creates a new tokenizer for XML documents.
 /// </summary>
 /// <param name="source">The source code manager.</param>
 public XmlTokenizer(SourceManager source)
 {
     src = source;
     stringBuffer = new StringBuilder();
 }
Esempio n. 52
0
        /// <summary>
        /// Sets the document's encoding to the given one.
        /// </summary>
        /// <param name="source">The source to change.</param>
        /// <param name="encoding">The encoding to use.</param>
        static void SetEncoding(SourceManager source, String encoding)
        {
            //TODO
            return;

            if (DocumentEncoding.IsSupported(encoding))
            {
                var enc = DocumentEncoding.Resolve(encoding);

                if (enc != null)
                    source.Encoding = enc;
            }
        }
Esempio n. 53
0
 internal SourceManager(SourceManager.Internal native)
     : this(&native)
 {
 }
Esempio n. 54
0
 internal SourceManager(SourceManager.Internal* native)
     : this(new global::System.IntPtr(native))
 {
 }
Esempio n. 55
0
        public HTMLDocument Load(String url)
        {
            _location.Href = url;
            Cookie = new Cookie();

            for (int i = _children.Length - 1; i >= 0; i++)
                RemoveChild(_children[i]);

            ReadyState = Readiness.Loading;
            QuirksMode = QuirksMode.Off;
            var task = Builder.GetFromUrl(url);

            task.ContinueWith(m =>
            {
                if (m.IsCompleted && !m.IsFaulted)
                {
                    var stream = m.Result;
                    var source = new SourceManager(stream);
                    var parser = new HtmlParser(this, source);
                    parser.Parse();
                }
            });

            return this;
        }
Esempio n. 56
0
 public CssTokenizer(SourceManager source)
     : base(source)
 {
     _stringBuffer = new StringBuilder();
     _src = source;
 }
Esempio n. 57
0
        /// <summary>
        /// Creates a new instance of the HTML parser with the specified document
        /// based on the given source manager.
        /// </summary>
        /// <param name="document">The document instance to be constructed.</param>
        /// <param name="source">The source to use.</param>
        internal HtmlParser(HTMLDocument document, SourceManager source)
        {
            tokenizer = new HtmlTokenizer(source);

            tokenizer.ErrorOccurred += (s, ev) =>
            {
                if (ErrorOccurred != null)
                    ErrorOccurred(this, ev);
            };

            started = false;
            doc = document;
            open = new List<Element>();
            formatting = new List<Element>();
            frameset = true;
            insert = HtmlTreeMode.Initial;
        }
Esempio n. 58
0
        /// <summary>
        /// Gets the text included in the external source.
        /// </summary>
        /// <param name="url">The URL of the external source.</param>
        /// <returns>The contained string.</returns>
        String GetText(String url)
        {
            if (Configuration.HasHttpRequester)
            {
                if (!Location.IsAbsolute(url))
                    url = Location.MakeAbsolute(_result.Url, url);

                var http = Configuration.GetHttpRequester();
                var response = http.Request(new DefaultHttpRequest { Address = new Uri(url) });
                var stream = new SourceManager(response.Content);
                var tok = new DtdPlainTokenizer(_result, stream);
                var token = tok.Get();

                if (token.Type == DtdTokenType.TextDecl)
                {
                    var pi = (DtdDeclToken)token;

                    if (!String.IsNullOrEmpty(pi.Encoding))
                        SetEncoding(stream, pi.Encoding);

                    token = tok.Get();
                }

                if (token.Type == DtdTokenType.Comment)
                    return ((DtdCommentToken)token).Data;
            }

            return String.Empty;
        }