示例#1
0
        private void SyncFileIfNotChanged(string filename, string newContents)
        {
            try
            {
                if (m_FileIOProvider.Exists(filename) && newContents == m_FileIOProvider.ReadAllText(filename))
                {
                    return;
                }
            }
            catch (Exception exception)
            {
                Debug.LogException(exception);
            }

            m_FileIOProvider.WriteAllText(filename, newContents);
        }
示例#2
0
        internal void UpdatePerceptualHash(string infoPath)
        {
            if (!_fileIO.Exists(infoPath))
            {
                return;
            }

            string pHashText = _fileIO.ReadAllText(infoPath).Trim();

            // The BloomCLI passes these back by writing to a file, so it can't return the null value easily... writes a literal string "null" instead.
            // convert that back to a proper null value (not a string)
            // Also deal with pHashes that are all 0's... this can happen and indicates something funny happened in the pHash calculation.
            // Doesn't make sense to assume two images that both return 0x000... are actually the same.
            // So change them into null, because null == null evaluates to false.
            if (pHashText == "null" || pHashText == "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")
            {
                pHashText = null;
            }

            this.Model.PHashOfFirstContentImage = pHashText;
        }
        private void SyncFileIfNotChanged(string filename, string newContents)
        {
            if (m_fileIOProvider.Exists(filename))
            {
                var currentContents = m_fileIOProvider.ReadAllText(filename);

                if (currentContents == newContents)
                {
                    return;
                }

                try
                {
                    LogDifference(filename, currentContents, newContents);
                }
                catch (Exception exception)
                {
                    Console.WriteLine("Failed to log difference of {0}\n{1}",
                                      filename, exception);
                }
            }

            m_fileIOProvider.WriteAllText(filename, newContents);
        }
示例#4
0
 public static Solution ParseSolutionFile(string filename, IFileIO fileIO)
 {
     return(ParseSolutionContent(fileIO.ReadAllText(filename)));
 }