Esempio n. 1
0
        public void AddSymbolFiles(SymbolFile symbolFile, HttpPostedFileBase[] uploadFiles)
        {
            var symbol = GetSymbol(symbolFile.Symbol.SystemId);

            if (symbolFile.SymbolFileVariant == null)
            {
                SymbolFileVariant variant = new SymbolFileVariant();
                variant.SystemId             = Guid.NewGuid();
                variant.Name                 = GetVariantName(symbol, symbolFile);
                symbolFile.SymbolFileVariant = variant;
            }

            symbol.DateChanged  = DateTime.Now;
            symbol.LastEditedBy = ClaimsPrincipal.Current.GetUsername();

            ImageService imageService = new ImageService();

            foreach (var uploadFile in uploadFiles)
            {
                int width = imageService.GetWidth(uploadFile);
                uploadFile.InputStream.Position = 0;
                var format = Path.GetExtension(uploadFile.FileName).Replace(".", "");
                if (width > 0 && format != "ai" && format != "pdf")
                {
                    symbolFile.Size = GetSize(width);
                }
                var filename = new ImageService().SaveImage(uploadFile, symbol, symbolFile, width, true);
                AddFile(symbolFile, symbol, symbolFile.SymbolFileVariant, filename, format);
            }
        }
Esempio n. 2
0
        public void TestSuite3()
        {
            var symbols = new Dictionary <string, int>
            {
                { "Val1", 0x11 },
                { "Val2", 0x22 },
                { "Val3", 0xff },
                { "Loc1", 0xd020 },
                { "Loc2", 0xd021 },
                { "Loc3", 0xd022 }
            };


            var symbolFile = new SymbolFile(symbols);

            var tree = GetContext("GrammarTests/test-3.txt");

            var walker = new ParseTreeWalker();
            var sbl    = new SimBaseListener {
                Symbols = symbolFile
            };

            walker.Walk(sbl, tree);

            Assert.AreEqual(0x11, sbl.Proc.ReadMemoryValueWithoutCycle(0xd020));
            Assert.AreEqual(0x22, sbl.Proc.ReadMemoryValueWithoutCycle(0xd021));
            Assert.AreEqual(0xff, sbl.Proc.ReadMemoryValueWithoutCycle(0xd022));
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            string        path = @"C:\Tool Demo Files\2. Crash Data\File43\CoreImage"; // C:\Tool Demo Files\2. Crash Data\File28\";
            DirectoryInfo dir  = new DirectoryInfo(path);

            FileInfo[] files = dir.GetFiles("*.symbol");
            //
            //
            foreach (FileInfo file in files)
            {
                //
                DateTime timeStamp = DateTime.Now;
                System.Console.WriteLine(string.Format("[{0}] - Reading starting...", file.Name));

                SymbolFile symbolFile = new SymbolFile(file);
                symbolFile.Read();

                DateTime endTime = DateTime.Now;
                TimeSpan span    = (endTime - timeStamp);

                System.Console.WriteLine(string.Format("[{0}] - Reading complete - {1} time, {2} binaries", file.Name, span, symbolFile.Count));
                System.Console.WriteLine(" ");
                System.Console.WriteLine(" ");
                System.Console.WriteLine(" ");
                System.Console.ReadKey();
            }
        }
Esempio n. 4
0
        public void TestAddSymbols()
        {
            var symfile = ".label MyLabel=$0801\n.label YourLabel=$c000\n  .label OurLabel=49152";
            var sf      = new SymbolFile(symfile);

            Assert.AreEqual(2049, sf.SymbolToAddress("MyLabel"));
            Assert.AreEqual(49152, sf.SymbolToAddress("YourLabel"));
            Assert.AreEqual(49152, sf.SymbolToAddress("OurLabel"));
        }
