Example #1
0
        public GuiLoader(
            Loader loader,
            NewsService newsService,
            DownloaderSubsystem downloaderSubsystem,
            DeckListModel deckListModel)
        {
            _loader        = loader;
            _deckListModel = deckListModel;

            _loader.Add(newsService.FetchNews);
            _loader.Add(downloaderSubsystem.CalculateProgress);
        }
Example #2
0
        public void Test_Count()
        {
            var loader = new Loader();

            loader.Add(_sitemapIndex);
            loader.Add(_urlset);
            Assert.IsTrue(
                loader.SitemapIndexes.Count == 1 &&                  // expect single sitemap index
                loader.Urlsets.Count == 1 &&                         // expect single urlset
                loader.SitemapIndexes.First().Entities.Count == 3 && // expect 3 entities from sitemapindex
                loader.Urlsets.First().Entities.Count == 36          // expect 36 entities from urlset
                );
        }
Example #3
0
        public void Test_Read_Write_Equals_From_Absolute_Url()
        {
            string absoluteUrl = "https://www.dr.dk/sitemap.xml";
            string s           = string.Empty;
            Urlset urlset      = null;

            using (var httpLoader = new HttpLoader(new Url(absoluteUrl)))
            {
                try
                {
                    urlset = httpLoader.Urlsets.FirstOrDefault();
                    if (urlset == null)
                    {
                        Assert.Fail($"urlset expected from {urlset} is null");
                    }
                    s = Composer.ComposeUrlset(httpLoader.Urlsets.First());
                }
                catch (Exception ex)
                {
                    Assert.Fail($"error {ex.Message}");
                }
            }
            var loader = new Loader();

            loader.Add(urlset);

            Assert.IsTrue(loader.Urlsets.First().Entities.Count == urlset.Entities.Count);
        }
        public void Swap_10000_Entities()
        {
            var buffer = new Loader();
            var sw     = new Stopwatch();

            for (int i = 0; i < 10000; i++)
            {
                buffer.Add(new Invoice(i, i + 10));
            }

            sw.Start();
            for (int i = 0; i < 10000 - 10; i++)
            {
                buffer.Swap(new Invoice(i, i + 10), new User(i + 1, i + 11));
            }
            sw.Stop();

            Assert.IsTrue(sw.ElapsedMilliseconds <= 1500);
        }
        // Use this for initialization
        void Start()
        {
            complementaryFuzer = new ComplementaryFilter();
            wiimote = GameObject.Find("wiimote");
            Angles = new Vector3();

            vSliderValuePrev = vSliderValue = 128f;

            timer = new Timer(500.0);
            timer.Elapsed += new ElapsedEventHandler(onTimerElapsed);

             ui= this.GetComponent<UserInterfaceWindow>();

            //supporting devices with custom drivers
            //When you add them add specialized first then XInputDriver  then wide range supporting drivers UnityDriver
            #if (UNITY_STANDALONE_WIN)
            InputManager.hidInterface.defaultDriver = new UnityDriver();
            InputManager.AddDriver(new ThrustMasterDriver());
            InputManager.AddDriver(new WiiDriver());
            //InputManager.AddDriver(new XInputDriver());

            #endif

            #if (UNITY_STANDALONE_OSX)
            //InputManager.AddDriver(new ThrustMasterDriver());
            //InputManager.AddDriver(new XInputDriver());

            InputManager.hidInterface.defaultDriver=new UnityDriver();
            #endif

            #if (UNITY_STANDALONE_ANDROID)
            InputManager.AddDriver(new ThrustMasterDriver());
            #endif

            //TODO think of better entry point
            InputManager.hidInterface.Enumerate();

            // !!!Postive аxes mapping only currently(need to find way to distinct postive from negative axis in Unity way of handling)
            // if(Application.isPlaying)
            //     InputManager.AddDriver(new UnityDriver());

            //if you want to load some states from .xml and add custom manually first load settings xml
            //!!!Application.streamingAssetPath gives "Raw" folder in web player

            #if (UNITY_STANDALONE || UNITY_EDITOR ) && !UNITY_WEBPLAYER && !UNITY_ANDROID
            //UnityEngine.Debug.Log("Standalone");

            if (ui != null)
            {//settingsXML would trigger internal loading mechanism (only for testing)

                InputManager.loadSettings(Path.Combine(Application.streamingAssetsPath, "InputSettings.xml"));

                ui.settings = InputManager.Settings;
            }

            manuallyAddStateAndHandlers();

            #endif

            #region Load InputSettings.xml Android
            #if UNITY_ANDROID

            Loader request = new Loader();

            if (Application.platform == RuntimePlatform.Android)
            {
                if (File.Exists(Application.persistentDataPath + "/" + "InputSettings.xml"))
                {

                    if (ui != null)
                    {
                        Debug.Log("Game>> Try to load from " + Application.persistentDataPath);
                        InputManager.loadSettings(Application.persistentDataPath + "/" + "InputSettings.xml");
                        ui.settings = InputManager.Settings;
                        manuallyAddStateAndHandlers();
                        return;

                    }
                }
                else
                {// content of StreamingAssets get packed inside .APK and need to be load with WWW
                    request.Add(Path.Combine(Application.streamingAssetsPath, "InputSettings.xml"));
                }

                request.LoadComplete += new EventHandler<LoaderEvtArgs<List<WWW>>>(onLoadComplete);
                request.Error += new EventHandler<LoaderEvtArgs<String>>(onLoadError);
                request.LoadItemComplete += new EventHandler<LoaderEvtArgs<WWW>>(onLoadItemComplete);
                request.load();
            }
            else //TARGET=ANDROID but playing in EDITOR => use Standalone setup
            {
                if (ui != null)
                {//settingsXML would trigger internal loading mechanism (only for testing)

                    InputManager.loadSettings(Path.Combine(Application.streamingAssetsPath, "InputSettings.xml"));

                    ui.settings = InputManager.Settings;
                }

                manuallyAddStateAndHandlers();

            }

            #endif
            #endregion

            #if(UNITY_WEBPLAYER || UNITY_EDITOR) && !UNITY_STANDALONE && !UNITY_ANDROID
            Loader request = new Loader();

                //UNITY_WEBPLAYER: Application.dataPath "http://localhost/appfolder/"
                request.Add(Application.dataPath+"/StreamingAssets/InputSettings.xml");

            request.LoadComplete += new EventHandler<LoaderEvtArgs<List<WWW>>>(onLoadComplete);
            request.Error += new EventHandler<LoaderEvtArgs<String>>(onLoadError);
            request.LoadItemComplete += new EventHandler<LoaderEvtArgs<WWW>>(onLoadItemComplete);
            request.load();
            #endif
        }
