Пример #1
0
        public bool SetDCCProgram(CDCCDefinition program)
        {
            bool isNotOverride = true;

            if (DCCPrograms.ContainsKey(program.Name))
            {
                DCCPrograms.Remove(program.Name);
                isNotOverride = false;
            }

            DCCPrograms.Add(program.Name, program);

            return(isNotOverride);
        }
Пример #2
0
        private void LoadProgramDefinitions()
        {
            XmlTextReader reader = null;

            try
            {
                if (!File.Exists(m_sProgramDefSavePath))
                {
                    SaveProgramDefinitions();
                }


                reader = new XmlTextReader(m_sProgramDefSavePath);
                string currentDef  = "";
                string currentProg = "";
                while (reader.Read())
                {
                    reader.MoveToElement();

                    if (reader.LocalName == "ProgramDef" && reader.AttributeCount > 0)
                    {
                        reader.MoveToNextAttribute();

                        var def = new CDCCDefinition();

                        def.Name = reader.Value;

                        SetDCCProgram(def);
                        currentDef = reader.Value;
                    }
                    else if (reader.LocalName == "Program" && reader.AttributeCount > 0)
                    {
                        reader.MoveToNextAttribute();

                        SDCCProgram program = new SDCCProgram();

                        program.Name = reader.Value;

                        reader.MoveToNextAttribute();

                        program.ExecutablePath = reader.Value;

                        GetDCCProgram(currentDef).Programs.Add(program.Name, program);

                        currentProg = program.Name;
                    }
                    else if (reader.LocalName == "File")
                    {
                        SDCCProgram prog = GetDCCProgram(currentDef).GetProgram(currentProg);

                        SStartupFile file = new SStartupFile("", "");

                        reader.MoveToNextAttribute();

                        file.Name = reader.Value;

                        reader.MoveToNextAttribute();

                        file.SetFilePath(reader.Value);

                        reader.MoveToNextAttribute();

                        bool boolVal;
                        Boolean.TryParse(reader.Value, out boolVal);
                        file.Copy = boolVal;

                        reader.MoveToNextAttribute();

                        Boolean.TryParse(reader.Value, out boolVal);
                        file.LaunchWithProgram = boolVal;

                        prog.StartupFiles.Add(file.Name, file);
                    }

                    else
                    {
                    }
                }
            }
            catch (Exception e)
            {
                if (reader != null)
                {
                    reader.Close();
                }

                CUserInteractionUtils.ShowErrorMessageBox(e.Message);                 // TODO: More ionfo pls
            }
        }