Esempio n. 5
0
        public void AddSymbolFilesFromSvg(SymbolFile symbolFile, HttpPostedFileBase uploadFile)
        {
            var symbol = GetSymbol(symbolFile.Symbol.SystemId);

            if (symbolFile.SymbolFileVariant == null)
            {
                SymbolFileVariant variant = new SymbolFileVariant();
                variant.SystemId             = Guid.NewGuid();
                variant.Name                 = GetVariantName(symbol, symbolFile);
                symbolFile.SymbolFileVariant = variant;
            }

            ImageService imageService = new ImageService();

            symbol.DateChanged  = DateTime.Now;
            symbol.LastEditedBy = ClaimsPrincipal.Current.GetUsername();
            symbolFile.Symbol   = symbol;
            symbolFile.SystemId = Guid.NewGuid();
            var filename = imageService.SaveImage(uploadFile, symbol, symbolFile, 0, false);

            symbolFile.FileName = filename;
            symbolFile.Format   = "svg";
            symbolFile.Size     = "stor";
            _dbContext.SymbolFiles.Add(symbolFile);
            _dbContext.SaveChanges();

            uploadFile.InputStream.Position = 0;
            filename        = imageService.ConvertImage(uploadFile, symbol, "tiff", symbolFile, 1500, false);
            symbolFile.Size = "stor";
            AddFile(symbolFile, symbol, symbolFile.SymbolFileVariant, filename, "tiff");

            uploadFile.InputStream.Position = 0;
            filename        = imageService.ConvertImage(uploadFile, symbol, "png", symbolFile, 50, false);
            symbolFile.Size = "liten";
            AddFile(symbolFile, symbol, symbolFile.SymbolFileVariant, filename, "png");

            uploadFile.InputStream.Position = 0;
            filename        = imageService.ConvertImage(uploadFile, symbol, "png", symbolFile, 150);
            symbolFile.Size = "liten";
            AddFile(symbolFile, symbol, symbolFile.SymbolFileVariant, filename, "png");

            //var gifInputFileName = filename;

            //filename = imageService.ConvertToGif(gifInputFileName, symbol, "gif", symbolFile, 50, false);
            //symbolFile.Size = "liten";
            //AddFile(symbolFile, symbol, symbolFile.SymbolFileVariant, filename, "gif");

            //filename = imageService.ConvertToGif(gifInputFileName, symbol, "gif", symbolFile, 150);
            //symbolFile.Size = "liten";
            //AddFile(symbolFile, symbol, symbolFile.SymbolFileVariant, filename, "gif");

            //uploadFile.InputStream.Position = 0;
            //filename = imageService.ConvertImage(uploadFile, symbol, "ai", symbolFile, 0, false);
            //symbolFile.Size = "stor";
            //AddFile(symbolFile, symbol, symbolFile.SymbolFileVariant, filename, "ai");
        }
Esempio n. 6
0
        public void TestNamespaces()
        {
            var symfile =
                ".label NonNamespacedLabel=$400\n.namespace kernal {\n  .label NamespacedLabel=$ffff\n}\n.label AnotherNonNamespacedLabel=$0800";
            var sf = new SymbolFile(symfile);

            Assert.AreEqual(1024, sf.SymbolToAddress("NonNamespacedLabel"));
            Assert.AreEqual(65535, sf.SymbolToAddress("kernal.NamespacedLabel"));
            Assert.AreEqual(2048, sf.SymbolToAddress("AnotherNonNamespacedLabel"));
        }
Esempio n. 7
0
        public override void ExitSymbolsFunction(sim6502Parser.SymbolsFunctionContext context)
        {
            var filename = context.symbolsFilename().StringLiteral().GetText();

            Logger.Trace($"Loading symbol file {filename}");
            var symbols = File.ReadAllText(filename);

            Symbols = new SymbolFile(symbols);
            Logger.Trace($"{Symbols.SymbolCount.ToString()} symbols loaded.");
        }
Esempio n. 8
0
        // GET: SymbolFiles/Create
        public ActionResult Create(Guid systemid)
        {
            ViewBag.Size           = new SelectList(CodeList.Size, "Key", "Value");
            ViewBag.SymbolGraphics = new SelectList(CodeList.SymbolGraphics, "Key", "Value");
            SymbolFile symbolFile = new SymbolFile();

            symbolFile.Symbol = _symbolService.GetSymbol(systemid);

            return(View(symbolFile));
        }
