Bläddra i källkod

feat: Example external overwrite docs added

Vaclav Elias 1 år sedan
förälder
incheckning
de744a3471
2 ändrade filer med 12 tillägg och 56 borttagningar
  1. 6 48
      en/examples/Stride.Utilities-examples.md
  2. 6 8
      en/examples/Stride.Utilities-remarks.md

+ 6 - 48
en/examples/Stride.Utilities-examples.md

@@ -1,57 +1,15 @@
 ---
-uid: Stride.Utilities.Test
+uid: Stride.Utilities
 example: [*content]
 ---
 
 ```csharp
-using System;
-using System.IO;
-using System.Text;
+// This example demonstrates how to add C# code snippets to API documentation from external files, though it's unrelated to the subject matter.
 
-class Test
-{
-
-    public static void Main()
-    {
-        string path = @"c:\temp\MyTest.txt";
-
-        // Delete the file if it exists.
-        if (File.Exists(path))
-        {
-            File.Delete(path);
-        }
-
-        //Create the file.
-        using (FileStream fs = File.Create(path))
-        {
-            AddText(fs, "This is some text");
-            AddText(fs, "This is some more text,");
-            AddText(fs, "\r\nand this is on a new line");
-            AddText(fs, "\r\n\r\nThe following is a subset of characters:\r\n");
+var trigger = Entity.Get<PhysicsComponent>();
 
-            for (int i=1;i < 120;i++)
-            {
-                AddText(fs, Convert.ToChar(i).ToString());
-            }
-        }
-
-        //Open the stream and read it back.
-        using (FileStream fs = File.OpenRead(path))
-        {
-            byte[] b = new byte[1024];
-            UTF8Encoding temp = new UTF8Encoding(true);
-            int readLen;
-            while ((readLen = fs.Read(b,0,b.Length)) > 0)
-            {
-                Console.WriteLine(temp.GetString(b,0,readLen));
-            }
-        }
-    }
-
-    private static void AddText(FileStream fs, string value)
-    {
-        byte[] info = new UTF8Encoding(true).GetBytes(value);
-        fs.Write(info, 0, info.Length);
-    }
+foreach (var collision in trigger.Collisions)
+{
+    //do something with the collision
 }
 ```

+ 6 - 8
en/examples/Stride.Utilities-remarks.md

@@ -1,16 +1,14 @@
 ---
-uid: Stride.Utilities.Test
+uid: Stride.Utilities
 remarks: *content
 ---
 
-Use the FileStream class to read from, write to, open, and close files on a file system, and to manipulate other file-related operating system handles, including pipes, standard input, and standard output. You can use the Read, Write, CopyTo, and Flush methods to perform synchronous operations, or the ReadAsync, WriteAsync, CopyToAsync, and FlushAsync methods to perform asynchronous operations. Use the asynchronous methods to perform resource-intensive file operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. FileStream buffers input and output for better performance.
+This remark serves as a demonstration of how to use overwrite files in API documentation. Overwrite files allow us to add a remarks section to the API docs seamlessly.
 
 > [!NOTE]
-> This type implements the IDisposable interface. When you have finished using the type, you should dispose of it either directly or indirectly. To dispose of the type directly, call its Dispose method in a `try/catch block`. To dispose of it indirectly, use a language construct such as `using` (in C#) or Using (in Visual Basic). For more information, see the "Using an Object that Implements IDisposable" section in the IDisposable interface topic.
-
-The IsAsync property detects whether the file handle was opened asynchronously. You specify this value when you create an instance of the FileStream class using a constructor that has an isAsync, useAsync, or options parameter. When the property is true, the stream utilizes overlapped I/O to perform file operations asynchronously. However, the IsAsync property does not have to be true to call the ReadAsync, WriteAsync, or CopyToAsync method. When the IsAsync property is false and you call the asynchronous read and write operations, the UI thread is still not blocked, but the actual I/O operation is performed synchronously.
-
-The Seek method supports random access to files. Seek allows the read/write position to be moved to any position within the file. This is done with byte offset reference point parameters. The byte offset is relative to the seek reference point, which can be the beginning, the current position, or the end of the underlying file, as represented by the three members of the SeekOrigin enumeration.
+> This text is an example of how to incorporate notes within the documentation. Notes are useful for providing additional information about the subject. You can also use ticks ` for code snippets.
 
 > [!CAUTION]
-> Disk files always support random access. At the time of construction, the CanSeek property value is set to true or false depending on the underlying file type. If the underlying file type is FILE_TYPE_DISK, as defined in winbase.h, the CanSeek property value is true. Otherwise, the CanSeek property value is false.
+> This text is an example of how to incorporate caution notes within the documentation to highlight important information or warnings.
+
+<p style="color:green">Html support is also available in the remarks section.</p>