void ReleaseDesignerOutlets()
        {
            if (BaseTextView != null)
            {
                BaseTextView.Dispose();
                BaseTextView = null;
            }

            if (CurrentTextView != null)
            {
                CurrentTextView.Dispose();
                CurrentTextView = null;
            }

            if (BaseLabel != null)
            {
                BaseLabel.Dispose();
                BaseLabel = null;
            }

            if (CurrentLabel != null)
            {
                CurrentLabel.Dispose();
                CurrentLabel = null;
            }
        }
Example #2
0
 private void SetCurrentLabel(string newCurrent)
 {
     if (CurrentLabel.InvokeRequired)
     {
         CurrentLabel.Invoke(new MethodInvoker(() => SetCurrentLabel(newCurrent)));
     }
     else
     {
         CurrentLabel.Text = string.Format("Current Song: {0}", newCurrent);
     }
 }
Example #3
0
        public void FindLogBasePath()
        {
            string appDir = Path.GetDirectoryName(Application.ExecutablePath);
            Dictionary <string, LogBasePathInfo> logPaths = new Dictionary <string, LogBasePathInfo>();

            // Find *.flconfig in appDir
            foreach (string fileName in Directory.GetFiles(appDir, "*.flconfig"))
            {
                // Read the path setting
                var    config   = new ConfigReader(fileName);
                string basePath = config.ReadPath();
                // If a log file was found in that path, put it on the list
                if (!string.IsNullOrEmpty(basePath))
                {
                    CheckLogBasePath(basePath, logPaths);
                }
            }

            // Find *.exe in appDir
            foreach (string fileName in Directory.GetFiles(appDir, "*.exe"))
            {
                string baseName = Path.GetFileNameWithoutExtension(fileName);
                // Go through all possible default log paths for the exe file
                // If a log file was found in a path, put it on the list
                CheckLogBasePath(Path.Combine(appDir, "log", baseName), logPaths);
                CheckLogBasePath(Path.Combine(appDir, baseName), logPaths);
                CheckLogBasePath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), baseName + "-log", baseName), logPaths);
                CheckLogBasePath(Path.Combine(Path.GetTempPath(), baseName + "-log", baseName), logPaths);
            }

            if (logPaths.Count == 1)
            {
                SetLogBasePath(logPaths.Values.First().LogBasePath);
            }
            else if (logPaths.Count > 1)
            {
                LogDirsListView.Items.Clear();
                foreach (var kvp in logPaths)
                {
                    AddDirectory(kvp.Value);
                }
                // Sort by latest update time
                logDirsColumnSorter.SortColumn = 1;
                logDirsColumnSorter.Order      = SortOrder.Descending;
                logDirsColumnSorter.Update();

                CurrentLabel.Hide();
                SelectedLogDirText.Hide();
                LogDirsListView.Show();
                dirListMode = true;
                UpdateButtons();
            }
        }
Example #4
0
        private void BrowseLogButton_Click(object sender, EventArgs args)
        {
            using (OpenFileDialog dlg = new OpenFileDialog())
            {
                dlg.FileName = SelectedLogDirText.Text;
                dlg.Filter   = Tx.T("log selection view.file dialog.filter");
                if (!string.IsNullOrEmpty(SelectedLogDirText.Text))
                {
                    dlg.InitialDirectory = Path.GetDirectoryName(SelectedLogDirText.Text);
                }
                dlg.Title = Tx.T("log selection view.file dialog.title");

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    if (ScanDirectoryWorker.IsBusy)
                    {
                        ScanDirectoryWorker.CancelAsync();
                    }

                    string basePath = GetBasePath(dlg.FileName);
                    SelectedLogDirText.Text = basePath;
                    try
                    {
                        SetLogBasePath(basePath);
                    }
                    catch
                    {
                        MessageBox.Show(
                            FindForm(),
                            Tx.T("msg.logpath parameter invalid", "value", basePath),
                            Tx.T("msg.title.error"),
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                        ResetLogBasePath();
                        FindLogBasePath();
                        return;
                    }

                    CurrentLabel.Show();
                    SelectedLogDirText.Show();
                    FindLogsButton.Show();
                    LogDirsListView.Hide();
                    dirListMode  = false;
                    fullScanMode = false;
                    UpdateButtons();
                }
            }
        }
