Initialize() public static method

public static Initialize ( IEnumerable args ) : void
args IEnumerable
return void
Example #1
0
        private static void MainReal(string[] a)
        {
            if (!Debugger.IsAttached)
            {
                SetUnhandledExceptionHandler();
            }

            AppArguments.Initialize(a);
            var data = AppArguments.Get(AppFlag.StorageLocation);

            if (!string.IsNullOrWhiteSpace(data))
            {
                ApplicationDataDirectory = Path.GetFullPath(data);
            }
            else
            {
                var exe = Assembly.GetEntryAssembly().Location;
                ApplicationDataDirectory = Path.GetFileName(exe).IndexOf("local", StringComparison.OrdinalIgnoreCase) != -1
                        ? Path.Combine(Path.GetDirectoryName(exe) ?? Path.GetFullPath("."), "Data")
                        : Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "AcTools Content Manager");
            }

            if (AppArguments.GetBool(AppFlag.VisualStyles, true))
            {
                Application.EnableVisualStyles();
            }

            AppArguments.AddFromFile(Path.Combine(ApplicationDataDirectory, "Arguments.txt"));
            RenameContentToData();

#if COSTURA
            CosturaUtility.Initialize();
#else
            var logFilename = AppArguments.GetBool(AppFlag.LogPacked) ? GetLogName("Packed Log") : null;
            AppArguments.Set(AppFlag.DirectAssembliesLoading, ref PackedHelper.OptionDirectLoading);

            var packedHelper = new PackedHelper("AcTools_ContentManager", "References", logFilename);
            packedHelper.PrepareUnmanaged("LevelDB");
            AppDomain.CurrentDomain.AssemblyResolve += packedHelper.Handler;
#endif

            MainInner(a);
        }