Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FileExpressionList"/> class.
        /// </summary>
        /// <param name="rawFileListString">The unprocessed list of file expressions.</param>
        /// <param name="project">The project where the expression list exists.</param>
        /// <param name="task">The task where the expression list exists.</param>
        public FileExpressionList(string rawFileListString, ProjectInstance project, ProjectTaskInstance task)
        {
            IList <string> expressions = rawFileListString.SplitStringList();
            var            seenFiles   = new HashSet <string>(PathComparer.Instance);

            foreach (string expression in expressions)
            {
                FileExpressionBase parsedExpression = FileExpressionFactory.ParseExpression(expression, project, task);
                Expressions.Add(parsedExpression);

                foreach (string file in parsedExpression.EvaluatedFiles)
                {
                    if (string.IsNullOrWhiteSpace(file))
                    {
                        continue;
                    }

                    if (seenFiles.Add(file))
                    {
                        DedupedFiles.Add(file);
                    }

                    AllFiles.Add(file);
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="FileExpressionList"/> class.
        /// </summary>
        /// <param name="rawFileListString">The unprocessed list of file expressions.</param>
        /// <param name="project">The project where the expression list exists.</param>
        /// <param name="task">The task where the expression list exists.</param>
        public FileExpressionList(string rawFileListString, ProjectInstance project, ProjectTaskInstance task)
        {
            List <string> expressions = rawFileListString.SplitStringList();

            NumExpressions = expressions.Count;

            var seenFiles = new HashSet <string>(PathComparer.Instance);

            foreach (string expression in expressions)
            {
                List <string> evaluatedFiles = FileExpression.EvaluateExpression(expression, project, task, out bool isBatched);
                if (isBatched)
                {
                    NumBatchExpressions++;
                }

                foreach (string file in evaluatedFiles)
                {
                    if (string.IsNullOrWhiteSpace(file))
                    {
                        continue;
                    }

                    if (seenFiles.Add(file))
                    {
                        DedupedFiles.Add(file);
                    }

                    AllFiles.Add(file);
                }
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var path     = $@"F:\Clients\MuhraSoft\MuhraSoftSystemV1Store\MuhraSoftSystem - Temp\MuhraSoftSystem\MuhraSoftSystem.csproj";
            var filename = $@"{path}\MuhraSoftSystem.csproj";

            XDocument  doc = XDocument.Load(filename);
            XNamespace ns  = "http://schemas.microsoft.com/developer/msbuild/2003";

            void DumpMatches(IEnumerable <string> values)
            {
                foreach (string x in values)
                {
                    AllFiles.Add(x);
                }
            }

            DumpMatches(doc.Descendants(ns + "Compile").Select(x => x.Attribute("Include").Value));
            DumpMatches(doc.Descendants(ns + "AssemblyOriginatorKeyFile").Select(x => x.Value));

            var dirInfo                 = new DirectoryInfo(path);
            var allFilesOnDisk          = dirInfo.GetFiles("*.*", SearchOption.AllDirectories).Select(s => s.FullName).ToList();
            var allFilesFromProjectFile = AllFiles.Select(s => $@"{path}\MuhraSoftSystem\{s}").ToList();
            var excludedFiles           = allFilesOnDisk.Except(allFilesFromProjectFile).ToList();
            var ff = excludedFiles.Where(w => w.Contains("All2") && w.EndsWith(".cs")).ToList();

            foreach (var f in ff)
            {
                if (f.EndsWith(".cs"))
                {
                    File.Delete(f);
                    Debug.WriteLine(f);
                }
            }
        }
Exemplo n.º 4
0
        public override void Hotload(List <string> changedFiles)
        {
            // TODO smarter hotloading.  Handle removed files.
            var loadedFileNames = new HashSet <string>(AllFiles.Keys);

            foreach (string file in FindConfigsInBaseDir())
            {
                string fileName = GetFileNameFromPath(file);
                loadedFileNames.Remove(fileName);
                if (!AllFiles.TryGetValue(fileName, out var fileInfo))
                {
                    // New file, add it.
                    var newFileInfo = ReadFile(file);
                    AllFiles.Add(newFileInfo.Name, newFileInfo);
                    changedFiles.Add(newFileInfo.Name);
                    continue;
                }

                var fileSize = new FileInfo(file).Length;
                var modified = File.GetLastWriteTimeUtc(file);

                // Timestamp or size need to differ before we bother generating a checksum of the file.
                // Timestamps are considered different if there's at least 1 second between them.
                if (fileSize == fileInfo.Size && Math.Abs((modified - fileInfo.Modified).TotalSeconds) < 1f)
                {
                    continue;
                }

                using (var fileStream = File.OpenRead(file)) {
                    int checksum = Internal.ChecksumUtils.Checksum(fileStream);
                    fileStream.Seek(0, SeekOrigin.Begin);

                    // Update the modified timestamp and file size even if the checksum is the same.
                    // Because we didn't early out a few lines above, we know that at least one of these values
                    // is stale.
                    fileInfo.Modified = modified;
                    fileInfo.Size     = fileSize;

                    if (checksum == fileInfo.Checksum)
                    {
                        // The files are identical.
                        continue;
                    }

                    // File has changed. Hotload it.
                    fileInfo.Checksum = checksum;
                    fileInfo.Modified = modified;
                    fileInfo.Parsed   = Configs.LoadDocFromStream(fileStream, file);

                    changedFiles.Add(fileName);
                }
            }

            foreach (string deletedFile in loadedFileNames)
            {
                AllFiles.Remove(deletedFile);
                changedFiles.Add(deletedFile);
            }
        }
Exemplo n.º 5
0
 private void GenerateFiles()
 {
     AllFiles.Clear();
     foreach (var file in _fileRenamerModel.Files)
     {
         AllFiles.Add(new FileViewModel(file));
     }
 }
Exemplo n.º 6
0
 public override void Preload()
 {
     foreach (string file in FindConfigsInBaseDir())
     {
         var fileInfo = ReadFile(file);
         AllFiles.Add(fileInfo.Name, fileInfo);
     }
 }
Exemplo n.º 7
0
 public void CreateRoot(File newFile = null)
 {
     if (newFile == null)
     {
         AllFiles.Add(File.GetRoot(this));
     }
     else
     {
         newFile.Parent = null;
         AllFiles.Add(newFile);
     }
 }
Exemplo n.º 8
0
        public WADArchive(string wad)
        {
            File = new System.IO.FileInfo(wad);

            using (var stream = File.OpenRead()) {
                var header = stream.ReadStruct <Header>();

                stream.ReadFully(Unknown1, 0, Unknown1.Length);
                Unknown2        = stream.ReadStruct <ulong>();
                FileInfosOffset = stream.ReadStruct <ushort>();
                FileInfoSize    = stream.ReadStruct <ushort>();
                var count = stream.ReadStruct <uint>();

                for (var i = 0; i < count; i++)
                {
                    var file = stream.ReadStruct <FileInfo>();
                    AllFiles.Add(file.PathHash, file);
                }
            }
        }
Exemplo n.º 9
0
        public static void GetAllFiles(string Path, ref List <string> AllFiles)
        {
            if (AllFiles == null)
            {
                AllFiles = new List <string>();
            }
            Directory.SetCurrentDirectory(Path);
            var FilesInThisPath = Directory.GetFiles(".");

            foreach (var i in FilesInThisPath)
            {
                AllFiles.Add($"{Path}/{i.Substring(2)}");
            }
            var DirectorysInThisPath = Directory.GetDirectories(".");

            foreach (var i in DirectorysInThisPath)
            {
                GetAllFiles($"{Path}/{i.Substring(2)}", ref AllFiles);
            }
        }
Exemplo n.º 10
0
    protected void OnImageOpenButtonClicked(object sender, EventArgs e)
    {
        try
        {
            if (!IsBusy() && checkPrograms())
            {
                FileChooserDialog fc = new FileChooserDialog("Open Images", this, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);
                if (Directory.Exists(MySettings.LastPicDir))
                {
                    fc.SetCurrentFolder(MySettings.LastPicDir);
                }

                if (fc.Run() == (int)ResponseType.Accept)
                {
                    #region Get all supported images

                    List <string> Files = new List <string>();
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.jpg", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.jpeg", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.CR2", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.CRW", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.png", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.tif", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.tiff", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.x3f", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.NEF", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.srw", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.srf", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.sr2", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.arw", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.erf", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.pef", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.raf", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.3fr", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.fff", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.dcr", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.dcs", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.kdc", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.rwl", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.mrw", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.mdc", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.nrw", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.orf", SearchOption.TopDirectoryOnly));
                    Files.AddRange(Directory.GetFiles(fc.Filename, "*.rw2", SearchOption.TopDirectoryOnly));

                    #endregion

                    if (Files.Count > 1)
                    {
                        AllFiles.Clear();
                        if (BrightnessCalculated)
                        {
                            AllCurves.BrInCurve  = null;
                            BrightnessCalculated = false;
                            GCurves.GCurve tmp;
                            AllCurves.Curves.TryGetValue(GCurves.CurveName.Exposure_Compensation.ToString(), out tmp);
                            tmp.ClearPoints();
                        }
                        deleteThumbs();

                        Workpath = fc.Filename;
                        MySettings.LastPicDir = fc.Filename;
                        MySettings.Save();

                        for (int i = 0; i < Files.Count; i++)
                        {
                            AllFiles.Add(new FileData(Files[i]));
                            if (PPfileOpened)
                            {
                                AllFiles[i].PP3 = new PP3Values(MainPP3.Path);
                            }
                            else
                            {
                                AllFiles[i].PP3 = new PP3Values();
                            }
                        }

                        if (PPfileOpened)
                        {
                            AllFiles[0].IsKeyframe = true;
                        }

                        PrevIndexSpin.Adjustment.Upper = AllFiles.Count - 1;
                        PrevCountSpin.Adjustment.Upper = AllFiles.Count - PrevIndexSpin.Value + 1;

                        UpdateTable();
                        GetExifData();

                        SetSaveStatus(false);
                    }
                    else
                    {
                        UpdateInfo(InfoType.Imagecount, 0);
                    }
                }
                fc.Destroy();
            }
        }
        catch (Exception ex) { ReportError("Browse Pictures", ex); BrightnessCalculated = false; }
    }