Example #5
0
        private void removeExistingOrders()
        {
            foreach (Label CurrentLabel in FoodTextBoxes)
            {
                this.Controls.Remove(CurrentLabel);
                CurrentLabel.Dispose();
            }
            FoodTextBoxes = new List <Label>();

            foreach (Label CurrentLabel in AmountTextBoxes)
            {
                this.Controls.Remove(CurrentLabel);
                CurrentLabel.Dispose();
            }
            AmountTextBoxes = new List <Label>();
        }
Example #6
0
        private void FindLogsButton_Click(object sender, EventArgs args)
        {
            CurrentLabel.Hide();
            SelectedLogDirText.Hide();
            FindLogsButton.Hide();
            ConfigErrorLabel.Hide();
            LogDirsListView.Items.Clear();
            LogDirsListView.Show();
            dirListMode = true;
            UpdateButtons();

            if (ignoredDirectories.Count == 0)
            {
                ignoredDirectories.Add(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + "\\");
                ignoredDirectories.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Adobe\\"));
                ignoredDirectories.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Common Files\\"));
                ignoredDirectories.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Google\\"));
                ignoredDirectories.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Microsoft"));
                ignoredDirectories.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Reference Assemblies\\"));
                ignoredDirectories.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Windows "));
                if (Environment.Is64BitOperatingSystem)
                {
                    ignoredDirectories.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Adobe\\"));
                    ignoredDirectories.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Common Files\\"));
                    ignoredDirectories.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Google\\"));
                    ignoredDirectories.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Microsoft"));
                    ignoredDirectories.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Reference Assemblies\\"));
                    ignoredDirectories.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Windows "));
                }
                ignoredDirectories.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Adobe\\"));
                ignoredDirectories.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Microsoft\\"));
                ignoredDirectories.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Package Cache\\"));
            }

            fullScanMode = true;
            ScanDirectoryWorker.RunWorkerAsync();
            MainForm.Instance.SetProgress(true, -1);
        }
