Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrygump committed Apr 15, 2024
1 parent 5375a30 commit aa5b841
Show file tree
Hide file tree
Showing 61 changed files with 2,836 additions and 0 deletions.
Binary file added .vs/ProjectEvaluation/yololabel.metadata.v7.bin
Binary file not shown.
Binary file added .vs/ProjectEvaluation/yololabel.projects.v7.bin
Binary file not shown.
Binary file added .vs/YoloLabel/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .vs/YoloLabel/v17/.futdcache.v2
Binary file not shown.
Binary file added .vs/YoloLabel/v17/.suo
Binary file not shown.
93 changes: 93 additions & 0 deletions .vs/YoloLabel/v17/DocumentLayout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"Version": 1,
"WorkspaceRootPath": "E:\\CrossLane\\YoloLabel\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{2ECBD749-81F5-4610-8FD0-03F4CC5F8168}|YoloLabel.csproj|e:\\crosslane\\yololabel\\form1.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{2ECBD749-81F5-4610-8FD0-03F4CC5F8168}|YoloLabel.csproj|solutionrelative:form1.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{2ECBD749-81F5-4610-8FD0-03F4CC5F8168}|YoloLabel.csproj|e:\\crosslane\\yololabel\\form1.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
"RelativeMoniker": "D:0:0:{2ECBD749-81F5-4610-8FD0-03F4CC5F8168}|YoloLabel.csproj|solutionrelative:form1.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
},
{
"AbsoluteMoniker": "D:0:0:{2ECBD749-81F5-4610-8FD0-03F4CC5F8168}|YoloLabel.csproj|e:\\crosslane\\yololabel\\classform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{2ECBD749-81F5-4610-8FD0-03F4CC5F8168}|YoloLabel.csproj|solutionrelative:classform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{2ECBD749-81F5-4610-8FD0-03F4CC5F8168}|YoloLabel.csproj|e:\\crosslane\\yololabel\\classform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
"RelativeMoniker": "D:0:0:{2ECBD749-81F5-4610-8FD0-03F4CC5F8168}|YoloLabel.csproj|solutionrelative:classform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 4,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{34e76e81-ee4a-11d0-ae2e-00a0c90fffc3}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "ClassForm.cs",
"DocumentMoniker": "E:\\CrossLane\\YoloLabel\\ClassForm.cs",
"RelativeDocumentMoniker": "ClassForm.cs",
"ToolTip": "E:\\CrossLane\\YoloLabel\\ClassForm.cs",
"RelativeToolTip": "ClassForm.cs",
"ViewState": "AQIAAAAAAAAAAAAAAAAuwBEAAAAiAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-04-14T07:45:18.234Z"
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "ClassForm.cs [\u8BBE\u8BA1]",
"DocumentMoniker": "E:\\CrossLane\\YoloLabel\\ClassForm.cs",
"RelativeDocumentMoniker": "ClassForm.cs",
"ToolTip": "E:\\CrossLane\\YoloLabel\\ClassForm.cs [\u8BBE\u8BA1]",
"RelativeToolTip": "ClassForm.cs [\u8BBE\u8BA1]",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-04-14T07:40:25.967Z",
"EditorCaption": " [\u8BBE\u8BA1]"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Form1.cs",
"DocumentMoniker": "E:\\CrossLane\\YoloLabel\\Form1.cs",
"RelativeDocumentMoniker": "Form1.cs",
"ToolTip": "E:\\CrossLane\\YoloLabel\\Form1.cs",
"RelativeToolTip": "Form1.cs",
"ViewState": "AQIAADcCAAAAAAAAAAAnwE8CAAAsAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-04-14T02:17:51.759Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "Form1.cs [\u8BBE\u8BA1]",
"DocumentMoniker": "E:\\CrossLane\\YoloLabel\\Form1.cs",
"RelativeDocumentMoniker": "Form1.cs",
"ToolTip": "E:\\CrossLane\\YoloLabel\\Form1.cs [\u8BBE\u8BA1]",
"RelativeToolTip": "Form1.cs [\u8BBE\u8BA1]",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-04-14T02:16:38.89Z",
"EditorCaption": " [\u8BBE\u8BA1]"
}
]
}
]
}
]
}
111 changes: 111 additions & 0 deletions ClassForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

174 changes: 174 additions & 0 deletions ClassForm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace YoloLabel
{
public partial class ClassForm : Form
{
public ClassForm(string _labelPth)
{
InitializeComponent();
if (!Directory.Exists(_labelPth))
{
Directory.CreateDirectory(_labelPth);
}
labelPath = _labelPth;
var tblF = Path.Combine(labelPath, "classes.txt");
if (File.Exists(tblF))
{
var tbl = File.ReadAllLines(tblF);
foreach (var c in tbl)
{
if (!String.IsNullOrEmpty(c))
{
Classes.Add(c);
}
}
listBox1.Items.Clear();
foreach (var c in Classes)
{
listBox1.Items.Add(c);
}
}
}

public int Class = 0;
public string labelPath;

public void SetFolder(string _labelPth)
{
if (!Directory.Exists(_labelPth))
{
Directory.CreateDirectory(_labelPth);
}
labelPath = _labelPth;
var tblF = Path.Combine(labelPath, "classes.txt");
if (File.Exists(tblF))
{
var tbl = File.ReadAllLines(tblF);
foreach (var c in tbl)
{
if (!String.IsNullOrEmpty(c))
{
Classes.Add(c);
}
}
listBox1.Items.Clear();
foreach (var c in Classes)
{
listBox1.Items.Add(c);
}
}
}

public List<string> Classes = new List<string>();

private void button1_Click(object sender, EventArgs e)
{
if (!String.IsNullOrEmpty(textBox1.Text))
{
Class = -1;
for(int i = 0; i<Classes.Count; i++)
{
if(textBox1.Text == Classes[i])
{
Class = i; break;
}
}
if (Class >= 0)
{
DialogResult = DialogResult.OK;
}
}
}

private void button2_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (listBox1.SelectedItem != null)
{
textBox1.Text = listBox1.SelectedItem.ToString();
}
}

private void listBox1_DoubleClick(object sender, EventArgs e)
{
if (listBox1.SelectedItem != null)
{
textBox1.Text = listBox1.SelectedItem.ToString();
Class = -1;
for (int i = 0; i < Classes.Count; i++)
{
if (textBox1.Text == Classes[i])
{
Class = i; break;
}
}
if (Class >= 0)
{
DialogResult = DialogResult.OK;
}
}
}

public void setMode(int mode)
{
if(mode == 0)
{
button3.Enabled = true;
}
else
{
button3.Enabled = false;
}
}

private void button3_Click(object sender, EventArgs e)
{
if (!String.IsNullOrEmpty(textBox1.Text))
{
bool bex = false;
for (int i = 0; i < Classes.Count; i++)
{
if (Classes[i].Equals(textBox1.Text))
{
bex = true;
break;
}
}
if (!bex)
{
Classes.Add(textBox1.Text);
string contents = "";
Classes.Sort((a, b) =>
{
return a.CompareTo(b);
});
foreach (var c in Classes)
{
contents += c.ToString() + "\n";
}
File.WriteAllText(Path.Combine(labelPath, "classes.txt"), contents);

listBox1.Items.Clear();
foreach (var c in Classes)
{
listBox1.Items.Add(c);
}
}
}
}
}
}
Loading

0 comments on commit aa5b841

Please sign in to comment.