Esempio n. 9
0
        public void TestLookupByAddress()
        {
            var symfile =
                ".label NonNamespacedLabel=$400\n.namespace kernal {\n  .label NamespacedLabel=$ffff\n}\n.label AnotherNonNamespacedLabel=$0800";
            var sf = new SymbolFile(symfile);

            Assert.AreEqual("NonNamespacedLabel", sf.AddressToSymbol(1024));
            Assert.AreEqual("kernal.NamespacedLabel", sf.AddressToSymbol(65535));
            Assert.AreEqual("AnotherNonNamespacedLabel", sf.AddressToSymbol(2048));

            Assert.AreEqual("$401", sf.AddressToSymbol(1025));
            Assert.AreEqual("1025", sf.AddressToSymbol(1025, false));
        }
Esempio n. 10
0
        private void AddFile(SymbolFile symbolFile, Models.Symbol symbol, SymbolFileVariant variant, string filename, string format)
        {
            SymbolFile file = new SymbolFile();

            file.SystemId          = Guid.NewGuid();
            file.Color             = symbolFile.Color;
            file.Size              = symbolFile.Size;
            file.Symbol            = symbol;
            file.SymbolFileVariant = variant;
            file.Type              = symbolFile.Type;
            file.FileName          = filename;
            file.Format            = format;
            _dbContext.SymbolFiles.Add(file);
            _dbContext.SaveChanges();
        }
Esempio n. 11
0
        private static bool WriteAnnotations(SymbolFile file, StreamWriter sw)
        {
            var providers = new SortedList <string, SourceProvider>();
            var itemCount = 1;

            var available = file.SourceFiles
                            .Where(x => x.IsResolved)
                            .Select(x => x.SourceReference.SourceProvider)
                            .Where(x => !providers.ContainsKey(x.Id));

            foreach (var provider in available)
            {
                providers.Add(provider.Id, provider);
                if (provider.SourceEntryVariableCount > itemCount)
                {
                    itemCount = provider.SourceEntryVariableCount;
                }
            }

            if (providers.Count == 0)
            {
                return(false);
            }

            Console.WriteLine("Indexing " + file.File.FullName);
            sw.WriteLine("SRCSRV: ini ------------------------------------------------");
            sw.WriteLine("VERSION=1");
            sw.WriteLine("SRCSRV: variables ------------------------------------------");
            sw.WriteLine("DATETIME=" + DateTime.UtcNow.ToString("u"));
            foreach (var sp in providers.Values)
            {
                sp.WriteEnvironment(sw);
            }
            sw.WriteLine("SRCSRV: source files ---------------------------------------");

            var files = file.SourceFiles
                        .Where(x => x.IsResolved)
                        .Select(x => x.SourceReference.GetSourceEntries());

            foreach (var values in files)
            {
                sw.WriteLine(string.Join("*", values.Take(itemCount)));
            }

            sw.WriteLine("SRCSRV: end ------------------------------------------------");

            return(true);
        }
Esempio n. 12
0
        private string GetVariantName(Models.Symbol symbol, SymbolFile symbolFile)
        {
            string variantName = symbol.Name;

            if (!string.IsNullOrEmpty(symbolFile.Type))
            {
                variantName = variantName + " " + symbolFile.Type;
            }

            if (!string.IsNullOrEmpty(symbolFile.Color))
            {
                variantName = variantName + " " + symbolFile.Color;
            }

            return(variantName);
        }
Esempio n. 13
0
        public void TestSuite10()
        {
            var symbols = new Dictionary <string, int>
            {
                { "Loc1", 0xd020 }
            };

            var symbolFile = new SymbolFile(symbols);

            var tree = GetContext("GrammarTests/test-10.txt");

            var walker = new ParseTreeWalker();
            var sbl    = new SimBaseListener {
                Symbols = symbolFile
            };

            walker.Walk(sbl, tree);
        }
