Ejemplo n.º 1
0
        public void Parse(AssetsReader reader)
        {
            Version      = reader.ReadCStr();
            Platform     = reader.ReadInt32();
            HasTypeTrees = reader.ReadBoolean();
            int numTypes = reader.ReadInt32();

            for (int i = 0; i < numTypes; i++)
            {
                Types.Add(new AssetsType(reader, HasTypeTrees));
            }
            int numObj = reader.ReadInt32();

            for (int i = 0; i < numObj; i++)
            {
                reader.AlignTo(4);
                var obj = ObjectInfo <AssetsObject> .Parse(ParentFile, reader);

                ObjectInfos.Add(obj);
            }
            int numAdds = reader.ReadInt32();

            for (int i = 0; i < numAdds; i++)
            {
                reader.AlignTo(4);
                Adds.Add(new RawPtr(reader));
            }
            int numExt = reader.ReadInt32();

            for (int i = 0; i < numExt; i++)
            {
                ExternalFiles.Add(new ExternalFile(reader));
            }
            reader.ReadCStr();
        }
Ejemplo n.º 2
0
        private void UpdateStatistics(ExternalFiles externalFiles)
        {
            foreach (var directoryEntry in externalFiles.AssetFiles)
            {
                if (directoryEntry.RelativePath.IsAsset())
                {
                    AssetSizes.Add(directoryEntry.Length);
                }
                else if (directoryEntry.RelativePath.IsPrefab())
                {
                    PrefabSizes.Add(directoryEntry.Length);
                }
                else if (directoryEntry.RelativePath.IsScene())
                {
                    SceneSizes.Add(directoryEntry.Length);
                }
            }

            foreach (var directoryEntry in externalFiles.KnownBinaryAssetFiles)
            {
                KnownBinaryAssetSizes.Add(directoryEntry.Length);
            }

            foreach (var directoryEntry in externalFiles.ExcludedByNameAssetFiles)
            {
                ExcludedByNameAssetsSizes.Add(directoryEntry.Length);
            }
        }
Ejemplo n.º 3
0
 public bool Execute()
 {
     return(ExternalFiles
            .Select(x => DownloadExternalFile(x.GetMetadata("Fullpath"), Timeout, ReportWarning, ReportError))
            .ToList()
            .All(x => x.Result));
 }
