Пример #1
0
        public Form1()
        {
            programPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            InitializeComponent();
            ConsoleWindowHelper Console = new ConsoleWindowHelper(ConsoleWindow);

            try
            {
                tabControl1.Appearance = TabAppearance.Normal;
                MainMenu();
                SettingsMenu();

                string[] possibleConfig = Directory.GetFiles(Form1.programPath, "*config.json");
                if (possibleConfig.Length <= 0)
                {
                    tabControl1.SelectedTab = tabPage2;
                }
                else
                {
                    try
                    {
                        Config = JsonReader.ReadFromJson <ManagerConfig>(possibleConfig[0]);
                    }
                    catch (Exception ex)
                    {
                        ConsoleWindowHelper.Exception(ex.Message + " - " + ex.StackTrace);
                        throw new IOException("Something went wrong while reading the config.json file, try deleting it and running the program again");
                    }

                    ModsFolderTextBox.Text = Config.ModsFolder;
                    GameFolderTextBox.Text = Config.GameFolder;

                    ModDataHandler = new ModDataHandler(Config.GameFolder, Config.ModsFolder, Config.ModsFolder);
                    new ModEnableElement(panel1, ModDataHandler.ManifestDoLoader, ModDataHandler.DIMOWALoaderInstaller.IsLoaderInstalled);

                    allEnabledMods = ModDataHandler.ModEnabledList.ModList.ToList();
                    for (int i = 0; i < ModDataHandler.ManifestsDosMods.Length; i++)
                    {
                        var e = new ModEnableElement(panel1, ModDataHandler.ManifestsDosMods[i], allEnabledMods.IndexOf(ModDataHandler.ManifestsDosMods[i].FileName) > -1);
                        if (i == 0)
                        {
                            e.ChangeRow(75);
                        }
                        else
                        {
                            e.ChangeRow(ModEnableElement.ModEnableElements[i].GetRow() + 25);
                        }

                        if (!ModDataHandler.DIMOWALoaderInstaller.IsLoaderInstalled)
                        {
                            e.LockElement(Color.Gray);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ConsoleWindowHelper.FatalException("A Fatal Exception occured while starting the program: " + ex.Message + " check the Console Windows for more information.");
                ConsoleWindowHelper.Exception(string.Format("{0}: {1} {2}\nInner Exception Message: {3}", ex.Source, ex.Message, ex.StackTrace, ex.InnerException));
            }
        }
Пример #2
0
 public SyncScanService(IOptions <ManagerConfig> cfg, BlockSyncManager bsm)
 {
     _bsm = bsm;
     _cfg = cfg.Value;
 }
Пример #3
0
        /// <summary>
        ///  Gets called on a authenication request. This method should check sessions or simmilar to verify that the user has access to the backend.
        ///  This method should return true if the current request is authenicated or false if it's not.
        /// </summary>
        /// <param name="man">ManagerEngine reference that the plugin is assigned to.</param>
        /// <returns>true/false if the user is authenticated</returns>
        public override bool OnAuthenticate(ManagerEngine man)
        {
            HttpContext      context = HttpContext.Current;
            HttpSessionState session = context.Session;
            HttpRequest      request = context.Request;
            HttpResponse     response = context.Response;
            ManagerConfig    config = man.Config;
            string           dir, authURL, secretKey, rootPath, data, returnURL, prefix;

            // Get some config values
            authURL   = config["ExternalAuthenticator.external_auth_url"];
            secretKey = config["ExternalAuthenticator.secret_key"];
            prefix    = config["ExternalAuthenticator.session_prefix"];
            dir       = Path.GetFileName(Path.GetDirectoryName(request.FilePath));

            if (prefix == null)
            {
                prefix = "mcmanager_";
            }

            // Always load the language packs
            if (dir == "language")
            {
                return(true);
            }

            // Check already authenticated on rpc and stream
            if (dir == "rpc" || dir == "stream")
            {
                if (session[prefix + "_ExternalAuthenticator"] != null && ((string)session[prefix + "_ExternalAuthenticator"]) == "true")
                {
                    // Override config values
                    foreach (string key in session.Keys)
                    {
                        if (key.StartsWith(prefix + "_ExternalAuthenticator."))
                        {
                            config[key.Substring((prefix + "_ExternalAuthenticator.").Length)] = (string)session[key];
                        }
                    }

                    // Try create root path
                    rootPath = man.ToAbsPath(config["filesystem.rootpath"]);
                    if (!Directory.Exists(rootPath))
                    {
                        Directory.CreateDirectory(rootPath);
                    }

                    // Use root path as path
                    if (config["filesystem.path"] == "" || !PathUtils.IsChildPath(rootPath, config["filesystem.path"]))
                    {
                        config["filesystem.path"] = rootPath;
                    }

                    return(true);
                }
            }

            // Handle post
            if (request.Form["key"] != null)
            {
                data = "";
                foreach (string key in request.Form.Keys)
                {
                    if (key != "key")
                    {
                        data += request.Form[key];
                    }
                }

                // Check if keys match
                if (MD5(data + secretKey) == request.Form["key"])
                {
                    session[prefix + "_ExternalAuthenticator"] = "true";

                    // Store input data in session scope
                    foreach (string key in request.Form.Keys)
                    {
                        string ckey = key.Replace("__", ".");                         // Handle PHP escaped strings
                        session[prefix + "_ExternalAuthenticator." + ckey] = request.Form[key];
                    }

                    return(true);
                }
                else
                {
                    response.Write("Input data doesn't match verify that the secret keys are the same.");
                    response.End();
                    return(false);
                }
            }

            // Build return URL
            returnURL = request.Url.ToString();
            if (returnURL.IndexOf('?') != -1)
            {
                returnURL = returnURL.Substring(0, returnURL.IndexOf('?'));
            }
            returnURL += "?type=" + man.Prefix;

            // Force auth absolute
            authURL = new Uri(request.Url, authURL).ToString();

            // Handle rpc and stream requests
            if (dir == "rpc" || dir == "stream")
            {
                returnURL = new Uri(request.Url, PathUtils.ToUnixPath(Path.GetDirectoryName(Path.GetDirectoryName(request.FilePath)))).ToString() + "/default.aspx?type=" + man.Prefix;
                config["authenticator.login_page"] = authURL + "?return_url=" + context.Server.UrlEncode(returnURL);
                return(false);
            }

            response.Redirect(authURL + "?return_url=" + context.Server.UrlEncode(returnURL), true);
            return(false);
        }
Пример #4
0
 private void Awake()
 {
     config = FindObjectOfType <ManagerConfig>();
 }
 public PerformanceManager(IOptions <ManagerConfig> cfg)
 {
     _cfg = cfg.Value;
 }
Пример #6
0
 public ProcessesService(IOptions <ManagerConfig> cfg, ProcessManager pm)
 {
     _pm       = pm;
     _cfg      = cfg.Value;
     timestamp = DateTime.UtcNow;
 }
Пример #7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="columns"></param>
        /// <param name="header"></param>
        public ResultSet(string[] columns, NameObjectCollection header)
        {
            this.header = header;
            this.config = null;
            this.columns = new StringList();
            this.data = new ArrayListList();

            if (columns != null) {
                foreach (string col in columns)
                    this.columns.Add(col);
            }
        }
Пример #8
0
 public TestController(IOptions <ManagerConfig> cfg)
 {
     _cfg = cfg.Value;
 }
Пример #9
0
        public MainWindow()
        {
            InitializeComponent();

            HandlerHotkey handlerHotkey = new HandlerHotkey();

            mainHotkey = new MainHotkey(this);
            mainHotkey.KeyCollection = handlerHotkey.SetupHandlers();

            string ConfigPath = @"C:\Users\oleksandr.dubyna\Documents\GIT\SE\SeScreenWindowSetter\SeScreenWindowSetter\managerScreen.json";

            FillListOfProcess();

            List <Employee> li = new List <Employee>();

            li.Add(new Employee
            {
                Id     = 1,
                age    = 23,
                name   = "Ritesh",
                gender = "M"
            });
            li.Add(new Employee
            {
                Id     = 2,
                age    = 23,
                name   = "sujit",
                gender = "M"
            });
            li.Add(new Employee
            {
                Id     = 3,
                age    = 23,
                name   = "Kabir",
                gender = "F"
            });
            li.Add(new Employee
            {
                Id     = 4,
                age    = 3,
                name   = "mantu",
                gender = "F"
            });
            li.Add(new Employee
            {
                Id     = 5,
                age    = 24,
                name   = "Kamlesh",
                gender = "M"
            });
            li.Add(new Employee
            {
                Id     = 6,
                age    = 28,
                name   = "Manoj",
                gender = "M"
            });
            li.Add(new Employee
            {
                Id     = 6,
                age    = 28,
                name   = "xxxx",
                gender = "M"
            });
            var res  = li.ToLookup(x => x.age);
            var res1 = li.OrderBy(x => x.age);
            var t    = ManagerConfig.Init(ConfigPath).
                       Bind(SetupState.InitNew).
                       Bind(ManagerState.InitFromConfig).
                       Bind(ManagerState.InitFromScreens.Curry()(ManagerScreen.Init())).
                       Bind(ManagerState.InitFlatStructure).
                       Bind(ManagerState.InitFromWindowProcesses.Curry()(ProcessManager.GetAllProcesses())).
                       Bind(ManagerState.InitParts).
                       Bind(ManagerState.SetNewCoordinates).
                       Bind(ManagerWindow.SetWindowsPositions);
            //ManagerConfig.Init(ConfigPath).
            //    Bind(ManagerScreen.Init); List<DesktopWindowsCaption>


            //BridgeConfigAndScreenInfo.
            //    Init(SetupState.Init1, ManagerScreen.Init(), ManagerConfig.Init(ConfigPath)).
            //    Aggregate(new List<RectangleWithProcesses[,]>(), SetWindowsInPositionBlock.Init).
            //    PipeForward(ManagerWindow.SetWindowsPositionsFromConfig);
        }
Пример #10
0
 public DiskPerformanceService(IOptions <ManagerConfig> cfg, PerformanceManager pm)
 {
     _pm       = pm;
     _cfg      = cfg.Value;
     timestamp = DateTime.UtcNow;
 }
Пример #11
0
 // Use this for initialization
 void Start()
 {
     managerConfig = GetComponentInParent<ManagerConfig>();
 }
Пример #12
0
 public void Configure(ManagerConfig config)
 {
     _config   = config;
     _renderer = new Renderer(_config.UnsavedGraphFilesPath, config.PathToNodeExe, config.PathToMermaidJsFile);
 }
Пример #13
0
 public SyncService(IOptions <ManagerConfig> cfg, SyncManager sm)
 {
     _sm       = sm;
     _cfg      = cfg.Value;
     timestamp = DateTime.UtcNow;
 }
Пример #14
0
 public static void Register()
 {
     ManagerConfig.Initialize(Config);
 }
Пример #15
0
 public SyncManager(IOptions <ManagerConfig> cfg)
 {
     _cfg = cfg.Value;
 }