Example #7
0
        public override object VisitAsmline(Z80AsmParser.AsmlineContext context)
        {
            CurrentLabel      = null;
            CurrentLabelColon = false;
            CurrentComment    = null;
            LabelSpan         = null;
            KeywordSpan       = null;
            CommentSpan       = null;
            IssueToEmit       = null;
            IsFieldAssignment = false;
            NumberSpans       = null;
            IdentifierSpans   = null;
            StringSpans       = null;
            FunctionSpans     = null;
            SemiVarSpans      = null;
            MacroParamSpans   = null;
            MacroParamNames   = null;
            SemiVarSpans      = null;
            StatementSpans    = null;
            OperandSpans      = null;
            MnemonicSpans     = null;

            if (context?.Start == null || context.Stop == null)
            {
                return(null);
            }

            var startIndex = context.start.StartIndex;
            var stopIndex  = context.stop.StopIndex;

            CurrentSourceText = InputStream.GetText(new Interval(startIndex, stopIndex));

            CurrentSourceLine = context.Start.Line;
            FirstColumn       = context.Start.Column;
            FirstPosition     = context.Start.StartIndex;
            LastPosition      = context.Stop.StopIndex;

            object mainInstructionPart = null;

            // --- Obtain label
            var labelCtx = context.label();

            if (labelCtx != null)
            {
                CurrentLabel      = labelCtx.GetChild(0).NormalizeToken();
                CurrentLabelColon = labelCtx.COLON() != null;
                LabelSpan         = new TextSpan(labelCtx.Start.StartIndex, labelCtx.Start.StopIndex + 1);
            }

            // --- Obtain line body/directive
            var lineBodyCtx = context.lineBody();

            if (lineBodyCtx != null)
            {
                // --- Special case, when a macro parameters is used as the main line
                LastInstructionPos = lineBodyCtx.Stop.StopIndex;
                var macroParamCtx = lineBodyCtx.macroParam();
                if (macroParamCtx != null)
                {
                    VisitMacroParam(macroParamCtx);
                    mainInstructionPart = new MacroParamLine(macroParamCtx.IDENTIFIER()?.NormalizeToken());
                }
                else
                {
                    mainInstructionPart = VisitLineBody(context.lineBody());
                }
            }
            else if (context.directive() != null)
            {
                mainInstructionPart = VisitDirective(context.directive());
            }

            // --- Obtain comment
            if (context.comment() != null)
            {
                var commentCtx = context.comment();
                CurrentComment = commentCtx.GetText();
                CommentSpan    = new TextSpan(commentCtx.Start.StartIndex, commentCtx.Stop.StopIndex + 1);
            }

            // --- Now, we have every part of the line, and create some special main instruction part
            if (context.exception != null)
            {
                mainInstructionPart = new ParserErrorLine();
            }
            else if (mainInstructionPart == null && (CurrentLabel != null || CurrentComment != null))
            {
                mainInstructionPart = new NoInstructionLine();
                if (CurrentLabel != null && !CurrentLabelColon)
                {
                    var statementFound = true;
                    switch (CurrentLabel.ToLower())
                    {
                    case "continue":
                        mainInstructionPart = new ContinueStatement();
                        break;

                    case "break":
                        mainInstructionPart = new BreakStatement();
                        break;

                    case "endm":
                    case "mend":
                        mainInstructionPart = new MacroEndStatement();
                        break;

                    case "endl":
                    case "lend":
                        mainInstructionPart = new LoopEndStatement();
                        break;

                    case "proc":
                        mainInstructionPart = new ProcStatement();
                        break;

                    case "endp":
                    case "pend":
                        mainInstructionPart = new ProcEndStatement();
                        break;

                    case "repeat":
                        mainInstructionPart = new RepeatStatement();
                        break;

                    case "endw":
                    case "wend":
                        mainInstructionPart = new WhileEndStatement();
                        break;

                    case "ends":
                        mainInstructionPart = new StructEndStatement();
                        break;

                    case "else":
                        mainInstructionPart = new ElseStatement();
                        break;

                    case "endif":
                        mainInstructionPart = new IfEndStatement();
                        break;

                    default:
                        statementFound = false;
                        break;
                    }

                    if (statementFound)
                    {
                        KeywordSpan  = new TextSpan(context.Start.StartIndex, context.Start.StopIndex + 1);
                        CurrentLabel = null;
                    }
                }
            }

            return(mainInstructionPart is SourceLineBase sourceLine
                ? AddLine(sourceLine, context)
                : mainInstructionPart);
        }
