Ejemplo n.º 1
0
        public TheImport(CORE.FileImporter importer)
        {
            Importer = importer;

            _uncConverter = new UncConverter2();

            RootFolderOrUnc2RootFolder = new StringDictionary();

            _remainingDriveLetters = new List<char>();

            for (int pos = 65; pos < 91; pos++)
            {
                _remainingDriveLetters.Add(Convert.ToChar(pos));
            }

            TemporaryMappedDrives = new List<NetworkDrive>();

            Location2Id = new Dictionary<string, int>();

            DriveLetters = new Dictionary<string, EnhancedDriveInfo>();
            RootFoldersOfDrive = new Dictionary<EnhancedDriveInfo, List<string>>();
            ItemsChainedByTagCache = new ItemsChainedByTagCache(this);

            if (Importer.ExcludeUnmatchedFiles)
            {
                UnmatchedFiles = new List<EnhancedFileInfo>();
            }
        }
Ejemplo n.º 2
0
        public WINDOWSTUFF()
        {
            InitializeComponent();
            core = CORE.getCORE();
            vm   = new VM_STUFF();

            this.DataContext = vm;

            //vm.StuffLoad();
        }
        /// <summary>
        /// Initializes a new instance of the EnhancedDriveInfo class.
        /// </summary>
        /// <param name="importer"></param>
        /// <param name="driveInfo"></param>
        public EnhancedDriveInfo(CORE.FileImporter importer, DriveInfo driveInfo)
        {
            this.driveInfo = driveInfo;
            this.serialNumber = string.Empty;

            if (driveInfo != null)
            {
                /*
                try
                {
                    char[] trimChars = { '\\' };
                    ManagementObject disk =
                        new ManagementObject("Win32_LogicalDisk.DeviceID=\"" + driveInfo.Name.TrimEnd(trimChars) + "\"");
                    disk.Get();
                    ManagementObject partition =
                        new ManagementObject("Win32_LogicalDiskToPartition.DeviceID=\"" + disk["DeviceID"] + "\"");
                    partition.Get();
                    ManagementObject drive =
                        new ManagementObject("Win32_DiskDrive.DeviceID=\"" + disk["DeviceID"] + "\"");
                    drive.Get();
                    ManagementObject wmi =
                        new ManagementObject("Win32_PhysicalMedia.Tag=\"" + drive["DeviceID"] + "\"");
                    wmi.Get();
            //                    this.serialNumber = (string)wmi["VolumeSerialNumber"];
                    this.serialNumber = (wmi.Properties["SerialNumber"].Value != null)
                           ? wmi.Properties["SerialNumber"].Value.ToString().Trim()
                           : string.Empty;
                }
                catch (ManagementException ex)
                {
                    importer.LogMessages.Enqueue(new LogMessage("Error", ex.ToString()));
                }
                catch (Exception ex)
                {
                    importer.LogMessages.Enqueue(new LogMessage("Error", ex.ToString()));
                }
                */
                try
                {
                    this.serialNumber = new PhysicalMediaSerialNumber(driveInfo.Name).GetSerialNumber();
                }
                catch (ArgumentException ex)
                {
                    importer.LogMessages.Enqueue(new LogMessage("Warn", ex.ToString()));

                }
            }
            else
            {
                importer.LogMessages.Enqueue(new LogMessage("Warn", "DriveInfo is null -> SerialNumber and VolumeName will be string.Empty."));
            }
        }
Ejemplo n.º 4
0
        public ActionResult Lista(int usuario_id)
        {
            ViewBag.API_URL   = ConfigurationManager.AppSettings["WebAPI_URL"].ToString();
            ViewBag.UsuarioID = usuario_id;

            if (CORE.ValidationLoginSession(usuario_id))
            {
                return(View());
            }
            else
            {
                return(RedirectToAction("UsuarioNaoIdentificado", "Error"));
            }
        }
Ejemplo n.º 5
0
        private void UnbindHotkey(string hotkey)
        {
            var key = Hotkey.Parse(hotkey);

            if (key == null)
            {
                Main.NewText("Invalid hotkey binding!");
            }
            else
            {
                DNMT.Config.Set("HotkeyBinds", hotkey, null);
                HotkeyCore.UnregisterHotkey(key);
                CORE.Print("Unbind " + hotkey);
            }
        }
Ejemplo n.º 6
0
        private void BindHotkey(string hotkey, string cmd)
        {
            var key = Hotkey.Parse(hotkey);

            if (string.IsNullOrEmpty(cmd) || !cmd.StartsWith(".") || key == null)
            {
                Main.NewText("Invalid hotkey binding!");
            }
            else
            {
                DNMT.Config.Set("HotkeyBinds", hotkey, cmd);
                HotkeyCore.RegisterHotkey(cmd, key);
                CORE.Print(hotkey + " set to " + cmd);
            }
        }
Ejemplo n.º 7
0
        public static void RefreshUsersFromWSO(List <User> usersWSO, CORE core)
        {
            var db = core.Entitron.GetStaticTables();

            //iterate all users from WSO
            foreach (User user in usersWSO)
            {
                //if theres already this user. we will update the db
                var databaseUser = db.Users.SingleOrDefault(u => !u.isLocalUser && u.UserName == user.UserName);
                if (databaseUser != null)
                {
                    databaseUser.UserName    = user.UserName;
                    databaseUser.Company     = user.Company;
                    databaseUser.MobilPhone  = user.MobilPhone;
                    databaseUser.DisplayName = user.DisplayName;
                    databaseUser.Email       = user.Email;
                    //Refresh ROLES
                    databaseUser.Roles.Clear();
                    foreach (var role in user.Roles)
                    {
                        databaseUser.Roles.Add(new User_Role {
                            AppRole = role.AppRole, User = databaseUser
                        });
                    }
                    //end refresh roles
                    databaseUser.isActive = true;
                    db.SaveChanges();
                }

                //if the user is not in DB, we will add this user to DB
                else
                {
                    db.Users.Add(user);
                }
            }

            //iterate the users in the DB
            foreach (User user in db.Users)
            {
                //if this user is in db but not in the  WSO, set inactive
                if (!usersWSO.Any(u => u.UserName == user.UserName))
                {
                    user.isActive = false;
                }
            }
            db.SaveChanges();
        }
Ejemplo n.º 8
0
        public InstructionExit HandleUUO(SimhPDP10CPU processor, ulong instruction, OpCodes opcode, int ac, ulong ea)
        {
            switch ((CALLIs)ea)
            {
            case CALLIs.GETTAB:
                return(GETTAB.Execute(Monitor, processor, instruction, opcode, ac, ea));

            case CALLIs.CORE:
                return(CORE.Execute(Monitor, processor, instruction, opcode, ac, ea));

            case CALLIs.EXIT:
                return(InstructionExit.IntentionalExit);

            default:
                return(InstructionExit.UnimplementedMonitorCall);
            }
        }
Ejemplo n.º 9
0
        public LightingEx()
        {
            string section = GetType().Name;

            HotkeyCore.RegisterHotkey(() =>
            {
                _flashlight = !_flashlight;
                CORE.Print("Flashlight: " + (_flashlight ? "Enabled" : "Disabled"));
            }, DNMT.Config.Get(section, "Flashlight", new Hotkey(Keys.Subtract, alt: true), true));
            HotkeyCore.RegisterHotkey(() =>
            {
                _torch = !_torch;
                CORE.Print("Torch: " + (_torch ? "Enabled" : "Disabled"));
            }, DNMT.Config.Get(section, "Torch", new Hotkey(Keys.Subtract, control: true), true));
            HotkeyCore.RegisterHotkey(() =>
            {
                _fullbright = !_fullbright;
                CORE.Print("Fullbright: " + (_fullbright ? "Enabled" : "Disabled"));
            }, DNMT.Config.Get(section, "Fullbright", new Hotkey(Keys.Subtract, shift: true), true));
        }
Ejemplo n.º 10
0
        private void cmd353(string[] args)
        {
            _Parsed = true;
            string names = UtilityService.JoinString(args, 5, args.Length).Trim(new char[] { ':' });

            string[] namelist = names.Split(' ');
            string   channel  = args[4];

            // Sometimes, the 331 isn't sended by the server so we emit the channel joined event here
            //CORE.OnChannelJoinedReceived(channel);
            CORE.SendRaw("MODE " + channel);
            CORE.SendRaw("TOPIC " + channel);
            NameReplyEventArgs e = new NameReplyEventArgs(channel, namelist);

            if (oNameCompleteEvent != null)
            {
                oNameCompleteEvent(this, e);
            }

            /////
        }
Ejemplo n.º 11
0
    private void Awake()
    {
        Application.targetFrameRate = frameRate;

        // Load data into the serializable class and transfer it to the non-serialisable list
        // This is an experimental function which can be used for futher development of this application
        // Since Application.streamingAssetsPath is read-only, it is not possible to modify the existing data
        // To overwrite or create new files locally, use Application.persistentDataPath instead
        StartCoroutine(CORE.LoadDataFromJSON(Path.Combine(CORE.DATABASE_WEB_SERVER, CORE.DATABASE_FOLDER, CORE.DATABASE_FILE_LOCATION), (webData) =>
        {
            if (!webData.Equals(""))
            {
                // Use online data
                CORE.LocationDatabase locationDatabase = JsonUtility.FromJson <CORE.LocationDatabase>(webData);
                CORE.LOCATION_DATABASE = locationDatabase.serializableList;

                Debug.Log("Online data");
                CORE.DATABASE_LOADED_FLAG = true;
            }
            else
            {
                StartCoroutine(CORE.LoadDataFromJSON(Path.Combine(Application.streamingAssetsPath, CORE.DATABASE_FOLDER, CORE.DATABASE_FILE_LOCATION), (localData) =>
                {
                    // Use local data
                    CORE.LocationDatabase locationDatabase = JsonUtility.FromJson <CORE.LocationDatabase>(localData);
                    CORE.LOCATION_DATABASE = locationDatabase.serializableList;

                    Debug.Log("Local data");
                    CORE.DATABASE_LOADED_FLAG = true;
                }));
            }
        }));

        // Load data into the serializable class and transfer it to the non-serialisable list
        StartCoroutine(CORE.LoadDataFromJSON(Path.Combine(Application.streamingAssetsPath, CORE.DATABASE_FOLDER, CORE.DATABASE_FILE_LAYER), (data) =>
        {
            CORE.PlanetDatabase planetDatabase = JsonUtility.FromJson <CORE.PlanetDatabase>(data);
            CORE.PLANET_DATABASE = planetDatabase.serializableList;
        }));
    }
