Beispiel #1
0
        static void Main()
        {
            Console.Title = "Starting login server, please wait...";
            CheckConfigurationFile();

            try
            {
                if (ServerCore.Utils.IsWindows)
                {
                    ServerKernel.ConfigReader = new IniFileName(Environment.CurrentDirectory + @"\Login.cfg");
                }
                else
                {
                    var     parser = new FileIniDataParser();
                    IniData data   = parser.ReadFile(Path.Combine(Environment.CurrentDirectory, "Login.cfg"));
                    ServerKernel.NewConfigReader = data;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            // load constants or create configuration file.

            // file handling

            Console.Title           = "[FoxConquer Project] Login Server";
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("\tFoxConquer Project: Conquer Online Private Server Emulator. 5517 Client Version.");
            Console.WriteLine("\t\tProject created by Felipe Vieira (FTW! Masters) and maintained by DaRkFoxDeveloper");
            Console.WriteLine("\t\tMay 01th, 2020 - All Rights Reserved\n");
            // Output the description of the server
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("The account server is designed to accept login data from the client and to\n"
                              + "verify that the username and password combination inputted is correct with the\n"
                              + "database. If the combination is correct, the client will be transferred to the\n"
                              + "message server of their choice. Please wait for the database to be initialized.\n");
            Console.WriteLine();
            Console.ForegroundColor = ConsoleColor.White;

            ServerKernel.Log.SaveLog("Computer Name: " + Environment.MachineName, true, "Login_Server", LogType.DEBUG);
            ServerKernel.Log.SaveLog("User Name: " + Environment.UserName, true, "Login_Server", LogType.DEBUG);
            ServerKernel.Log.SaveLog("System Directory: " + Environment.SystemDirectory, true, "Login_Server", LogType.DEBUG);
            ServerKernel.Log.SaveLog("Current Base Directory: " + Environment.CurrentDirectory, true, LogType.DEBUG);
            ServerKernel.Log.SaveLog("Some environment variables:", true, "Login_Server", LogType.DEBUG);
            ServerKernel.Log.SaveLog("OS=" + Environment.OSVersion, true, "Login_Server", LogType.DEBUG);
            ServerKernel.Log.SaveLog("NUMBER_OF_PROCESSORS: " + Environment.ProcessorCount, true, "Login_Server", LogType.DEBUG);
            ServerKernel.Log.SaveLog("PROCESSOR_ARCHITETURE: " + (Environment.Is64BitProcess ? "x64" : "x86"), true, "Login_Server", LogType.DEBUG);

            ServerKernel.Log.SaveLog("Initializing login server...", true, "Login_Server");

            ServerKernel.Log.SaveLog("Starting threads...", true, "Login_Server", LogType.DEBUG);
            ThreadHandling.StartThreading();
            ServerStartup();

            ServerKernel.ServerStartTime = DateTime.Now;
            ConsoleHandle();
        }
Beispiel #2
0
 private void WaitForAsync(Func <Task> asyncFunc) => ThreadHandling?.ExecuteSynchronously(asyncFunc);
Beispiel #3
0
 private T WaitForAsync <T>(Func <Task <T> > asyncFunc) => ThreadHandling != null?ThreadHandling.ExecuteSynchronously <T>(asyncFunc) : default(T);
Beispiel #4
0
        public void SetObjects(uint cObjects, object[] ppunk)
        {
            // If asked to, release our cached selected Project object(s)
            UnconfiguredProject  = null;
            ConfiguredProperties = null;

            if (cObjects == 0)
            {
                // If we have never configured anything (maybe a failure occurred
                // on open so app designer is closing us). In this case do nothing.
                if (ThreadHandling != null)
                {
                    SetObjects(true);
                }
                return;
            }

            if (ppunk.Length < cObjects)
            {
                throw new ArgumentOutOfRangeException(nameof(cObjects));
            }

            var configuredProjectsProperties = new List <ProjectProperties>();

            // Look for an IVsBrowseObject
            for (int i = 0; i < cObjects; ++i)
            {
                var browseObj = ppunk[i] as IVsBrowseObject;
                if (browseObj != null)
                {
                    IVsHierarchy hier = null;
                    uint         itemid;
                    int          hr;
                    hr = browseObj.GetProjectItem(out hier, out itemid);
                    Debug.Assert(itemid == VSConstants.VSITEMID_ROOT, "Selected object should be project root node");

                    if (hr == VSConstants.S_OK && itemid == VSConstants.VSITEMID_ROOT)
                    {
                        UnconfiguredProject = hier.GetUnconfiguredProject();
                        // We need to save ThreadHandling because the app designer will call SetObjects with null, and then call
                        // Deactivate(). We need to run async code during Deactivate() which requires ThreadHandling.
                        ThreadHandling = UnconfiguredProject.Services.ExportProvider.GetExportedValue <IThreadHandling>();

                        var pcg = ppunk[i] as IVsProjectCfg2;
                        if (pcg != null)
                        {
                            string vsConfigName;
                            pcg.get_CanonicalName(out vsConfigName);

                            ThreadHandling.ExecuteSynchronously(async delegate {
                                var provider            = new ConfiguredRProjectExportProvider();
                                var configuredProjProps = await provider.GetExportAsync <ProjectProperties>(UnconfiguredProject, vsConfigName);
                                configuredProjectsProperties.Add(configuredProjProps);
                            });
                        }
                    }
                }
                ConfiguredProperties = configuredProjectsProperties.ToArray();
            }
            SetObjects(false);
        }
Beispiel #5
0
 private void WaitForAsync(Func <Task> asyncFunc)
 {
     Debug.Assert(ThreadHandling != null);
     ThreadHandling.ExecuteSynchronously(asyncFunc);
 }
Beispiel #6
0
 private T WaitForAsync <T>(Func <Task <T> > asyncFunc)
 {
     Debug.Assert(ThreadHandling != null);
     return(ThreadHandling.ExecuteSynchronously <T>(asyncFunc));
 }