Skip to content

Commit 3666559

Browse files
refactor: remove useless using
1 parent 0808cba commit 3666559

12 files changed

Lines changed: 56 additions & 89 deletions

File tree

FreeFrame/Components/Importer.cs

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
1+
using FreeFrame.Components.Shapes;
2+
using OpenTK.Mathematics;
43
using System.Text;
5-
using System.Text.RegularExpressions;
6-
using System.Threading.Tasks;
74
using System.Xml;
8-
using FreeFrame.Components.Shapes;
9-
using OpenTK.Mathematics;
105

116
namespace FreeFrame.Components
127
{
138
public static class Importer
149
{
10+
/// <summary>
11+
/// Import shapes list and timeline from a stream
12+
/// </summary>
13+
/// <param name="pStream">Given stream</param>
14+
/// <returns>Shape list and timeline</returns>
15+
/// <exception cref="Exception">If something went wrong in the importation</exception>
1516
static private (List<Shape>, SortedDictionary<int, List<Shape>>, bool) ImportFromStream(Stream pStream)
1617
{
1718
List<Shape> shapes = new List<Shape>();
@@ -68,6 +69,13 @@ static private (List<Shape>, SortedDictionary<int, List<Shape>>, bool) ImportFro
6869
}
6970
return (shapes, new SortedDictionary<int, List<Shape>>(), compatibilityFlag);
7071
}
72+
73+
/// <summary>
74+
/// Import shapes list and timeline from a file path
75+
/// </summary>
76+
/// <param name="pFilename">File path</param>
77+
/// <returns>Shape list and timeline</returns>
78+
/// <exception cref="ArgumentException">If file cannot be found</exception>
7179
static public (List<Shape>, SortedDictionary<int, List<Shape>>, bool) ImportFromFile(string pFilename)
7280
{
7381
if (!File.Exists(pFilename))
@@ -77,16 +85,27 @@ static public (List<Shape>, SortedDictionary<int, List<Shape>>, bool) ImportFrom
7785

7886
return ImportFromStream(new MemoryStream(byteArray));
7987
}
88+
89+
/// <summary>
90+
/// Import shapes list and timeline from a string
91+
/// </summary>
92+
/// <param name="pString">Given string</param>
93+
/// <returns>Shape list and timeline</returns>
8094
static public (List<Shape>, SortedDictionary<int, List<Shape>>, bool) ImportFromString(string pString)
8195
{
8296
byte[] byteArray = Encoding.UTF8.GetBytes(pString);
8397

8498
return ImportFromStream(new MemoryStream(byteArray));
8599
}
86100

101+
/// <summary>
102+
/// Export a given shape list into an svg file
103+
/// </summary>
104+
/// <param name="shapes">Shape list</param>
105+
/// <param name="clientSize">Window size</param>
106+
/// <param name="path">File path</param>
87107
static public void ExportToFile(List<Shape> shapes, Vector2i clientSize, string path)
88108
{
89-
90109
using (FileStream fs = new FileStream(path, FileMode.Create))
91110
{
92111
byte[] bytes = Encoding.ASCII.GetBytes($@"<?xml version=""1.0"" encoding=""utf-8"" ?>
@@ -107,6 +126,11 @@ static public void ExportToFile(List<Shape> shapes, Vector2i clientSize, string
107126
}
108127
}
109128

129+
/// <summary>
130+
/// Convert from a string to an Color4 value
131+
/// </summary>
132+
/// <param name="hexadecimal">hexadecimal string</param>
133+
/// <returns>Color4 value</returns>
110134
static public Color4 HexadecimalToRGB(string hexadecimal)
111135
{
112136
float r = Convert.ToInt32(hexadecimal.Substring(1, 2), 16) / 255f;

FreeFrame/Components/Shapes/Path/DrawAttribute.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
1+
using OpenTK.Mathematics;
62
using System.Text.RegularExpressions;
7-
using OpenTK.Mathematics;
83

94
namespace FreeFrame.Components.Shapes.Path
105
{

FreeFrame/Components/Shapes/SVGPath.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
4-
using System.Xml;
5-
using System.Text.RegularExpressions;
6-
using FreeFrame.Components.Shapes.Path;
1+
using FreeFrame.Components.Shapes.Path;
72
using OpenTK.Graphics.OpenGL4;
83
using OpenTK.Mathematics;
4+
using System.Text.RegularExpressions;
5+
using System.Xml;
96

107
namespace FreeFrame.Components.Shapes
118
{

FreeFrame/Components/Shapes/SVGRectangle.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
4-
using System.Xml;
5-
using OpenTK.Graphics.OpenGL4;
1+
using OpenTK.Graphics.OpenGL4;
62
using OpenTK.Mathematics;
3+
using System.Xml;
74

85
namespace FreeFrame.Components.Shapes
96
{

FreeFrame/Components/Shapes/Shape.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using FreeFrame.Components.Shapes.Path;
2-
using Newtonsoft.Json;
3-
using OpenTK.Graphics.OpenGL4;
4-
using OpenTK.Mathematics;
5-
using OpenTK.Windowing.Desktop;
1+
using OpenTK.Mathematics;
62

73
namespace FreeFrame.Components.Shapes
84
{

FreeFrame/Helper.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
using OpenTK.Graphics.OpenGL4;
2-
using System;
3-
using System.Collections.Generic;
42
using System.Diagnostics;
5-
using System.Linq;
63
using System.Runtime.InteropServices;
7-
using System.Text;
8-
using System.Threading.Tasks;
94

105
namespace FreeFrame
116
{
@@ -51,6 +46,9 @@ static private void DebugCallback(DebugSource source, DebugType type, int id, De
5146
if (type == DebugType.DebugTypeError)
5247
throw new Exception("OpenGL error");
5348
}
49+
/// <summary>
50+
/// Enable the debug mode
51+
/// </summary>
5452
static public void EnableDebugMode()
5553
{
5654
GL.DebugMessageCallback(_debugProcCallback, IntPtr.Zero);

FreeFrame/IDrawable.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
using OpenTK.Mathematics;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
72

83
namespace FreeFrame
94
{

FreeFrame/Program.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using OpenTK;
2-
using OpenTK.Mathematics;
3-
using OpenTK.Graphics;
4-
using FreeFrame.Components;
5-
using FreeFrame.Components.Shapes;
6-
using OpenTK.Windowing.Common;
1+
using OpenTK.Mathematics;
72
using OpenTK.Windowing.Desktop;
83

94
namespace FreeFrame
@@ -16,7 +11,7 @@ static void Main()
1611
{
1712
Size = new Vector2i(800, 600),
1813
Title = "FreeFrame",
19-
NumberOfSamples = 8,
14+
NumberOfSamples = 8, // MSAA
2015
};
2116
using Window window = new(GameWindowSettings.Default, nativeWindowSettings); // Create window context (GLFW, OpenGL)
2217

FreeFrame/Renderer.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
using OpenTK.Graphics.OpenGL4;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
1+
using FreeFrame.Components.Shapes;
2+
using OpenTK.Graphics.OpenGL4;
73
using OpenTK.Mathematics;
8-
using FreeFrame.Components.Shapes;
94

105
namespace FreeFrame
116
{

FreeFrame/Selector.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
using FreeFrame.Components.Shapes;
22
using OpenTK.Graphics.OpenGL4;
33
using OpenTK.Mathematics;
4-
using System;
5-
using System.Collections.Generic;
6-
using System.Linq;
7-
using System.Text;
8-
using System.Threading.Tasks;
94

105
namespace FreeFrame
116
{

0 commit comments

Comments
 (0)