Ejemplo n.º 12
0
        public override void OnChatCommand(string command, string[] args)
        {
            if (command != "bind" && command != "unbind" && command != "listbinds")
            {
                return;
            }

            if ((command == "bind" && (args.Length <= 1 || args[0] == "help")) ||
                (command == "unbind" && (args.Length <= 0 || args[0] == "help")) ||
                (command == "listbinds" && args.Length > 0 && args[0] == "help"))
            {
                CORE.Print("Usage:");
                CORE.Print("  .bind modifiers,hotkey command");
                CORE.Print("  .unbind modifiers,hotkey");
                CORE.Print("  .listbinds");
                CORE.Print("Example:");
                CORE.Print("  .bind Control,T .time dusk");
                CORE.Print("  .unbind Control,T");
                CORE.Print("  .bind Control,Shift,K .usetime");
                return;
            }

            if (command == "bind")
            {
                BindHotkey(args[0], string.Join(" ", args.Skip(1)));
            }
            else if (command == "unbind")
            {
                UnbindHotkey(args[0]);
            }
            else if (command == "listbinds")
            {
                foreach (var hotkey in HotkeyCore.GetHotkeys().Where(hotkey => !string.IsNullOrEmpty(hotkey.Tag)))
                {
                    Main.NewText(hotkey.ToString());
                }
            }
        }
Ejemplo n.º 13
0
        public GodMode()
        {
            string section = GetType().Name;

            _mode = DNMT.Config.Get(section, "Mode", Mode.Off, true);

            Action update = () =>
            {
                DNMT.Config.Set <Mode>("GodMode", "Mode", _mode);
                CORE.Print("God Mode: " + _mode, Color.Green);
            };

            HotkeyCore.RegisterHotkey(() =>
            {
                if (_mode == Mode.God)
                {
                    _mode = Mode.Off;
                }
                else
                {
                    _mode++;
                }
                update();
            }, DNMT.Config.Get(section, "KeySwitch", new Hotkey(Keys.G), true));
            HotkeyCore.RegisterHotkey(() =>
            {
                if (_mode == Mode.Off)
                {
                    _mode = Mode.God;
                }
                else
                {
                    _mode--;
                }
                update();
            }, DNMT.Config.Get(section, "KeyDowngrade", new Hotkey(Keys.G, shift: true), true));
        }
        public TerrariaEvents()
        {
            var worldGen = Assembly.GetEntryAssembly().GetType("Terraria.WorldGen");

            _triggerLunarApocalypse = worldGen.GetMethod("TriggerLunarApocalypse");
            _spawnMeteor            = worldGen.GetField("spawnMeteor");
            _dropMeteor             = worldGen.GetMethod("dropMeteor");

            string section = GetType().Name;
            bool   control = true, shift = true, alt = false;

            HotkeyCore.RegisterHotkey(() =>
            {
                CORE.Print("EVENT: Goblin Army");
                if (Main.invasionType > 0)
                {
                    Main.invasionSize = 0;
                }
                else
                {
                    Main.StartInvasion(1);
                }
            }, DNMT.Config.Get(section, "GoblinArmy", new Hotkey(Keys.D3, control, shift, alt), true));
            HotkeyCore.RegisterHotkey(() =>
            {
                CORE.Print("EVENT: Frost Legion");
                if (Main.invasionType > 0)
                {
                    Main.invasionSize = 0;
                }
                else
                {
                    Main.StartInvasion(2);
                }
            }, DNMT.Config.Get(section, "FrostLegion", new Hotkey(Keys.D4, control, shift, alt), true));
            HotkeyCore.RegisterHotkey(() =>
            {
                CORE.Print("EVENT: Pirate Invasion");
                if (Main.invasionType > 0)
                {
                    Main.invasionSize = 0;
                }
                else
                {
                    Main.StartInvasion(3);
                }
            }, DNMT.Config.Get(section, "PirateInvasion", new Hotkey(Keys.D5, control, shift, alt), true));
            HotkeyCore.RegisterHotkey(() =>
            {
                CORE.Print("EVENT: Martian Madness");
                if (Main.invasionType > 0)
                {
                    Main.invasionSize = 0;
                }
                else
                {
                    Main.StartInvasion(4);
                }
            }, DNMT.Config.Get(section, "MartianMadness", new Hotkey(Keys.D9, control, shift, alt), true));
            HotkeyCore.RegisterHotkey(() =>
            {
                CORE.Print("EVENT: Pumpkin Moon");
                if (Main.pumpkinMoon)
                {
                    Main.stopMoonEvent();
                }
                else
                {
                    Main.startPumpkinMoon();
                }
            }, DNMT.Config.Get(section, "PumpkinMoon", new Hotkey(Keys.D7, control, shift, alt), true));
            HotkeyCore.RegisterHotkey(() =>
            {
                CORE.Print("EVENT: Frost Moon");
                if (Main.snowMoon)
                {
                    Main.stopMoonEvent();
                }
                else
                {
                    Main.startSnowMoon();
                }
            }, DNMT.Config.Get(section, "FrostMoon", new Hotkey(Keys.D8, control, shift, alt), true));
            HotkeyCore.RegisterHotkey(() =>
            {
                CORE.Print("EVENT: Lunar Apocalypse");
                if (Terraria.NPC.LunarApocalypseIsUp || Terraria.NPC.AnyNPCs(398))
                {
                    StopLunarEvent();
                }
                else
                {
                    TriggerLunarApocalypse();
                }
            }, DNMT.Config.Get(section, "LunarApocalypse", new Hotkey(Keys.D0, control, shift, alt), true));
            HotkeyCore.RegisterHotkey(() =>
            {
                CORE.Print("EVENT: Moon Lord");
                if (Terraria.NPC.LunarApocalypseIsUp || Terraria.NPC.AnyNPCs(398))
                {
                    StopLunarEvent();
                }
                else
                {
                    SpawnMoonLord();
                }
            }, DNMT.Config.Get(section, "MoonLord", new Hotkey(Keys.OemTilde, control, shift, alt), true));
            HotkeyCore.RegisterHotkey(() =>
            {
                CORE.Print("EVENT: Blood Moon");
                if (Main.bloodMoon)
                {
                    Main.bloodMoon = false;
                }
                else
                {
                    TriggerBloodMoon();
                }
            }, DNMT.Config.Get(section, "BloodMoon", new Hotkey(Keys.D2, control, shift, alt), true));
            HotkeyCore.RegisterHotkey(() =>
            {
                CORE.Print("EVENT: Solar Eclipse");
                if (Main.eclipse)
                {
                    Main.eclipse = false;
                }
                else
                {
                    TriggerEclipse();
                }
            }, DNMT.Config.Get(section, "SolarEclipse", new Hotkey(Keys.D6, control, shift, alt), true));
            HotkeyCore.RegisterHotkey(() =>
            {
                CORE.Print("EVENT: Meteor");
                SpawnMeteor = false;
                DropMeteor();
            }, DNMT.Config.Get(section, "Meteor", new Hotkey(Keys.D1, control, shift, alt), true));
        }
            public FileImporterProperties(CORE.FileImporter fileImporter)
                : base(false, ";;;", "|||", ":::")
            {
                this.fileImporter = fileImporter;
                this.Plugin = fileImporter;
                string fileImporterDataPath = this.fileImporter.DataPath + "FileImporter\\";

                if (File.Exists(fileImporterDataPath + "TVShowsReplacementRules.txt"))
                {
                    try
                    {
                        this.tvShowsReplacements = File.ReadAllText(fileImporterDataPath + "TVShowsReplacementRules.txt");
                    }
                    catch (Exception ex)
                    {
                        this.fileImporter.LogMessages.Enqueue(
                            new LogMessage(
                                "Warn", "Unable to load the default TVShowsTagValueReplacementRules." + Environment.NewLine + ex));
                    }
                }

                if (File.Exists(fileImporterDataPath + "TVShowsRegex.txt"))
                {
                    try
                    {
                        this._tvShowsRegex = File.ReadAllText(fileImporterDataPath + "TVShowsRegex.txt");
                    }
                    catch (Exception ex)
                    {
                        this.fileImporter.LogMessages.Enqueue(
                            new LogMessage(
                                "Warn", "Unable to load the default TVShowsRegex." + Environment.NewLine + ex));
                    }
                }

                if (File.Exists(fileImporterDataPath + "MoviesRegex.txt"))
                {
                    try
                    {
                        moviesRegex = File.ReadAllText(fileImporterDataPath + "MoviesRegex.txt");
                    }
                    catch (Exception ex)
                    {
                        this.fileImporter.LogMessages.Enqueue(
                            new LogMessage("Warn", "Unable to load the default MoviesRegex." + Environment.NewLine + ex));
                    }
                }

                if (File.Exists(fileImporterDataPath + "MusicRegex.txt"))
                {
                    try
                    {
                        musicRegex = File.ReadAllText(fileImporterDataPath + "MusicRegex.txt");
                    }
                    catch (Exception ex)
                    {
                        this.fileImporter.LogMessages.Enqueue(
                            new LogMessage("Warn", "Unable to load the default MusicRegex." + Environment.NewLine + ex));
                    }
                }

                InitializeOptionSettings();
            }