Ejemplo n.º 4
0
        // See if the project is based on a .asmdef file, and process the files at the .asmdef file location. We'll
        // already have processed any of these files in the Assets and Packages folder, so this will catch any
        // packages that are external to the solution folder and registered with `file:`
        private void CollectExternalFilesForAsmDefProject(ExternalFiles externalFiles, IProject project)
        {
            if (!project.IsProjectFromUserView())
            {
                return;
            }

            // We know that the default projects are not .asmdef based, and will obviously live in Assets, which we've
            // already processed. This is just an optimisation - if a plugin renames the projects, we'll still work ok
            if (project.Name == "Assembly-CSharp" || project.Name == "Assembly-CSharp-Editor" ||
                project.Name == "Assembly-CSharp-firstpass" || project.Name == "Assembly-CSharp-Editor-firstpass")
            {
                return;
            }

            foreach (var projectItem in project.GetSubItemsRecursively())
            {
                if (projectItem is IProjectFile projectFile)
                {
                    var location = projectFile.Location;
                    if (location.FullPath.EndsWith(".asmdef", StringComparison.InvariantCultureIgnoreCase))
                    {
                        CollectExternalFilesForDirectory(externalFiles, location.Parent);
                        return;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public BrowserBase(DriverType driverType)
        {
            var externalFiles = new ExternalFiles();
            var path          = externalFiles.GetRepositoryFolder();

            switch (driverType)
            {
            case DriverType.Edge:

                _driver = new EdgeDriver(path);
                break;

            case DriverType.Chrome:
                _driver = new ChromeDriver(path);
                _driver.Manage().Window.Maximize();
                var tabs = _driver.WindowHandles;
                if (tabs.Count > 1)
                {
                    _driver.SwitchTo().Window(tabs[1]);

                    _driver.Close();

                    _driver.SwitchTo().Window(tabs[0]);
                }
                break;
            }
        }
Ejemplo n.º 6
0
 private void AddExternalMetaFiles(ExternalFiles externalFiles, PsiModuleChangeBuilder builder)
 {
     foreach (var directoryEntry in externalFiles.MetaFiles)
     {
         AddMetaPsiSourceFile(builder, directoryEntry.GetAbsolutePath());
     }
 }
        public WebApiTestsSteps()
        {
            _externalFiles = new ExternalFiles();
            var apiAppConfiguration = new AppConfiguration();

            _url        = apiAppConfiguration.GetApplicationConfigurationValue(ConfigurationEnums.ApiUrl);
            _apiActions = new ApiActions();
        }
Ejemplo n.º 8
0
 protected override bool ExecuteInner()
 {
     return(ExternalFiles
            .SelectMany(GetExternalFilesInfo)
            .Select(DownloadExternalFile)
            .ToList()
            .All(x => x.Result));
 }
Ejemplo n.º 9
0
 public bool Execute()
 {
     return(ExternalFiles
            .Select(x => DownloadExternalFile(x.GetMetadata("Fullpath"), Timeout))
            .WhereNotNull()
            .ToList()
            .All(x => x.Result));
 }
Ejemplo n.º 10
0
        private void CollectExternalFilesForSolutionDirectory(ExternalFiles externalFiles, string relativePath)
        {
            var path = mySolutionDirectory.Combine(relativePath);

            if (path.ExistsDirectory)
            {
                CollectExternalFilesForDirectory(externalFiles, path);
            }
        }
Ejemplo n.º 11
0
 private void btnImportExcel_Click(object sender, EventArgs e)
 {
     try
     {
         dataGridView.DataSource = ExternalFiles.ImporExcel();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error! " + ex.Message, "Importar", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Ejemplo n.º 12
0
 private void btnImportExcel_Click(object sender, EventArgs e)
 {
     try
     {
         dgvProductos.DataSource = ExternalFiles.ImporExcel();
         btnGuardar.Enabled      = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error! " + ex.Message, "Importar", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Ejemplo n.º 13
0
 private void btnAceptar_Click(object sender, EventArgs e)
 {
     //crear dgv para exportar
     Bloqueo.bloquear(this, true);
     try
     {
         DataGridView       dgvExportar = new DataGridView();
         DataGridViewColumn columna     = new DataGridViewColumn();
         if (chkId.Checked == true)
         {
             columna.HeaderText = "Id"; dgvExportar.Columns.Add(columna);
         }
         if (chkCodigo.Checked == true)
         {
             columna.HeaderText = "Codigo"; dgvExportar.Columns.Add(columna);
         }
         if (chkNombre.Checked == true)
         {
             columna.HeaderText = "Nombre"; dgvExportar.Columns.Add(columna);
         }
         if (chkSucursal.Checked == true)
         {
             columna.HeaderText = "Sucursal"; dgvExportar.Columns.Add(columna);
         }
         if (chkAlmacen.Checked == true)
         {
             columna.HeaderText = "Alamcen"; dgvExportar.Columns.Add(columna);
         }
         if (chkPrecioCompra.Checked == true)
         {
             columna.HeaderText = "P. Compra"; dgvExportar.Columns.Add(columna);
         }
         if (chkPrecioVenta.Checked == true)
         {
             columna.HeaderText = "P. Venta"; dgvExportar.Columns.Add(columna);
         }
         if (chkStock.Checked == true)
         {
             columna.HeaderText = "Stock"; dgvExportar.Columns.Add(columna);
         }
         if (chkValor.Checked == true)
         {
             columna.HeaderText = "Valor"; dgvExportar.Columns.Add(columna);
         }
         ExternalFiles.ExportarDataGridViewExcel(dgvProductos);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error: " + ex.Message, "Exportar", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     Bloqueo.bloquear(this, false);
 }
Ejemplo n.º 14
0
        private ExternalFiles CollectExternalFilesForUnityProject()
        {
            // These are idempotent and can be called multiple times. We expect most files to come from here - either in
            // Assets or Packages. We can have assets in externally stored packages, but they are not treated as user
            // editable source, so we can mostly ignore them (the exception is file: based packages, but these are
            // expected to be a small number, and will complicate gathering stats for thresholds)
            var externalFiles = new ExternalFiles();

            CollectExternalFilesForSolutionDirectory(externalFiles, "Assets");
            CollectExternalFilesForSolutionDirectory(externalFiles, "Packages");
            CollectExternalFilesForSolutionDirectory(externalFiles, "ProjectSettings");
            return(externalFiles);
        }
        // We add scenes, assets and prefabs to the Misc Files project in Rider. This is so that:
        // * The Find Usages results list expects project files and throws if any occurrence is a project file
        // * Only project files are included in SWEA, and we want that for the usage count Code Vision metric
        // Unfortunately, ReSharper keeps the Misc Files project in sync with Visual Studio's idea of the Misc Files
        // project (i.e. files open in the editor that aren't part of a project). This means ReSharper will remove our
        // files from Misc Files and we end up with invalid PSI source files and loads of exceptions.
        // Fortunately, ReSharper doesn't require project files for find usages or rename, and doesn't have Code Vision,
        // so we don't need to worry about a usage count (usage suppression is already handled in the suppressor). So
        // for ReSharper, we just treat all of our files as PSI source files
        private void AddExternalFiles(ExternalFiles externalFiles)
        {
            var builder = new PsiModuleChangeBuilder();

            AddExternalPsiSourceFiles(externalFiles.MetaFiles, builder);
            AddExternalPsiSourceFiles(externalFiles.AssetFiles, builder);
            FlushChanges(builder, externalFiles.AssetFiles.Select(t => t.GetAbsolutePath()).ToList());

            // We should only start watching for file system changes after adding the files we know about
            foreach (var directory in externalFiles.Directories)
            {
                myFileSystemTracker.AdviseDirectoryChanges(myLifetime, directory, true, OnProjectDirectoryChange);
            }
        }
Ejemplo n.º 16
0
        public void Parse(AssetsReader reader)
        {
            Version      = reader.ReadCStr();
            Platform     = reader.ReadInt32();
            HasTypeTrees = reader.ReadBoolean();
            int numTypes = reader.ReadInt32();

            for (int i = 0; i < numTypes; i++)
            {
                Types.Add(new AssetsType(reader, HasTypeTrees));
            }

            List <ObjectRecord> records = new List <ObjectRecord>();
            int numObj = reader.ReadInt32();

            for (int i = 0; i < numObj; i++)
            {
                reader.AlignTo(4);
                var obj = new ObjectRecord(reader);
                records.Add(obj);
            }

            int numAdds = reader.ReadInt32();

            for (int i = 0; i < numAdds; i++)
            {
                reader.AlignTo(4);
                Adds.Add(new RawPtr(reader));
            }
            int numExt = reader.ReadInt32();

            for (int i = 0; i < numExt; i++)
            {
                ExternalFiles.Add(new ExternalFile(reader));
            }
            reader.ReadCStr();

            //load the object infos in order based on their type
            foreach (var record in records.OrderBy(x => PreloadObjectOrder(x)).ThenBy(x => x.ObjectID))
            {
                var obj = ObjectInfo <AssetsObject> .Parse(ParentFile, record);

                ObjectInfos.Add(obj);
                if (ShouldForceLoadObject(record))
                {
                    var o = obj.Object;
                }
            }
        }
Ejemplo n.º 17
0
        public Manifest CreateManifest()
        {
            var manifest = new Manifest
            {
                DefinedSymbols  = Args.define,
                SourceFiles     = Args.Files.Select(f => GetFileWithModificationDate(f)).ToList(),
                ReferencedFiles = Args.References.Select(f => GetFileWithModificationDate(f)).ToList(),
                ContentFiles    = Args.ContentFiles.Select(cf => GetFileWithModificationDate(cf)).ToList(),
                NoneFiles       = Args.NoneFiles.Select(cf => GetFileWithModificationDate(cf)).ToList(),
                SkcVersion      = SkcVersion,
                SkcFile         = GetFileWithModificationDate(SkcFile),
                ExternalFiles   = ExternalFiles.Select(GetFileWithModificationDate).ToList()
            };

            return(manifest);
        }
Ejemplo n.º 18
0
 public void Write(AssetsWriter writer)
 {
     writer.WriteCString(Version);
     writer.Write(Platform);
     writer.Write(HasTypeTrees);
     writer.Write(Types.Count());
     Types.ForEach(x => x.Write(writer));
     writer.Write(ObjectInfos.Count());
     ObjectInfos.ForEach(x => {
         writer.AlignTo(4);
         x.Write(writer);
     });
     writer.Write(Adds.Count());
     Adds.ForEach(x => x.Write(writer));
     writer.Write(ExternalFiles.Count());
     ExternalFiles.ForEach(x => x.Write(writer));
     writer.WriteCString("");
 }
Ejemplo n.º 19
0
        private void AddExternalAssetFiles(ExternalFiles externalFiles)
        {
            if (externalFiles.AssetFiles.Count == 0)
            {
                return;
            }

            using (new ProjectModelBatchChangeCookie(mySolution, SimpleTaskExecutor.Instance))
                using (mySolution.Locks.UsingWriteLock())
                {
                    // Note that we ignore binary and "excluded by name" files. We could include them and set ShouldBuildPsi
                    // to false, but that doesn't give us anything
                    foreach (var directoryEntry in externalFiles.AssetFiles)
                    {
                        AddAssetProjectFile(directoryEntry.GetAbsolutePath());
                    }
                }
        }
Ejemplo n.º 20
0
        private void CollectExternalFilesForDirectory(ExternalFiles externalFiles, FileSystemPath directory)
        {
            // Don't process the entire solution directory - this would process Assets and Packages for a second time,
            // and also process Temp and Library, which are likely to be huge
            if (directory == mySolutionDirectory)
            {
                myLogger.Error("Unexpected request to process entire solution directory. Skipping");
                return;
            }

            if (myRootPaths.Contains(directory))
            {
                return;
            }

            // Make sure the directory hasn't already been processed as part of a previous directory. This can happen if
            // the project is a .asmdef based project living under Assets or Packages, or inside a file:// based package
            foreach (var rootPath in myRootPaths)
            {
                if (rootPath.IsPrefixOf(directory))
                {
                    return;
                }
            }

            myLogger.Info("Processing directory for asset and meta files: {0}", directory);

            // Based on super simple tests, GetDirectoryEntries is faster than GetChildFiles with subsequent calls to
            // GetFileLength. But what is more surprising is that Windows in a VM is an order of magnitude FASTER than
            // Mac, on the same project!
            var entries = directory.GetDirectoryEntries("*", PathSearchFlags.RecurseIntoSubdirectories
                                                        | PathSearchFlags.ExcludeDirectories);

            foreach (var entry in entries)
            {
                externalFiles.AddFile(entry);
            }
            externalFiles.AddDirectory(directory);

            myRootPaths.Add(directory);
        }
Ejemplo n.º 21
0
        // We add scenes, assets and prefabs to the Misc Files project in Rider. This is so that:
        // * The Find Usages results list expects project files and throws if any occurrence is a project file
        // * Only project files are included in SWEA, and we want that for the usage count Code Vision metric
        // Unfortunately, ReSharper keeps the Misc Files project in sync with Visual Studio's idea of the Misc Files
        // project (i.e. files open in the editor that aren't part of a project). This means ReSharper will remove our
        // files from Misc Files and we end up with invalid PSI source files and loads of exceptions.
        // Fortunately, ReSharper doesn't require project files for find usages or rename, and doesn't have Code Vision,
        // so we don't need to worry about a usage count (usage suppression is already handled in the suppressor). So
        // for ReSharper, we just treat all of our files as PSI source files
        private void AddExternalFiles(ExternalFiles externalFiles)
        {
            var builder = new PsiModuleChangeBuilder();

            AddExternalPsiSourceFiles(externalFiles.MetaFiles, builder);

#if RESHARPER
            AddExternalPsiSourceFiles(externalFiles.AssetFiles, builder);
#endif
            FlushChanges(builder);

#if RIDER
            AddExternalProjectFiles(externalFiles.AssetFiles);
#endif

            // We should only start watching for file system changes after adding the files we know about
            foreach (var directory in externalFiles.Directories)
            {
                myFileSystemTracker.AdviseDirectoryChanges(myLifetime, directory, true, OnProjectDirectoryChange);
            }
        }
Ejemplo n.º 22
0
 public RegisterNewAccountSteps()
 {
     _registrationPage = new RegistrationPage();
     _registration     = new Registration();
     _externalFiles    = new ExternalFiles();
 }
 public LoginRegisteredAccountSteps()
 {
     _loginPage     = new LoginPage();
     _registration  = new Registration();
     _externalFiles = new ExternalFiles();
 }
 private void btnImportar_Click(object sender, EventArgs e)
 {
     dataGridView.DataSource = ExternalFiles.ImporExcel();
 }
Ejemplo n.º 25
0
        private static bool UniversalGeneArchiveCurrent()
        {
            var fileInfo = new FileInfo(ExternalFiles.UniversalGeneFilePath);

            return(fileInfo.Exists && ExternalFiles.GetElapsedDays(fileInfo.CreationTime) < 1.0);
        }
Ejemplo n.º 26
0
 public void Setup()
 {
     _externalFiles = new ExternalFiles();
 }