Example #8
0
        private void pd_PrintPage(object sender, PrintPageEventArgs ev)
        {
            Length LeftMargin;
            Length TopMargin;

            //The labelnumber of the first label to be printed on this page!
            //This is NOT necessary the index of the labelnumer in the list as
            //each label can have a quantity to be printed of more than one.

            //Euhhh NextPage contains the number of the page to be drawn next.
            //But because we a now drawing it... it's the page to be drawn now.
            //Upon leave we increase this number. We work zero based, to the first page
            //actually has numbe 0
            uint FirstLabel = NextPage * LabelsPerPage;

            //LastLabel = the labelnumber of the max last label on THIS page,
            //(thus not the end of the document)
            uint LastLabel = ((NextPage + 1) * LabelsPerPage) - 1;

            //A limit can be given bij pages (print page 5 to 7) or
            //by reaching the last label.
            //So the number labels max to go is:
            uint LastLabelOfJob;

            if (ToPage == uint.MaxValue)
            {
                LastLabelOfJob = uint.MaxValue;
            }
            else
            {
                LastLabelOfJob = (ToPage + 1) * LabelsPerPage - 1;
            }
            //uint LastLabelOfJob = ((ToPage+1) * LabelsPerPage) - 1;
            uint AllLabelsCount;

            AllLabelsCount = Labels.CountAll - 1; //make this max also zero based

            //If we requested pages 0 to n but we need less than n pages to
            //print all labels, we limit to the last label.
            if (LastLabelOfJob > AllLabelsCount)
            {
                LastLabelOfJob = AllLabelsCount;
            }

            //If we have less labels than would fit the page, will still need to
            //stop at the last label...
            if (LastLabel > AllLabelsCount)
            {
                LastLabel = AllLabelsCount;
            }

            //Adjust for physical margings of the printer in respect to
            //paperdefinitions.
            //test
            //PrinterBounds theBounds;
            //theBounds = new PrinterBounds(ev);
            if (!theBoundsCached)
            {
                theBounds       = new PrinterBounds(ev);
                theBoundsCached = true;
            }
            //*
            LeftMargin = theBounds.HardMarginLeft;
            TopMargin  = theBounds.HardMarginTop;

            PaperDef.PhysicalLeftMargin = LeftMargin;
            PaperDef.PhysicalTopMargin  = TopMargin;

            ev.Graphics.PageUnit = GraphicsUnit.Pixel;
            float dpiX = ev.Graphics.DpiX;
            float dpiY = ev.Graphics.DpiY;

            uint LabelIndex      = 0;
            uint HorizontalIndex = 0;
            uint VerticalIndex   = 0;
            uint QuantityCount   = 0;

            foreach (Label.Label CurrentLabel in Labels)
            {
                if (LabelIndex + CurrentLabel.Quantity < FirstLabel)
                {
                    LabelIndex += CurrentLabel.Quantity;
                    continue;
                }

                // Stop if we don't need any more labels
                if (LabelIndex > LastLabel)
                {
                    break;
                }

                for (QuantityCount = 0; QuantityCount < CurrentLabel.Quantity; QuantityCount++)
                {
                    // skip labels that don't need printing..
                    if (LabelIndex < FirstLabel)
                    {
                        LabelIndex++;
                        continue;
                    }

                    // Stop if we don't need any more labels
                    if (LabelIndex > LastLabel)
                    {
                        break;
                    }

                    Tools.Rectangle          rect     = PaperDef.GetLabelRectangle((int)HorizontalIndex, (int)VerticalIndex);
                    System.Drawing.Rectangle convRect = new System.Drawing.Rectangle((int)rect.Left.InPixels(dpiX), (int)rect.Top.InPixels(dpiY), (int)rect.Size.Width.InPixels(dpiX), (int)rect.Size.Height.InPixels(dpiY));

                    ACA.LabelX.Label.LabelSet labelset = new ACA.LabelX.Label.LabelSet();

                    labelset.CurrentLabel    = CurrentLabel;
                    labelset.DefaultLabel    = DefaultLabel;
                    labelset.BaseLabel       = LabelDef.DefaultLabel;
                    labelset.StaticVarsLabel = StaticVarslabel;


                    executeLua(labelset.CurrentLabel, labelset.DefaultLabel, labelset.BaseLabel, labelset.StaticVarsLabel);

                    CurrentLabel.Draw(ev.Graphics, convRect, LabelDef, labelset, Language, DrawBorders);
                    counter++;
                    if (counter > 200)
                    {
                        GC.Collect();
                        counter = 0;
                    }
                    HorizontalIndex++;

                    if (HorizontalIndex >= PaperDef.labelLayout.HorizontalCount)
                    {
                        HorizontalIndex = 0;
                        VerticalIndex++;
                    }

                    if (VerticalIndex >= PaperDef.labelLayout.VerticalCount)
                    {
                        VerticalIndex = 0;
                    }

                    LabelIndex++;
                }
            }

            if (LabelIndex <= LastLabelOfJob)
            {
                NextPage++;
                ev.HasMorePages = true;
            }
            else
            {
                NextPage        = 0;
                ev.HasMorePages = false;
            }
        }