Ejemplo n.º 16
0
        static int Main(string[] args)
        {
            bool          server_is_running = true;
            string        path = null;
            int?          port = null;
            string        _input;
            Enviroment    enviroment = new Enviroment(Directory.GetCurrentDirectory());
            InitialParams parsed_params;
            DBModel       model = new DBModel();

            model.CreatePeopleTable();



            try
            {
                parsed_params = CORE.ParseParams(args);
                port          = parsed_params._port;
                path          = parsed_params._path;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(CORE._app_response_fail);
            }

            if (parsed_params._port == null)
            {
                port = CORE._default_port;
            }

            if (string.IsNullOrEmpty(parsed_params._path))
            {
                path = enviroment.DefaultPath;
            }

            if (!SERVER_CORE.CORE.PortIsAvailable(port))
            {
                Console.WriteLine($"PORT {port} is busy");
                return(SERVER_CORE.CORE._app_response_fail);
            }

            Console.WriteLine("PORT: " + port);
            Console.WriteLine("PATH: " + path);

            HTTPServer server = new HTTPServer((int)port);

            server.Start();

            //Infinite loop... until 'exit' command is typed
            while (server_is_running)
            {
                _input = Console.ReadLine();
                _input = _input.ToLower();

                switch (_input)
                {
                case CORE._timestamp_minutes_running_command:
                    Console.WriteLine("UPTIME: " + (DateTime.Now - enviroment.App_Start_Timestamp).TotalMinutes + " minutes");
                    break;

                case CORE._timestamp_started_at_command:
                    Console.WriteLine($"UPTIME STARTED AT: {enviroment.App_Start_Timestamp.ToShortDateString()} | {enviroment.App_Start_Timestamp.ToShortTimeString()}");
                    break;

                case CORE._exit_app_command:
                    server_is_running = false;
                    break;

                default:
                    Console.WriteLine($"UNKNOWN COMMAND '{_input}'");
                    break;
                }
            }

            return(CORE._app_response_success);
        }
        internal static bool GetPropertyForMisc(int index, ref int i, OptionSettings prop, 
            CORE.FileImporter fileImporter,
            ImporterPropertiesCore.FileImporterProperties importerProperties)
        {
            if (index == i++)
            {
                prop.Name = "Mode";
                prop.Caption = "Mode";

                prop.HelpText = "Expert mode shows all options " +
                                "except those dependent on other options." +
                                Environment.NewLine +
                                "(Ex: 'Chaining tags' option is only visible" +
                                " if you selected 'Group/chain items" +
                                " with matching tags' in the 'Chaining options'.)" +
                                Environment.NewLine +
                                "Simple-Hide mode hides a lot of the more advanced options." +
                                " Simple-Disable will instead disable the same advanced options.";

                prop.DataType = "string";

                prop.Choices = new[]
                    {
                        "Simple-Hide".Translate(),
                        "Simple-Disable".Translate(),
                        "Expert".Translate()
                    };

                prop.Dependencies = "Simple-Hide".Translate()
                                    +
                                    ":::HIDEGROUP"
                                    +
                                    " ImageAssociationRules,"
                                    +
                                    "FilesystemInfo,"
                                    +
                                    "Debugging," +
                                    "ADS"
                                    +
                                    ";;;"
                                    +
                                    "Simple-Disable".Translate()
                                    +
                                    ":::DISABLEGROUP"
                                    +
                                    " ImageAssociationRules,"
                                    +
                                    "FilesystemInfo,"
                                    +
                                    "Debugging,ADS"
                                    +
                                    ";;;"
                                    +
                                    "Simple-Hide".Translate()
                                    +
                                    ":::HIDE"
                                    +
                                    " ImageTagName,"
                                    +
                                    "DeleteNonExistentFiles,"
                                    +
                                    "AlwaysUpdate,"
                                    +
                                    "IncludeHiddenFiles,"
                                    +
                                    "ExcludeFileMasks,"
                                    +
                                    "MinFileSize,"
                                    +
                                    "ExcludeUnmatchedFiles,"
                                    +
                                    "ChainingOptions,"
                                    +
                                    "AlwaysUpdateImages,"
                                    +
                                    "TagValuesReplacement"
                                    +
                                    ";;;"
                                    +
                                    "Simple-Disable".Translate()
                                    +
                                    ":::DISABLE ImageTagName,"
                                    +
                                    "DeleteNonExistentFiles,"
                                    +
                                    "AlwaysUpdate,"
                                    +
                                    "IncludeHiddenFiles,"
                                    +
                                    "ExcludeFileMasks"
                                    +
                                    ",MinFileSize,"
                                    +
                                    "ExcludeUnmatchedFiles,"
                                    +
                                    "ChainingOptions,AlwaysUpdateImages,"
                                    +
                                    "TagValuesReplacement"
                                    +
                                    ";;;"
                                    +
                                    "Expert".Translate()
                                    +
                                    ":::ENABLEGROUP "
                                    +
                                    "ImageAssociationRules,"
                                    +
                                    "FilesystemInfo,"
                                    +
                                    "Debugging,"
                                    +
                                    "ADS"
                                    +
                                    ";;;"
                                    +
                                    "Expert".Translate()
                                    +
                                    ":::SHOWGROUP "
                                    +
                                    "ImageAssociationRules,"
                                    +
                                    "FilesystemInfo,"
                                    +
                                    "Debugging,"
                                    +
                                    "ADS"
                                    +
                                    ";;;" + "Expert".Translate()
                                    +
                                    ":::ENABLE "
                                    +
                                    "ImageTagName,"
                                    +
                                    "DeleteNonExistentFiles,"
                                    +
                                    "AlwaysUpdate,"
                                    +
                                    "IncludeHiddenFiles,"
                                    +
                                    "ExcludeFileMasks,"
                                    +
                                    "MinFileSize,"
                                    +
                                    "ExcludeUnmatchedFiles,"
                                    +
                                    "ChainingOptions,"
                                    +
                                    "AlwaysUpdateImages,"
                                    +
                                    "TagValuesReplacement"
                                    +
                                    ";;;"
                                    +
                                    "Expert".Translate()
                                    +
                                    ":::Show "
                                    +
                                    "ImageTagName,"
                                    +
                                    "DeleteNonExistentFiles,"
                                    +
                                    "AlwaysUpdate,"
                                    +
                                    "IncludeHiddenFiles,"
                                    +
                                    "ExcludeFileMasks,"
                                    +
                                    "MinFileSize,"
                                    +
                                    "ExcludeUnmatchedFiles,"
                                    +
                                    "ChainingOptions,"
                                    +
                                    "AlwaysUpdateImages,"
                                    +
                                    "TagValuesReplacement";

                prop.GroupName = "Misc";
                prop.DefaultValue = "Simple-Hide".Translate();
                return true;
            }

            /*
                if (index == i++)
                {
                    prop.Name = "WizardToggle";
                    prop.Caption = string.Empty;
                    prop.DefaultValue = "Start the setup wizard".Translate();
                    prop.HelpText = "Click to start a wizard guiding you through the setup of this import";
                    prop.GroupName = "Misc";
                    prop.Dependencies = "Start the setup wizard".Translate() +
                                        ":::WizardStepper = 1|||SHOW WizardStepper";
                    prop.DataType = "toggle";
                    return true;
                }

                if (index == i++)
                {
                    prop.Name = "WizardStepper";
                    prop.Caption = "Wizard test";
                    prop.HelpText = "help";
                    prop.Choices = new List<string> { "MediaType", "RootFolders2", "TagMasks" };
                    prop.DefaultValue = 0;
                    prop.DataType = "wizard";
                    return true;
                }
                */

            //if (index == i++)
            //{

            //    prop.Name = "MediaType";

            //    prop.Caption = "Media type";

            //    prop.Choices2["any"] = "Any";
            //    prop.Choices2["music"] = "Music";
            //    prop.Choices2["musicvideos"] = "Music videos";
            //    prop.Choices2["movies"] = "Movies";
            //    prop.Choices2["tvshows"] = "TVShows";
            //    prop.Choices2["text"] = "Text";
            //    prop.Choices2["games"] = "Games";
            //    prop.Choices2["images"] = "Images";

            //    prop.HelpText = "If set other properties " +
            //                    "will be preconfigured to reflect" +
            //                    " the chosen media type.";

            ////    fileImporter.MovieProfile = "default";
            ////    fileImporter.MusicProfile = "default";
            ////    fileImporter.PicturesProfile = "default";
            ////    fileImporter.TVShowsProfile = "default";

            //    //string movieFolders = string.Empty;

            //    //if (fileImporter.MovieFolders != null)
            //    //{

            //    //     movieFolders
            //    //        = string.Join
            //    //            (Environment.NewLine,
            //    //             fileImporter.MovieFolders);

            //    //}

            //    //string tvFolders = String.Empty;

            //    //if (fileImporter.TVShowsFolders != null)
            //    //{

            //    //     tvFolders
            //    //         = string.Join
            //    //         (Environment.NewLine,
            //    //         fileImporter.TVShowsFolders);

            //    //}

            //    //string musicFolders = String.Empty;

            //    //if (fileImporter.MusicFolders != null)
            //    //{

            //    //     musicFolders
            //    //         = string.Join
            //    //         (Environment.NewLine,
            //    //         fileImporter.MusicFolders);

            //    //}

            //    //string photoFolders = String.Empty;

            //    //if (fileImporter.PicturesFolders != null)
            //    //{

            //    //    photoFolders
            //    //       = string.Join
            //    //           (Environment.NewLine,
            //    //            fileImporter.PicturesFolders);

            //    //}

            //    //string musicVideosFolders
            //    //    = importerProperties
            //    //    .FixMediaLocation
            //    //    ("ExistingMusicVideos");

            //    //string moviePosterFolder
            //    //= importerProperties
            //    //.FixMediaLocation
            //    //("ExistingMoviePosters");

            //    //string movieFanartFolder
            //    //= importerProperties.FixMediaLocation
            //    //("ExistingMovieFanArt");

            //    //string tvSeriesBannerFolder
            //    //    = importerProperties.FixMediaLocation
            //    //    ("ExistingTVSeriesBanners");

            //    //string tvSeriesPosterFolder
            //    //    = importerProperties.FixMediaLocation
            //    //    ("ExistingTVSeriesPosters");

            //    //string tvSeriesFanartFolder
            //    //    = importerProperties.FixMediaLocation
            //    //    ("ExistingTVFanArt");

            //    //string tvSeasonImageFolder
            //    //    = importerProperties.FixMediaLocation
            //    //    ("ExistingTVSeasonPosters");

            //    //prop.Dependencies = ".*:::UPDATE Mode" +
            //    //                    ";;;any:::IncludeFileMasks = " +
            //    //                    "|||SHOWGROUP ImageAssociationRules" +
            //    //                    "|||ImageSearchActive2 = false" +
            //    //                    "|||ImageSearchActive3 = false" +
            //    //                    "|||ImageSearchActive4 = false" +
            //    //                    "|||ImageSearchActive5 = false" +
            //    //                    ";;;music:::IncludeFileMasks = "
            //    //                    +
            //    //                    FileImporter
            //    //                    .FileImporterProperties
            //    //                    .AudioExtensions
            //    //                    +
            //    //                    "|||RootFolders2 = "
            //    //                    +
            //    //                    musicFolders
            //    //                    +
            //    //                    "|||TagMasks = "
            //    //                    +
            //    //                    importerProperties.MusicRegex
            //    //                    +
            //    //                    "|||SHOWGROUP ImageAssociationRules"
            //    //                    +
            //    //                    "|||ImageSearchActive2 = false"
            //    //                    +
            //    //                    "|||ImageSearchActive3 = false"
            //    //                    +
            //    //                    "|||ImageSearchActive4 = false"
            //    //                    +
            //    //                    "|||ImageSearchActive5 = false"
            //    //                    +
            //    //                    ";;;movies:::IncludeFileMasks = "
            //    //                    +
            //    //                    FileImporter.FileImporterProperties.VideoExtensions
            //    //                    +
            //    //                    "|||RootFolders2 = "
            //    //                    +
            //    //                    movieFolders
            //    //                    +
            //    //                    "|||TagMasks = "
            //    //                    +
            //    //                    importerProperties.MoviesRegex
            //    //                    +
            //    //                    "|||SHOWGROUP ImageAssociationRules" +
            //    //                    "|||ImageSearchActive2 = true" +
            //    //                    "|||ImageSearchActive3 = false" +
            //    //                    "|||ImageSearchActive4 = false" +
            //    //                    "|||ImageSearchActive5 = false" +
            //    //                    "|||ImageFolder = " + moviePosterFolder
            //    //                    +
            //    //                    "|||ImageFolder2 = " + movieFanartFolder
            //    //                    +
            //    //                    ";;;musicvideos:::IncludeFileMasks = "
            //    //                    +
            //    //                    FileImporter.FileImporterProperties.VideoExtensions
            //    //                    +
            //    //                    "|||RootFolders2 = " + musicVideosFolders +
            //    //                    "|||SHOWGROUP ImageAssociationRules" +
            //    //                    "|||ImageSearchActive2 = false" +
            //    //                    "|||ImageSearchActive3 = false" +
            //    //                    "|||ImageSearchActive4 = false" +
            //    //                    "|||ImageSearchActive5 = false" +
            //    //                    ";;;tvshows:::IncludeFileMasks = " + FileImporter.FileImporterProperties.VideoExtensions +
            //    //                    "|||RootFolders2 = " + tvFolders +
            //    //                    "|||TagMasks = " + importerProperties.TVShowsRegex +
            //    //                    "|||TagValuesReplacement = " + importerProperties.tvShowsReplacements +
            //    //                    "|||ENABLEGROUP ImageAssociationRules" +
            //    //                    "|||SHOWGROUP ImageAssociationRules" +
            //    //                    "|||ImageSearchActive2 = true" +
            //    //                    "|||ImageSearchActive3 = true" +
            //    //                    "|||ImageSearchActive4 = true" +
            //    //                    "|||ImageSearchActive5 = true" +
            //    //                    "|||ImageFolder2 = "
            //    //                    +
            //    //                    tvSeriesFanartFolder
            //    //                    +
            //    //                    "|||ImageFolder3 = "
            //    //                    +
            //    //                    tvSeasonImageFolder
            //    //                    +
            //    //                    "|||ImageFolder4 = "
            //    //                    +
            //    //                    tvSeriesPosterFolder
            //    //                    +
            //    //                    "|||ImageFolder5 = "
            //    //                    +
            //    //                    tvSeriesBannerFolder
            //    //                    +
            //    //                    ";;;text:::IncludeFileMasks = "
            //    //                    +
            //    //                    FileImporter.FileImporterProperties.TextExtensions
            //    //                    +
            //    //                    "|||SHOWGROUP ImageAssociationRules"
            //    //                    +
            //    //                    "|||ImageSearchActive2 = false"
            //    //                    +
            //    //                    "|||ImageSearchActive3 = false" +
            //    //                    "|||ImageSearchActive4 = false" +
            //    //                    "|||ImageSearchActive5 = false" +
            //    //                    ";;;images:::IncludeFileMasks = "
            //    //                    +
            //    //                    FileImporter.FileImporterProperties.ImageExtensions +
            //    //                    "|||RootFolders2 = " + photoFolders +
            //    //                    "|||HIDEGROUP ImageAssociationRules" +
            //    //                    "|||ImageSearchActive2 = false" +
            //    //                    "|||ImageSearchActive3 = false" +
            //    //                    "|||ImageSearchActive4 = false" +
            //    //                    "|||ImageSearchActive5 = false" +
            //    //                    ";;;games:::IncludeFileMasks = " + "*.lnk" +
            //    //                    "|||SHOWGROUP ImageAssociationRules" +
            //    //                    "|||ImageSearchActive2 = false" +
            //    //                    "|||ImageSearchActive3 = false" +
            //    //                    "|||ImageSearchActive4 = false" +
            //    //                    "|||ImageSearchActive5 = false";

            //    prop.DataType = "string";
            //    const string defaultValue = "any";

            ////    if (fileImporter.IsFirstLoad)
            ////    {

            ////        string sectionName
            ////            = fileImporter.Section
            ////            .Name.ToLowerInvariant();

            ////        List<string> musicLibraryNames
            ////            = new List<string>
            ////                  {
            ////                      "music",
            ////                      "music".Translate()
            ////                  };

            ////        List<string> moviesLibraryNames
            ////            = new List<string>
            ////            {
            ////                "movies",
            ////                "movies".Translate()
            ////            };

            ////        List<string> musicvideosLibraryNames
            ////            = new List<string>
            ////            {
            ////                "musicvideos",
            ////                "musicvideos".Translate()
            ////            };

            ////        List<string> tvshowsLibraryNames = new List<string>
            ////            {
            ////                "tv-shows",
            ////                "tv-shows".Translate(),
            ////                "tvshows",
            ////                "tvshows".Translate(),
            ////                "series",
            ////                "series".Translate(),
            ////                "tv series",
            ////                "tv series".Translate()
            ////            };

            ////        List<string> gamesLibraryNames
            ////            = new List<string> { "games",
            ////                "games".Translate() };

            ////        List<string> imagesLibraryNames = new List<string>
            ////            {
            ////                "photos",
            ////                "photos".Translate(),
            ////                "images",
            ////                "images".Translate(),
            ////                "pictures",
            ////                "pictures".Translate()
            ////            };

            ////        List<string> booksLibraryNames = new List<string>
            ////            {
            ////                "books",
            ////                "books".Translate(),
            ////                "text",
            ////                "text".Translate()
            ////            };

            ////        if (musicLibraryNames.Contains(sectionName))
            ////        {
            ////            defaultValue = "music";
            ////        }
            ////        else if (moviesLibraryNames.Contains(sectionName))
            ////        {
            ////            defaultValue = "movies";
            ////        }
            ////        else if (musicvideosLibraryNames.Contains(sectionName))
            ////        {
            ////            defaultValue = "musicvideos";
            ////        }
            ////        else if (tvshowsLibraryNames.Contains(sectionName))
            ////        {
            ////            defaultValue = "tvshows";
            ////        }
            ////        else if (booksLibraryNames.Contains(sectionName))
            ////        {
            ////            defaultValue = "text";
            ////        }
            ////        else if (gamesLibraryNames.Contains(sectionName))
            ////        {
            ////            defaultValue = "games";
            ////        }
            ////        else if (imagesLibraryNames.Contains(sectionName))
            ////        {
            ////            defaultValue = "images";
            ////        }
            ////    }

            //    prop.DefaultValue = defaultValue;
            //    return true;

            //}

            if (index == i++)
            {
                prop.Name = "RootFolders2";
                prop.Caption = "Root folders";
                prop.HelpText = "Select any number of root folders from which to import files";
                prop.DataType = "folderlist";
                prop.Choices = new string[] { };
                return true;
            }

            if (index == i++)
            {
                prop.Name = "TagMasks";
                prop.Caption = "Tag masks";
                prop.HelpText = "Enter one or more tag masks such as <artist>\\<album>\\<track> - <name>.<>" +
                                Environment.NewLine +
                                "The 'name' tag is important because it will be used as the item's name, that is showed on the last view step." +
                                Environment.NewLine +
                                "So usually your tag masks should at least make sure to fill this tag.";
                prop.DataType = "stringlist";
                return true;
            }

            if (index == i++)
            {
                prop.Name = "ChainFiles";
                prop.Caption = "Group/chain files in each directory together";
                prop.HelpText =
                    "If set files in a folder will be added as one item with all the filenames separated by pipes";
                prop.Dependencies = "False:::ChainingOptions = 0" + ";;;True:::ChainingOptions = 1";
                prop.DataType = "bool";
                prop.DefaultValue = false;
                return true;
            }

            if (index == i++)
            {
                prop.Name = "ChainingOptions";
                prop.Caption = "Chaining options";
                prop.Choices2["0"] = "Don't group/chain anything".Translate();
                prop.Choices2["1"] = "Group/chain files in same folder".Translate();
                prop.Choices2["2"] = "Group/chain items with matching tags".Translate();
                prop.HelpText =
                    "If set files in a folder will be added as one item with all the filenames separated by pipes";
                prop.Dependencies = "..*:::DISABLE ChainFiles|||HIDE ChainFiles" + ";;;0:::HIDE ChainingTags" +
                                    ";;;1:::HIDE ChainingTags" + ";;;2:::SHOW ChainingTags";
                prop.DataType = "string";
                prop.DefaultValue = "0";
                return true;
            }

            if (index == i++)
            {
                prop.Name = "ChainingTags";
                prop.Caption = "Chaining tags";
                prop.HelpText = "The tags used for the \"Group/chain items with matching tags\" chaining option";
                prop.DataType = "stringlist";
                return true;
            }

            if (index == i++)
            {
                prop.Name = "DeleteNonExistentFiles";
                prop.Caption = "Delete/Relocate non existent files";
                prop.HelpText =
                    "If set all files of already existing items will be checked. If a file isn't available anymore it is first searched for in other rootfolders." +
                    Environment.NewLine +
                    "If found the location just gets replaced with the new one. If not the location gets deleted. If all locations are deleted the item will get deleted." +
                    Environment.NewLine +
                    "To prevent deleting the items just because your NAS is currently offline, the items only get deleted if the rootfolder of the item is currently available." +
                    Environment.NewLine +
                    "(If you removed the rootfolder from the 'RootFolders' property the items folder is checked instead.)";
                prop.DataType = "bool";
                prop.DefaultValue = false;
                return true;
            }

            if (index == i++)
            {
                prop.Name = "AlwaysUpdate";
                prop.Caption = "Update all items";
                prop.HelpText = "If set all found files will be updated.\r\n" +
                                "If not only files that were modified since the last import will be updated.";
                prop.DataType = "bool";
                prop.DefaultValue = false;
                return true;
            }

            if (index == i++)
            {
                prop.Name = "TagValuesReplacement";
                prop.Caption = "Tag values replacement";
                prop.HelpText = "Use this option to relace tag values.\r\n" +
                                "Each line is one replacement rule.\r\n" + "Ex:\r\n" +
                                "<SeriesName>=Star Trek; The Next Generation (<-?->) <SeriesName>=Star Trek: The Next Generation\r\n" +
                                "<SeriesName>=Star Trek; Voyager (<-?->) <SeriesName>=Star Trek: Voyager\r\n" +
                                "\r\n" + "<resolution>=720p (<-?->) <IsHD>=true\r\n" +
                                "<resolution>=1080p (<-?->) <IsHD>=true (<-:->) <IsHD>=false";
                prop.DataType = "customlist";
                prop.DefaultValue = new string[] { };
                prop.CanTypeChoices = true;
                return true;
            }

            return false;
        }
