public void LoadScripts(string path, ref List <string> scriptErrors) { // for each script file, first get product model from scrip filename; // then parse the content of the script file to get test parameters; // finally verify scripts by datasheet. scriptErrors = new List <string>(); string[] files = Directory.GetFiles(path, "*.ini", SearchOption.AllDirectories); string[] testModel = new string[5]; List <ScriptDefs> testParams = null; List <string> testScriptErrors; if (files != null) { foreach (string fileName in files) { ParseProductModel(fileName, out testModel); scriptErrors.Add(fileName); sType scriptType = ParseScriptType(testModel); ReadTestScript(fileName, scriptType, out testParams, out testScriptErrors); if (testScriptErrors != null) { scriptErrors.AddRange(testScriptErrors); } //VerifyDatasheet(specsTable, out specsTableStatus); } } else { MessageBox.Show("Empty directory. Please try again."); return; } }
public static string randomString(int len, sType s) { string text; switch (s) { case sType.Standard: text = "₠₡₢₣₤₥₦₧₨₩₹₸₷₶₵₴₳₲₱₰₯₮₭€₫₺⃰₽℅ℓ№™ⱠⱡⱢⱣⱤⱥⱦⱧⱩfiⱻⱾⱿⱯⱮⱱⱲⱳⱴⱵƩƱƲƳƴǍǎǢǣǤǥǭȄȜȞȣȮփռպֆӸӂҿҧ"; break; case sType.Special: text = "ƀƁƂƄƅƆƈƉƋƍƎƏƐƑƒƓƔƕƖƗƘƙƜƛơƣƥƪƩƱƲƳƴǍǎǢǣǤǥǭȄȜȞȣȮփռպֆӸӂҿҧͲͳʹͶͷͻͼͽΆΙΘΗΖΕΔΓΒΑΐΏΎΌΉΈΛάέήίΰαβϡϠϝϞϜϛϦФЯЮПЎЍЌЫЬЭЮйЩШЙЉЊϪϚѤѬѭѮѰѹ҈҉ҘѾүҾӁ"; break; case sType.Foreign: text = "䂥䂀䂁䂀䂀䁿䁾䁽䂌䂋䂎䃞䃝䃜䃛䃫䃬䃮䃰䃱䃲䃳䃴䃵䃶䃷䃸䃹䃺䃪䃩䃙䄣䄢䄡䄠䄟䒐䒏䒎䒍䒌䒋䑬䑽䑼䑾䒀䒂䑳䄞䄝䄜䄛䄋䃻䃫䃬䃭䃮䃯䃰䃱䃲䃳䃴䃵䃶䃷䃸䃹䃺䆴䇀䇁䆱䇟䇮䇯䇱䇝䇜䇍䉶䉱䉲䉢䉣䊃䊅䊖䊦䊥䊐䊞䊟䌵䌴䌳䍦䍥䍷䍷䍹"; break; case sType.Normal: text = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; break; case sType.Unreadable: text = "\u202e\u202f\u202a"; break; default: throw new InvalidOperationException(); } char[] array = new char[len]; for (int i = 0; i < len; i++) { array[i] = text[rand.Next(text.Length)]; } return new string(array); }
static string randomString(int len, sType s) { string chars = ""; switch (s) { case sType.Foreign: chars = "這是驚人的我喜歡看到人們的笑容黄後で色の読み取りは秘密ここ地獄にありかみそりどこでもなぜ死んだ魚のフロート非常に高い月を伝えます美國死亡淨混淆他媽的佩爾松低音蟾蜍你是如何科網喜歡這個地方他媽的芋引員運永閲越悦沿炎塩演縁"; break; case sType.Unreadable: chars = "\u206A\u202F\u202F\u202D\u202B\u206F"; break; case sType.Normal: chars = "1234567890abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"; break; case sType.Special: chars = "'\"`'`\"'`"; break; case sType.Underscore: chars = "________________________________________________________________________________________________________________________________________________________________________________________"; break; default: throw new InvalidOperationException(); } int length = len; char[] buffer = new char[length]; for (int i = 0; i < length; i++) { buffer[i] = chars[rand.Next(chars.Length)]; } return new string(buffer); }
public sType type; //셀의 타입 #endregion Fields #region Constructors public Shell() { this.type = sType.NONE; this.estimatedCost = 0.0f; this.nodeTotalCost = 1.0f; this.bObstacle = false; this.parent = null; }
public Vector3 position; //Position of the node #endregion public Shell() { this.type = sType.NONE; this.estimatedCost = 0.0f; this.nodeTotalCost = 1.0f; this.bObstacle = false; this.parent = null; }
//생성자에서 위치 받기 public Node(Vector3 _pos) { type = sType.NONE; fCost = 1.0f; gCost = 0.0f; hCost = 0.0f; pos = _pos; parent = null; }
//생성자에서 위치 받기 public Node(Vector3 _pos) { type = sType.NONE; fCost = 1.0f; gCost = 0.0f; hCost = 0.0f; pos = _pos; parent = null; }
/// <summary> //Constructor with adding position to the node creation /// </summary> public Shell(Vector3 pos) { this.type = sType.NONE; this.estimatedCost = 0.0f; this.nodeTotalCost = 1.0f; this.bObstacle = false; this.parent = null; this.position = pos; }
/// <summary> //Constructor with adding position to the node creation /// </summary> public Shell(Vector3 pos) { this.type = sType.NONE; this.estimatedCost = 0.0f; this.nodeTotalCost = 1.0f; this.bObstacle = false; this.parent = null; this.position = pos; }
public void Play(string name, sType type) { Sound sound = Array.Find(sounds, x => x.name == name); switch (type) { case sType.music: musicPlayer.Stop(); musicPlayer.clip = sound.clip; musicPlayer.Play(); break; case sType.sound: soundPlayer.PlayOneShot(sound.clip); break; } }
public static string randomString(int len, sType s) { string text; switch (s) { case sType.Standard: text = "₠₡₢₣₤₥₦₧₨₩₹₸₷₶₵₴₳₲₱₰₯₮₭€₫₺⃰₽℅ℓ№™ⱠⱡⱢⱣⱤⱥⱦⱧⱩfiⱻⱾⱿⱯⱮⱱⱲⱳⱴⱵƩƱƲƳƴǍǎǢǣǤǥǭȄȜȞȣȮփռպֆӸӂҿҧ"; break; case sType.Special: text = "ƀƁƂƄƅƆƈƉƋƍƎƏƐƑƒƓƔƕƖƗƘƙƜƛơƣƥƪƩƱƲƳƴǍǎǢǣǤǥǭȄȜȞȣȮփռպֆӸӂҿҧͲͳʹͶͷͻͼͽΆΙΘΗΖΕΔΓΒΑΐΏΎΌΉΈΛάέήίΰαβϡϠϝϞϜϛϦФЯЮПЎЍЌЫЬЭЮйЩШЙЉЊϪϚѤѬѭѮѰѹ҈҉ҘѾүҾӁ"; break; case sType.Foreign: text = "䂥䂀䂁䂀䂀䁿䁾䁽䂌䂋䂎䃞䃝䃜䃛䃫䃬䃮䃰䃱䃲䃳䃴䃵䃶䃷䃸䃹䃺䃪䃩䃙䄣䄢䄡䄠䄟䒐䒏䒎䒍䒌䒋䑬䑽䑼䑾䒀䒂䑳䄞䄝䄜䄛䄋䃻䃫䃬䃭䃮䃯䃰䃱䃲䃳䃴䃵䃶䃷䃸䃹䃺䆴䇀䇁䆱䇟䇮䇯䇱䇝䇜䇍䉶䉱䉲䉢䉣䊃䊅䊖䊦䊥䊐䊞䊟䌵䌴䌳䍦䍥䍷䍷䍹"; break; case sType.Normal: text = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; break; case sType.Unreadable: text = "\u202e\u202f\u202a"; break; case sType.beta: text = "[SND-OWNS-YOU]"; break; default: throw new InvalidOperationException(); } char[] array = new char[len]; for (int i = 0; i < len; i++) { array[i] = text[rand.Next(text.Length)]; } return(new string(array)); }
private static Tuple <sType, double?> getPricing(string input) { string priceCandidate = input.Split('>')[7].Split('<')[0]; double?price = null; sType saleType = sType.NotAvailable; if (priceCandidate == null || priceCandidate.Length < 2) { price = null; saleType = sType.NotAvailable; } else if (priceCandidate.ToLower().Contains("free")) { price = null; saleType = sType.FreeToPlay; } else { price = double.Parse(priceCandidate.Replace("$", ""), CultureInfo.InvariantCulture); saleType = sType.CostsMoney; } return(new Tuple <sType, double?>(saleType, price)); }
private void ReadTestScript(string scriptFileName, sType scriptType, out List <ScriptDefs> testParams, out List <string> testScriptErrors) { testParams = new List <ScriptDefs>(); string scriptFileRead; List <string> scriptFileLines = new List <string>(); List <string> scriptFileLinesWithLineNums = new List <string>(); testScriptErrors = new List <string>(); List <string> formatErrors = new List <string>(); List <string> binErrors = new List <string>(); List <int> softwareBins = new List <int>(); string[] scriptFileLineParams; try { // read file content including all delimiters StreamReader sr = new StreamReader(scriptFileName); scriptFileRead = sr.ReadToEnd(); sr.Close(); if (!scriptFileRead.Equals(string.Empty)) { scriptFileLines.AddRange(scriptFileRead.Split(fileToLinesDelimiters, StringSplitOptions.None)); int lineNum = 1; foreach (string line in scriptFileLines) { scriptFileLinesWithLineNums.Add((lineNum++).ToString() + specialDelimeter[0] + line); } // first run the format and bin check, and also remove all comment lines FormatCheck(ref scriptFileLinesWithLineNums, out softwareBins, out formatErrors); if (formatErrors != null) { testScriptErrors.AddRange(formatErrors); } tType testType = tType.UNKNOWN; string testName = string.Empty; string testUnit = string.Empty; double testTarget = reservedBins[0]; double testSpecMin = reservedBins[0]; double testSpecMax = reservedBins[0]; int testSWBin = reservedBins[0]; int testHWBin = reservedBins[0]; for (int i = 0; i < scriptFileLinesWithLineNums.Count; i++) { string[] thisLine = scriptFileLinesWithLineNums[i].Split(specialDelimeter, StringSplitOptions.None); lineNum = Convert.ToInt16(thisLine[0].Trim()); if (lineNum == 1) { //the display line was checked already in FormatCheck() continue; } scriptFileLineParams = thisLine[1].Split(lineToParamsDelimiters, StringSplitOptions.None); int length = scriptFileLineParams.Length; if (scriptFileLineParams[0].Trim().Equals("1")) { string[] testParamPerLine = new string[8]; for (int j = 0; j < 12; j++) { // testType, testName, testUnit, testTarget, testSpecMin, testSpecMax, testSWBin, testHWBin if (j == 2 && length > 2) { testType = ParseTestType(scriptFileLineParams[2].Trim().ToUpper()); } if (j == 3 && length > 3) { testName = scriptFileLineParams[3].Trim().ToUpper(); } if (j == 4 && length > 4) { testUnit = scriptFileLineParams[4].Trim().ToUpper(); } if (j == 7 && length > 7) { testTarget = ParseTarget(scriptFileLineParams[7]); } if (j == 8 && length > 8) { testSpecMin = ParseTarget(scriptFileLineParams[8]); } if (j == 9 && length > 9) { testSpecMax = ParseTarget(scriptFileLineParams[9]); } if (j == 10 && length > 10) { testSWBin = ParseBins(scriptFileLineParams[10]); } if (j == 11 && length > 11) { testHWBin = ParseBins(scriptFileLineParams[11]); } } testParams.Add(new ScriptDefs { ScriptType = scriptType, TestNum = lineNum, TestType = testType, TestName = testName, TestUnit = testUnit, TestTarget = testTarget, TestSpecMin = testSpecMin, TestSpecMax = testSpecMax, TestSWBin = testSWBin, TestHWBin = testHWBin }); } } // for loop of each line scanning // more BIN checks BinCheck(testParams, softwareBins, out binErrors); if (binErrors != null) { testScriptErrors.AddRange(binErrors); } } } catch (Exception exception) { MessageBox.Show("Reading test script process failed: \n" + exception.ToString()); return; } }
private void ReadTestScript(string scriptFileName, sType scriptType, out List<ScriptDefs> testParams, out List<string> testScriptErrors) { testParams = new List<ScriptDefs>(); string scriptFileRead; List<string> scriptFileLines = new List<string>(); List<string> scriptFileLinesWithLineNums = new List<string>(); testScriptErrors = new List<string>(); List<string> formatErrors = new List<string>(); List<string> binErrors = new List<string>(); List<int> softwareBins = new List<int>(); string[] scriptFileLineParams; try { // read file content including all delimiters StreamReader sr = new StreamReader(scriptFileName); scriptFileRead = sr.ReadToEnd(); sr.Close(); if (!scriptFileRead.Equals(string.Empty)) { scriptFileLines.AddRange(scriptFileRead.Split(fileToLinesDelimiters, StringSplitOptions.None)); int lineNum = 1; foreach (string line in scriptFileLines) { scriptFileLinesWithLineNums.Add((lineNum++).ToString() + specialDelimeter[0] + line); } // first run the format and bin check, and also remove all comment lines FormatCheck(ref scriptFileLinesWithLineNums, out softwareBins, out formatErrors); if (formatErrors != null) { testScriptErrors.AddRange(formatErrors); } tType testType = tType.UNKNOWN; string testName = string.Empty; string testUnit = string.Empty; double testTarget = reservedBins[0]; double testSpecMin = reservedBins[0]; double testSpecMax = reservedBins[0]; int testSWBin = reservedBins[0]; int testHWBin = reservedBins[0]; for (int i = 0; i < scriptFileLinesWithLineNums.Count; i++) { string[] thisLine = scriptFileLinesWithLineNums[i].Split(specialDelimeter, StringSplitOptions.None); lineNum = Convert.ToInt16(thisLine[0].Trim()); if (lineNum == 1) { //the display line was checked already in FormatCheck() continue; } scriptFileLineParams = thisLine[1].Split(lineToParamsDelimiters, StringSplitOptions.None); int length = scriptFileLineParams.Length; if (scriptFileLineParams[0].Trim().Equals("1")) { string[] testParamPerLine = new string[8]; for (int j = 0; j < 12; j++) { // testType, testName, testUnit, testTarget, testSpecMin, testSpecMax, testSWBin, testHWBin if (j == 2 && length > 2) testType = ParseTestType(scriptFileLineParams[2].Trim().ToUpper()); if (j == 3 && length > 3) testName = scriptFileLineParams[3].Trim().ToUpper(); if (j == 4 && length > 4) testUnit = scriptFileLineParams[4].Trim().ToUpper(); if (j == 7 && length > 7) testTarget = ParseTarget(scriptFileLineParams[7]); if (j == 8 && length > 8) testSpecMin = ParseTarget(scriptFileLineParams[8]); if (j == 9 && length > 9) testSpecMax = ParseTarget(scriptFileLineParams[9]); if (j == 10 && length > 10) testSWBin = ParseBins(scriptFileLineParams[10]); if (j == 11 && length > 11) testHWBin = ParseBins(scriptFileLineParams[11]); } testParams.Add(new ScriptDefs { ScriptType = scriptType, TestNum = lineNum, TestType = testType, TestName = testName, TestUnit = testUnit, TestTarget = testTarget, TestSpecMin = testSpecMin, TestSpecMax = testSpecMax, TestSWBin = testSWBin, TestHWBin = testHWBin }); } } // for loop of each line scanning // more BIN checks BinCheck(testParams, softwareBins, out binErrors); if (binErrors != null) { testScriptErrors.AddRange(binErrors); } } } catch (Exception exception) { MessageBox.Show("Reading test script process failed: \n" + exception.ToString()); return; } }