Esempio n. 14
0
        // GET: SymbolFiles/EditFile/5
        public ActionResult EditFile(Guid?systemid)
        {
            if (systemid == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            SymbolFile symbolFile = _symbolService.GetSymbolFile(systemid.Value);

            if (symbolFile == null)
            {
                return(HttpNotFound());
            }

            ViewBag.Sizes          = new SelectList(CodeList.Size, "Key", "Value", symbolFile.Size);
            ViewBag.SymbolGraphics = new SelectList(CodeList.SymbolGraphics, "Key", "Value", symbolFile.Type);

            return(View(symbolFile));
        }
Esempio n. 15
0
        public ActionResult EditFile(SymbolFile symbolFile)
        {
            var originalSymbolFile = _symbolService.GetSymbolFile(symbolFile.SystemId);

            ViewBag.Sizes          = new SelectList(CodeList.Size, "Key", "Value", originalSymbolFile.Size);
            ViewBag.SymbolGraphics = new SelectList(CodeList.SymbolGraphics, "Key", "Value", originalSymbolFile.Type);

            if (!_authorizationService.HasAccess(originalSymbolFile.Symbol.Owner,
                                                 ClaimsPrincipal.Current.GetOrganizationName()))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized));
            }
            if (ModelState.IsValid)
            {
                try
                {
                    if (symbolFile.FileName != originalSymbolFile.FileName)
                    {
                        _symbolService.RenameFile(originalSymbolFile, symbolFile.FileName);
                        originalSymbolFile.FileName = symbolFile.FileName;
                    }

                    originalSymbolFile.Color = symbolFile.Color;
                    originalSymbolFile.Size  = symbolFile.Size;
                    originalSymbolFile.Type  = symbolFile.Type;

                    _symbolService.UpdateSymbolFile(originalSymbolFile);
                    return(RedirectToAction("edit", "symbolfiles", new { systemid = originalSymbolFile.SymbolFileVariant.SystemId }));
                }
                catch (FileException exf)
                {
                    Log.Error(exf);
                    ModelState.AddModelError("errorFile", exf.Message);
                }
                catch (Exception ex) {
                    Log.Error(ex);
                    ModelState.AddModelError("error", "Det oppstod en feil");
                }
            }

            return(View(originalSymbolFile));
        }
Esempio n. 16
0
        public void TestSuite2()
        {
            var symbols = new Dictionary <string, int> {
                { "Val1", 0x11 }, { "Val2", 0x22 }, { "Val3", 0xff }
            };
            var symbolFile = new SymbolFile(symbols);

            var tree = GetContext("GrammarTests/test-2.txt");

            var walker = new ParseTreeWalker();
            var sbl    = new SimBaseListener {
                Symbols = symbolFile
            };

            walker.Walk(sbl, tree);

            Assert.AreEqual(0x11, sbl.Proc.XRegister);
            Assert.AreEqual(0x22, sbl.Proc.Accumulator);
            Assert.AreEqual(0xff, sbl.Proc.YRegister);
        }
Esempio n. 17
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public IndexerResult Exec()
        {
            Uri    codeBase = new Uri(typeof(SourceServerIndexer).Assembly.CodeBase);
            string myDir    = Path.GetDirectoryName(codeBase.LocalPath);

            _srcToolPath = SvnTools.GetNormalizedFullPath(Path.Combine(myDir, "srctool.exe"));
            _pdbStrPath  = SvnTools.GetNormalizedFullPath(Path.Combine(myDir, "pdbstr.exe"));

            if (!File.Exists(_srcToolPath))
            {
                throw new FileNotFoundException("SRCTOOL.EXE not found", _srcToolPath);
            }
            if (!File.Exists(_srcToolPath))
            {
                throw new FileNotFoundException("PDBSTR.EXE not found", _pdbStrPath);
            }

            IndexerState state = new IndexerState();

            foreach (string pdbFile in SymbolFiles)
            {
                SymbolFile symbolFile = new SymbolFile(pdbFile);

                if (!symbolFile.Exists)
                {
                    throw new FileNotFoundException(string.Format("Symbol {0} file not found", symbolFile.FullName), symbolFile.FullName);
                }

                state.SymbolFiles.Add(symbolFile.FullName, symbolFile);
            }

            ReadSourceFilesFromPdbs(state); // Check if there are files to index for this pdb file

            PerformExclusions(state);

            ResolveFiles(state);

            WritePdbAnnotations(state);

            return(CreateResultData(state));
        }