Ejemplo n.º 18
0
    void Update()
    {
        // Update the indicator location
        if (placementIndicatorEnabled)
        {
            UpdatePlacementPose();
            UpdatePlacementIndicator();
        }

        // Context is always facing to the camera
        if (labelList.Count != 0)
        {
            foreach (GameObject t in labelList)
            {
                t.transform.LookAt(Camera.main.transform);
                t.transform.Rotate(new Vector3(0, 180, 0));
            }
        }

        if (landmarkList.Count != 0)
        {
            foreach (GameObject l in landmarkList)
            {
                l.transform.LookAt(Camera.main.transform);
                l.transform.Rotate(new Vector3(0, 180, 0));
            }
        }

        if (profilePanel.activeSelf)
        {
            profilePanel.transform.LookAt(Camera.main.transform);
            profilePanel.transform.Rotate(new Vector3(0, 180, 0));
        }

        // Detect tapping
        if ((Input.touchCount > 0) && (Input.GetTouch(0).phase == TouchPhase.Began))
        {
            Ray        raycast = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
            RaycastHit raycastHit;
            if (Physics.Raycast(raycast, out raycastHit))
            {
                #region SHOW_CITY_PROFILE
                // Display city profile
                if (raycastHit.collider.CompareTag("Pin"))
                {
                    // Compute the scaling factor
                    float distanceScale = (raycastHit.collider.transform.position - referenceOrigin).magnitude / 1000;

                    // Display the panel before the other sprites by shifting a very small value so that it is not occluded
                    // A. Dynamic distance
                    //profilePanel.transform.position = raycastHit.collider.transform.position * 0.99f;

                    // B. Fixed distance
                    profilePanel.transform.position = Camera.main.transform.position + 1.0f * (raycastHit.point - Camera.main.transform.position).normalized;

                    // Fetch selected landmark information
                    CORE.LocationInfo selectedLocation = CORE.LOCATION_DATABASE[int.Parse(raycastHit.collider.name)];

                    // Assign information to the panel
                    profilePanel.transform.Find("Label_CityName").GetComponent <Text>().text        = selectedLocation.name;
                    profilePanel.transform.Find("Label_CityCountry").GetComponent <Text>().text     = selectedLocation.country + "";
                    profilePanel.transform.Find("Label_CityDescription").GetComponent <Text>().text = selectedLocation.description;
                    profilePanel.transform.Find("Button_Portal").gameObject.SetActive(selectedLocation.panorama);

                    // Reset images just in case the target images are not available
                    profilePanel.transform.Find("Image_CityLandmark").gameObject.GetComponent <Image>().sprite = defaultLandmark;
                    profilePanel.transform.Find("Image_CountryFlag").gameObject.GetComponent <Image>().sprite  = defaultFlag;

                    // Load images from local resources
                    StartCoroutine(CORE.LoadImageToSprite(Path.Combine(Application.streamingAssetsPath, CORE.IMAGE_FOLDER_CITY, CORE.FileNameParser(selectedLocation.name) + CORE.IMAGE_FORMAT), (result) =>
                    {
                        profilePanel.transform.Find("Image_CityLandmark").gameObject.GetComponent <Image>().sprite = result;
                    }));

                    StartCoroutine(CORE.LoadImageToSprite(Path.Combine(Application.streamingAssetsPath, CORE.IMAGE_FOLDER_FLAG, CORE.FileNameParser(selectedLocation.country) + CORE.IMAGE_FORMAT), (result) =>
                    {
                        profilePanel.transform.Find("Image_CountryFlag").gameObject.GetComponent <Image>().sprite = result;
                    }));

                    StartCoroutine(CORE.LoadImageToTexture(Path.Combine(Application.streamingAssetsPath, CORE.IMAGE_FOLDER_PANORAMA, CORE.FileNameParser(selectedLocation.name) + CORE.IMAGE_FORMAT), (result) =>
                    {
                        mappedEarth.transform.Find("Portal_Panorama").GetComponent <Renderer>().material.SetTexture("_Texture", result);
                    }));

                    panoramaPanel.transform.Find("Text").GetComponent <Text>().text = selectedLocation.landmark;

                    // Append formatted string to the url
                    url = Path.Combine(CORE.SEARCH_ENGINE_PATH, CORE.FileNameParser(selectedLocation.name));

                    // Scale the panel
                    // A. Dynamic scale
                    //profilePanel.transform.localScale = Vector3.one * UIPanelScaleDynamic * distanceScale;

                    // B. Fixed scale
                    profilePanel.transform.localScale = Vector3.one * UIPanelScaleFixed;

                    // Rotate the panel to face the user
                    profilePanel.transform.LookAt(Camera.main.transform);
                    profilePanel.transform.Rotate(new Vector3(0, 180, 0));

                    // Show the panel
                    profilePanel.SetActive(true);
                }
                #endregion
            }
        }
    }
