- Congig 추가

- friction.exe -> squeak.exe
- 색상 변경
- analysis 기준 변경
This commit is contained in:
2017-06-21 02:41:29 +09:00
parent 9bf6a38f6d
commit 44841453e9
7 changed files with 271 additions and 77 deletions

120
Config.cs Normal file
View File

@@ -0,0 +1,120 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace friction
{
public static class Config
{
static string m_strPath = "";
static Config()
{
string strPrjName = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;
string strFolder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), strPrjName);
m_strPath = strFolder + "\\config.ini";
if (!Directory.Exists(strFolder))
Directory.CreateDirectory(strFolder);
Load();
}
public static void Init()
{
}
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
private static void Load()
{
StringBuilder temp = new StringBuilder(10240);
int iRes = GetPrivateProfileString("Option", "recent", "", temp, 10240, m_strPath);
if(temp.Length > 0)
{
string[] astrList = temp.ToString().Split(new string[] { "//" }, StringSplitOptions.None);
foreach (string strFile in astrList)
OPTION.AddRecentFile(strFile);
}
}
private static void Save()
{
WritePrivateProfileString("Option", "recent", OPTION.GetRecentAll(), m_strPath);
}
public static class OPTION
{
public static List<string> m_RecentList = new List<string>();
public static void AddRecentFile(string strPath)
{
if(m_RecentList.Find(s => s==strPath) != null)
m_RecentList.Remove(strPath);
m_RecentList.Add(strPath);
Save();
}
public static string GetRecentAll()
{
return string.Join("//", m_RecentList);
}
}
public static class ANALYSIS
{
public enum RISK
{
NO,
POTENTIAL,
HIGH
}
public enum DEPENDANCY
{
NO,
POTENTIAL,
HIGH,
NOT_ENNOUGH_DATA
}
public static RISK GetRisk(float fAvg)
{
if (fAvg <= 3)
return RISK.NO;
else if (fAvg <= 5)
return RISK.POTENTIAL;
else
return RISK.HIGH;
}
public static DEPENDANCY GetDependancy(float fStdev, int iTestCnt)
{
if (iTestCnt <= 3)
return DEPENDANCY.NOT_ENNOUGH_DATA;
else if (fStdev < 3.5f)
return DEPENDANCY.NO;
else if (fStdev < 5.5f)
return DEPENDANCY.POTENTIAL;
else
return DEPENDANCY.HIGH;
}
}
}
}