update code

master
syneffort 2 years ago
parent fa53570753
commit 957ec8482b
  1. 24
      BitMaskTest/.vscode/launch.json
  2. 41
      BitMaskTest/.vscode/tasks.json
  3. 2
      BitMaskTest/BitMaskTest.csproj
  4. 27
      BitMaskTest/PopupButtonMask.cs
  5. 14
      BitMaskTest/Program.cs

@ -0,0 +1,24 @@
{
// IntelliSense .
// .
// https://go.microsoft.com/fwlink/?linkid=830387() .
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net7.0/BitMaskTest.dll",
"args": [],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}

@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/BitMaskTest.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/BitMaskTest.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/BitMaskTest.csproj"
],
"problemMatcher": "$msCompile"
}
]
}

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
</Project>

@ -4,15 +4,28 @@ using System.Text;
namespace BitMaskTest
{
// [Flags]
// public enum ButtonMask
// {
// None = 0x00,
// Remove = 0x01,
// LevelUp = 0x02,
// Change = 0x04,
// Reset = 0x08,
// Cancel = 0x10,
// }
[Flags]
public enum ButtonMask
{
None = 0x00,
Remove = 0x01,
LevelUp = 0x02,
Change = 0x04,
Reset = 0x08,
Cancel = 0x10,
None = 0,
Remove = 1 << 0,
LevelUp = 1 << 1,
Change = 1 << 2,
Reset = 1 << 3,
Cancel = 1 << 4,
All = int.MaxValue
}
class PopupButtonMask
@ -34,7 +47,7 @@ namespace BitMaskTest
return buttons;
}
private bool checkMask(ButtonMask compareTarget)
public bool checkMask(ButtonMask compareTarget)
{
int flags = (int)this.Mask;
int flag = (int)compareTarget;

@ -25,15 +25,15 @@ namespace BitMaskTest
static void Main(string[] args)
{
PopupButtonMask popupButton = new PopupButtonMask();
popupButton.Mask = ButtonMask.LevelUp | ButtonMask.Reset | ButtonMask.Cancel | ButtonMask.Remove | ButtonMask.Change;
popupButton.Mask = ButtonMask.LevelUp | ButtonMask.Cancel | ButtonMask.Remove | ButtonMask.Change;
List<ButtonMask> buttons = popupButton.GetButtons();
foreach (ButtonMask item in buttons)
{
Console.WriteLine(item);
}
System.Console.WriteLine(popupButton.checkMask(ButtonMask.All));
Console.ReadKey();
// List<ButtonMask> buttons = popupButton.GetButtons();
// foreach (ButtonMask item in buttons)
// {
// Console.WriteLine(item);
// }
}
}
}

Loading…
Cancel
Save