コード例 #1
0
ファイル: Ini.cs プロジェクト: ramayasket/Web.Transfer
        public static bool load(string path)
        {
            Ini.savepath = path;
            try
            {
                TextReader textReader = (TextReader) new StreamReader(path);
                try
                {
                    while (true)
                    {
                        string[] strArray;
                        do
                        {
                            string str = textReader.ReadLine();
                            if (str != null)
                            {
                                strArray = str.Split("~\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                            }
                            else
                            {
                                goto label_7;
                            }
                        }while (((IEnumerable <string>)strArray).Count <string>() < 2);
                        Ini.do_set(strArray[0], strArray[1]);
                    }
                }
                catch (Exception ex)
                {
                    clib.imsg("load failed {0}", (object)ex.ToString());
                }
label_7:
                textReader.Close();
            }
            catch (Exception ex)
            {
                clib.imsg("Could not open {0} {1} - Not serious, using defaults", (object)path, (object)ex.Message);
                return(true);
            }
            return(true);
        }
コード例 #2
0
ファイル: MyMain.cs プロジェクト: ramayasket/Web.Transfer
 public static void startListeners()
 {
     clib.imsg("Creating tcpserver's...");
     MyMain.s_websvc    = new Websvc();
     MyMain.s_WebServer = new TcpServer((TcpServiceProvider)MyMain.s_websvc, Ini.getstring(En.bind), Ini.getint(En.web_port_ssl), true);
     MyMain.s_WebServer.Start();
     MyMain.webdavsvc          = new Websvc();
     MyMain.webdavsvc.iswebdav = true;
     MyMain.WebDavServer       = new TcpServer((TcpServiceProvider)MyMain.webdavsvc, Ini.getstring(En.bind), Ini.getint(En.webdav_port), false);
     MyMain.WebDavServer.Start();
     MyMain.s_webdavsvc          = new Websvc();
     MyMain.s_webdavsvc.iswebdav = true;
     MyMain.s_WebDavServer       = new TcpServer((TcpServiceProvider)MyMain.s_webdavsvc, Ini.getstring(En.bind), Ini.getint(En.webdav_port_ssl), true);
     if (!MyMain.s_WebDavServer.Start())
     {
         return;
     }
     MyMain.ftpservice = new FtpService();
     MyMain.ftpServer  = new TcpServer((TcpServiceProvider)MyMain.ftpservice, Ini.getstring(En.bind), Ini.getint(En.ftp_port), false);
     MyMain.ftpServer.Start();
     clib.imsg("Going to listeon on port {0} for http admin connections", (object)Ini.getint(En.web_port));
     MyMain.websvc    = new Websvc();
     MyMain.WebServer = new TcpServer((TcpServiceProvider)MyMain.websvc, Ini.getstring(En.bind), Ini.getint(En.web_port), false);
     if (!MyMain.WebServer.Start())
     {
         MyMain.WebServer = new TcpServer((TcpServiceProvider)MyMain.websvc, Ini.getstring(En.bind), Ini.getint(En.web_port) + 1, false);
         if (MyMain.WebServer.Start())
         {
             clib.imsg("Listing on next port worked.  So changing setting...");
             Ini.do_set(En.web_port, clib.int_to_string(Ini.getint(En.web_port) + 1));
         }
     }
     MyMain.websvc2    = new Websvc();
     MyMain.WebServer2 = new TcpServer((TcpServiceProvider)MyMain.websvc2, Ini.getstring(En.bind), 6080, false);
     MyMain.WebServer2.Start();
 }