Example #1
0
        // These are duplicated from IgorRuntimeUtils.cs in the Core module.  This was necessary to
        // keep the updater working, but they are overridden by the RuntimeUtils version once Core is
        // installed.  If you have any fixes for these two functions, fix them both here and in
        // IgorRuntimeUtils.cs.
        public static bool CopyFile(string SourceFile, string TargetFile)
        {
            if (File.Exists(SourceFile))
            {
                if (File.Exists(TargetFile))
                {
                    DeleteFile(TargetFile);
                }

                try
                {
                    File.Copy(SourceFile, TargetFile);
                }
                catch (System.IO.IOException IOEx)
                {
                    if (IOEx.GetHashCode() == 112)
                    {
                        IgorDebug.CoreCriticalError("Failed to copy file " + SourceFile + " to " + TargetFile + " because there is not enough free space at the target location.");
                    }

                    throw IOEx;

                    return(false);
                }

                return(true);
            }

            return(false);
        }
Example #2
0
        public static void ProcessArgs()
        {
            InitializeRuntimeCoreIfNeeded();

            if (RuntimeCore != null)
            {
                if (typeof(IgorCore).IsAssignableFrom(RuntimeCore.GetType()))
                {
                    IgorCore CoreInst = (IgorCore)RuntimeCore;

                    if (CoreInst != null)
                    {
                        ActiveModulesForJob.Clear();

                        foreach (IIgorModule CurrentModule in EnabledModules)
                        {
                            CurrentModule.ProcessArgs(CoreInst);
                        }
                    }
                    else
                    {
                        IgorDebug.CoreCriticalError("Core could not be case to type IgorCore!");
                    }
                }
                else
                {
                    IgorDebug.CoreCriticalError("Core is not of type IgorCore.  Did you make your own?  You may need to change how this works.");
                }
            }
            else
            {
                IgorDebug.CoreCriticalError("Core not found so we bailed out of processing arguments!");
            }
        }
Example #3
0
        // Pulled from https://msdn.microsoft.com/en-us/library/bb762914.aspx
        public static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs, bool bSkipUnityMetaFiles = true)
        {
            // Get the subdirectories for the specified directory.
            DirectoryInfo dir = new DirectoryInfo(sourceDirName);

            DirectoryInfo[] dirs = dir.GetDirectories();

            if (!dir.Exists)
            {
                IgorDebug.CoreCriticalError("Source directory does not exist or could not be found: " + sourceDirName);

                return;
            }

            // If the destination directory doesn't exist, create it.
            if (!Directory.Exists(destDirName))
            {
                Directory.CreateDirectory(destDirName);
            }

            // Get the files in the directory and copy them to the new location.
            FileInfo[] files = dir.GetFiles();
            foreach (FileInfo file in files)
            {
                if (!file.Name.EndsWith(".meta"))
                {
                    string temppath = Path.Combine(destDirName, file.Name);
                    file.CopyTo(temppath, false);
                }
            }

            // If copying subdirectories, copy them and their contents to new location.
            if (copySubDirs)
            {
                foreach (DirectoryInfo subdir in dirs)
                {
                    string temppath = Path.Combine(destDirName, subdir.Name);
                    DirectoryCopy(subdir.FullName, temppath, copySubDirs);
                }
            }
        }