// ----------------------------------------------------------------------------------------
 public void Rename(CodeFile file)
 {
     BeginRenameVisual(file);
 }
        public void Copy(CodeFile file)
        {
            CodeFile newFile = file.MakeCopy(null);

            CodeProjectManager.Instance.Current.AddFile(newFile);
        }
Exemple #3
0
        private void LoadXML()
        {
            try
            {
                using (var xml_reader = new XmlTextReader(Path))
                    using (var reader = new XmlValidatingReader(xml_reader))
                    {
                        int fileErrorsCounter = 0;

                        XmlSchema schema = XmlSchema.Read(new StringReader(Resources.ResourceManager.GetString("ProjectSchema")), null);
                        reader.Schemas.Add(schema);

                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.Element && reader.Name == "Project")
                            {
                                //project.Name = reader.GetAttribute("Name");
                                //project.DefaultCodeFileExtension = reader.GetAttribute("DefaultCodeFileExtension");
                                NextDefaultFileNumber = Convert.ToInt32(reader.GetAttribute("NextDefaultFileNumber"));
                            }
                            // Files
                            else if (reader.NodeType == XmlNodeType.Element && reader.Name == "Files")
                            {
                            }
                            else if (reader.NodeType == XmlNodeType.Element && reader.Name == "File")
                            {
                                try
                                {
                                    CodeFile file = new CodeFile(reader.GetAttribute("Path"), false);
                                    AddFile(file, false);
                                }
                                catch (LoadCodeFileException ex)
                                {
                                    fileErrorsCounter++;

                                    ErrorWindow err = new ErrorWindow
                                    {
                                        ShortDesc = LocalString.Get("Error_LoadFileInProject_short") + " '" + System.IO.Path.GetFileName(ex.FileName) + "'.",
                                        FullDesc  = LocalString.Get("Error_LoadFileInProject_full"),
                                        Exception = ex
                                    };
                                    err.ShowDialog();
                                }
                            }
                            // WorkDirs
                            else if (reader.NodeType == XmlNodeType.Element && reader.Name == "WorkDirs")
                            {
                            }
                            if (reader.NodeType == XmlNodeType.Element && reader.Name == "WorkDir")
                            {
                                WorkDirs.Add(reader.GetAttribute("Path"));
                            }
                        }

                        if (fileErrorsCounter > 0)
                        {
                        }
                    }
            }
            catch (IOException ex)                  { throw new ParsingProjectException(Path, ex); }
            catch (XmlException ex)                 { throw new ParsingProjectException(Path, ex); }
            catch (XmlSchemaException ex)           { throw new ParsingProjectException(Path, ex); }
            catch (UnauthorizedAccessException ex)  { throw new ParsingProjectException(Path, ex); }
        }
Exemple #4
0
 public FileExistsException(CodeFile file)
     : base("File [" + file.Path + "] already exists!")
 {
     File = file;
 }
 public void UpdateCodeFile(CodeFile codeFile)
 {
     CurrentCodeFile = codeFile;
 }
 public void RemoveFromTabs(CodeFile file)
 {
     tabControl.CloseTab(file);
 }
 public bool IsFileOpened(CodeFile file)
 {
     return(tabControl.Elements.Count(codeFile => codeFile == file) > 0);
 }
Exemple #8
0
        public List <CompileError> Compile(CodeFile file)
        {
            // что есть сейчас
            //_recent.Clear();

            string text   = file.Text;
            var    errors = new List <CompileError>();

            for (int i = 0; i < text.Length; i++)
            {
                Char c = text[i];

                if (Char.IsDigit(c))
                {
                    CompileError.Type type = CompileError.Type.Type0;

                    if (c == '0')
                    {
                        type = CompileError.Type.Type0;
                    }
                    else if (c == '1')
                    {
                        type = CompileError.Type.Type1;
                    }
                    else if (c == '2')
                    {
                        type = CompileError.Type.Type2;
                    }
                    else if (c == '3')
                    {
                        type = CompileError.Type.Type3;
                    }
                    else if (c == '4')
                    {
                        type = CompileError.Type.Type4;
                    }
                    else if (c == '5')
                    {
                        type = CompileError.Type.Type5;
                    }
                    else if (c == '6')
                    {
                        type = CompileError.Type.Type6;
                    }
                    else if (c == '7')
                    {
                        type = CompileError.Type.Type7;
                    }
                    else if (c == '8')
                    {
                        type = CompileError.Type.Type8;
                    }
                    else if (c == '9')
                    {
                        type = CompileError.Type.Type9;
                    }

                    errors.Add(new CompileError(type, file, i, i + 1));

                    if (_recent.ContainsKey(type))
                    {
                        _recent[type] += 1;
                    }
                    else
                    {
                        _recent[type] = 1;
                    }
                }
                else
                {
                    // No error
                }
            }

            OnCompiled();

            return(errors);
        }
 public VersionSelectWindow(CodeFile file)
 {
     File = file;
     InitializeComponent();
 }