Ejemplo n.º 19
0
    public void MapEarth()
    {
        profilePanel.SetActive(false);

        // Clear old variables
        Destroy(mappedEarth);

        foreach (GameObject l in landmarkList)
        {
            Destroy(l);
        }
        landmarkList.Clear();

        foreach (GameObject t in labelList)
        {
            Destroy(t);
        }
        labelList.Clear();

        #region EARTH_MAPPING
        // Initialise the earth object and the horizon
        // The horizon (range) is 5km x 5km as suggested for a 1.7m human
        referenceOrigin = placementPose.position;
        referenceEarth  = Instantiate(earthToReference, referenceOrigin, Quaternion.identity);
        mappedEarth     = Instantiate(earthHorizonPrefab, referenceOrigin, Quaternion.identity);

        Transform pinGroup = referenceEarth.transform.Find("Group_Pins");
        Transform refTop   = referenceEarth.transform.Find("Ref_Top");

        // Scale and reposition the Earth
        referenceEarth.transform.localScale = Vector3.one * CORE.EARTH_PREFAB_SCALE_TO_REAL;

        // Rotate the Earth so that the current position is facing up so that we can do the following calculations
        // Use the pre-calculated value
        referenceEarth.transform.rotation = CORE.ROTATE_TO_TOP;

        // Rotate the Earth so that the current north direction is aligned geographically
        // First, find the current device facing direction (projection on z axis)
        Vector3 facingDirection      = Vector3.ProjectOnPlane(Camera.main.transform.forward, Vector3.up).normalized;
        Vector3 prefabNorthDirection = Vector3.ProjectOnPlane(refTop.position - referenceEarth.transform.position, Vector3.up).normalized;

        // Then, compute the degree required to rotate the earth to the facing direction
        Quaternion rotateToFacingDirection = Quaternion.FromToRotation(prefabNorthDirection, facingDirection);

        // Lastly, compute the degree required to rotate the earth to the geographical north
        Quaternion rotateToGeographicalNorth = Quaternion.Euler(0, -Input.compass.trueHeading, 0);

        // 1. Use ROTATION
        // Compute the degree required to rotate the north direction to match the facing direction
        //float degree;
        //Vector3 axis;
        //rotateToFacingDirection.ToAngleAxis(out degree, out axis);
        //mappedEarth.transform.RotateAround(transform.position, Vector3.up, degree);

        // Then rotate the Earth again according to the heading direction from the GPS so that the north direction is matched both virtually and physically
        //mappedEarth.transform.Rotate(Vector3.up, -Input.compass.trueHeading, Space.World);

        // OR 2. Use QUATERNION
        // Those steps need to be combined backwards to get the correct result
        referenceEarth.transform.rotation = rotateToGeographicalNorth * rotateToFacingDirection * CORE.ROTATE_TO_TOP;

        // Fix the floating point imprecision issue due to the large scale
        Vector3 impreciseRefPosition = pinGroup.GetChild(0).gameObject.transform.position;
        float   preciseScaleFactor   = CORE.EARTH_CRUST_RADIUS / impreciseRefPosition.y;

        foreach (Transform pin in pinGroup)
        {
            pin.position *= preciseScaleFactor;
        }

        // Shift the mapped earth down so that the y value of current position is the same as the selected surface for mapping
        referenceEarth.transform.position -= new Vector3(0, CORE.EARTH_CRUST_RADIUS, 0);
        #endregion

        mappedEarth.transform.Find("Mapping_Border").rotation = referenceEarth.transform.rotation;

        #region PIN_ASSIGNMENT
        Vector3 preciseRefPosition = pinGroup.GetChild(0).gameObject.transform.position;
        foreach (Transform pin in pinGroup)
        {
            // Display landmarks excluding the current position
            if (pin.position != preciseRefPosition)
            {
                CORE.LocationInfo currentPinLocation = CORE.LOCATION_DATABASE[int.Parse(pin.gameObject.name)];
                float             geoDistance        = CORE.DistanceBetweenLatLong(currentPinLocation.coord, CORE.USER_LATLONG);
                float             distanceScale      = (pin.position - referenceOrigin).magnitude / 1000;

                #region CITY_LANDMARK_IMAGE
                // Instantiate the landmark prefab
                GameObject landmark = Instantiate(landmarkPrefab, pin.position, Quaternion.identity, canvasWorld.transform);

                // Set the landmark image
                Transform landmarkImage = landmark.transform.Find("UI_Landmark_Image");
                landmarkImage.name = pin.name;

                // Rescale the landmark
                landmark.transform.localScale *= distanceScale;

                // Change the sprite based on the geographical distance
                if (geoDistance > 5)
                {
                    landmarkImage.GetComponent <Image>().sprite = spriteFarPin;
                }
                else
                {
                    landmarkImage.GetComponent <Image>().sprite = spriteNearPin;
                }

                // Fill the color
                landmarkImage.GetComponent <Image>().color = new Color32(0, 255, 0, 255);

                landmarkList.Add(landmark);
                #endregion

                #region CITY_INFO_LABEL
                // Place hovering labels
                GameObject label = Instantiate(labelPrefab, pin.position, Quaternion.identity, canvasWorld.transform);
                label.transform.Find("Label_LandmarkName").GetComponent <Text>().text = currentPinLocation.name + ", " + currentPinLocation.country;

                // Display the indicator based on the geographical distance
                if (geoDistance > 5)
                {
                    label.transform.Find("Label_LandmarkDistance").GetComponent <Text>().text = "▽ ";
                }
                else
                {
                    label.transform.Find("Label_LandmarkDistance").GetComponent <Text>().text = "▲ ";
                }

                // Display the geographical distance
                label.transform.Find("Label_LandmarkDistance").GetComponent <Text>().text += (geoDistance.ToString() + "km");

                // Rescale the label
                label.transform.localScale = Vector3.one * UILabelScale * distanceScale;
                labelList.Add(label);
                #endregion
            }
            else
            {
                pin.gameObject.SetActive(false);
            }
        }

        profilePanel.transform.SetAsLastSibling();
        #endregion

        legendPanel.SetActive(true);

        // Destroy it since it is no longer needed
        Destroy(referenceEarth);
    }
        internal static void SetPluginProperties(CORE.FileImporter fileImporter, IMeedioItem properties)
        {
            if (properties["ImporterSettings"] != null)
            {
                CustomProperty.SetProperties(properties, "ImporterSettings");
            }

            if ((properties["RootFolders2"] != null) && !(properties["RootFolders2"] is DBNull))
            {
                fileImporter.RootFolders = (string[]) properties["RootFolders2"];
                fileImporter.LogMessages.Enqueue(
                    new LogMessage("debug", "RootFolders: " + String.Join(Environment.NewLine, fileImporter.RootFolders)));
            }

            if ((properties["RootFolders"] != null) && !(properties["RootFolders"] is DBNull))
            {
                if (fileImporter.RootFolders == null)
                {
                    fileImporter.RootFolders = (string[]) properties["RootFolders"];
                    for (int rootFolderPos = 0; rootFolderPos < fileImporter.RootFolders.Length; rootFolderPos++)
                    {
                        fileImporter.RootFolders[rootFolderPos] = fileImporter.RootFolders[rootFolderPos].ToLowerInvariant();
                    }

                    fileImporter.LogMessages.Enqueue(
                        new LogMessage(
                            "debug", "RootFolders: " + String.Join(Environment.NewLine, fileImporter.RootFolders)));
                }
                else
                {
                    List<string> rootFoldersList = new List<string>(fileImporter.RootFolders);
                    rootFoldersList.AddRange((string[]) properties["RootFolders"]);
                    fileImporter.RootFolders =
                        new string[rootFoldersList.Select(rf => rf.ToLowerInvariant()).Distinct().Count()];
                    rootFoldersList.Select(rf => rf.ToLowerInvariant()).Distinct().ToArray().CopyTo(
                        fileImporter.RootFolders, 0);
                    fileImporter.LogMessages.Enqueue(
                        new LogMessage(
                            "debug", "RootFolders: " + String.Join(Environment.NewLine, fileImporter.RootFolders)));
                }
            }

            fileImporter.TagMasks = new List<TagMask>();
            if ((properties["TagMasks"] != null) && !(properties["TagMasks"] is DBNull))
            {
                fileImporter.TagMasksStrings = (string[]) properties["TagMasks"];
                fileImporter.LogMessages.Enqueue(new LogMessage("debug", "TagMasks:"));
                foreach (string tagMask in fileImporter.TagMasksStrings)
                {
                    fileImporter.TagMasks.Add(new TagMask(tagMask ?? String.Empty));
                    fileImporter.LogMessages.Enqueue(
                        new LogMessage("debug", "  Mask:  " + fileImporter.TagMasks[fileImporter.TagMasks.Count - 1].Mask));
                    fileImporter.LogMessages.Enqueue(
                        new LogMessage("debug", "  RegEx: " + fileImporter.TagMasks[fileImporter.TagMasks.Count - 1].RegExp));
                }
            }

            if ((properties["ChainFiles"] != null) && !(properties["ChainFiles"] is DBNull))
            {
                fileImporter.ChainFiles = (bool) properties["ChainFiles"];
            }

            if ((properties["ChainingOptions"] != null)
                && !(properties["ChainingOptions"] is DBNull))
            {
                fileImporter.ChainingOption = (ChainOption) Convert.ToInt32((string) properties["ChainingOptions"]);
            }

            if ((properties["ChainingTags"] != null)
                && !(properties["ChainingTags"] is DBNull))
            {
                fileImporter.TagsToChainBy = (string[]) properties["ChainingTags"];
            }

            if ((properties["DeleteNonExistentFiles"] != null)
                && !(properties["DeleteNonExistentFiles"] is DBNull))
            {
                fileImporter.DeleteNonExistentFiles = (bool) properties["DeleteNonExistentFiles"];
            }

            if ((properties["AlwaysUpdate"] != null)
                && !(properties["AlwaysUpdate"] is DBNull))
            {
                fileImporter.AlwaysUpdate = (bool) properties["AlwaysUpdate"];
            }

            fileImporter.TagValuesReplacementRules = new ReplacementRules(properties["TagValuesReplacement"] as string[]);

            if ((properties["IncludeFileMasks"] != null)
                && !(properties["IncludeFileMasks"] is DBNull))
            {
                fileImporter.IncludeFileMasks = (string) properties["IncludeFileMasks"];
            }

            if (String.IsNullOrEmpty(fileImporter.IncludeFileMasks))
            {
                fileImporter.IncludeFileMasks = "*.*";
            }

            if ((properties["ExcludeFileMasks"] != null)
                && !(properties["ExcludeFileMasks"] is DBNull))
            {
                fileImporter.ExcludeFileMasks = (string) properties["ExcludeFileMasks"];
            }

            if ((properties["IncludeHiddenFiles"] != null)
                && !(properties["IncludeHiddenFiles"] is DBNull))
            {
                fileImporter.IncludeHiddenFiles = (bool) properties["IncludeHiddenFiles"];
            }

            if ((properties["ExcludeUnmatchedFiles"] != null)
                && !(properties["ExcludeUnmatchedFiles"] is DBNull))
            {
                fileImporter.ExcludeUnmatchedFiles = (bool) properties["ExcludeUnmatchedFiles"];
            }

            if ((properties["MinFileSize"] != null)
                && !(properties["MinFileSize"] is DBNull))
            {
                fileImporter.MinFileSize = (int) properties["MinFileSize"];
            }

            fileImporter.ImageLinker.ImageSearches.Clear();

            var iso = new ImageSearchOptions();

            bool addThisImageSearch = false;

            if ((properties["ImageFileMasks"] != null)
                && !(properties["ImageFileMasks"] is DBNull))
            {
                var imageFileMasks
                    = (string) properties
                                   ["ImageFileMasks"];

                if (imageFileMasks.Contains(':'))
                {
                    iso.ImageFolderSearchPattern = imageFileMasks.Split(new[] {':'})[0];
                    iso.FileFolderSearchPattern = imageFileMasks.Split(new[] {':'})[1];
                }
                else
                {
                    iso.ImageFolderSearchPattern = imageFileMasks;
                    iso.FileFolderSearchPattern = imageFileMasks;
                }
            }

            if ((properties["ImageFolder"] != null) && !(properties["ImageFolder"] is DBNull))
            {
                iso.ImageFolder = (string) properties["ImageFolder"];
            }

            if ((properties["FileFolderImage"] != null) && !(properties["FileFolderImage"] is DBNull))
            {
                iso.SearchFileFolderOptions = (string) properties["FileFolderImage"];
                fileImporter.ImportImages = !String.IsNullOrEmpty(iso.ImageFolder) ||
                                            iso.SearchFileFolderOptions != "Never".Translate();
                addThisImageSearch = !String.IsNullOrEmpty(iso.ImageFolder) ||
                                     iso.SearchFileFolderOptions != "Never".Translate();
            }

            if ((properties["ImageCount"] != null) && !(properties["ImageCount"] is DBNull))
            {
                iso.MaxImages = (int) properties["ImageCount"];
            }

            if ((properties["ImageTagName"] != null) && !(properties["ImageTagName"] is DBNull))
            {
                iso.ImageTagName = (string) properties["ImageTagName"];
            }

            if ((properties["AlwaysUpdateImages"] != null) && !(properties["AlwaysUpdateImages"] is DBNull))
            {
                fileImporter.alwaysUpdateImages = (bool) properties["AlwaysUpdateImages"];
            }

            if ((properties["SaveInImageBaseTag"] != null) && !(properties["SaveInImageBaseTag"] is DBNull))
            {
                iso.SaveInImageBaseTag = (bool) properties["SaveInImageBaseTag"];
            }

            if (addThisImageSearch)
            {
                fileImporter.ImageLinker.ImageSearches.Add(iso);
            }

            bool doNextImageSearch = false;
            if ((properties["ImageSearchActive2"] != null) && !(properties["ImageSearchActive2"] is DBNull))
            {
                doNextImageSearch = (bool) properties["ImageSearchActive2"];
            }

            if (doNextImageSearch)
            {
                iso = new ImageSearchOptions();
                if ((properties["ImageFileMasks2"] != null) && !(properties["ImageFileMasks2"] is DBNull))
                {
                    string imageFileMasks = (string) properties["ImageFileMasks2"];
                    if (imageFileMasks.Contains(':'))
                    {
                        iso.ImageFolderSearchPattern = imageFileMasks.Split(new[] {':'})[0];
                        iso.FileFolderSearchPattern = imageFileMasks.Split(new[] {':'})[1];
                    }
                    else
                    {
                        iso.ImageFolderSearchPattern = imageFileMasks;
                        iso.FileFolderSearchPattern = imageFileMasks;
                    }
                }

                if ((properties["ImageFolder2"] != null) && !(properties["ImageFolder2"] is DBNull))
                {
                    iso.ImageFolder = (string) properties["ImageFolder2"];
                }

                if ((properties["FileFolderImage2"] != null) && !(properties["FileFolderImage2"] is DBNull))
                {
                    iso.SearchFileFolderOptions = (string) properties["FileFolderImage2"];
                    addThisImageSearch = !String.IsNullOrEmpty(iso.ImageFolder) ||
                                         iso.SearchFileFolderOptions != "Never".Translate();
                    fileImporter.ImportImages = fileImporter.ImportImages || addThisImageSearch;
                }

                if ((properties["ImageCount2"] != null) && !(properties["ImageCount2"] is DBNull))
                {
                    iso.MaxImages = (int) properties["ImageCount2"];
                }

                if ((properties["ImageTagName2"] != null) && !(properties["ImageTagName2"] is DBNull))
                {
                    iso.ImageTagName = (string) properties["ImageTagName2"];
                }

                if ((properties["SaveInImageBaseTag2"] != null) && !(properties["SaveInImageBaseTag2"] is DBNull))
                {
                    iso.SaveInImageBaseTag = (bool) properties["SaveInImageBaseTag2"];
                }

                if (addThisImageSearch)
                {
                    fileImporter.ImageLinker.ImageSearches.Add(iso);
                }
            }

            if ((properties["ImageSearchActive3"] != null) && !(properties["ImageSearchActive3"] is DBNull))
            {
                doNextImageSearch = (bool) properties["ImageSearchActive3"];
            }

            if (doNextImageSearch)
            {
                iso = new ImageSearchOptions();
                if ((properties["ImageFileMasks3"] != null) && !(properties["ImageFileMasks3"] is DBNull))
                {
                    string imageFileMasks = (string) properties["ImageFileMasks3"];
                    if (imageFileMasks.Contains(':'))
                    {
                        iso.ImageFolderSearchPattern = imageFileMasks.Split(new[] {':'})[0];
                        iso.FileFolderSearchPattern = imageFileMasks.Split(new[] {':'})[1];
                    }
                    else
                    {
                        iso.ImageFolderSearchPattern = imageFileMasks;
                        iso.FileFolderSearchPattern = imageFileMasks;
                    }
                }

                if ((properties["ImageFolder3"] != null) && !(properties["ImageFolder3"] is DBNull))
                {
                    iso.ImageFolder = (string) properties["ImageFolder3"];
                }

                if ((properties["FileFolderImage3"] != null) && !(properties["FileFolderImage3"] is DBNull))
                {
                    iso.SearchFileFolderOptions = (string) properties["FileFolderImage3"];
                    addThisImageSearch = fileImporter.ImportImages || !String.IsNullOrEmpty(iso.ImageFolder) ||
                                         iso.SearchFileFolderOptions != "Never".Translate();
                    fileImporter.ImportImages = fileImporter.ImportImages || addThisImageSearch;
                }

                if ((properties["ImageCount3"] != null) && !(properties["ImageCount3"] is DBNull))
                {
                    iso.MaxImages = (int) properties["ImageCount3"];
                }

                if ((properties["ImageTagName3"] != null) && !(properties["ImageTagName3"] is DBNull))
                {
                    iso.ImageTagName = (string) properties["ImageTagName3"];
                }

                if ((properties["SaveInImageBaseTag3"] != null) && !(properties["SaveInImageBaseTag3"] is DBNull))
                {
                    iso.SaveInImageBaseTag = (bool) properties["SaveInImageBaseTag3"];
                }

                if (addThisImageSearch)
                {
                    fileImporter.ImageLinker.ImageSearches.Add(iso);
                }
            }

            if ((properties["ImageSearchActive4"] != null) && !(properties["ImageSearchActive4"] is DBNull))
            {
                doNextImageSearch = (bool) properties["ImageSearchActive4"];
            }

            if (doNextImageSearch)
            {
                iso = new ImageSearchOptions();
                if ((properties["ImageFileMasks4"] != null) && !(properties["ImageFileMasks4"] is DBNull))
                {
                    string imageFileMasks = (string) properties["ImageFileMasks4"];
                    if (imageFileMasks.Contains(':'))
                    {
                        iso.ImageFolderSearchPattern = imageFileMasks.Split(new[] {':'})[0];
                        iso.FileFolderSearchPattern = imageFileMasks.Split(new[] {':'})[1];
                    }
                    else
                    {
                        iso.ImageFolderSearchPattern = imageFileMasks;
                        iso.FileFolderSearchPattern = imageFileMasks;
                    }
                }

                if ((properties["ImageFolder4"] != null) && !(properties["ImageFolder4"] is DBNull))
                {
                    iso.ImageFolder = (string) properties["ImageFolder4"];
                }

                if ((properties["FileFolderImage4"] != null) && !(properties["FileFolderImage4"] is DBNull))
                {
                    iso.SearchFileFolderOptions = (string) properties["FileFolderImage4"];
                    addThisImageSearch = fileImporter.ImportImages || !String.IsNullOrEmpty(iso.ImageFolder) ||
                                         iso.SearchFileFolderOptions != "Never".Translate();
                    fileImporter.ImportImages = fileImporter.ImportImages || addThisImageSearch;
                }

                if ((properties["ImageCount4"] != null) && !(properties["ImageCount4"] is DBNull))
                {
                    iso.MaxImages = (int) properties["ImageCount4"];
                }

                if ((properties["ImageTagName4"] != null) && !(properties["ImageTagName4"] is DBNull))
                {
                    iso.ImageTagName = (string) properties["ImageTagName4"];
                }

                if ((properties["SaveInImageBaseTag4"] != null) && !(properties["SaveInImageBaseTag4"] is DBNull))
                {
                    iso.SaveInImageBaseTag = (bool) properties["SaveInImageBaseTag4"];
                }

                if (addThisImageSearch)
                {
                    fileImporter.ImageLinker.ImageSearches.Add(iso);
                }
            }

            if ((properties["ImageSearchActive5"] != null) && !(properties["ImageSearchActive5"] is DBNull))
            {
                doNextImageSearch = (bool) properties["ImageSearchActive5"];
            }

            if (doNextImageSearch)
            {
                iso = new ImageSearchOptions();
                if ((properties["ImageFileMasks5"] != null) && !(properties["ImageFileMasks5"] is DBNull))
                {
                    string imageFileMasks = (string) properties["ImageFileMasks5"];
                    if (imageFileMasks.Contains(':'))
                    {
                        iso.ImageFolderSearchPattern = imageFileMasks.Split(new[] {':'})[0];
                        iso.FileFolderSearchPattern = imageFileMasks.Split(new[] {':'})[1];
                    }
                    else
                    {
                        iso.ImageFolderSearchPattern = imageFileMasks;
                        iso.FileFolderSearchPattern = imageFileMasks;
                    }
                }

                if ((properties["ImageFolder5"] != null) && !(properties["ImageFolder5"] is DBNull))
                {
                    iso.ImageFolder = (string) properties["ImageFolder5"];
                }

                if ((properties["FileFolderImage5"] != null) && !(properties["FileFolderImage5"] is DBNull))
                {
                    iso.SearchFileFolderOptions = (string) properties["FileFolderImage5"];
                    addThisImageSearch = fileImporter.ImportImages || !String.IsNullOrEmpty(iso.ImageFolder) ||
                                         iso.SearchFileFolderOptions != "Never".Translate();
                    fileImporter.ImportImages = fileImporter.ImportImages || addThisImageSearch;
                }

                if ((properties["ImageCount5"] != null) && !(properties["ImageCount5"] is DBNull))
                {
                    iso.MaxImages = (int) properties["ImageCount5"];
                }

                if ((properties["ImageTagName5"] != null) && !(properties["ImageTagName5"] is DBNull))
                {
                    iso.ImageTagName = (string) properties["ImageTagName5"];
                }

                if ((properties["SaveInImageBaseTag5"] != null) && !(properties["SaveInImageBaseTag5"] is DBNull))
                {
                    iso.SaveInImageBaseTag = (bool) properties["SaveInImageBaseTag5"];
                }

                if (addThisImageSearch)
                {
                    fileImporter.ImageLinker.ImageSearches.Add(iso);
                }
            }

            /*
                if (properties["FollowShortcuts"] != null)
                {
                    FollowShortcuts = (Boolean)properties["FollowShortcuts"];
                }
                */
            if ((properties["FileSizeTagName"] != null) && !(properties["FileSizeTagName"] is DBNull))
            {
                fileImporter.FileSizeTagName = (string) properties["FileSizeTagName"];
                fileImporter.FileSize = fileImporter.FileSizeTagName.Length > 0;
            }

            if ((properties["CreationDateTagName"] != null) && !(properties["CreationDateTagName"] is DBNull))
            {
                fileImporter.CreationDateTagName = (string) properties["CreationDateTagName"];
                fileImporter.CreationDate = fileImporter.CreationDateTagName.Length > 0;
            }

            if ((properties["LastModificationDateTagName"] != null) &&
                !(properties["LastModificationDateTagName"] is DBNull))
            {
                fileImporter.LastModificationDateTagName = (string) properties["LastModificationDateTagName"];
                fileImporter.LastModificationDate = fileImporter.LastModificationDateTagName.Length > 0;
            }

            if ((properties["LastAccessDateTagName"] != null) && !(properties["LastAccessDateTagName"] is DBNull))
            {
                fileImporter.LastAccessDateTagName = (string) properties["LastAccessDateTagName"];
                fileImporter.LastAccessDate = fileImporter.LastAccessDateTagName.Length > 0;
            }

            if ((properties["SerialNumberTagName"] != null) && !(properties["SerialNumberTagName"] is DBNull))
            {
                fileImporter.SerialNumberTagName = (string) properties["SerialNumberTagName"];
                fileImporter.SerialNumber = fileImporter.SerialNumberTagName.Length > 0;
            }

            /*
                if (properties["DiscIDTagName"] != null)
                {
                    DiscIDTagName = (string)properties["DiscIDTagName"];
                }
                */
            if ((properties["VolumeNameTagName"] != null) && !(properties["VolumeNameTagName"] is DBNull))
            {
                fileImporter.VolumeNameTagName = (string) properties["VolumeNameTagName"];
                fileImporter.VolumeName = fileImporter.VolumeNameTagName.Length > 0;
            }

            if ((properties["SingleFilename"] != null) && !(properties["SingleFilename"] is DBNull))
            {
                fileImporter.SingleFilename = (string) properties["SingleFilename"];
            }

            if (!String.IsNullOrEmpty(fileImporter.SingleFilename))
            {
                fileImporter.RootFolders = new[] {Path.GetDirectoryName(fileImporter.SingleFilename)};
                fileImporter.IncludeFileMasks = String.Empty;
                fileImporter.IncludeFileMasks = Path.GetFileName(fileImporter.SingleFilename);
            }

            if ((properties["ImportFromADS"] != null) && !(properties["ImportFromADS"] is DBNull))
            {
                fileImporter.ImportFromAlternateDataStream = (bool) properties["ImportFromADS"];
            }

            if ((properties["ExportToADS"] != null) && !(properties["ExportToADS"] is DBNull))
            {
                fileImporter.ExportToAlternateDataStream = (bool) properties["ExportToADS"];
            }

            if ((properties["DebugLevel"] != null) && !(properties["DebugLevel"] is DBNull))
            {
                fileImporter.DebugLevel = (string) properties["DebugLevel"];
            }
        }
