Example #1
0
        /// <summary>
        /// Detects the AviSynth version/date and writes it into the log
        /// </summary>
        /// <param name="oLog">the version information will be added to the log if available</param>
        public static void CheckAviSynth(LogItem oLog)
        {
            string fileVersion             = string.Empty;
            string fileDate                = string.Empty;
            string fileProductName         = string.Empty;
            bool   bFoundInstalledAviSynth = false;

            // remove msvc files
            LSMASHFileActions(true);
            PortableAviSynthActions(true);

            // detect system installation
            string syswow64path = Environment.GetFolderPath(Environment.SpecialFolder.System).ToLowerInvariant().Replace("\\system32", "\\SysWOW64");

#if x86
            // on a x86 MeGUI build try the SysWOW64 folder first
            if (GetFileInformation(Path.Combine(syswow64path, "avisynth.dll"), out fileVersion, out fileDate, out fileProductName))
            {
                bFoundInstalledAviSynth = true;
            }
            else if (!Directory.Exists(syswow64path) &&
                     GetFileInformation(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "avisynth.dll"), out fileVersion, out fileDate, out fileProductName))
#endif
#if x64
            if (GetFileInformation(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "avisynth.dll"), out fileVersion, out fileDate, out fileProductName))
#endif
            bFoundInstalledAviSynth = true;

            if (bFoundInstalledAviSynth)
            {
                if (fileProductName.Contains("+") && !MainForm.Instance.Settings.AlwaysUsePortableAviSynth)
                {
                    MainForm.Instance.Settings.AviSynthPlus = true;
                }
                if (oLog != null)
                {
                    oLog.LogValue("AviSynth" + (fileProductName.Contains("+") ? "+" : String.Empty),
                                  fileVersion + " (" + fileDate + ")" + (!MainForm.Instance.Settings.AlwaysUsePortableAviSynth ? String.Empty : " (inactive)"));
                }
                if (!MainForm.Instance.Settings.AlwaysUsePortableAviSynth)
                {
                    if (!MainForm.Instance.Settings.AviSynthPlus)
                    {
                        LSMASHFileActions(false);
                    }
                    return;
                }
            }

            // detects included avisynth
            MainForm.Instance.Settings.PortableAviSynth = false;
            if (GetFileInformation(MainForm.Instance.Settings.AviSynth.Path, out fileVersion, out fileDate, out fileProductName))
            {
                if (oLog != null)
                {
                    oLog.LogValue("AviSynth" + (fileProductName.Contains("+") ? "+" : String.Empty) + " portable",
                                  fileVersion + " (" + fileDate + ")" + (!bFoundInstalledAviSynth ? String.Empty : " (active)"));
                }
                if (!bFoundInstalledAviSynth || MainForm.Instance.Settings.AlwaysUsePortableAviSynth)
                {
                    UpdateCacher.CheckPackage("avs");
                    MainForm.Instance.Settings.PortableAviSynth = true;
                    PortableAviSynthActions(false);
                    if (fileProductName.Contains("+"))
                    {
                        MainForm.Instance.Settings.AviSynthPlus = true;
                    }
                }
            }
            else if (!bFoundInstalledAviSynth)
            {
                if (oLog != null)
                {
                    oLog.LogValue("AviSynth", "not found", ImageType.Error);
                }
            }

            if (!MainForm.Instance.Settings.AviSynthPlus)
            {
                LSMASHFileActions(false);
            }
        }
Example #2
0
 public Joiner(string exe)
 {
     UpdateCacher.CheckPackage("besplit");
     executable = exe;
 }