Ejemplo n.º 1
0
        private void AddAllLabels(MissingLabel changeLabel)
        {
            var filePath         = Path.Combine(CurrentProject.Path, changeLabel.Language, changeLabel.Module);
            var jsonModule       = this.findLabel.ParseOneJsonFile(filePath);
            var getInChildModule = jsonModule;
            var childPath        = changeLabel.LabelPath.Split('.');

            for (var i = 0; i < childPath.Length; i++)
            {
                if ((childPath.Length - 1) != i)
                {
                    var canDeeper = this.findLabel.TryGoDeeper(getInChildModule, childPath[i]);
                    if (canDeeper)
                    {
                        getInChildModule = this.findLabel.GetDeeperChild(getInChildModule, childPath[i]);
                    }
                    else
                    {
                        getInChildModule = AddGroup(getInChildModule, childPath[i]);
                        getInChildModule = this.findLabel.GetDeeperChild(getInChildModule, childPath[i]);
                    }
                }
                else
                {
                    if (changeLabel.Sync)
                    {
                        var isMarkdown = CheckOnMarkdown(changeLabel.Module, changeLabel.LabelPath);
                        getInChildModule = AddLabel(getInChildModule, childPath[i], changeLabel.Language, isMarkdown);
                    }
                }
            }

            this.saveLabels.WriteLabelsToHardDrive(jsonModule, filePath);
        }
Ejemplo n.º 2
0
        private bool FindDuplucateMissingLabel(MissingLabel newMissingLabel)
        {
            foreach (var missingLabel in this.allMissingLabels)
            {
                if (missingLabel.Language.Equals(newMissingLabel.Language) && missingLabel.Module.Equals(newMissingLabel.Module) && missingLabel.LabelPath.Equals(newMissingLabel.LabelPath))
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 3
0
 private void Expanded_Activated(object sender, EventArgs e)
 {
     if (Program.TimetableList.Count == 0)
     {
         MissingLabel.BringToFront();
         MissingLabel.Show();
     }
     else
     {
         MissingLabel.Hide();
     }
 }
Ejemplo n.º 4
0
        private void RemoveLabel(MissingLabel changeLabel)
        {
            this.findLabel.SetMetaInAllLanguage();
            foreach (var language in CurrentProject.AllLanguage)
            {
                var     modulePath = Path.Combine(CurrentProject.Path, language, changeLabel.Module);
                JObject jsonModule;
                try
                {
                    jsonModule = this.findLabel.ParseOneJsonFile(modulePath);
                }
                catch (Exception)
                {
                    continue;
                }

                var getInChildModule = jsonModule;

                var childPath = changeLabel.LabelPath.Split('.');
                for (var i = 0; i < childPath.Length; i++)
                {
                    var canDeeper = this.findLabel.TryGoDeeper(getInChildModule, childPath[i]);
                    if (canDeeper && childPath.Length - 1 != i)
                    {
                        getInChildModule = this.findLabel.GetDeeperChild(getInChildModule, childPath[i]);
                    }
                    else
                    {
                        if (childPath.Length - 1 != i)
                        {
                            break;
                        }
                    }

                    if (i == childPath.Length - 1)
                    {
                        getInChildModule.Remove(childPath[i]);
                    }
                }

                this.saveLabels.WriteLabelsToHardDrive(jsonModule, modulePath);
            }

            this.findLabel.RemoveMetaInAllLanguage();
        }
Ejemplo n.º 5
0
        private void CompareMissingLabel(string labelPath, string language, string module)
        {
            foreach (var oneOtherLanguage in this.allJsonAllLanguages)
            {
                if (!oneOtherLanguage.Language.Equals(language))
                {
                    for (var y = 0; y < oneOtherLanguage.AllJsonFileNames.Count; y++)
                    {
                        if (oneOtherLanguage.AllJsonFileNames[y].Equals(module))
                        {
                            for (int i = 0; i < oneOtherLanguage.AllLabelPath[y].Count; i++)
                            {
                                if (oneOtherLanguage.AllLabelPath[y][i].Equals(labelPath))
                                {
                                    break;
                                }

                                if (i == (oneOtherLanguage.AllLabelPath[y].Count - 1))
                                {
                                    MissingLabel missingLabel = new MissingLabel
                                    {
                                        Language  = oneOtherLanguage.Language,
                                        Module    = module,
                                        LabelPath = labelPath
                                    };
                                    if (FindDuplucateMissingLabel(missingLabel))
                                    {
                                        this.allMissingLabels.Add(missingLabel);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private void Expanded_Activated(object sender, EventArgs e)
        {
            if (Program.TimetableList.Count == 0)
            {
                MissingLabel.BringToFront();
                MissingLabel.Show();
            }
            else
            {
                MissingLabel.Hide();
            }
            if (!started)
            {
                Termlabel.Text = "Term " + Program.SettingsData.Curterm;
                started        = true;
                for (int k = 0; k < 10; k++)
                {
                    for (int i = 0; i <= 6; i++)
                    {
                        period tPeriod;
                        if (Program.TimetableList.ContainsKey((k + 1) + "" + i))
                        {
                            tPeriod = Program.TimetableList[(k + 1) + "" + i];
                        }
                        else
                        {
                            tPeriod              = new period();
                            tPeriod.ClassCode    = "";
                            tPeriod.DayNumber    = -1;
                            tPeriod.PeriodNumber = -1;
                        }
                        TextBox textLabel = new TextBox();
                        Label   classroom = new Label();
                        Label   classcod  = new Label();
                        classroom.Text        = tPeriod.Room;
                        classroom.Location    = new Point(65, 65);
                        classcod.Text         = tPeriod.ClassCode;
                        classcod.Location     = new Point(0, 65);
                        classcod.AutoSize     = true;
                        textLabel.ReadOnly    = true;
                        textLabel.WordWrap    = true;
                        textLabel.BorderStyle = BorderStyle.None;
                        textLabel.Width       = 98;
                        textLabel.Height      = 45;
                        textLabel.Multiline   = true;
                        textLabel.Location    = new Point(1, 3);
                        Panel eriod = (Panel)(Controls.Find((k + 1) + i.ToString(), false))[0];
                        textLabel.Text      = tPeriod.ClassDescription;
                        eriod.BackColor     = Program.ColorRef.ContainsKey(tPeriod.ClassCode) ? Program.ColorRef[tPeriod.ClassCode] : Color.White;
                        textLabel.BackColor = eriod.BackColor;
                        eriod.Controls.Clear();
                        eriod.Controls.Add(classcod);
                        eriod.Controls.Add(classroom);
                        eriod.Controls.Add(textLabel);
                    }
                }
            }

            if (Program.curDay == 0)
            {
                Curdayhigh.Visible = false;
            }
            else
            {
                Panel deriod = (Panel)(Controls.Find(Program.curDay + "0", false))[0];
                Curdayhigh.Visible  = true;
                Curdayhigh.Location = new Point(deriod.Location.X - 10, 0);
            }
            if (Program.SettingsData.EarlyDate.Date == DateTime.Now.Date)
            {
                Earlybutt.BackColor = Color.GreenYellow;
            }
        }