Ejemplo n.º 21
0
    private IEnumerator LoadGPS()
    {
        if (!Input.location.isEnabledByUser)
        {
            Debug.Log("Location service is not enabled: Using default location - UK.");

            tempPinCoord.Add(CORE.ECEFCoordinateFromLatLong(CORE.USER_LATLONG, CORE.EARTH_PREFAB_RADIUS));
            LoadPredefinedPinLocation();
            GeneratePins();
            ComputeRotation();
            dataInitialised        = true;
            CORE.PIN_ASSIGNED_FLAG = true;
            yield break;
        }

        // Initialise location service
        Input.compass.enabled = true;
        Input.location.Start();

        int maxWait = 20;

        // Use default value if failed
        while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
        {
            yield return(new WaitForSeconds(1));

            maxWait--;
        }

        if (maxWait < 1)
        {
            Debug.Log("Timeout: Using default location - UK.");
            yield return(false);
        }

        if (Input.location.status == LocationServiceStatus.Failed)
        {
            Debug.Log("Unable to get location information: Using default location - UK.");
            yield return(false);
        }
        else
        {
            // Use values from the GPS
            CORE.USER_LATLONG = new Vector2(Input.location.lastData.latitude, Input.location.lastData.longitude);

            // Add current location to the list for futher computation
            tempPinCoord.Add(CORE.ECEFCoordinateFromLatLong(CORE.USER_LATLONG, CORE.EARTH_PREFAB_RADIUS));

            // Add featured location values to the list
            LoadPredefinedPinLocation();

            // Generate pins based on given values
            GeneratePins();

            // Compute the rotation required for rotating the current location to the top
            ComputeRotation();

            // Generate labels
            GenerateLabels();

            dataInitialised        = true;
            CORE.PIN_ASSIGNED_FLAG = true;
        }

        Input.location.Stop();

        yield return(null);
    }
        internal static void CreateLogConfig(CORE.FileImporter fileImporter,
            string logConfigFilename)
        {
            using (var logConfigWriter
                = new LogConfigWriter
                (
                FolderLocations.Logs
                +
                "FileImporter_"
                +
                fileImporter.Section.Name
                +
                "_"
                +
                fileImporter.ImportFunc
                .StartTime.ToString
                (CultureInfo.InvariantCulture)
                .Replace(':', ';')
                +
                ".log",
                logConfigFilename,
                Encoding.UTF8))
            {
                logConfigWriter.WriteStartElement("log4net");

                #if TRACE
                if (IsAttached)
                {
                    logConfigWriter.AddTraceAppender();
                }
                #endif

                if (fileImporter.DebugLevel != "Off")
                {
                    logConfigWriter.AddFileAppender();
                }

                logConfigWriter.WriteStartElement("root");
                logConfigWriter.WriteStartElement("level");
                logConfigWriter.WriteAttributeString("value", fileImporter.DebugLevel.ToUpper());
                logConfigWriter.WriteEndElement();

                #if TRACE
                if (IsAttached)
                {
                    logConfigWriter.WriteStartElement("appender-ref");
                    logConfigWriter.WriteAttributeString("ref", "Trace");
                    logConfigWriter.WriteEndElement();
                }
                #endif

                if (fileImporter.DebugLevel != "Off")
                {
                    logConfigWriter.WriteStartElement("appender-ref");
                    logConfigWriter.WriteAttributeString("ref", "File");
                    logConfigWriter.WriteEndElement();
                }

                logConfigWriter.WriteEndElement();
                logConfigWriter.WriteEndElement();
            }
        }