/// <summary>
        /// Create a ResourceLink
        /// </summary>
        /// <param name="ResourceLink"></param>
        /// <returns></returns>
        public async Task <string> CreateResourceLinkAsync(ResourceLink resourceLink)
        {
            CheckInitialized();

            string command = JsonConvert.SerializeObject(resourceLink, new JsonSerializerSettings()
            {
                NullValueHandling = NullValueHandling.Ignore
            });

            HttpClient client = await GetHttpClient().ConfigureAwait(false);

            //Create ResourceLink
            var result = await client.PostAsync(new Uri(ApiBase + "resourcelinks"), new JsonContent(command)).ConfigureAwait(false);

            var jsonResult = await result.Content.ReadAsStringAsync().ConfigureAwait(false);

            DefaultHueResult[] resourceLinkResult = JsonConvert.DeserializeObject <DefaultHueResult[]>(jsonResult);

            if (resourceLinkResult.Length > 0 && resourceLinkResult[0].Success != null && !string.IsNullOrEmpty(resourceLinkResult[0].Success.Id))
            {
                return(resourceLinkResult[0].Success.Id);
            }

            return(null);
        }
        /// <summary>
        /// Imports a new file by the given <see cref="ResourceLink"/>.
        /// </summary>
        /// <param name="resourceLink">The <see cref="ResourceLink"/> from which to load the resource.</param>
        public async Task ImportNewFileAsync(ResourceLink resourceLink)
        {
            if (this.IsLoading)
            {
                return;
            }

            this.IsLoading = true;
            try
            {
                m_currentFile          = resourceLink;
                m_currentImportOptions = GraphicsCore.Current.ImportersAndExporters.CreateImportOptions(m_currentFile);
                base.RaisePropertyChanged(nameof(CurrentFile));
                base.RaisePropertyChanged(nameof(CurrentFileForStatusBar));
                base.RaisePropertyChanged(nameof(CurrentImportOptions));

                await m_scene.ImportAsync(m_currentFile, m_currentImportOptions);
            }
            finally
            {
                this.IsLoading = false;
            }

            base.Messenger.Publish <NewModelLoadedMessage>();
        }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MediaPlayerComponent"/> class.
 /// </summary>
 public MediaPlayerComponent()
 {
     m_mfResourceLock       = new object();
     m_currentVideoLink     = null;
     m_currentCaptureDevice = null;
     m_audioVolume          = 1f;
 }
 private void FindSource()
 {
     //IL_0024: Unknown result type (might be due to invalid IL or missing references)
     //IL_0029: Unknown result type (might be due to invalid IL or missing references)
     //IL_002e: Unknown result type (might be due to invalid IL or missing references)
     //IL_0033: Expected O, but got Unknown
     //IL_008c: Unknown result type (might be due to invalid IL or missing references)
     //IL_0091: Unknown result type (might be due to invalid IL or missing references)
     //IL_0096: Expected O, but got Unknown
     SEName = ResourceName.GetSE(SEID);
     if (!(ResourceLink != null))
     {
         Transform    val = this.get_gameObject().get_transform().get_parent();
         ResourceLink component;
         while (true)
         {
             if (!(val != null) || val.get_name() == "UI Root")
             {
                 return;
             }
             component = val.GetComponent <ResourceLink>();
             if (component != null)
             {
                 AudioClip val2 = component.Get <AudioClip>(SEName);
                 if (val2 != null)
                 {
                     break;
                 }
             }
             val = val.get_transform().get_parent();
         }
         ResourceLink = component;
     }
 }
        public async Task <Response <ResourceLink> > CreateOrUpdateAsync(string linkId, ResourceLink parameters, CancellationToken cancellationToken = default)
        {
            if (linkId == null)
            {
                throw new ArgumentNullException(nameof(linkId));
            }
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            using var message = CreateCreateOrUpdateRequest(linkId, parameters);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            case 201:
            {
                ResourceLink value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                if (document.RootElement.ValueKind == JsonValueKind.Null)
                {
                    value = null;
                }
                else
                {
                    value = ResourceLink.DeserializeResourceLink(document.RootElement);
                }
                return(Response.FromValue(value, message.Response));
            }
Exemple #6
0
        /// <summary>
        /// Disposes all current resources.
        /// </summary>
        private void DisposeResources()
        {
            lock (m_mfResourceLock)
            {
                // Shutdown current session
                if (m_mediaSession != null)
                {
                    m_mediaSession.Shutdown();
                }

                // Clear all references
                m_currentVideoLink     = null;
                m_currentCaptureDevice = null;
                m_currentVideoDuration = TimeSpan.Zero;
                GraphicsHelper.SafeDispose(ref m_displayControl);
                GraphicsHelper.SafeDispose(ref m_audioStreamVolume);
                GraphicsHelper.SafeDispose(ref m_mediaSession);
                m_sessionEventHandler = null;

                GraphicsHelper.SafeDispose(ref m_videoSourceStream);
                GraphicsHelper.SafeDispose(ref m_videoSourceStreamNet);
            }

            // Apply new state
            this.IsPaused = false;
            this.State    = MediaPlayerState.NothingToDo;
        }
 private static void PlaySound(rymFX fx, rymFXSoundInfo info)
 {
     //IL_0018: Unknown result type (might be due to invalid IL or missing references)
     //IL_0074: Unknown result type (might be due to invalid IL or missing references)
     //IL_0079: Expected O, but got Unknown
     if (fx.get_enabled() && (!info.loop || !(info.audio_source != null)) && !string.IsNullOrEmpty(info.clip_name))
     {
         ResourceLink component = fx.GetComponent <ResourceLink>();
         if (component != null)
         {
             string    fileNameWithoutExtension = Path.GetFileNameWithoutExtension(info.clip_name);
             AudioClip val = component.Get <AudioClip>(fileNameWithoutExtension);
             if (val != null)
             {
                 AudioObject audioObject = SoundManager.PlaySE(val, info.loop, fx.get__transform());
                 if (audioObject != null && info.loop)
                 {
                     EffectInfoComponent component2 = fx.GetComponent <EffectInfoComponent>();
                     if (component2 != null)
                     {
                         component2.SetLoopAudioObject(audioObject);
                     }
                 }
             }
             else
             {
                 Log.Error(LOG.RESOURCE, "{0} is not found. ({1})", fileNameWithoutExtension, fx.get_name());
             }
         }
     }
 }
        /// <summary>
        /// Imports a model from the given file.
        /// </summary>
        /// <param name="sourceFile">The source file to be loaded.</param>
        /// <param name="importOptions">Some configuration for the importer.</param>
        public ImportedModelContainer ImportModel(ResourceLink sourceFile, ImportOptions importOptions)
        {
            // Get import options
            ACImportOptions acImportOptions = importOptions as ACImportOptions;

            if (acImportOptions == null)
            {
                throw new SeeingSharpException("Invalid import options for ACImporter!");
            }

            ImportedModelContainer result = new ImportedModelContainer(acImportOptions);

            // Get needed resource key
            NamedOrGenericKey resGeometry = GraphicsCore.GetNextGenericResourceKey();

            // Load and fill result object
            ObjectType objType = ACFileLoader.ImportObjectType(sourceFile);

            result.ImportedResources.Add(new ImportedResourceInfo(
                                             resGeometry,
                                             () => new GeometryResource(objType)));
            result.Objects.Add(new GenericObject(resGeometry));

            return(result);
        }
Exemple #9
0
        /// <summary>
        /// Internal helper method for all "LoadSimple" tests.
        /// </summary>
        /// <param name="tableSource">The source of the table file.</param>
        /// <param name="tableImporter">The importer to be used.</param>
        private static void Load_DummyData_GenericPart(
            ResourceLink tableSource,
            ITableImporter tableImporter,
            TableImporterConfig importConfig,
            string firstTableName)
        {
            string[]         tableNames = null;
            ITableHeaderRow  headerRow  = null;
            List <ITableRow> loadedRows = new List <ITableRow>();

            using (ITableFile tableFile = tableImporter.OpenTableFile(tableSource, importConfig))
            {
                tableNames = tableFile.GetTableNames().ToArray();
                if (tableNames.Contains(firstTableName))
                {
                    headerRow = tableFile.ReadHeaderRow(firstTableName);
                    using (ITableRowReader rowReader = tableFile.OpenReader(firstTableName))
                    {
                        loadedRows.AddRange(rowReader.ReadAllRows());
                    }
                }
            }

            // Do all checking
            Assert.True(tableNames.Length > 0);
            Assert.True(tableNames[0] == firstTableName);
            Assert.NotNull(headerRow);
            Assert.True(headerRow.FieldCount == 7);
            Assert.True(headerRow.GetFieldName(1) == "TestCol_2");
            Assert.True(headerRow.GetFieldName(3) == "TestCol_4");
            Assert.True(loadedRows.Count == 20);
            Assert.True(loadedRows[4].ReadField <int>("TestCol_4") == 2202304);
        }
 public void UpdateResourceLink(ResourceLink resourceLink, Tool tool)
 {
     resourceLink.CustomProperties = CustomProperties;
     resourceLink.Description      = Description;
     resourceLink.Title            = Title;
     resourceLink.Tool             = tool;
 }
        /// <summary>
        /// Loads a sound file from the given resource.
        /// </summary>
        /// <param name="resource">The resource to load.</param>
        public static async Task <CachedSoundFile> FromResourceAsync(ResourceLink resource)
        {
            resource.EnsureNotNull(nameof(resource));

            CachedSoundFile result = new CachedSoundFile();

            using (Stream inStream = await resource.OpenInputStreamAsync())
                using (SDXM.SoundStream stream = new SDXM.SoundStream(inStream))
                {
                    await Task.Factory.StartNew(() =>
                    {
                        // Read all data into the adio buffer
                        SDXM.WaveFormat waveFormat = stream.Format;
                        XA.AudioBuffer buffer      = new XA.AudioBuffer
                        {
                            Stream     = stream.ToDataStream(),
                            AudioBytes = (int)stream.Length,
                            Flags      = XA.BufferFlags.EndOfStream
                        };

                        // Store members
                        result.m_decodedPacketsInfo = stream.DecodedPacketsInfo;
                        result.m_format             = waveFormat;
                        result.m_audioBuffer        = buffer;
                    });
                }

            return(result);
        }
        /// <summary>
        /// Get all ResourceLinks
        /// </summary>
        /// <returns></returns>
        public async Task <IReadOnlyCollection <ResourceLink> > GetResourceLinksAsync()
        {
            CheckInitialized();

            HttpClient client = await GetHttpClient().ConfigureAwait(false);

            string stringResult = await client.GetStringAsync(new Uri(String.Format("{0}resourcelinks", ApiBase))).ConfigureAwait(false);

            List <ResourceLink> results = new List <ResourceLink>();

            JToken token = JToken.Parse(stringResult);

            if (token.Type == JTokenType.Object)
            {
                //Each property is a light
                var jsonResult = (JObject)token;

                foreach (var prop in jsonResult.Properties())
                {
                    ResourceLink newResourceLink = JsonConvert.DeserializeObject <ResourceLink>(prop.Value.ToString());
                    newResourceLink.Id = prop.Name;

                    results.Add(newResourceLink);
                }
            }

            return(results);
        }
Exemple #13
0
 private static void SetLinkOptionalDescriptors(ResourceLink resourceLink, Link link)
 {
     link.HrefLang = resourceLink.HrefLang;
     link.Name     = resourceLink.Name;
     link.Title    = resourceLink.Title;
     link.Type     = resourceLink.Type;
 }
        /// <summary>
        /// Reads the model in ASCII format from the specified stream.
        /// </summary>
        private ImportedModelContainer TryReadAscii(ResourceLink source, Stream stream, StlImportOptions importOptions)
        {
            using (var reader = new StreamReader(stream, s_encoding, false, 128, true))
            {
                var newGeometry = new Geometry();

                while (!reader.EndOfStream)
                {
                    var line = reader.ReadLine();

                    if (line == null)
                    {
                        continue;
                    }

                    line = line.Trim();

                    if (line.Length == 0 || line.StartsWith("\0") || line.StartsWith("#") || line.StartsWith("!") ||
                        line.StartsWith("$"))
                    {
                        continue;
                    }

                    ParseLine(line, out var id, out var values);
                    switch (id)
                    {
                    // Header.. not needed here
                    case "solid":
                        break;

                    // Geometry data
                    case "facet":
                        this.ReadFacet(reader, values, newGeometry, importOptions);
                        break;

                    // End of file
                    case "endsolid":
                        break;
                    }
                }

                // Generate result container
                var modelContainer = new ImportedModelContainer(source, importOptions);
                var resGeometryKey = modelContainer.GetResourceKey(RES_KEY_GEO_CLASS, RES_KEY_GEO_NAME);
                var resMaterialKey = modelContainer.GetResourceKey(RES_KEY_MAT_CLASS, RES_KEY_MAT_NAME);
                modelContainer.AddResource(new ImportedResourceInfo(
                                               resGeometryKey,
                                               _ => new GeometryResource(newGeometry)));
                modelContainer.AddResource(new ImportedResourceInfo(
                                               resMaterialKey,
                                               _ => new StandardMaterialResource()));
                var loadedMesh = new Mesh(resGeometryKey, resMaterialKey);
                modelContainer.AddObject(loadedMesh);

                // Append an object which transform the whole coordinate system
                modelContainer.FinishLoading(newGeometry.GenerateBoundingBox());

                return(modelContainer);
            }
        }
Exemple #15
0
        public override IEnumerable <object[]> GetData(MethodInfo testMethod)
        {
            // Guid and DateTime values shared for serialization test
            var sharedGuid     = Guid.Parse("96685bc4-dcb7-4b22-90cc-ca83baff8186");
            var sharedDateTime = DateTime.Parse("Fri, 1 May 2020 00:00:00Z");

            // dummies
            var emptyLink = new ResourceLink("", "", "");
            var testee    = new Testee {
                Id = sharedGuid, CreatedDate = sharedDateTime
            };
            var nestedTestee = new NestedTestee
            {
                Id          = sharedGuid,
                CreatedDate = sharedDateTime,
                Nested      = testee,
                Collection  = new List <Testee> {
                    testee
                }
            };
            var genericTestee = new GenericTestee <Testee>
            {
                Nested      = nestedTestee,
                Id          = sharedGuid,
                CreatedDate = sharedDateTime,
                Collection  = new List <Testee> {
                    testee, nestedTestee
                }
            };
            var testeeList = new List <Testee> {
                testee, nestedTestee, genericTestee
            };
            var testeePagination = new Pagination <Testee>(testeeList, testeeList.Count, 5);

            // resources
            var resources = testeeList.Select(x =>
            {
                var resource = new SingleResource(x);
                resource.Links.Add(emptyLink);
                return(resource);
            }).ToList();

            var enumerableResource = new EnumerableResource(resources);

            enumerableResource.Links.Add(emptyLink);
            var paginationResource = new PaginationResource(resources, resources.Count(), 5, 1);

            paginationResource.Links.Add(emptyLink);

            // expectedOutputs
            var expectedSingleString     = File.ReadAllText(Path.Combine("Serialization", "SingleResource.json"));
            var expectedEnumerableString = File.ReadAllText(Path.Combine("Serialization", "EnumerableResource.json"));
            var expectedPaginationString = File.ReadAllText(Path.Combine("Serialization", "PaginationResource.json"));

            yield return(new object[] { testee, resources.First(), expectedSingleString });

            yield return(new object[] { testeeList, enumerableResource, expectedEnumerableString });

            yield return(new object[] { testeePagination, paginationResource, expectedPaginationString });
        }
Exemple #16
0
        private ResourceLink GetResourceLinkFromMockArrangements <T>() where T : class
        {
            // creating additional stubs
            const string routeName    = "test-route";
            var          resourceLink = new ResourceLink(routeName, GetDummyUrl(routeName), GetDummyMethod());

            //mocking dependency methods
            var mockHateoasLink = new Mock <IHateoasLink <T> >();

            mockHateoasLink.Setup(x => x.RouteName).Returns(routeName);
            mockHateoasLink.Setup(x => x.GetRouteDictionary(It.IsAny <object>()))
            .Returns(It.IsAny <IDictionary <string, object> >());

            _mockHateoasContext
            .Setup(x => x.GetApplicableLinks(It.IsAny <Type>(), It.IsAny <object>()))
            .Returns(new List <IHateoasLink> {
                mockHateoasLink.Object
            });

            _mockResourceLinkFactory
            .Setup(x => x.Create(It.IsAny <string>(), It.IsAny <IDictionary <string, object> >()))
            .Returns(resourceLink);

            return(resourceLink);
        }
Exemple #17
0
 /// <summary>
 /// Adds a new texture resource to the scene.
 /// </summary>
 /// <param name="sceneManipulator">The manipulator of the scene.</param>
 /// <param name="textureSourceHighQuality">The source of the texture in high quality.</param>
 /// <param name="textureSourceLowQuality">The texture in low quality.</param>
 public static NamedOrGenericKey AddTextureResource(
     this SceneManipulator sceneManipulator,
     ResourceLink textureSourceHighQuality,
     ResourceLink textureSourceLowQuality)
 {
     return sceneManipulator.AddResource(_ => new StandardTextureResource(textureSourceHighQuality, textureSourceLowQuality));
 }
Exemple #18
0
 /// <summary>
 /// Adds a new simple colored material resource to the scene.
 /// </summary>
 /// <param name="sceneManipulator">The manipulator of the scene.</param>
 /// <param name="textureSourceHighQuality">The source of the texture which should be loaded.</param>
 /// <param name="textureSourceLowQuality">The source of the texture with low quality.</param>
 public static NamedOrGenericKey AddStandardMaterialResource(
     this SceneManipulator sceneManipulator,
     ResourceLink textureSourceHighQuality, ResourceLink textureSourceLowQuality)
 {
     var resTexture = sceneManipulator.AddTextureResource(textureSourceHighQuality, textureSourceLowQuality);
     return sceneManipulator.AddResource(_ => new StandardMaterialResource(resTexture));
 }
        public async Task <IActionResult> OnPostAsync()
        {
            if (ResourceLink.CustomProperties.IsPresent())
            {
                if (!ResourceLink.CustomProperties.TryConvertToDictionary(out _))
                {
                    ModelState.AddModelError(
                        $"{nameof(Tool)}.{nameof(Tool.CustomProperties)}",
                        "Cannot parse the Custom Properties.");
                }
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var user = await _context.GetUserFullAsync(User);

            var tool = await _context.Tools.FindAsync(ResourceLink.ToolId);

            var resourceLink = ResourceLink.ToResourceLink(tool);

            _context.ResourceLinks.Add(resourceLink);
            user.Platform.ResourceLinks.Add(resourceLink);

            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemple #20
0
 private void GetQuizletLinkByClassLink(string quizSetLink)
 {
     try
     {
         HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(quizSetLink);
         myRequest.Method = "GET";
         WebResponse  myResponse = myRequest.GetResponse();
         StreamReader sr         = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8);
         string       result     = sr.ReadToEnd();
         sr.Close();
         myResponse.Close();
         string          pattern = @"\<article class\=\""feed\-preview set\-preview\"" data\-type\=\""1\"" data-id\=\""(?<id>[0-9]{8})\""\>";
         Regex           regex   = new Regex(pattern);
         MatchCollection matchs  = regex.Matches(result);
         foreach (Match match in matchs)
         {
             ResourceLink link = new ResourceLink();
             link.path      = string.Format(@"http://quizlet.com/{0}/export", match.Groups["id"].Value);
             link.Term1Lang = LearningLanguage.JP;
             link.Term2Lang = LearningLanguage.VN;
             QuizletPathList.Add(link);
         }
     }
     catch
     {
     }
 }
        public void should_return_not_found_when_request_with_invalid_id()
        {
            var inValidLink = new ResourceLink("user/detail", "users/-1");
            var response    = Get(inValidLink);

            Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
        }
Exemple #22
0
        public async Task <ResourceLink> Create(ResourceLink resourceLink)
        {
            _context.Add(resourceLink);
            await SaveChanges();

            return(resourceLink);
        }
 /// <summary>
 /// Loads a bitmap using WIC.
 /// </summary>
 public static WicBitmapSourceInternal LoadBitmapSource(ResourceLink resource)
 {
     using (var inStream = resource.OpenInputStream())
     {
         return(LoadBitmapSource(inStream));
     }
 }
Exemple #24
0
 protected void AddLink(ResourceLink link)
 {
     if (link == null)
     {
         throw new ArgumentNullException(nameof(link), "Reference to link cannot be null.");
     }
     _links.Add(link);
 }
Exemple #25
0
        /// <summary>
        /// Imports a ac file from the given stream.
        /// </summary>
        /// <param name="resourceLink">The link to the ac file.</param>
        public static GeometryFactory ImportGeometryFactory(ResourceLink resourceLink)
        {
            using var inStream = resourceLink.OpenInputStream();

            var geometry = ImportGeometry(inStream, resourceLink);

            return(new CustomGeometryFactory(geometry));
        }
        public ShowLinkWindow()
        {
            InitializeComponent();
            ResourceLink resourceLinks = new ResourceLink();

            linkItems = resourceLinks.linkItems;
            setUpView();
        }
 /// <summary>
 /// Creates a new texture from a bitmap.
 /// </summary>
 internal static D3D11.ID3D11Texture2D CreateTexture(EngineDevice device, ResourceLink source)
 {
     using (var inStream = source.OpenInputStream())
         using (var rawImage = SDXTK.Image.Load(inStream))
         {
             return(CreateTexture(device, rawImage));
         }
 }
 /// <summary>
 /// Imports a ac file from the given stream.
 /// </summary>
 /// <param name="resourceLink">The link to the ac file.</param>
 public static ObjectType ImportObjectType(ResourceLink resourceLink)
 {
     using (Stream inStream = resourceLink.OpenInputStream())
     {
         VertexStructure structure = ImportVertexStructure(inStream, resourceLink);
         return(new GenericObjectType(structure));
     }
 }
Exemple #29
0
        public ActionResult DeleteConfirmed(long id)
        {
            ResourceLink resourceLink = db.ResourceLinks.Find(id);

            db.ResourceLinks.Remove(resourceLink);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public void GetFileExtension_AssemblyResourceLink()
        {
            ResourceLink extPNG = new AssemblyResourceLink(this.GetType(), "DummyNamespace.DummyFile.png");
            ResourceLink extJPG = extPNG.GetForAnotherFile("Dummy.jpg");

            Assert.True(extPNG.FileExtension == "png");
            Assert.True(extJPG.FileExtension == "jpg");
        }
        public void When_Adding_A_Link()
        {
            var subject = new ContractStub();
            var link = new ResourceLink();

            subject.AddLink(link);
            Assert.That(subject.Links, Has.Count.EqualTo(1));
            Assert.That(subject.Links.First(), Is.SameAs(link));
        }
Exemple #32
0
		public async Task CreateResourceLinkSingle()
		{
			ResourceLink resourceLink = new ResourceLink();
			resourceLink.Name = "r1";
			resourceLink.Description = "test";
			//resourceLink.ClassId = 1;

			var result = await _client.CreateResourceLinkAsync(resourceLink);

			Assert.IsNotNull(result);
		}
 public vResourceLink(ResourceLink model)
 {
     DB db =new DB();
     this.ID = model.ID;
     this.Title = model.Title;
     this.URL =  model.URL;
     this.Time = model.Time;
     this.LinkTypeID = model.LinkTypeID;
     this.TypeDictionary = model.TypeDictionary;
     this.IsHaveFile = model.IsHaveFile;
     this.FileID = model.FileID;
     if(IsHaveFile)
     {
         File = db.Files.Find(model.FileID);
     }
     this.UserID = model.UserID;
     this.Username = model.User.Username;
 }
Exemple #34
0
		public async Task UpdateResourceLink()
		{
			ResourceLink resourceLink = new ResourceLink();
			resourceLink.Name = "t1";

			var ResourceLinkId = await _client.CreateResourceLinkAsync(resourceLink);

			//Update name
			resourceLink.Name = "t2";
			await _client.UpdateResourceLinkAsync(ResourceLinkId, resourceLink);

			//Get saved ResourceLink
			var savedResourceLink = await _client.GetResourceLinkAsync(ResourceLinkId);

			//Check 
			Assert.AreEqual(resourceLink.Name, savedResourceLink.Name);

		}
        /// <summary>
        /// Builds the background for the given scene.
        /// </summary>
        /// <param name="manipulator">The current scene manipulator.</param>
        /// <param name="backgroundTexture">The link to the background texture file.</param>
        public static void BuildBackground(this SceneManipulator manipulator, ResourceLink backgroundTexture)
        {
            backgroundTexture.EnsureNotNull("backgroundTexture");

            // Create the background layer (if necessary)
            if (!manipulator.ContainsLayer(Constants.GFX_LAYER_BACKGROUND))
            {
                SceneLayer bgLayer = manipulator.AddLayer(Constants.GFX_LAYER_BACKGROUND);
                manipulator.SetLayerOrderID(
                    bgLayer,
                    Constants.GFX_LAYER_BACKGROUND_ORDERID);
            }

            // Load the background
            var resBackgroundTexture = manipulator.AddTexture(backgroundTexture);
            manipulator.Add(
                new TexturePainter(resBackgroundTexture)
                {
                    AccentuationFactor = 1f
                },
                Constants.GFX_LAYER_BACKGROUND);
        }
        public static TilemapData FromFile(ResourceLink link)
        {
            int maxLength = 0;
            List<string> lines = new List<string>(16);

            // Read raw data from the tilemap file
            using (Stream inStream = link.OpenInputStream())
            using (StreamReader inStreamReader = new StreamReader(inStream))
            {
                string actLine = inStreamReader.ReadLine();
                while (actLine != null)
                {
                    lines.Add(actLine);
                    if (actLine.Length > maxLength) { maxLength = actLine.Length; }

                    actLine = inStreamReader.ReadLine();
                }
            }

            // Enable/Disable specific tiles
            TilemapData result = new TilemapData(maxLength, lines.Count);
            for (int loopY = 0; loopY < lines.Count; loopY++)
            {
                string actLine = lines[loopY];
                for (int loopX = 0; loopX < maxLength; loopX++)
                {
                    if (actLine.Length <= loopX) { result[loopX, loopY] = false; }
                    else if (actLine[loopX] == Constants.TILE_CHAR_UNALLOWED) { result[loopX, loopY] = false; }
                    else if (actLine[loopX] == Constants.TILE_CHAR_ALLOWED)
                    {
                        result[loopX, loopY] = true;
                    }
                    else
                    {
                        throw new SeeingSharpException("Unknown character in tilemap file: " + actLine[loopX]);
                    }
                }
            }

            return result;
        }
Exemple #37
0
		public async Task DeleteResourceLink()
		{
			ResourceLink resourceLink = new ResourceLink();
			resourceLink.Name = "t1";
			resourceLink.Description = "test";

			var resourceLinkId = await _client.CreateResourceLinkAsync(resourceLink);

			//Delete
			await _client.DeleteResourceLinkAsync(resourceLinkId);

			var exits = await _client.GetResourceLinkAsync(resourceLinkId);
			Assert.IsNull(exits);

		}
 public PlayMovieRequestMessage(ResourceLink videoLink)
 {
     this.VideoLink = videoLink;
 }