Example #6
0
        // Use this for initialization
        void Start()
        {
            complementaryFuzer = new ComplementaryFilter();
            wiimote            = GameObject.Find("wiimote");
            Angles             = new Vector3();



            vSliderValuePrev = vSliderValue = 128f;

            timer          = new Timer(500.0);
            timer.Elapsed += new ElapsedEventHandler(onTimerElapsed);

            ui = this.GetComponent <UserInterfaceWindow>();


            //supporting devices with custom drivers
            //When you add them add specialized first then XInputDriver  then wide range supporting drivers UnityDriver
#if (UNITY_STANDALONE_WIN)
            InputManager.hidInterface.defaultDriver = new UnityDriver();
            InputManager.AddDriver(new ThrustMasterDriver());
            InputManager.AddDriver(new WiiDriver());
            //InputManager.AddDriver(new XInputDriver());
#endif

#if (UNITY_STANDALONE_OSX)
            //InputManager.AddDriver(new ThrustMasterDriver());
            //InputManager.AddDriver(new XInputDriver());

            InputManager.hidInterface.defaultDriver = new UnityDriver();
#endif

#if (UNITY_STANDALONE_ANDROID)
            InputManager.AddDriver(new ThrustMasterDriver());
#endif


            //TODO think of better entry point
            InputManager.hidInterface.Enumerate();



            // !!!Postive аxes mapping only currently(need to find way to distinct postive from negative axis in Unity way of handling)
            // if(Application.isPlaying)
            //     InputManager.AddDriver(new UnityDriver());


            //if you want to load some states from .xml and add custom manually first load settings xml
            //!!!Application.streamingAssetPath gives "Raw" folder in web player

#if (UNITY_STANDALONE || UNITY_EDITOR) && !UNITY_WEBPLAYER && !UNITY_ANDROID
            //UnityEngine.Debug.Log("Standalone");



            if (ui != null)
            {//settingsXML would trigger internal loading mechanism (only for testing)
                InputManager.loadSettings(Path.Combine(Application.streamingAssetsPath, "InputSettings.xml"));



                ui.settings = InputManager.Settings;
            }


            manuallyAddStateAndHandlers();
#endif

            #region Load InputSettings.xml Android
#if UNITY_ANDROID
            Loader request = new Loader();


            if (Application.platform == RuntimePlatform.Android)
            {
                if (File.Exists(Application.persistentDataPath + "/" + "InputSettings.xml"))
                {
                    if (ui != null)
                    {
                        Debug.Log("Game>> Try to load from " + Application.persistentDataPath);
                        InputManager.loadSettings(Application.persistentDataPath + "/" + "InputSettings.xml");
                        ui.settings = InputManager.Settings;
                        manuallyAddStateAndHandlers();
                        return;
                    }
                }
                else
                {// content of StreamingAssets get packed inside .APK and need to be load with WWW
                    request.Add(Path.Combine(Application.streamingAssetsPath, "InputSettings.xml"));
                }


                request.LoadComplete     += new EventHandler <LoaderEvtArgs <List <WWW> > >(onLoadComplete);
                request.Error            += new EventHandler <LoaderEvtArgs <String> >(onLoadError);
                request.LoadItemComplete += new EventHandler <LoaderEvtArgs <WWW> >(onLoadItemComplete);
                request.load();
            }
            else //TARGET=ANDROID but playing in EDITOR => use Standalone setup
            {
                if (ui != null)
                {//settingsXML would trigger internal loading mechanism (only for testing)
                    InputManager.loadSettings(Path.Combine(Application.streamingAssetsPath, "InputSettings.xml"));



                    ui.settings = InputManager.Settings;
                }


                manuallyAddStateAndHandlers();
            }
#endif
            #endregion

#if (UNITY_WEBPLAYER || UNITY_EDITOR) && !UNITY_STANDALONE && !UNITY_ANDROID
            Loader request = new Loader();

            //UNITY_WEBPLAYER: Application.dataPath "http://localhost/appfolder/"
            request.Add(Application.dataPath + "/StreamingAssets/InputSettings.xml");


            request.LoadComplete     += new EventHandler <LoaderEvtArgs <List <WWW> > >(onLoadComplete);
            request.Error            += new EventHandler <LoaderEvtArgs <String> >(onLoadError);
            request.LoadItemComplete += new EventHandler <LoaderEvtArgs <WWW> >(onLoadItemComplete);
            request.load();
#endif
        }
        // Use this for initialization
        void Start()
        {
            if (String.IsNullOrEmpty(settingsFileName))
            {
                Debug.LogError("Please add settings(.xml or .bin) fileName from StreamingAssets");
                return;
            }


            ui = this.GetComponent <UserInterfaceWindow>();

            //supporting devices with custom drivers
            //When you add them add specialized first then XInputDriver  then wide range supporting drivers like WinMM or OSXDriver
            //supporting devices with custom drivers
            //When you add them add specialized first then XInputDriver  then wide range supporting drivers WinMM or OSXDriver
                #if (UNITY_STANDALONE_WIN)
            InputManager.AddDriver(new ThrustMasterDriver());
            //InputManager.AddDriver(new WiiDriver());
            InputManager.AddDriver(new XInputDriver());
            //change default driver
            //InputManager.hidInterface.defaultDriver=new UnityDriver();
                #endif
                #if (UNITY_STANDALONE_OSX)
            InputManager.AddDriver(new ThrustMasterDriver());
            InputManager.AddDriver(new XInputDriver());
            //change default driver
            //InputManager.hidInterface.defaultDriver=new UnityDriver();
                #endif

                #if (UNITY_STANDALONE_ANDROID)
            InputManager.AddDriver(new ThrustMasterDriver());
            InputManager.AddDriver(new XInputDriver());
                #endif

            if (profiles == null)
            {
                InputManager.hidInterface.LoadProfiles("DeviceProfiles");
            }
            else
            {
                InputManager.hidInterface.SetProfiles(profiles);
            }

            InputManager.hidInterface.Enumerate();



            //if you want to load some states from .xml and add custom manually first load settings xml
            //!!!Application.streamingAssetPath gives "Raw" folder in web player

                #if (UNITY_STANDALONE || UNITY_EDITOR) && !UNITY_WEBPLAYER && !UNITY_ANDROID
            //UnityEngine.Debug.Log("Standalone");



            if (ui != null && !String.IsNullOrEmpty(settingsFileName))
            {    //settingsXML would trigger internal loading mechanism (only for testing)
                //load settings from external file

                ui.settings = InputManager.loadSettings(Path.Combine(Application.streamingAssetsPath, settingsFileName));

                //	ui.settings=InputManager.loadSettingsFromXMLText(Path.Combine(Application.streamingAssetsPath,settingsFileName));



                //dispatch Event
                this.m_onLoad.Invoke();
            }
                #endif

            #region Load InputSettings.xml Android
                #if UNITY_ANDROID
            Loader request = new Loader();


            if (Application.platform == RuntimePlatform.Android)
            {
                if (File.Exists(Application.persistentDataPath + "/" + settingsFileName))
                {
                    if (ui != null)
                    {
                        Debug.Log("Game>> Try to load from " + Application.persistentDataPath);

                        ui.settings = InputManager.loadSettings(Application.persistentDataPath + "/" + settingsFileName);


                        //dispatch load complete
                        this.m_onLoad.Invoke();

                        return;
                    }
                }
                else
                {        // content of StreamingAssets get packed inside .APK and need to be load with WWW
                    request.Add(Path.Combine(Application.streamingAssetsPath, "InputSettings.xml"));
                    request.Add(Path.Combine(Application.streamingAssetsPath, "profiles.txt"));
                    request.Add(Path.Combine(Application.streamingAssetsPath, "xbox360_drd.txt"));
                    //....

                    //unpack everything in presistentDataPath
                }


                request.LoadComplete     += new EventHandler <LoaderEvtArgs <List <WWW> > >(onLoadComplete);
                request.Error            += new EventHandler <LoaderEvtArgs <String> >(onLoadError);
                request.LoadItemComplete += new EventHandler <LoaderEvtArgs <WWW> >(onLoadItemComplete);
                request.load();
            }
            else     //TARGET=ANDROID but playing in EDITOR => use Standalone setup
            {
                if (ui != null)
                {        //settingsXML would trigger internal loading mechanism (only for testing)
                    InputManager.loadSettings(Path.Combine(Application.streamingAssetsPath, settingsFileName));



                    ui.settings = InputManager.Settings;
                }
            }
                #endif
            #endregion

                #if (UNITY_WEBPLAYER || UNITY_EDITOR) && !UNITY_STANDALONE && !UNITY_ANDROID
            Loader request = new Loader();

            //UNITY_WEBPLAYER: Application.dataPath "http://localhost/appfolder/"
            request.Add(Application.dataPath + "/StreamingAssets/" + settingsFileName);


            request.LoadComplete     += new EventHandler <LoaderEvtArgs <List <WWW> > >(onLoadComplete);
            request.Error            += new EventHandler <LoaderEvtArgs <String> >(onLoadError);
            request.LoadItemComplete += new EventHandler <LoaderEvtArgs <WWW> >(onLoadItemComplete);
            request.load();
                #endif
        }
        // Use this for initialization
        void Start()
        {
            if (String.IsNullOrEmpty (settingsFileName)) {

                        Debug.LogError("Please add settings(.xml or .bin) fileName from StreamingAssets");
                        return;
                    }

            ui= this.GetComponent<UserInterfaceWindow>();

            //supporting devices with custom drivers
            //When you add them add specialized first then XInputDriver  then wide range supporting drivers like WinMM or OSXDriver
            //supporting devices with custom drivers
            //When you add them add specialized first then XInputDriver  then wide range supporting drivers WinMM or OSXDriver
            #if (UNITY_STANDALONE_WIN)
            InputManager.AddDriver(new ThrustMasterDriver());
            //InputManager.AddDriver(new WiiDriver());
            InputManager.AddDriver(new XInputDriver());
            //change default driver
            //InputManager.hidInterface.defaultDriver=new UnityDriver();
            #endif
            #if (UNITY_STANDALONE_OSX)
            InputManager.AddDriver(new ThrustMasterDriver());
            InputManager.AddDriver(new XInputDriver());
            //change default driver
            //InputManager.hidInterface.defaultDriver=new UnityDriver();

            #endif

            #if (UNITY_STANDALONE_ANDROID)
            InputManager.AddDriver(new ThrustMasterDriver());
            InputManager.AddDriver(new XInputDriver());
            #endif

            if (profiles == null)
                                InputManager.hidInterface.LoadProfiles ("DeviceProfiles");
                        else
                                InputManager.hidInterface.SetProfiles (profiles);

            InputManager.hidInterface.Enumerate();

            //if you want to load some states from .xml and add custom manually first load settings xml
            //!!!Application.streamingAssetPath gives "Raw" folder in web player

            #if (UNITY_STANDALONE || UNITY_EDITOR ) && !UNITY_WEBPLAYER && !UNITY_ANDROID
            //UnityEngine.Debug.Log("Standalone");

            if (ui != null && !String.IsNullOrEmpty (settingsFileName))
            {//settingsXML would trigger internal loading mechanism (only for testing)

            //load settings from external file

            ui.settings=InputManager.loadSettings(Path.Combine(Application.streamingAssetsPath, settingsFileName));

            //	ui.settings=InputManager.loadSettingsFromXMLText(Path.Combine(Application.streamingAssetsPath,settingsFileName));

            //dispatch Event
            this.m_onLoad.Invoke();

            }

            #endif

            #region Load InputSettings.xml Android
            #if UNITY_ANDROID

            Loader request = new Loader();

            if (Application.platform == RuntimePlatform.Android)
            {
                if (File.Exists(Application.persistentDataPath + "/" + settingsFileName))
            {

                if (ui != null)
                {
                    Debug.Log("Game>> Try to load from " + Application.persistentDataPath);

                        ui.settings=InputManager.loadSettings(Application.persistentDataPath + "/" + settingsFileName);

                        //dispatch load complete
                        this.m_onLoad.Invoke();

                    return;

                }
            }
            else
            {// content of StreamingAssets get packed inside .APK and need to be load with WWW
                request.Add(Path.Combine(Application.streamingAssetsPath, "InputSettings.xml"));
                request.Add(Path.Combine(Application.streamingAssetsPath, "profiles.txt"));
                request.Add(Path.Combine(Application.streamingAssetsPath, "xbox360_drd.txt"));
                //....

                //unpack everything in presistentDataPath
            }

            request.LoadComplete += new EventHandler<LoaderEvtArgs<List<WWW>>>(onLoadComplete);
            request.Error += new EventHandler<LoaderEvtArgs<String>>(onLoadError);
            request.LoadItemComplete += new EventHandler<LoaderEvtArgs<WWW>>(onLoadItemComplete);
            request.load();
            }
            else //TARGET=ANDROID but playing in EDITOR => use Standalone setup
            {
            if (ui != null)
            {//settingsXML would trigger internal loading mechanism (only for testing)

                    InputManager.loadSettings(Path.Combine(Application.streamingAssetsPath, settingsFileName));

                ui.settings = InputManager.Settings;
            }

            }

            #endif
            #endregion

            #if(UNITY_WEBPLAYER || UNITY_EDITOR) && !UNITY_STANDALONE && !UNITY_ANDROID
            Loader request = new Loader();

            //UNITY_WEBPLAYER: Application.dataPath "http://localhost/appfolder/"
            request.Add(Application.dataPath+"/StreamingAssets/"+settingsFileName);

            request.LoadComplete += new EventHandler<LoaderEvtArgs<List<WWW>>>(onLoadComplete);
            request.Error += new EventHandler<LoaderEvtArgs<String>>(onLoadError);
            request.LoadItemComplete += new EventHandler<LoaderEvtArgs<WWW>>(onLoadItemComplete);
            request.load();
            #endif
        }