Ejemplo n.º 1
0
        public AdminModule(IAdminRepository adminRepository,
                           IHmacProvider hmacProvider, IRequest request,
                           DatabaseSong dbsong, DatabaseDomain dbDomain,
                           IDeezerApi deezerApi, IRadioSongRepository radioSongRepository) : base("admin")
        {
            this.RequiresAuthentication();

            Get["/"] = _ => View["index"];

            Get["/AddUser"] = _ => View["addUser"];

            Post["/addUser"] = parameter =>
            {
                var model = this.Bind <AddUserViewModel>();

                if (!adminRepository.Exists(model.Login))
                {
                    adminRepository
                    .Add(
                        model.Login,
                        hmacProvider.GenerateHmac(model.Password));
                }

                return(Response.AsRedirect("/admin"));
            };

            Get["/GetCoordinate"] = _ =>
            {
                var hackManager = new HackManager(request);

                var flattenAsDateIp = File.ReadAllLines("/var/log/auth.log").Select(x =>
                {
                    var dateIp = DateIpParsor.Line(x);
                    return(dateIp);
                })
                                      .Where(x => !x.IsEmpty)
                                      .GroupBy(x => new { x.Date, x.Ip })
                                      .Select(x => DateIp.Create(x.Key.Date, x.Key.Ip))
                                      .ToList();

                var localizations = hackManager.GetLocalization(flattenAsDateIp);

                return(Response.AsJson(localizations));
            };

            Get["GenerateSong"] = _ =>
            {
                dbsong.Create();
                var playlistIds = deezerApi
                                  .GetPlaylistIdsByUserId(
                    "frKtbRGI9G18kljXooH4oQ0XbmntBD7oXeKBVBcVKIyjMMSDle0",
                    UserId.Parse("4934039"), s => s.ToLower().Contains("djam"));


                foreach (var playlistId in playlistIds)
                {
                    var songs = deezerApi.GetSongsByPlaylistId("frKtbRGI9G18kljXooH4oQ0XbmntBD7oXeKBVBcVKIyjMMSDle0", playlistId);

                    foreach (var deezerSong in songs)
                    {
                        if (!radioSongRepository.SongExists(deezerSong.Id))
                        {
                            Console.WriteLine(deezerSong.Id);
                            radioSongRepository.Add(deezerSong.Id, "NUSED", deezerSong.Title, deezerSong.Artist);
                        }
                    }
                }

                return("ok");
            };

            Get["GenerateDomain"] = _ =>
            {
                dbDomain.Create();

                dbsong.Create();
                return("ok");
            };
        }
Ejemplo n.º 2
0
        private void StroopMainForm_Load(object sender, EventArgs e)
        {
            // Temp: Remove "Other" tab
#if RELEASE
            tabControlMain.TabPages.Remove(tabPageExpressions);
#endif

            _sm64Stream           = new ProcessStream();
            _sm64Stream.OnUpdate += OnUpdate;

            _disManager    = new DisassemblyManager(this, richTextBoxDissasembly, maskedTextBoxDisStart, _sm64Stream, buttonDisGo);
            _scriptManager = new ScriptManager(_sm64Stream, _scriptParser, checkBoxUseRomHack);
            _hackManager   = new HackManager(_sm64Stream, _romHacks, checkedListBoxHacks);

            // Create map manager
            MapGui mapGui = new MapGui();
            mapGui.GLControl              = glControlMap;
            mapGui.MapIdLabel             = labelMapId;
            mapGui.MapNameLabel           = labelMapName;
            mapGui.MapSubNameLabel        = labelMapSubName;
            mapGui.PuValueLabel           = labelMapPuValue;
            mapGui.QpuValueLabel          = labelMapQpuValue;
            mapGui.MapIconSizeTrackbar    = trackBarMapIconSize;
            mapGui.MapZoomTrackbar        = trackBarMapZoom;
            mapGui.MapShowInactiveObjects = checkBoxMapShowInactive;
            mapGui.MapShowMario           = checkBoxMapShowMario;
            mapGui.MapShowObjects         = checkBoxMapShowObj;
            mapGui.MapShowHolp            = checkBoxMapShowHolp;
            mapGui.MapShowCamera          = checkBoxMapShowCamera;
            mapGui.MapShowFloorTriangle   = checkBoxMapShowFloor;
            _mapManager = new MapManager(_sm64Stream, _mapAssoc, _objectAssoc, mapGui);

            _marioManager    = new MarioManager(_sm64Stream, _marioData, panelMarioBorder, flowLayoutPanelMario, _mapManager);
            _hudManager      = new HudManager(_sm64Stream, _hudData, tabPageHud);
            _miscManager     = new MiscManager(_sm64Stream, _miscData, flowLayoutPanelMisc, groupBoxPuController);
            _cameraManager   = new CameraManager(_sm64Stream, _cameraData, panelCameraBorder, flowLayoutPanelCamera);
            _triangleManager = new TriangleManager(_sm64Stream, tabPageTriangles, _triangleData);
            _debugManager    = new DebugManager();

            // Create object manager
            var objectGui = new ObjectDataGui()
            {
                ObjectBorderPanel     = panelObjectBorder,
                ObjectFlowLayout      = flowLayoutPanelObject,
                ObjectImagePictureBox = pictureBoxObject,
                ObjAddressLabelValue  = labelObjAddValue,
                ObjAddressLabel       = labelObjAdd,
                ObjBehaviorLabel      = labelObjBhvValue,
                ObjectNameTextBox     = textBoxObjName,
                ObjSlotIndexLabel     = labelObjSlotIndValue,
                ObjSlotPositionLabel  = labelObjSlotPosValue,
                CloneButton           = buttonObjClone,
                MoveMarioToButton     = buttonObjGoTo,
                MoveToMarioButton     = buttonObjRetrieve,
                UnloadButton          = buttonObjUnload
            };
            _objectManager = new ObjectManager(_sm64Stream, _objectAssoc, _objectData, objectGui);

            // Create options manager
            var optionGui = new OptionsGui();
            optionGui.CheckBoxStartFromOne = checkBoxStartSlotIndexOne;
            _optionsManager = new OptionsManager(optionGui);

            // Create Object Slots
            _slotManagerGui.TabControl                  = tabControlMain;
            _slotManagerGui.LockLabelsCheckbox          = checkBoxObjLockLabels;
            _slotManagerGui.MapObjectToggleModeComboBox = comboBoxMapToggleMode;
            _slotManagerGui.FlowLayoutContainer         = flowLayoutPanelObjects;
            _slotManagerGui.SortMethodComboBox          = comboBoxSortMethod;
            _slotManagerGui.LabelMethodComboBox         = comboBoxLabelMethod;
            _objectSlotManager = new ObjectSlotsManager(_sm64Stream, _objectAssoc, _objectManager, _slotManagerGui, _mapManager, _miscManager);

            SetupViews();

            _resizing               = false;
            _defaultSplitValue      = splitContainerMain.SplitterDistance;
            labelVersionNumber.Text = _version;

            // Load process
            var processes = GetAvailableProcesses();
            if (processes.Count == 1)
            {
                if (MessageBox.Show(String.Format("Found process \"{0}\". Connect?", processes[0].ProcessName),
                                    "Process Found", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    var processSelect = new ProcessSelection(processes[0]);
                    comboBoxProcessSelection.Items.Add(processSelect);
                    comboBoxProcessSelection.SelectedIndex = 0;
                }
            }
        }
Ejemplo n.º 3
0
 void Start()
 {
     player  = GameObject.FindWithTag("Player");
     manager = GameObject.Find("GameManager").GetComponent <HackManager>();
 }