Example #9
0
            //更新标签数值
            public void UpdateLabels()
            {
                GameObject CurrentLabel;
                float      Illumination = 0;
                //各种照度计数
                int TotalCount = 0;
                int CountPart1 = 0;
                int CountPart2 = 0;

                DaylightFactorMean = 0;
                illuminationMean   = 0;
                DaylightFactorMin  = 15000;
                float Factor = 0;
                int   count  = 0;

                //网络
                for (int i = 0; i < RowCount; i++)
                {
                    for (int j = 0; j < ColumnCount; j++)
                    {
                        Factor       = 0;                  //采光系数
                        Illumination = 0;                  //照度值
                        CurrentLabel = Labels [i * ColumnCount + j];
                        for (int Index = 0; Index < sideWindowsCount; Index++)
                        {
                            Factor = Factor + LightOutput.GetPointDaylightFactor(CurrentLabel.transform.position, sideWindowPositionArray [Index], sideWindowWidthArray [Index], sideWindowHeightArray [Index]);
                        }
                        //for (int Index = 0; Index < skylightsCount; Index++)
                        //{
                        //    Factor = Factor + LightOutput.GetSkylightPointFactor2(CurrentLabel.transform.position, skylightPositionArray[Index], skylightWidthArray[Index], skylightHeightArray[Index]);
                        //}
                        for (int Index = 0; Index < LampCount; Index++)
                        {
                            //LampIntensity的数组是不对的,因为shader限制除了一个室外照度来模仿采光系数,需要乘以室外照度
                            Illumination += LightOutput.GetPointIllumination(CurrentLabel.transform.position, LampPositionArray [Index], LampAngleArray [Index], LampIntensity [Index] * LightOutput.OutdoorIllumination, LampSpotAngle [Index], 'y');
                        }

                        Illumination += Factor * LightOutput.OutdoorIllumination;                        //总照度等于灯的照度加上采光照度
                        count++;
                        //DaylightFactorMean = 0.5f * (DaylightFactorMean + Factor);//计算平均采光系数
                        DaylightFactorMean = DaylightFactorMean + (Factor - DaylightFactorMean) / count;
                        //illuminationMean = 0.5f * (illuminationMean + Illumination);//计算平均照度
                        illuminationMean = illuminationMean + (Illumination - illuminationMean) / count;
                        if (Factor < DaylightFactorMin)
                        {
                            DaylightFactorMin = Factor;                            //计算最小照度
                        }

                        //计算各个部分占的百分比
                        TotalCount++;
                        if (Illumination < 200)
                        {
                            CountPart1++;
                        }
                        else if (Illumination < 500)
                        {
                            CountPart2++;
                        }
                        if (firstMode)
                        {
                            CurrentLabel.GetComponentInChildren <Text>().text = ((int)Illumination).ToString();
                        }
                        else
                        {
                            CurrentLabel.GetComponentInChildren <Text>().text = Factor.ToString("#0.##");
                        }
                    }
                }

                PercentPart1 = CountPart1 * 1.0f / TotalCount * 100;
                PercentPart2 = CountPart2 * 1.0f / TotalCount * 100;

                Illumination = 0;
                //折线图
                //dataOutput.ClearStaticGragh ();
                //chartUpdate.ClearStaticGragh ();//清空第二张折线图
                //for (int j = 0; j < sideWindowsCount; j++) {
                //	for (int i = 0; i < 25; i++) {
                //		Factor = 0;
                //		for (int Index = 0; Index < sideWindowsCount; Index++) {
                //			Factor = Factor + LightOutput.GetPointDaylightFactor (new Vector3 (sideWindowPositionArray [j].x, firstPosition.y, firstPosition.z) + new Vector3 (0, 0, i * StepLength), sideWindowPositionArray [Index], sideWindowWidthArray [Index], sideWindowHeightArray [Index]);
                //		}
                //		//for (int Index = 0; Index < skylightsCount; Index++)
                //		//{
                //		//    Factor = Factor + LightOutput.GetSkylightPointFactor2(new Vector3(sideWindowPositionArray[j].x, firstPosition.y, firstPosition.z) + new Vector3(0, 0, i * StepLength), skylightPositionArray[Index], skylightWidthArray[Index], skylightHeightArray[Index]);
                //		//}
                //		for (int Index = 0; Index < LampCount; Index++) {
                //			Illumination += LightOutput.GetPointIllumination (new Vector3 (sideWindowPositionArray [j].x, firstPosition.y, firstPosition.z) + new Vector3 (0, 0, i * StepLength), LampPositionArray [Index] * LightOutput.OutdoorIllumination, LampAngleArray [Index], LampIntensity [Index], LampSpotAngle [Index], 'y');
                //		}
                //		Illumination = Factor * LightOutput.OutdoorIllumination;
                //		StaticGraphValues [i] = (int)Illumination;
                //	}
                //	//dataOutput.OutputStaticGragh (StaticGraphValues, (j + 1).ToString ());
                //	//chartUpdate.OutputStaticGragh (StaticGraphValues, (j + 1).ToString ()); ;//更新第二张折线图
                //}
            }