Exemplo n.º 1
0
        public void AppendFiles(IEnumerable <string> paths)
        {
            foreach (var path in paths)
            {
                if (Directory.Exists(path))
                {
                    var files = Directory.GetFiles(path, "*.inc", SearchOption.AllDirectories);
                    foreach (var file in files)
                    {
                        var fInfo         = new FileInfo(file);
                        var subCondenser  = new Condenser(File.ReadAllText(fInfo.FullName), fInfo.Name);
                        var subDefinition = subCondenser.Condense();
                        Functions.AddRange(subDefinition.Functions);
                        Enums.AddRange(subDefinition.Enums);
                        Structs.AddRange(subDefinition.Structs);
                        Defines.AddRange(subDefinition.Defines);
                        Constants.AddRange(subDefinition.Constants);
                        Methodmaps.AddRange(subDefinition.Methodmaps);
                        Typedefs.AddRange(subDefinition.Typedefs);
                        EnumStructs.AddRange(subDefinition.EnumStructs);
                    }
                }
            }

            // var editor = Program.MainWindow.GetCurrentEditorElement();

            Sort();
            ProduceStringArrays();
        }
Exemplo n.º 2
0
 private void BackgroundParser_Worker()
 {
     while (true)
     {
         while (Program.Options.DynamicIsac)
         {
             Thread.Sleep(5000);
             var ee = GetAllEditorElements();
             if (ee != null)
             {
                 SMDefinition[] definitions = new SMDefinition[ee.Length];
                 for (int i = 0; i < ee.Length; ++i)
                 {
                     FileInfo fInfo = new FileInfo(ee[i].FullFilePath);
                     if (fInfo.Extension.Trim('.').ToLowerInvariant() == "inc")
                     {
                         var condenser = new Condenser(File.ReadAllText(fInfo.FullName), fInfo.Name);
                         definitions[i] = ((new Condenser(File.ReadAllText(fInfo.FullName), fInfo.Name)).Condense());
                     }
                 }
                 currentSMDef       = (Program.ConfigList.Current.GetSMDef()).ProduceTemporaryExpandedDefinition(definitions);
                 currentSMFunctions = currentSMDef.Functions.ToArray();
                 currentACNodes     = currentSMDef.ProduceACNodes();
                 currentISNodes     = currentSMDef.ProduceISNodes();
                 ++currentSMDefUID;
             }
         }
         Thread.Sleep(5000);
     }
 }
Exemplo n.º 3
0
 public void AppendFiles(string[] paths)
 {
     for (int i = 0; i < paths.Length; ++i)
     {
         if (Directory.Exists(paths[i]))
         {
             string[] files = Directory.GetFiles(paths[i], "*.inc", SearchOption.AllDirectories);
             for (int j = 0; j < files.Length; ++j)
             {
                 FileInfo  fInfo         = new FileInfo(files[j]);
                 Condenser subCondenser  = new Condenser(File.ReadAllText(fInfo.FullName), fInfo.Name);
                 var       subDefinition = subCondenser.Condense();
                 Functions.AddRange(subDefinition.Functions);
                 Enums.AddRange(subDefinition.Enums);
                 Structs.AddRange(subDefinition.Structs);
                 Defines.AddRange(subDefinition.Defines);
                 Constants.AddRange(subDefinition.Constants);
                 Methodmaps.AddRange(subDefinition.Methodmaps);
                 Typedefs.AddRange(subDefinition.Typedefs);
             }
         }
     }
     Sort();
     ProduceStringArrays();
 }
        private void BackgroundParser_Worker()
        {
            while (true)
            {
                while (Program.OptionsObject.Program_DynamicISAC)
                {
                    Thread.Sleep(3000);
                    var ee    = GetAllEditorElements();
                    var caret = -1;

                    if (ee != null)
                    {
                        var definitions = new SMDefinition[ee.Length];
                        List <SMFunction> currentFunctions = null;
                        for (var i = 0; i < ee.Length; ++i)
                        {
                            var fInfo = new FileInfo(ee[i].FullFilePath);
                            if (fInfo.Extension.Trim('.').ToLowerInvariant() == "inc")
                            {
                                definitions[i] =
                                    new Condenser(File.ReadAllText(fInfo.FullName), fInfo.Name).Condense();
                            }

                            if (fInfo.Extension.Trim('.').ToLowerInvariant() == "sp")
                            {
                                var i1 = i;
                                Dispatcher.Invoke(() =>
                                {
                                    if (ee[i1].IsLoaded)
                                    {
                                        caret           = ee[i1].editor.CaretOffset;
                                        definitions[i1] =
                                            new Condenser(File.ReadAllText(fInfo.FullName), fInfo.Name)
                                            .Condense();
                                        currentFunctions = definitions[i1].Functions;
                                    }
                                });
                            }
                        }

                        currentSMDef = Program.Configs[Program.SelectedConfig].GetSMDef()
                                       .ProduceTemporaryExpandedDefinition(definitions, caret, currentFunctions);
                        currentSMFunctions = currentSMDef.Functions.ToArray();
                        currentACNodes     = currentSMDef.ProduceACNodes();
                        currentISNodes     = currentSMDef.ProduceISNodes();
                        ++currentSMDefUID;
                    }
                }
            }

            // ReSharper disable once FunctionNeverReturns
        }
Exemplo n.º 5
0
 public void AppendFiles(string[] paths)
 {
     foreach (var path in paths)
     {
         if (Directory.Exists(path))
         {
             string[] files = Directory.GetFiles(path, "*.inc", SearchOption.AllDirectories);
             foreach (var file in files)
             {
                 FileInfo  fInfo         = new FileInfo(file);
                 Condenser subCondenser  = new Condenser(File.ReadAllText(fInfo.FullName), fInfo.Name);
                 var       subDefinition = subCondenser.Condense();
                 Functions.AddRange(subDefinition.Functions);
                 Enums.AddRange(subDefinition.Enums);
                 Defines.AddRange(subDefinition.Defines);
                 Constants.AddRange(subDefinition.Constants);
             }
         }
     }
     Sort();
     ProduceStringArrays();
 }
        public static void Condense(TextReader reader, TextWriter writer)
        {
            Condenser theCondenser = new Condenser(reader, writer);

            theCondenser.Condense();
        }
 public static void Condense(TextReader reader, TextWriter writer)
 {
     Condenser theCondenser = new Condenser(reader, writer);
     theCondenser.Condense();
 }
Exemplo n.º 8
0
 public void SetCondenser(Condenser newCondenser)
 {
     condenser = newCondenser;
 }