static void processSimple(string filename) { var folder = BuildFolder(filename); var lines = SimpleLine .FromFile(filename) .OrderBy(x => x.Address); var groups = LineGroup.MakeGroups(lines); var missing = SourceProcessing.GetMissingOutput(groups, (x) => x.ToString()); File.WriteAllLines(Path.Combine(folder, "with-missing.txt"), missing); var bytecodes = SourceProcessing.GetBadBytecodeConversions(lines); File.WriteAllLines(Path.Combine(folder, "bad-bytecode-conversions.txt"), bytecodes); var allraw = SourceProcessing.GetAllRaw(lines, (x) => x.ToString()); File.WriteAllLines(Path.Combine(folder, "all-raw.txt"), allraw); var allrawOps = SourceProcessing.GetAllRaw(lines, (x) => x.ToLongString()); File.WriteAllLines(Path.Combine(folder, "all-raw-with-ops.txt"), allrawOps); // Code with labels and line breaks var labeled = SourceProcessing.LabelCode(allraw); File.WriteAllLines(Path.Combine(folder, "code-labeled.txt"), labeled); }
void RenderLineGroup(LineGroup lineGroup) { GL.Begin(GL.LINE_STRIP); if (lineGroup.material != null) { lineGroup.material.SetPass(0); } else { defaultMaterial.SetPass(0); } for (int i = 0; i < lineGroup.vertices.Length; i++) { if (lineGroup.gradient == null) { GL.Color(Color.cyan); } else { float t = (float)i / (lineGroup.vertices.Length - 1); GL.Color(lineGroup.gradient.Evaluate(t)); } GL.Vertex(lineGroup.vertices[i]); } GL.End(); GL.Flush(); }
void GenerateSquare() { float[] v1 = { -0.5f, -0.5f }; float[] v2 = { -0.5f, 0.5f }; float[] v3 = { 0.5f, 0.5f }; float[] v4 = { 0.5f, -0.5f }; vertices.Add(new VectorN(v1)); vertices.Add(new VectorN(v2)); vertices.Add(new VectorN(v3)); vertices.Add(new VectorN(v4)); LineGroup lineGroup = Instantiate(root.lineGroupPrefab, transform); lineGroup.lineRenderer.startColor = GetColorByDimension(); lineGroup.lineRenderer.endColor = GetColorByDimension(); lineGroup.transform.localPosition = Vector3.zero; lineGroup.transform.localScale = Vector3.one; lineGroup.indexTransform = new int[5]; for (int i = 0; i < 4; i++) { lineGroup.indexTransform[i] = i; } lineGroup.indexTransform[4] = 0; lineGroups.Add(lineGroup); }
public LineGroup GetGroupByID() { LineGroupRepository lineGroup_repo = new LineGroupRepository(); LineGroup lineGroup = lineGroup_repo.SearchLineGroup(GroupId); return(lineGroup); }
public void GetFilePaths() { lineGroups = new List <LineGroup>(); Debug.Log("Checking for: " + filePath); if (Directory.Exists(filePath)) { Debug.Log(filePath + " exists!"); DirectoryInfo info = new DirectoryInfo(filePath); foreach (CommonWarnings2 messageType in Enum.GetValues(typeof(CommonWarnings2))) { Debug.Log("Checking for: " + messageType.ToString()); if (Directory.Exists(filePath + messageType.ToString() + @"\")) { Debug.Log("Found: " + messageType.ToString()); LineGroup temp = new LineGroup(); temp.filePath = filePath + messageType.ToString() + @"\"; temp.type = messageType; temp.GetFilePaths(); lineGroups.Add(temp); Debug.Log("\n"); } else { Debug.Log(filePath + messageType.ToString() + " doesn't exist, please add it or the voicepack will not work as intended."); } } } else { Debug.Log(filePath + " doesn't exist."); } }
void Link2LowerDimensions() { //GameObject connectionNull ConnectionNull = new GameObject("Connection Null " + dimension); ConnectionNull.transform.SetParent(transform); ConnectionNull.transform.localPosition = Vector3.zero; ConnectionNull.transform.localScale = Vector3.one; int min1Length = min1DimensionCubeLeft.vertices.Count; for (int i = 0; i < min1Length; i++) { LineGroup lineGroup = Instantiate(root.lineGroupPrefab, ConnectionNull.transform); lineGroup.transform.localPosition = Vector3.zero; lineGroup.transform.localScale = Vector3.one; lineGroup.lineRenderer.startColor = GetColorByDimension(); lineGroup.lineRenderer.endColor = GetColorByDimension(); lineGroup.indexTransform = new int[2]; lineGroup.indexTransform[0] = i; lineGroup.indexTransform[1] = i + min1Length; lineGroups.Add(lineGroup); } }
private readonly IList _vectors = new ArrayList();//<VectorUI>(); public VectorVisualizer(IVectorVisualizerUI page) { AllLines = new ArrayList(); this.Page = page; this._lines = new LineGroup(AxisCenter); this.Lines.LineAdded += this.Lines_LineAdded; this.Lines.LineRemoved += this.Lines_LineRemoved; }
private LineGroup CreateLineGroup(BoardProperties context, LineType type) { var lines = GetIndexes(context, type) .Select(i => (IPositions)CreateLine(context, type, i.Item1, i.Item2)).ToList(); var lineGroup = new LineGroup(type, lines); return(lineGroup); }
public void Awake() { GameObject intersections = GameObject.Find("Intersections"); MeshFilter mf = intersections.GetComponent <MeshFilter>() as MeshFilter; mIntersections = new PointMesh(mf.mesh); mIntersections.PointSize = 0.2f; mLinesToRender = new LineMesh(gameObject.GetComponent <MeshFilter>().mesh); mLines = new LineGroup(mLinesToRender, mIntersections); }
private LinePointsGroup <T> LinePointsGroup(LineGroup <T> lineGroup, IEnumerable <string> linePointsWeeks) { Dictionary <string, PointGroup <T> > linePoints = LinePointsTemplate(linePointsWeeks); foreach (T item in lineGroup.Data()) { linePoints[ItemKey(item)].Add(item); } return(new LinePointsGroup <T>(linePoints.Values.AsEnumerable(), lineGroup.Type())); }
public void AddLineGroup(Color c, int num, GameObject prefab, float width, bool vis = false) { LineGroup lg = new LineGroup(); lg.numLines = num; lg.visible = vis; lg.col = c; lg.index = (groups.Count > 0) ? groups[groups.Count - 1].index + groups[groups.Count - 1].numLines : 0; lg.Initialize(prefab, this, width); groups.Add(lg); }
public bool SearchLineGroup() { LineGroupRepository lineGroup_repo = new LineGroupRepository(); LineGroup lineGroup = lineGroup_repo.SearchLineGroup(GroupId); if (lineGroup != null) { return(true); } else { return(false); } }
private void btnGroup_Click(object sender, RoutedEventArgs e) { LineGroup newLineGroup = new LineGroup(currentSelection); foreach (var myLine in currentSelection) { foreach (var line in myLine.GetLines()) { lines[line] = newLineGroup; } } lineGroups.Add(newLineGroup); currentSelection.Clear(); currentSelection.Add(lineGroups.Last()); }
private void AddLine(int fromPos, int toPos) { LineGroup lg = new LineGroup(); _depth++; LineJoin item1 = new LineJoin(); item1.Start = fromPos; item1.End = toPos; lg.Add(item1); Groups.Insert(0, lg); }
private void PopulateGroups() { _LineGroups = new List <LineGroup>(); var currentGroupIndex = -1; foreach (var multiLineText in _Target) { //get ordered list of lines in MLT var orderedList = multiLineText.Lines.OrderBy <LineEdit, int>((l) => { return(l.LineNumber); }).ToList(); var count = orderedList.Count(); //WE ARE GOING TO CREATE GROUPS WITH GROUPSIZE NUMBER OF LINES PER GROUP. LineGroup tmpGroup = null; for (int i = 0; i < count; i++) { var line = orderedList[i]; if (tmpGroup == null) { currentGroupIndex++; tmpGroup = new LineGroup(currentGroupIndex, multiLineText); } tmpGroup.Lines.Add(line); //IF OUR GROUP HAS REACHED THE GROUP SIZE OR IF WE ARE ON THE LAST ELEMENT IN THE MLT if (tmpGroup.Lines.Count == LineGroupSize || i == count - 1) { //THIS GROUP IS FINISHED. ADD IT TO OUR _LINEGROUPS, AND RESET OUR TMP VAR _LineGroups.Add(tmpGroup); tmpGroup = null; } } } }
private void LoadScene(string filename) { lines.Clear(); lineGroups.Clear(); MainCanvas.Children.Clear(); currentSelection.Clear(); lastClickedLine = null; using (FileStream fs = new FileStream(filename, FileMode.OpenOrCreate)) { BinaryFormatter binaryFormatter = new BinaryFormatter(); List <ICanvasObject> linesWithoutGroups = (List <ICanvasObject>)binaryFormatter.Deserialize(fs); lineGroups = (List <LineGroup>)binaryFormatter.Deserialize(fs); foreach (var line in linesWithoutGroups) { MyLine myLine = line as MyLine; myLine.SetLineValues(); MainCanvas.Children.Add(myLine.Line); lines.Add(myLine.Line, myLine); } foreach (var group in lineGroups) { LineGroup myGroup = group as LineGroup; foreach (var line in myGroup.Lines) { line.SetLineValues(); MainCanvas.Children.Add(line.Line); lines.Add(line.Line, myGroup); } } MessageBox.Show("Load completed!"); } }
// メソッド protected override OfficeLineArt.View.Line CreateLine(LineGroup polygon, Apex begin, Apex end) { return(new Line(polygon, begin, end)); }
// コンストラクター internal Line(LineGroup parent, Apex begin, Apex end) : base(parent, begin, end) { }
public LineEnumerator(LineGroup lines) : base(lines.ActiveLines) { }
public void Read(Song song, Stream stream) { if (song == null) throw new ArgumentNullException("song"); if (stream == null) throw new ArgumentNullException("stream"); var doc = XDocument.Load(stream); if (doc.Root.Name != "song") { throw new SongFormatException("File is not a valid OpenSong song."); } var root = doc.Root; song.Title = root.Elements("title").Single().Value; song.Copyright = root.Elements("author").Any() ? root.Elements("author").Single().Value : String.Empty; if (root.Elements("copyright").Any()) { var copyright = root.Element("copyright").Value; if (!copyright.StartsWith("©") && !copyright.StartsWith("(c)")) copyright = "© " + copyright; song.Copyright = String.IsNullOrEmpty(song.Copyright) ? copyright : song.Copyright + "\n" + copyright; } song.Category = root.Elements("theme").Any() ? root.Element("theme").Value : String.Empty; song.CcliNumber = root.Elements("ccli").Any() ? int.Parse(root.Element("ccli").Value) : (int?)null; var lines = root.Elements("lyrics").Single().Value.Split('\n'); string partKey = null; LineGroup currentLineGroup = null; List<LineGroup> partLineGroups = null; for (int l = 0; l < lines.Length; l++) { var line = lines[l]; if (line.StartsWith("[")) // next part (or group of parts) { if (partKey != null) FinishPart(song, partKey, partLineGroups, currentLineGroup); var i = line.IndexOf("]"); if (i < 0) throw new SongFormatException("File is not a valid OpenSong song: Invalid part declaration."); partKey = line.Substring(1, i - 1).Trim(); partLineGroups = new List<LineGroup>(); currentLineGroup = null; } else // not the start of a new part { if (line.Trim() == String.Empty || line[0] == ';' || line.StartsWith("---")) { // ignore empty line, comments, '---' breaks (whatever they mean) continue; } if (partKey == null) // no part has been started -> create an anonymous one { partKey = "Unnamed"; partLineGroups = new List<LineGroup>(); } if (line[0] == '.') { // chord line -> always start new line group and set chords property if (currentLineGroup != null) partLineGroups.Add(currentLineGroup); currentLineGroup = new LineGroup { Chords = line.Substring(1) }; } else if (line[0] == ' ') { // lyrics line -> set lyrics to current LineGroup if (currentLineGroup == null || currentLineGroup.Lines.Count == 0) { if (currentLineGroup == null) { currentLineGroup = new LineGroup(); } currentLineGroup.Lines.Add(new Line { Text = line.Substring(1) }); partLineGroups.Add(currentLineGroup); currentLineGroup = null; } else { throw new SongFormatException("File is not a valid OpenSong song: Expected verse number."); } } else if (char.IsDigit(line[0])) { int vnum = int.Parse(line[0].ToString()); if (currentLineGroup == null) { currentLineGroup = new LineGroup(); } else if (currentLineGroup.Lines.Count > 0 && vnum <= currentLineGroup.Lines.Last().Number) { partLineGroups.Add(currentLineGroup); currentLineGroup = new LineGroup(); } currentLineGroup.Lines.Add(new Line { Text = line.Substring(1), Number = vnum }); } else { throw new SongFormatException("File is not a valid OpenSong song: Expected one of ' ', '.', ';' , '[0-9]'"); } } } if (partKey != null) FinishPart(song, partKey, partLineGroups, currentLineGroup); // parse order if (root.Elements("presentation").Any() && root.Elements("presentation").Single().Value.Trim() != String.Empty) { var val = root.Elements("presentation").Single().Value.Trim(); var split = wordRegex.Matches(val).Cast<Match>(); song.SetOrder(split.Select(m => GetPartName(m.Value)), ignoreMissing: true); } else { // if no order is specified, add each part once in order foreach (SongPart part in song.Parts) { song.AddPartToOrder(part); } } }
private void FinishPart(Song song, string key, List<LineGroup> lineGroups, LineGroup lastLineGroup) { if (lastLineGroup != null) lineGroups.Add(lastLineGroup); if (lineGroups.Count == 0) throw new SongFormatException("File is not a valid OpenSong song: Empty part"); foreach (var lg in lineGroups) { if (lg.Lines.Count == 0) lg.Lines.Add(new Line { Text = "" }); } var noNumbers = !lineGroups[0].Lines[0].Number.HasValue; if (noNumbers && lineGroups.Any(lg => lg.Lines.Any(l => l.Number.HasValue))) throw new SongFormatException("File is not a valid OpenSong song: Found mixed numbered and unnumbered lines."); int maxVerseNumber; if (noNumbers) { maxVerseNumber = 1; } else { maxVerseNumber = lineGroups.Max(lg => lg.Lines.Max(l => l.Number.Value)); } for (int i = 1; i <= maxVerseNumber; i++) { if (!noNumbers && !lineGroups.Any(lg => lg.Lines.Any(l => l.Number == i))) continue; string name; if (noNumbers) name = GetPartName(key); else name = GetPartName(key + i.ToString()); var part = new SongPart(song, name); var slide = new SongSlide(song); slide.Text = String.Join("\n", lineGroups. Where(lg => lg.Lines.Any(l => noNumbers || l.Number == i)). Select(lg => PrepareLine(lg.Lines.Where(l => noNumbers || l.Number == i).Single().Text, lg.Chords))); part.AddSlide(slide); // apply slide breaks int ind; while ((ind = slide.Text.IndexOf("||")) >= 0) { slide.Text = slide.Text.Remove(ind, 2); part.SplitSlide(slide, ind); } // apply line breaks foreach (var s in part.Slides) { s.Text = s.Text.Replace("|", "\n"); } song.AddPart(part); } }
private void FinishPart(Song song, string key, List <LineGroup> lineGroups, LineGroup lastLineGroup) { if (lastLineGroup != null) { lineGroups.Add(lastLineGroup); } if (lineGroups.Count == 0) { throw new SongFormatException("File is not a valid OpenSong song: Empty part"); } foreach (var lg in lineGroups) { if (lg.Lines.Count == 0) { lg.Lines.Add(new Line { Text = "" }); } } var noNumbers = !lineGroups[0].Lines[0].Number.HasValue; if (noNumbers && lineGroups.Any(lg => lg.Lines.Any(l => l.Number.HasValue))) { throw new SongFormatException("File is not a valid OpenSong song: Found mixed numbered and unnumbered lines."); } int maxVerseNumber; if (noNumbers) { maxVerseNumber = 1; } else { maxVerseNumber = lineGroups.Max(lg => lg.Lines.Max(l => l.Number.Value)); } for (int i = 1; i <= maxVerseNumber; i++) { if (!noNumbers && !lineGroups.Any(lg => lg.Lines.Any(l => l.Number == i))) { continue; } string name; if (noNumbers) { name = GetPartName(key); } else { name = GetPartName(key + i.ToString()); } var part = new SongPart(song, name); var slide = new SongSlide(song); slide.Text = String.Join("\n", lineGroups. Where(lg => lg.Lines.Any(l => noNumbers || l.Number == i)). Select(lg => PrepareLine(lg.Lines.Where(l => noNumbers || l.Number == i).Single().Text, lg.Chords))); part.AddSlide(slide); // apply slide breaks int ind; while ((ind = slide.Text.IndexOf("||")) >= 0) { slide.Text = slide.Text.Remove(ind, 2); part.SplitSlide(slide, ind); } // apply line breaks foreach (var s in part.Slides) { s.Text = s.Text.Replace("|", "\n"); } song.AddPart(part); } }
public void Read(Song song, Stream stream) { if (song == null) { throw new ArgumentNullException("song"); } if (stream == null) { throw new ArgumentNullException("stream"); } var doc = XDocument.Load(stream); if (doc.Root.Name != "song") { throw new SongFormatException("File is not a valid OpenSong song."); } var root = doc.Root; song.Title = root.Elements("title").Single().Value; song.Copyright = root.Elements("author").Any() ? root.Elements("author").Single().Value : String.Empty; if (root.Elements("copyright").Any()) { var copyright = root.Element("copyright").Value; if (!copyright.StartsWith("©") && !copyright.StartsWith("(c)")) { copyright = "© " + copyright; } song.Copyright = String.IsNullOrEmpty(song.Copyright) ? copyright : song.Copyright + "\n" + copyright; } song.Category = root.Elements("theme").Any() ? root.Element("theme").Value : String.Empty; song.CcliNumber = root.Elements("ccli").Any() ? int.Parse(root.Element("ccli").Value) : (int?)null; var lines = root.Elements("lyrics").Single().Value.Split('\n'); string partKey = null; LineGroup currentLineGroup = null; List <LineGroup> partLineGroups = null; for (int l = 0; l < lines.Length; l++) { var line = lines[l]; if (line.StartsWith("[")) // next part (or group of parts) { if (partKey != null) { FinishPart(song, partKey, partLineGroups, currentLineGroup); } var i = line.IndexOf("]"); if (i < 0) { throw new SongFormatException("File is not a valid OpenSong song: Invalid part declaration."); } partKey = line.Substring(1, i - 1).Trim(); partLineGroups = new List <LineGroup>(); currentLineGroup = null; } else // not the start of a new part { if (line.Trim() == String.Empty || line[0] == ';' || line.StartsWith("---")) { // ignore empty line, comments, '---' breaks (whatever they mean) continue; } if (partKey == null) // no part has been started -> create an anonymous one { partKey = "Unnamed"; partLineGroups = new List <LineGroup>(); } if (line[0] == '.') { // chord line -> always start new line group and set chords property if (currentLineGroup != null) { partLineGroups.Add(currentLineGroup); } currentLineGroup = new LineGroup { Chords = line.Substring(1) }; } else if (line[0] == ' ') { // lyrics line -> set lyrics to current LineGroup if (currentLineGroup == null || currentLineGroup.Lines.Count == 0) { if (currentLineGroup == null) { currentLineGroup = new LineGroup(); } currentLineGroup.Lines.Add(new Line { Text = line.Substring(1) }); partLineGroups.Add(currentLineGroup); currentLineGroup = null; } else { throw new SongFormatException("File is not a valid OpenSong song: Expected verse number."); } } else if (char.IsDigit(line[0])) { int vnum = int.Parse(line[0].ToString()); if (currentLineGroup == null) { currentLineGroup = new LineGroup(); } else if (currentLineGroup.Lines.Count > 0 && vnum <= currentLineGroup.Lines.Last().Number) { partLineGroups.Add(currentLineGroup); currentLineGroup = new LineGroup(); } currentLineGroup.Lines.Add(new Line { Text = line.Substring(1), Number = vnum }); } else { throw new SongFormatException("File is not a valid OpenSong song: Expected one of ' ', '.', ';' , '[0-9]'"); } } } if (partKey != null) { FinishPart(song, partKey, partLineGroups, currentLineGroup); } // parse order if (root.Elements("presentation").Any() && root.Elements("presentation").Single().Value.Trim() != String.Empty) { var val = root.Elements("presentation").Single().Value.Trim(); var split = wordRegex.Matches(val).Cast <Match>(); song.SetOrder(split.Select(m => GetPartName(m.Value)), ignoreMissing: true); } else { // if no order is specified, add each part once in order foreach (SongPart part in song.Parts) { song.AddPartToOrder(part); } } }
public async override Task <ResultArgs <StudyItemViewModelArgs> > GetNextStudyItemViewModelAsync() { if (_AbortIsFlagged) { return(await StudyHelper.GetAbortedAsync()); } LineEdit lineToStudy = null; //IF WE KNOW ALL OF OUR GROUPS, RESET AND START OVER if (_KnownGroupNumbers.Count == _LineGroups.Count) { _PrevGroupNumberStudied = -1; _PrevStudyWasHit = false; _KnownGroupNumbers.Clear(); foreach (var completedGroup in _LineGroups) { completedGroup.Reset(); } } //GET THE INITIAL GROUP NUMBER TO TRY TO STUDY int groupNumberToStudy = _PrevGroupNumberStudied; LineGroup group = null; if (_PrevStudyWasHit) { //PREV STUDY WAS HIT, SO TRY TO STAY WITH THE PREV GROUP. group = GetGroupFromGroupNumber(_PrevGroupNumberStudied); if (group == null) { throw new Exception();//SINCE PREV STUDY WAS HIT, THIS SHOULD NEVER HAPPEN. } //IF THE GROUP IS NOT YET COMPLETED, GET ITS NEXT LINE, OTHERWISE WE NEED TO TRY THE NEXT GROUP. if (!group.Completed) { lineToStudy = group.GetLine(); if (lineToStudy == null) { throw new Exception(); } _PrevGroupNumberStudied = group.GroupNumber; } else { //PREVIOUS GROUP WAS A HIT AND THAT COMPLETED THAT GROUP, SO GET NEXT GROUP int nextGroupNumber = GetNextUnknownGroupNumber(); group = GetGroupFromGroupNumber(nextGroupNumber); if (group.Completed) { throw new Exception(); } lineToStudy = group.GetLine(); _PrevGroupNumberStudied = group.GroupNumber; } } else { //PREVIOUS WAS A MISS, SO GET LINE FROM NEXT UNKNOWN GROUP int nextGroupNumber = GetNextUnknownGroupNumber(); group = GetGroupFromGroupNumber(nextGroupNumber); if (group.Completed) { throw new Exception(); } lineToStudy = group.GetLine(); _PrevGroupNumberStudied = group.GroupNumber; } //groupNumberToStudy = _PrevGroupNumberStudied; //if (groupNumberToStudy == _LineGroups.Count) // groupNumberToStudy = 0; ////FIND THE FIRST GROUP NUMBER THAT IS UNKNOWN //for (int i = 0; i < _LineGroups.Count; i++) //{ // if (!_KnownGroupNumbers.Contains(groupNumberToStudy)) // break; // //THAT GROUP NUMBER IS ALREADY KNOWN. UPDATE FOR THE NEXT TRY. // groupNumberToStudy++; // if (groupNumberToStudy == _LineGroups.Count) // groupNumberToStudy = 0; //} ////WE NOW HAVE THE GROUP NUMBER TO STUDY. //var group = _LineGroups[groupNumberToStudy]; //var lineToStudy = group.GetLine(); //WE NOW HAVE THE LINE TO STUDY. PROCURE A LINE ORDER var result = await StudyItemViewModelFactory.Ton.Procure(lineToStudy, group.MultiLineText); var viewModel = result.Object; StudyItemViewModelArgs args = new StudyItemViewModelArgs(viewModel); var resultArgs = new ResultArgs <StudyItemViewModelArgs>(args); var retArgs = await StudyHelper.WrapInTask <ResultArgs <StudyItemViewModelArgs> >(resultArgs); return(retArgs); }
static void processMesen(string filename) { var rawlines = File.ReadAllLines(filename); //var folder = Path.Combine(Path.GetDirectoryName(filename), $"{Path.GetFileNameWithoutExtension(filename)} {DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss")}"); var folder = Path.Combine(Path.GetDirectoryName(filename), Path.GetFileNameWithoutExtension(filename)); Directory.CreateDirectory(folder); // Raw input File.WriteAllLines(Path.Combine(folder, "raw.txt"), rawlines); // Parse lines into usable form var lines = MesenLine.ConvertTrace(rawlines.ToList()); var notMesen = rawlines .Where(x => !string.IsNullOrEmpty(x) && !MesenLine.IsA(x)); File.WriteAllLines(Path.Combine(folder, "not-mesen.txt"), notMesen); notMesen = null; rawlines = null; // Simple, just code & address ordered var code = lines .Select(x => $"{x.Address} {x.Op} {x.Parameters}".Trim()) .Distinct() .OrderBy(x => x) .ToList(); File.WriteAllLines(Path.Combine(folder, "code.txt"), code); // Code with labels and line breaks var labeled = SourceProcessing.LabelCode(code); File.WriteAllLines(Path.Combine(folder, "code-labeled.txt"), labeled); code = null; labeled = null; // Address/instruction usage counts var addresses = lines .Where(x => !string.IsNullOrEmpty(x.Target)) .Select(x => $"{x.Target} {x.Op}"); GroupCountAndWriteFile(addresses, Path.Combine(folder, "address-usage.txt")); addresses = null; // Code instruction counts var codeAddresses = lines .Select(x => x.Address); GroupCountAndWriteFile(codeAddresses, Path.Combine(folder, "code-address-counts.txt")); codeAddresses = null; // Move counts var moves = lines .Where(x => x.Op == "mvn" || x.Op == "mvp") .Select(x => $"{getMoveAddresses(x)} {x.Op}"); GroupCountAndWriteFile(moves, Path.Combine(folder, "moves.txt")); moves = null; // Move counts - source moves = lines .Where(x => x.Op == "mvn" || x.Op == "mvp") .Select(x => $"{getMoveAddresses(x).Split(' ')[0]} {x.Op}"); GroupCountAndWriteFile(moves, Path.Combine(folder, "moves-source.txt")); moves = null; // Move counts - destination moves = lines .Where(x => x.Op == "mvn" || x.Op == "mvp") .Select(x => $"{getMoveAddresses(x).Split(' ')[2]} {x.Op}"); GroupCountAndWriteFile(moves, Path.Combine(folder, "moves-destination.txt")); moves = null; // Move counts - both moves = lines .Where(x => x.Op == "mvn" || x.Op == "mvp") .Select(x => $"{getMoveAddresses(x).Split(' ')[0]} {x.Op}") .Concat( lines .Where(x => x.Op == "mvn" || x.Op == "mvp") .Select(x => $"{getMoveAddresses(x).Split(' ')[2]} {x.Op}") ); GroupCountAndWriteFile(moves, Path.Combine(folder, "moves-both.txt")); moves = null; // With missing sections var olines = Line.ToLines(lines); var groups = LineGroup.MakeGroups(olines); olines = null; var missing = SourceProcessing.GetMissingOutput(groups, (x) => x.ToString()); File.WriteAllLines(Path.Combine(folder, "with-missing.txt"), missing); missing = null; groups = null; // Jump targets Regex targetsRegex = new Regex(@"^(?:jsr|jrl|jmp|jml)$", RegexOptions.Compiled); Regex containsIndirect = new Regex(@",|\[|\(", RegexOptions.Compiled); var targets = lines .Where(x => targetsRegex.IsMatch(x.Op) && containsIndirect.IsMatch(x.Parameters)) .Select(x => $"{x.Address} {x.Op} {x.Parameters} [{x.Target}]"); GroupCountAndWriteFile(targets, Path.Combine(folder, "jump-targets.txt")); targets = null; // Wrong bytecode conversions var wrong = lines .Where(x => x.BytecodeOriginal != x.Bytecode) .Select(x => $"{x.Op} {x.Parameters} log={x.BytecodeOriginal} computed={x.Bytecode}") .ToList(); File.WriteAllLines(Path.Combine(folder, "wrong-bytecode.txt"), wrong); wrong = null; lines = null; var f = 8; }