예제 #1
0
 public RequestMaker()
 {
     sec       = new NetworkSecurity();
     usernames = new string[10001];
     passwords = new string[10001];
     InitUsers();
 }
        protected override void OnStart(string[] args)
        {
            try
            {
                Thread.CurrentPrincipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());

                ServiceController serviceController_obj = new ServiceController("YakSys RCT Server");

                if (!File.Exists(Application.StartupPath + "\\YakSysRctServerLib.dll"))
                {
                    try
                    {
                        MessageBox.Show(null, ServerStringFactory.GetString(36, ServerSettingsEnvironment.CurrentLanguage), ServerStringFactory.GetString(37, ServerSettingsEnvironment.CurrentLanguage), MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1);

                        serviceController_obj.Refresh();

                        serviceController_obj.Stop();
                    }
                    catch
                    {
                    }

                    return;
                }

                new Thread(new ThreadStart(WatchProcWindowModule)).Start();

                YakSys.XMLConfigImporter.YakSysServerDBEnvironment.LoadXMLDataFile(Application.StartupPath + "\\YakSysServerDB", false);

                NetworkSecurity.LoadSecurityDB(new YakSysServerDBEnvironment().GetSecurityDataBase());

                NetworkSecurity.LoadAccessRestrictionRulesDB(new YakSysServerDBEnvironment().GetAccessRestrictionRules());

                NETRemotingInteractionLayer.StartNETRemotingHost(5550);

                NetworkStatusAndStatistics.ServerStatus = ServerStringFactory.GetString(7, ServerSettingsEnvironment.CurrentLanguage);

                if (ServerSettingsEnvironment.StartServerAtRun == true)
                {
                    if (NetworkSecurity.UserAccount.UsersAccounts.Count == 0)
                    {
                        MessageBox.Show(ServerStringFactory.GetString(69, ServerSettingsEnvironment.CurrentLanguage), ServerStringFactory.GetString(1, ServerSettingsEnvironment.CurrentLanguage), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        try
                        {
                            obj_NetworkAction.StartServer(ServerSettingsEnvironment.ServerPort);//IPC call
                        }
                        catch { }
                        string string_ConnectingServiceHost = CSP.ConnectingServiceProvider.GetCommonCSPIPString();
                    }
                }
            }
            catch (Exception e)
            {
                // MessageBox.Show("Starting YakSys Server Service failed");
            }
        }
예제 #3
0
// END CUT HERE
// BEGIN CUT HERE
    public static void Main()
    {
        try {
            NetworkSecurity ___test = new NetworkSecurity();
            ___test.run_test(-1);
        } catch (Exception e) {
//Console.WriteLine(e.StackTrace);
            Console.WriteLine(e.ToString());
        }
    }