Esempio n. 18
0
        public ActionResult Create(SymbolFile symbolFile, HttpPostedFileBase[] uploadFiles, bool autogenererFraSvg = false)
        {
            ViewBag.Size           = new SelectList(CodeList.Size, "Key", "Value", symbolFile.Size);
            ViewBag.SymbolGraphics = new SelectList(CodeList.SymbolGraphics, "Key", "Value", symbolFile.Type);
            if (ModelState.IsValid)
            {
                if (autogenererFraSvg)
                {
                    _symbolService.AddSymbolFilesFromSvg(symbolFile, uploadFiles[0]);
                }
                else
                {
                    _symbolService.AddSymbolFiles(symbolFile, uploadFiles);
                }


                return(RedirectToAction("Details", "Files", new { systemid = symbolFile.Symbol.SystemId }));
            }

            return(View(symbolFile));
        }
Esempio n. 19
0
        public void RenameFile(SymbolFile symbolFile, string newFileName)
        {
            var fileExists = _dbContext.SymbolFiles.Where(f => f.FileName == newFileName && f.SystemId != symbolFile.SystemId);

            if (fileExists.Any())
            {
                throw new FileException("Filnavn finnes fra før");
            }

            string targetFolder = System.Web.HttpContext.Current.Server.MapPath("~/files");

            if (!string.IsNullOrEmpty(symbolFile.Symbol.SymbolPackages[0].Folder))
            {
                targetFolder = targetFolder + "\\" + symbolFile.Symbol.SymbolPackages[0].Folder;
            }
            string targetPath = Path.Combine(targetFolder, symbolFile.FileName);

            string destinationPath = Path.Combine(targetFolder, newFileName);

            File.Move(targetPath, destinationPath);
        }
Esempio n. 20
0
        public void TestSuite8()
        {
            var symbols = new Dictionary <string, int>
            {
                { "Loc1", 0xd020 }
            };

            var symbolFile = new SymbolFile(symbols);

            var tree = GetContext("GrammarTests/test-8.txt");

            var walker = new ParseTreeWalker();
            var sbl    = new SimBaseListener {
                Symbols = symbolFile
            };

            walker.Walk(sbl, tree);

            Assert.AreEqual(0xabcd, sbl.Proc.ReadMemoryWordWithoutCycle(0xd020));
            Assert.AreEqual(0xd0, sbl.Proc.ReadMemoryValueWithoutCycle(0xd022));
        }
Esempio n. 21
0
        private static bool WriteAnnotations(SymbolFile file, StreamWriter sw)
        {
            var providers = new SortedList<string, SourceProvider>();
            var itemCount = 1;

            var available = file.SourceFiles
                .Where(x => x.IsResolved)
                .Select(x => x.SourceReference.SourceProvider)
                .Where(x => !providers.ContainsKey(x.Id));

            foreach (var provider in available)
            {
                providers.Add(provider.Id, provider);
                if (provider.SourceEntryVariableCount > itemCount)
                    itemCount = provider.SourceEntryVariableCount;
            }

            if (providers.Count == 0)
                return false;

            Console.WriteLine("Indexing " + file.File.FullName);
            sw.WriteLine("SRCSRV: ini ------------------------------------------------");
            sw.WriteLine("VERSION=1");
            sw.WriteLine("SRCSRV: variables ------------------------------------------");
            sw.WriteLine("DATETIME=" + DateTime.UtcNow.ToString("u"));
            foreach (var sp in providers.Values)
                sp.WriteEnvironment(sw);
            sw.WriteLine("SRCSRV: source files ---------------------------------------");

            var files = file.SourceFiles
                .Where(x => x.IsResolved)
                .Select(x => x.SourceReference.GetSourceEntries());

            foreach (var values in files)
                sw.WriteLine(string.Join("*", values.Take(itemCount)));

            sw.WriteLine("SRCSRV: end ------------------------------------------------");

            return true;
        }
