Ejemplo n.º 1
0
 public List<FileCheck> Compare(FileCheckList baseline)
 {
     Dictionary<string, FileCheck> xdict = Filelist.OrderBy(fc => fc.Name).ToDictionary(k => k.Name, v => v);
     List<FileCheck> y = baseline.Filelist.OrderBy(fc => fc.Name).ToList();
     y.RemoveAll(fc => xdict.ContainsKey(fc.Name) && xdict[fc.Name].Size == fc.Size);
     return y;
 }
Ejemplo n.º 2
0
        public List <FileCheck> Compare(FileCheckList baseline)
        {
            Dictionary <string, FileCheck> xdict = Filelist.OrderBy(fc => fc.Name).ToDictionary(k => k.Name, v => v);
            List <FileCheck> y = baseline.Filelist.OrderBy(fc => fc.Name).ToList();

            y.RemoveAll(fc => xdict.ContainsKey(fc.Name) && xdict[fc.Name].Size == fc.Size);
            return(y);
        }
Ejemplo n.º 3
0
        // load list from xml file
        public void Load(string sFilename)
        {
            XmlSerializer ser    = new XmlSerializer(typeof(FileCheckList));
            StreamReader  reader = new StreamReader(sFilename);
            FileCheckList fcl    = (FileCheckList)ser.Deserialize(reader);

            Filelist = fcl.Filelist;
            ScanTime = fcl.ScanTime;
        }
Ejemplo n.º 4
0
        public static List<FileCheck> Test(string singularFolder)
        {
            FileCheckList fclactual = new FileCheckList();
            fclactual.Generate(singularFolder);

            FileCheckList fclfile = new FileCheckList();
            fclfile.Load(Path.Combine(singularFolder, "singular.xml"));

            List<FileCheck> err = fclfile.Compare(fclactual);
            return err;
        }
Ejemplo n.º 5
0
        public static List <FileCheck> Test(string singularFolder)
        {
            FileCheckList fclactual = new FileCheckList();

            fclactual.Generate(singularFolder);

            FileCheckList fclfile = new FileCheckList();

            fclfile.Load(Path.Combine(singularFolder, "singular.xml"));

            List <FileCheck> err = fclfile.Compare(fclactual);

            return(err);
        }
Ejemplo n.º 6
0
        private static void WriteSupportInfo()
        {
            string singularName = GetSingularRoutineName();  // "Singular v" + GetSingularVersion();
            Logger.Write( LogColor.Hilite, "Starting " + singularName);

            // save some support info in case we need
            // Logger.WriteFile("{0:F1} days since Windows was restarted", TimeSpan.FromMilliseconds(Environment.TickCount).TotalHours / 24.0);
            Logger.WriteFile("{0:F1} days since Windows was restarted", TimeSpan.FromMilliseconds(GetTickCount64()).TotalDays);
            Logger.WriteFile("{0} FPS currently in WOW", GetFPS());
            Logger.WriteFile("{0} ms of Latency in WOW", SingularRoutine.Latency);
            Logger.WriteFile("{0} local system time", DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss"));

            #if HB_DE
            Logger.WriteFile("HB_DE defined for this build");
            #endif

            // verify installed source integrity
            try
            {
                string singularFolder = GetSingularSourcePath();

                FileCheckList actual = new FileCheckList();
                actual.Generate(singularFolder);

                FileCheckList certified = new FileCheckList();
                certified.Load(Path.Combine(singularFolder, "singular.xml"));

                List<FileCheck> err = certified.Compare(actual);

                List<FileCheck> fcerrors = FileCheckList.Test(GetSingularSourcePath());
                if (!fcerrors.Any())
                    Logger.Write("Installation: integrity verified for {0}", GetSingularVersion());
                else
                {
                    Logger.Write(Color.HotPink, "Installation: modified by user - forum support may not be available", singularName);
                    Logger.WriteFile("=== following {0} differ from Singular distribution ===", fcerrors.Count);
                    foreach (var fc in fcerrors)
                    {
                        if ( !File.Exists( fc.Name ))
                            Logger.WriteDiagnostic("   deleted: {0} {1}", fc.Size, fc.Name);
                        else if ( certified.Filelist.Any( f => 0 == String.Compare( f.Name, fc.Name, true)))
                            Logger.WriteDiagnostic("   changed: {0} {1}", fc.Size, fc.Name);
                        else
                            Logger.WriteDiagnostic("   inserted {0} {1}", fc.Size, fc.Name);
                    }
                    Logger.WriteFile(Styx.Common.LogLevel.Diagnostic, "");
                }
            }
            catch (FileNotFoundException e)
            {
                Logger.Write(Color.HotPink, "Installation: file missing - forum support not available");
                Logger.Write(Color.HotPink, "missing file: {0}", e.FileName );
            }
            catch (Exception e)
            {
                Logger.Write(Color.HotPink, "Installation: verification error - forum support not available");
                Logger.WriteFile(e.ToString());
            }
        }