Esempio n. 22
0
        public ActionResult Edit(SymbolFile symbolFile, HttpPostedFileBase[] uploadFile, string FileToRemove)
        {
            ViewBag.Size           = new SelectList(CodeList.Size, "Key", "Value");
            ViewBag.SymbolGraphics = new SelectList(CodeList.SymbolGraphics, "Key", "Value");

            var variants = _symbolService.GetSymbolVariant(symbolFile.SymbolFileVariant.SystemId);

            if (!_authorizationService.HasAccess(variants[0].Symbol.Owner,
                                                 ClaimsPrincipal.Current.GetOrganizationName()))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized));
            }

            foreach (var variant in variants)
            {
                variant.SymbolFileVariant.Name = symbolFile.SymbolFileVariant.Name;
                _symbolService.UpdateSymbolFile(variant);
            }

            if (uploadFile != null && uploadFile[0] != null)
            {
                var file = variants.FirstOrDefault();
                symbolFile.SymbolFileVariant = file.SymbolFileVariant;
                symbolFile.Type   = symbolFile.Type;
                symbolFile.Color  = symbolFile.Color;
                symbolFile.Size   = symbolFile.Size;
                symbolFile.Symbol = file.Symbol;
                _symbolService.AddSymbolFiles(symbolFile, uploadFile);
            }

            if (!string.IsNullOrEmpty(FileToRemove))
            {
                var fileToRemove = _symbolService.GetSymbolFile(Guid.Parse(FileToRemove));
                _symbolService.RemoveSymbolFile(fileToRemove);
            }

            variants = _symbolService.GetSymbolVariant(symbolFile.SymbolFileVariant.SystemId);

            return(View(variants));
        }
Esempio n. 23
0
        public void TestSuite4()
        {
            var symbols = new Dictionary <string, int> {
                { "FALSE", 0x00 }
            };

            var symbolFile = new SymbolFile(symbols);
            var tree       = GetContext("GrammarTests/test-4.txt");

            var walker = new ParseTreeWalker();
            var sbl    = new SimBaseListener {
                Symbols = symbolFile
            };

            walker.Walk(sbl, tree);

            Assert.IsTrue(sbl.Proc.CarryFlag);
            Assert.IsFalse(sbl.Proc.NegativeFlag);
            Assert.IsTrue(sbl.Proc.ZeroFlag);
            Assert.IsFalse(sbl.Proc.OverflowFlag);
            Assert.IsFalse(sbl.Proc.DecimalFlag);
        }
Esempio n. 24
0
        public void TestSuite1()
        {
            var symbols = new Dictionary <string, int>();

            symbols.Add("MySymbol", 0xa000);
            symbols.Add("Loc1", 0xc000);
            symbols.Add("Loc2", 0x80);

            var symbolFile = new SymbolFile(symbols);

            var tree = GetContext("GrammarTests/test-1.txt");

            var walker = new ParseTreeWalker();
            var sbl    = new SimBaseListener();

            sbl.Symbols = symbolFile;

            walker.Walk(sbl, tree);

            Assert.AreEqual(0xd0, sbl.Proc.ReadMemoryValueWithoutCycle(0x80));
            Assert.AreEqual(0xabcd, sbl.Proc.ReadMemoryWordWithoutCycle(0xc000));
            Assert.AreEqual(0xdcba, sbl.Proc.ReadMemoryWordWithoutCycle(0xc002));
            Assert.AreEqual(0x0d, sbl.Proc.ReadMemoryValueWithoutCycle(0x81));
        }
Esempio n. 25
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public IndexerResult Exec()
        {
            Uri codeBase = new Uri(typeof(SourceServerIndexer).Assembly.CodeBase);
            string myDir = Path.GetDirectoryName(codeBase.LocalPath);

            _srcToolPath = SvnTools.GetNormalizedFullPath(Path.Combine(myDir, "srctool.exe"));
            _pdbStrPath = SvnTools.GetNormalizedFullPath(Path.Combine(myDir, "pdbstr.exe"));

            if (!File.Exists(_srcToolPath))
                throw new FileNotFoundException("SRCTOOL.EXE not found", _srcToolPath);
            if (!File.Exists(_srcToolPath))
                throw new FileNotFoundException("PDBSTR.EXE not found", _pdbStrPath);

            IndexerState state = new IndexerState();

            foreach (string pdbFile in SymbolFiles)
            {
                SymbolFile symbolFile = new SymbolFile(pdbFile);

                if (!symbolFile.Exists)
                    throw new FileNotFoundException(string.Format("Symbol {0} file not found", symbolFile.FullName), symbolFile.FullName);

                state.SymbolFiles.Add(symbolFile.FullName, symbolFile);
            }

            ReadSourceFilesFromPdbs(state); // Check if there are files to index for this pdb file

            PerformExclusions(state);

            ResolveFiles(state);

            WritePdbAnnotations(state);

            return CreateResultData(state);
        }
Esempio n. 26
0
        static bool WriteAnnotations(IndexerState state, SymbolFile file, StreamWriter sw)
        {
            SortedList<string, SourceProvider> providers = new SortedList<string, SourceProvider>();
            int itemCount = 1;

            foreach (SourceFile sf in file.SourceFiles)
            {
                if (!sf.IsResolved || sf.NoSourceAvailable)
                    continue;

                SourceReference sr = sf.SourceReference;
                SourceProvider provider = sr.SourceProvider;

                if (providers.ContainsKey(provider.Id))
                    continue;

                providers.Add(provider.Id, provider);

                if (provider.SourceEntryVariableCount > itemCount)
                    itemCount = provider.SourceEntryVariableCount;
            }

            if (providers.Count == 0)
                return false;

            sw.WriteLine("SRCSRV: ini ------------------------------------------------");
            sw.WriteLine("VERSION=1");
            sw.Write("VERCTRL=SharpSvn.PdbAnnotate");
            foreach (SourceProvider sp in providers.Values)
            {
                if (!string.IsNullOrEmpty(sp.Name))
                {
                    sw.Write('+');
                    sw.Write(sp.Name);
                }
            }
            sw.WriteLine();
            sw.WriteLine("SRCSRV: variables ------------------------------------------");
            sw.WriteLine("DATETIME=" + DateTime.Now.ToUniversalTime().ToString("u"));
            sw.WriteLine("SRCSRVTRG=%fnvar%(%VAR2%__TRG)");
            sw.WriteLine("SRCSRVCMD=%fnvar%(%VAR2%__CMD)");
            //sw.WriteLine("SRCSRVENV=PATH=%PATH%\\bSystemDrive=%SystemDrive%\\bSystemRoot=%SystemRoot%\\bProgramFiles=%ProgramFiles%\\bProgramData=%ProgramData%\\b%fnvar%(%VAR2%__ENV)");
            foreach (SourceProvider sp in providers.Values)
            {
                sp.WriteEnvironment(sw);
            }
            sw.WriteLine("SRCSRV: source files ---------------------------------------");

            // Note: the sourcefile block must be written in the order they are found by the PdbReader
            //	otherwise SrcTool skips all sourcefiles which don't exist locally and are out of order
            foreach (SourceFile sf in file.SourceFiles)
            {
                if (!sf.IsResolved || sf.NoSourceAvailable)
                    continue;

                sw.Write(sf.FullName);
                sw.Write('*');

                SourceReference sr = sf.SourceReference;
                SourceProvider provider = sr.SourceProvider;

                sw.Write(provider.Id);
                sw.Write('*');

                string[] strings = sr.GetSourceEntries();

                if (strings != null)
                    for (int i = 0; i < itemCount; i++)
                    {
                        if (i < strings.Length)
                            sw.Write(strings[i]);

                        sw.Write('*');
                    }
                else
                {
                    for (int i = 0; i < itemCount; i++)
                        sw.Write('*');
                }

                // Note: We defined the variables upto itemCount+2 (filename, type, itemcount),
                // All variables above this index are reserved for future extensions

                sw.WriteLine();
            }

            sw.WriteLine("SRCSRV: end ------------------------------------------------");

            return true;
        }
Esempio n. 27
0
 internal void AddSymbolFile(SymbolFile symfile)
 {
     symbol_files.Add(symfile);
 }
Esempio n. 28
0
 internal void AddSymbolFile(SymbolFile symfile)
 {
     symbol_files.Add (symfile);
 }
Esempio n. 29
0
 public void RemoveSymbolFile(SymbolFile symbolFile)
 {
     DeleteFile(symbolFile.FileName, symbolFile.Symbol.SymbolPackages.FirstOrDefault()?.Folder);
     _dbContext.SymbolFiles.Remove(symbolFile);
     _dbContext.SaveChanges();
 }
Esempio n. 30
0
        static bool WriteAnnotations(IndexerState state, SymbolFile file, StreamWriter sw)
        {
            SortedList<string, SourceProvider> providers = new SortedList<string, SourceProvider>();
            int itemCount = 1;

            foreach (SourceFile sf in file.SourceFiles)
            {
                if (!sf.IsResolved || sf.NoSourceAvailable)
                    continue;

                SourceReference sr = sf.SourceReference;
                SourceProvider provider = sr.SourceProvider;

                if (providers.ContainsKey(provider.Id))
                    continue;

                providers.Add(provider.Id, provider);

                if (provider.SourceEntryVariableCount > itemCount)
                    itemCount = provider.SourceEntryVariableCount;
            }

            if (providers.Count == 0)
                return false;

            sw.WriteLine("SRCSRV: ini ------------------------------------------------");
            sw.WriteLine("VERSION=1");
            sw.Write("VERCTRL=SharpSvn.PdbAnnotate");
            foreach (SourceProvider sp in providers.Values)
            {
                if (!string.IsNullOrEmpty(sp.Name))
                {
                    sw.Write('+');
                    sw.Write(sp.Name);
                }
            }
            sw.WriteLine();
            sw.WriteLine("SRCSRV: variables ------------------------------------------");
            sw.WriteLine("DATETIME=" + DateTime.Now.ToUniversalTime().ToString("u"));
            sw.WriteLine("SRCSRVTRG=%fnvar%(%VAR2%__TRG)");
            sw.WriteLine("SRCSRVCMD=%fnvar%(%VAR2%__CMD)");
            //sw.WriteLine("SRCSRVENV=PATH=%PATH%\\bSystemDrive=%SystemDrive%\\bSystemRoot=%SystemRoot%\\bProgramFiles=%ProgramFiles%\\bProgramData=%ProgramData%\\b%fnvar%(%VAR2%__ENV)");
            foreach (SourceProvider sp in providers.Values)
            {
                sp.WriteEnvironment(sw);
            }
            sw.WriteLine("SRCSRV: source files ---------------------------------------");

            // Note: the sourcefile block must be written in the order they are found by the PdbReader
            //	otherwise SrcTool skips all sourcefiles which don't exist locally and are out of order
            foreach (SourceFile sf in file.SourceFiles)
            {
                if (!sf.IsResolved || sf.NoSourceAvailable)
                    continue;

                sw.Write(sf.FullName);
                sw.Write('*');

                SourceReference sr = sf.SourceReference;
                SourceProvider provider = sr.SourceProvider;

                sw.Write(provider.Id);
                sw.Write('*');

                string[] strings = sr.GetSourceEntries();

                if (strings != null)
                    for (int i = 0; i < itemCount; i++)
                    {
                        if (i < strings.Length)
                            sw.Write(strings[i]);

                        sw.Write('*');
                    }
                else
                {
                    for (int i = 0; i < itemCount; i++)
                        sw.Write('*');
                }

                // Note: We defined the variables upto itemCount+2 (filename, type, itemcount),
                // All variables above this index are reserved for future extensions

                sw.WriteLine();
            }

            sw.WriteLine("SRCSRV: end ------------------------------------------------");

            return true;
        }