internal ClientContext(ISerializationService serializationService, IClientClusterService clusterService,
     IClientPartitionService partitionService, IClientInvocationService invocationService,
     IClientExecutionService executionService, IClientListenerService listenerService, ProxyManager proxyManager, ClientConfig clientConfig)
 {
     this.serializationService = serializationService;
     this.clusterService = clusterService;
     this.partitionService = partitionService;
     this.invocationService = invocationService;
     this.executionService = executionService;
     this.listenerService = listenerService;
     this.proxyManager = proxyManager;
     this.clientConfig = clientConfig;
 }
 internal ClientContext(ISerializationService serializationService, IClientClusterService clusterService,
     IClientPartitionService partitionService, IClientInvocationService invocationService,
     IClientExecutionService executionService, IClientListenerService listenerService, ProxyManager proxyManager,
     ClientConfig clientConfig)
 {
     _serializationService = serializationService;
     _clusterService = clusterService;
     _partitionService = partitionService;
     _invocationService = invocationService;
     _executionService = executionService;
     _listenerService = listenerService;
     _proxyManager = proxyManager;
     _clientConfig = clientConfig;
 }
Example #3
0
        public TResponse Invoke <TDefinitionResponse, TResponse>(Func <TService, TDefinitionResponse> method)
        {
            TResponse response = default(TResponse);

            XmlRpcResponseEventHandler responseHandler = (sender, args) =>
            {
                var            deserializer = new XmlRpcResponseDeserializer();
                XmlRpcResponse res          = deserializer.DeserializeResponse(args.ResponseStream, typeof(TResponse));
                response = (TResponse)res.retVal;
            };

            using (ProxyManager <TService> manager = CreateProxyManager(responseHandler))
            {
                method(manager);
            }

            return(response);
        }
Example #4
0
        public void SetClientPrivacy(ClientPrivacy privacy, string proxy = "", ProxyType proxyType = ProxyType.HTTPS)
        {
            string lol = "0";

            if (privacy == ClientPrivacy.GoodFriends)
            {
                lol = "1";
            }
            else if (privacy == ClientPrivacy.ScanEverything)
            {
                lol = "2";
            }
            HttpRequest req = new HttpRequest();

            req.AddHeader("Authorization", token);
            ProxyManager.SimpleChange(req, proxy, proxyType);
            req.Patch($"https://discordapp.com/api/v6/users/@me/settings", "{\"explicit_content_filter\":" + $"\"{lol}\"" + "}", "application/json");
        }
        public void PMFindProxyMethodRequiringDynamicAssemblyResolution()
        {
            // Exercise the need of the proxy manager to
            // resolve assembly loads, by using assemblies that are not in the normal search path
            // as they are in a completely different folder.
            string tempDir = TestHelper.CopyComplexSampleToTempFolder();

            string        path           = tempDir + @"\Microsoft.Sample.WCF.Client.exe";
            List <string> assembliesColl = new List <string>();

            ScenarioRunManager.GetReferencedAssemblies(path, assembliesColl);
            this.assemblies = new string[assembliesColl.Count];
            assembliesColl.CopyTo(this.assemblies, 0);
            ProxyManager pm             = new ProxyManager(this.assemblies);
            MethodInfo   contractMethod = pm.GetContractMethod("http://microsoft.com/sample/wcf/ISampleService/Logon");

            pm.GetProxyMethod(contractMethod);
        }
        protected override void MyUsed(ProxyManager ma, dynamic options)
        {
            var typename = "";

            if (ComFunc.nvl(options.RestAPIModuleName) != "")
            {
                typename = ComFunc.nvl(options.RestAPIModuleName);
            }
            else
            {
                typename = "EWRA";
            }

            GlobalCommon.Logger.WriteLog(LoggerLevel.INFO,
                                         string.Format("RestAPI的运行模块为{0},如要调整,请在ProxyManager.UseProxy中的options参数设定RestAPIModuleName的值", typename));

            if (typename == "EWRA")
            {
                moduletype = typeof(EWRAGo);
            }
            else
            {
                var t = Assembly.GetEntryAssembly().GetType(typename);
                if (t == null)
                {
                    GlobalCommon.Logger.WriteLog(LoggerLevel.WARN,
                                                 string.Format("警告:名称为{0}的RestAPI模块未找到,系统使用默认EWRA处理模块进行替代,如要调整,请确保在ProxyManager.UseProxy中的options.RestAPIModuleName的值为FullName,并且该类型已引用", typename));
                    moduletype = typeof(EWRAGo);
                }
                else
                {
                    if (t.GetTypeInfo().IsSubclassOf(typeof(EWRAGo)))
                    {
                        moduletype = t;
                    }
                    else
                    {
                        GlobalCommon.Logger.WriteLog(LoggerLevel.WARN,
                                                     string.Format("警告:名称为{0}的模块不是EWRA类型的处理模块,系统使用默认RestAPI处理模块进行替代,如要调整,请确保在定义模块时继承EWRAGo", typename));
                        moduletype = typeof(EWRAGo);
                    }
                }
            }
        }
        protected override void MyUsed(ProxyManager ma, dynamic options)
        {
            var TypeName_WeixinModule = "";

            if (ComFunc.nvl(options.WeixinModuleName) != "")
            {
                TypeName_WeixinModule = ComFunc.nvl(options.WeixinModuleName);
            }
            else
            {
                TypeName_WeixinModule = "WeixinWebGo";
            }

            GlobalCommon.Logger.WriteLog(LoggerLevel.INFO,
                                         string.Format("{1}的运行模块为{0},如要调整,请在ProxyManager.UseProxy中的options参数设定WeixinModuleName的值", TypeName_WeixinModule, this.GetType().Name));

            if (TypeName_WeixinModule == "WeixinWebGo")
            {
                moduletype = typeof(WeixinWebGo);
            }
            else
            {
                var t = Assembly.GetEntryAssembly().GetType(TypeName_WeixinModule);
                if (t == null)
                {
                    GlobalCommon.Logger.WriteLog(LoggerLevel.WARN,
                                                 string.Format("警告:名称为{0}的微信Web模块未找到,系统使用默认微信Web处理模块进行替代,如要调整,请确保在ProxyManager.UseProxy中的options.WeixinModuleName的值为FullName,并且该类型已引用", TypeName_WeixinModule));
                    moduletype = typeof(WeixinWebGo);
                }
                else
                {
                    if (t.GetTypeInfo().IsSubclassOf(typeof(WeixinWebGo)))
                    {
                        moduletype = t;
                    }
                    else
                    {
                        GlobalCommon.Logger.WriteLog(LoggerLevel.WARN,
                                                     string.Format("警告:名称为{0}的微信Web模块不是微信Web的处理模块,系统使用默认微信Web处理模块进行替代,如要调整,请确保在定义模块时继承WeixinWebGo", TypeName_WeixinModule));
                        moduletype = typeof(WeixinWebGo);
                    }
                }
            }
        }
 protected override void OnLoadAssembly(ProxyManager ma, dynamic options, List <Type> logics)
 {
     foreach (Type t in logics)
     {
         var entity = new LogicEntity(t);
         var lkey   = entity.LogicName.ToUpper();
         if (!_logics.ContainsKey(lkey))
         {
             _logics.Add(lkey, entity);
         }
         else
         {
             if (_logics.ContainsKey(lkey))
             {
                 throw new DuplicateLogicException("Duplicate Logic's Name,please make sure Logic:[" + entity.LogicName + "] unique!");
             }
         }
     }
 }
Example #9
0
 public static bool IsTokenValid(string token, string proxy = "", ProxyType proxyType = ProxyType.HTTPS)
 {
     if (token.Length != 59 && token.Length != 88)
     {
         return(false);
     }
     try
     {
         HttpRequest req = new HttpRequest();
         req.AddHeader("Authorization", token);
         ProxyManager.SimpleChange(req, proxy, proxyType);
         req.Get("https://discord.com/api/v6/users/@me/library");
         return(true);
     }
     catch (TokenNotValidException ex)
     {
         return(false);
     }
 }
Example #10
0
        public List <DiscordGuild> GetGuilds(string proxy = "", ProxyType proxyType = ProxyType.HTTPS)
        {
            List <DiscordGuild> guilds = new List <DiscordGuild>();
            HttpRequest         req    = new HttpRequest();

            req.AddHeader("Authorization", token);
            ProxyManager.SimpleChange(req, proxy, proxyType);
            string lol = req.Get($"https://discordapp.com/api/v6/users/@me/guilds").ToString();

            string[] splitter = Strings.Split(lol, @"""id"": ");
            for (int i = 0; i < splitter.Length; i++)
            {
                if (i != 0)
                {
                    guilds.Add(new DiscordGuild(ulong.Parse(splitter[i].Substring(0, 20).Replace(@"""", "")), token));
                }
            }
            return(guilds);
        }
Example #11
0
        public void DeserializeSampleExplicitInterfaceImplementation()
        {
            string[] allSoapActions = new string[] { "http://tempuri.org/ICustomContracts/Hidden" };
            using (Parser p = TestHelper.CreateWcfParserFromFile("ExplicitInterface.svclog", true, false, SoapActionMode.Include, allSoapActions))
            {
                ProxyManager        pm = new ProxyManager("ClientProxies.Custom.dll", "Contracts.Custom.dll");
                Deserializer        d  = new Deserializer();
                ParsedMessage       parsedMessage;
                CallParameterInfo[] parameters;
                MethodInfo          mi;

                parsedMessage = p.ReadNextRequest();
                mi            = pm.GetContractMethod(parsedMessage.SoapAction);
                Assert.AreEqual <string>("Hidden", mi.Name);
                parameters = d.DeserializeInputParameters(parsedMessage.Message, mi);
                Assert.AreEqual <int>(1, parameters.Length);
                this.ValidateNonNullInputParameter <string>(parameters[0], "a");
            }
        }
Example #12
0
        private HazelcastClient(ClientConfig config)
        {
            _config = config;
            var groupConfig = config.GetGroupConfig();

            _instanceName = "hz.client_" + _id + (groupConfig != null ? "_" + groupConfig.GetName() : string.Empty);

            _lifecycleService = new LifecycleService(this);
            try
            {
                //TODO make partition strategy parametric
                var partitioningStrategy = new DefaultPartitioningStrategy();
                _serializationService =
                    new SerializationServiceBuilder().SetManagedContext(new HazelcastClientManagedContext(this,
                                                                                                          config.GetManagedContext()))
                    .SetConfig(config.GetSerializationConfig())
                    .SetPartitioningStrategy(partitioningStrategy)
                    .SetVersion(SerializationService.SerializerVersion)
                    .Build();
            }
            catch (Exception e)
            {
                throw ExceptionUtil.Rethrow(e);
            }
            _proxyManager = new ProxyManager(this);

            //TODO EXECUTION SERVICE
            _executionService = new ClientExecutionService(_instanceName, config.GetExecutorPoolSize());
            _clusterService   = new ClientClusterService(this);
            _loadBalancer     = config.GetLoadBalancer() ?? new RoundRobinLB();

            _addressProvider          = new AddressProvider(_config);
            _connectionManager        = new ClientConnectionManager(this);
            _invocationService        = CreateInvocationService();
            _listenerService          = new ClientListenerService(this);
            _userContext              = new ConcurrentDictionary <string, object>();
            _partitionService         = new ClientPartitionService(this);
            _lockReferenceIdGenerator = new ClientLockReferenceIdGenerator();
            _statistics         = new Statistics(this);
            _nearCacheManager   = new NearCacheManager(this);
            _credentialsFactory = InitCredentialsFactory(config);
        }
Example #13
0
        private void SetRamblerWordsWeight()
        {
            ProxyManager pm = new ProxyManager();

            string errorPattern = "<td class=\"error\">[^</td>]*</td></td>";
            Regex  rx           = new Regex(errorPattern);

            string req = GetRamblerAdStatReq();

            Uri           ramblerUri = new Uri(req);
            DownloaderObj obj        = new DownloaderObj(ramblerUri, null, true);

            Downloader.DownloadSync(obj);
            if (obj.DataStr == null)
            {
                return;
            }

            while (rx.IsMatch(obj.DataStr)) //write another method.....
            {
                //content = Content.DownloadString(req, pm.GetProxy());
            }

            if (!rx.IsMatch(obj.DataStr))
            {
                foreach (string[] theme in allThemes)
                {
                    string pattern = @"<tr>\s*<tr>\s*<td class=hd_gray><a href=[^>]*>" +
                                     theme[0] +
                                     @"</a>[^<]</td>\s*<td class=hd_gray[^>]*>([^<]*)</td>\s*" +
                                     @"<td class=hd_gray[^>]*>[^<]*</td>\s*</tr>";

                    theme[2] = (Int32.Parse(new Regex(pattern).Match(obj.DataStr).Groups[1].Value.Replace("&nbsp;", "")) + Int32.Parse(theme[2])).ToString();
                }
            }
            else
            {
                //parse new proxies, and rerun method();
                //ProxyManager.
                GlobalLog.Write("Expired proxyes on SetRamblerWordsWeight() method, need to rerun method or get fresh proxies");
            }
        }
Example #14
0
        private void RunInternal()
        {
            Config.Load();
            _configDialog = new ConfigDialog(this);
            var form = Config.Shape.StartsWith("横長") ? (Form) new HorizontalMainForm() : new VerticalMainForm();

            _form         = form;
            _mainBehavior = new MainWindow(this, form);
            _proxyManager = new ProxyManager(_form, Config);
            _proxyManager.UpdatePacFile();
            _errorLog = new ErrorLog(Sniffer);
            Sniffer.RepeatingTimerController = _mainBehavior.Notifier;
            LoadData();
            ApplyConfig();
            ApplySettings();
            HttpProxy.AfterSessionComplete += HttpProxy_AfterSessionComplete;
            _mainTimer.Tick += TimerTick;
            Application.Run(_form);
            Terminate();
        }
Example #15
0
        private void GetItemClones([NotNull] Item item, [NotNull] List <Item> clones)
        {
            var realItem = ProxyManager.GetRealItem(item, false);

            var links = Globals.LinkDatabase.GetReferrers(realItem);

            foreach (var link in links)
            {
                if (link.SourceFieldID != FieldIDs.Source)
                {
                    continue;
                }

                var clone = link.GetSourceItem();
                if (clone != null)
                {
                    clones.Add(clone);
                }
            }
        }
Example #16
0
        /// <summary>
        ///
        /// </summary>
        protected void WriteContatoreStampeEffettuate() //se la stampa multipla è abilitata allora gestisco l'aggiornamento del contatore prints_num
        {
            string abilita_multi_stampa_etichetta = utils.InitConfigurationKeys.GetValue("0", "FE_MULTI_STAMPA_ETICHETTA");

            if (abilita_multi_stampa_etichetta.Equals("1"))
            {
                DocsPaWR.SchedaDocumento  schedaDocumento = DocumentManager.getDocumentoSelezionato();
                DocsPaWR.DocsPaWebService ws = ProxyManager.getWS();
                try
                {
                    ws.updateStampeDocumentoEffettuate(UserManager.getInfoUtente(),
                                                       this.NumeroStampeEffettuate,
                                                       this.NumeroStampeDaEffettuare,
                                                       schedaDocumento.systemId);
                }
                catch (Exception e) { }
                string numStampe = (this.NumeroStampeEffettuate + this.NumeroStampeDaEffettuare).ToString();
                schedaDocumento.protocollo.stampeEffettuate = numStampe;
            }
        }
 private HazelcastClient(Configuration config)
 {
     Configuration       = config;
     HazelcastProperties = new HazelcastProperties(config.Properties);
     if (config.InstanceName != null)
     {
         _instanceName = config.InstanceName;
     }
     else
     {
         _instanceName = "hz.client_" + _id;
     }
     LifecycleService = new LifecycleService(this);
     try
     {
         //TODO make partition strategy parametric
         var partitioningStrategy = new DefaultPartitioningStrategy();
         SerializationService = new SerializationServiceBuilder().SetConfig(config.SerializationConfig)
                                .SetPartitioningStrategy(partitioningStrategy)
                                .SetVersion(IO.Serialization.SerializationService.SerializerVersion).Build();
     }
     catch (Exception e)
     {
         throw ExceptionUtil.Rethrow(e);
     }
     ProxyManager = new ProxyManager(this);
     //TODO EXECUTION SERVICE
     ExecutionService         = new ExecutionService(_instanceName);
     LoadBalancer             = config.LoadBalancer ?? new RoundRobinLB();
     PartitionService         = new PartitionService(this);
     AddressProvider          = new AddressProvider(Configuration.NetworkConfig, HazelcastProperties);
     ConnectionManager        = new ConnectionManager(this);
     InvocationService        = new InvocationService(this);
     ListenerService          = new ListenerService(this);
     ClusterService           = new ClusterService(this);
     LockReferenceIdGenerator = new ClientLockReferenceIdGenerator();
     // Statistics = new Statistics(this);
     NearCacheManager   = new NearCacheManager(this);
     CredentialsFactory = config.SecurityConfig.AsCredentialsFactory() ??
                          new StaticCredentialsFactory(new UsernamePasswordCredentials());
 }
Example #18
0
        protected void gv_dettItemsCons_PreRender(object sender, EventArgs e)
        {
            if (Request.QueryString["idProfile"] != null && Request.QueryString["idProfile"] != string.Empty)
            {
                this.gv_dettItemsCons.Columns[6].Visible = false;
            }

            DocsPAWA.DocsPaWR.TipoIstanzaConservazione[] cons = ProxyManager.getWS().GetTipologieIstanzeConservazione();

            for (int i = 0; i < this.gv_dettItemsCons.Rows.Count; i++)
            {
                for (int t = 0; t < cons.Length; t++)
                {
                    string tipo_cons = ((Label)this.gv_dettItemsCons.Rows[i].FindControl("tipo_cons")).Text;
                    if (tipo_cons.Equals(cons[t].Codice))
                    {
                        ((Label)this.gv_dettItemsCons.Rows[i].FindControl("tipo_cons")).Text = cons[t].Descrizione;
                    }
                }
            }
        }
Example #19
0
        protected override void OnUsed(ProxyManager ma, dynamic options)
        {
            if (options != null)
            {
                if (ComFunc.nvl(options.WeixinHome) != "")
                {
                    weixinhome = options.WeixinHome;
                }
                if (ComFunc.nvl(options.WeixinRootHome) != "")
                {
                    weixinroothome = options.WeixinRootHome;
                }
            }

            GlobalCommon.Logger.WriteLog(LoggerLevel.INFO,
                                         string.Format("WeixinWebGo起始页WeixinHome设定为{0},如要调整,请在ProxyManager.UseProxy中的options参数设定WeixinHome的值", weixinhome));
            GlobalCommon.Logger.WriteLog(LoggerLevel.INFO,
                                         string.Format("WeixinWebGo的RootHome设定为{0},如要调整,请在ProxyManager.UseProxy中的options参数设定WeixinRootHome的值", weixinroothome));
            //添加微信远程呼叫模块
            DoAddProxy(ma, options);
        }
    public void InitCityData()
    {
        MyCity = new CityInfo()
        {
            IsMine   = true,
            CityData = ProxyManager.GetInstance().Get <PlayerProxy>().city,
            Position = ProxyManager.GetInstance().Get <PlayerProxy>().city.WorldPos
        };

        //Set temp data.
        //for (int i = 0; i < 1; i++)
        //{
        //    OtherCityList.Add(new CityInfo()
        //    {
        //        IsMine = false,
        //        Position = new Coord(5 + i, 7 + i)
        //    });
        //}

        EventManager.GetInstance().SendEvent(EventId.WorldCityDataUpdate);
    }
Example #21
0
        public FirmaResult[] HSM_SignMultiSign(FileRequest[] fileRequestList, bool cofirma, bool timestamp, tipoFirma TipoFirma, String AliasCertificato, String DominioCertificato, String OtpFirma, String PinCertificato)
        {
            InfoUtente infoUtente = NttDataWA.UIManager.UserManager.GetInfoUser();

            FirmaResult[]             firmaResult = null;
            DocsPaWR.DocsPaWebService docsPaWS    = ProxyManager.GetWS();
            try
            {
                string tipoFirmaSTR   = TipoFirma.ToString();
                string multiSignToken = docsPaWS.HSM_OpenMultiSignSession(infoUtente, fileRequestList, cofirma, timestamp, tipoFirmaSTR);
                if (!string.IsNullOrEmpty(multiSignToken))
                {
                    firmaResult = docsPaWS.HSM_SignMultiSignSession(infoUtente, fileRequestList, multiSignToken, AliasCertificato, DominioCertificato, OtpFirma, PinCertificato, cofirma);
                }
            }
            catch (System.Exception ex)
            {
                return(null);
            }
            return(firmaResult);
        }
Example #22
0
        public List <Relationship> GetRelationships(string proxy = "", ProxyType proxyType = ProxyType.HTTPS)
        {
            List <Relationship> relationships = new List <Relationship>();
            HttpRequest         req           = new HttpRequest();

            req.AddHeader("Authorization", token);
            ProxyManager.SimpleChange(req, proxy, proxyType);
            string lol = req.Get($"https://discordapp.com/api/v6/users/@me/relationships").ToString();

            string[] splitter = Strings.Split(lol, @"{""id"": """);
            bool     can      = false;

            for (int i = 0; i < splitter.Length; i++)
            {
                if (!can)
                {
                    string[] otherSplitter = Strings.Split(splitter[i], @"""");
                    string   stringId      = otherSplitter[0].Replace("[", "").Replace(" ", "").Replace("]", "").Replace("{", "}").Replace(@"""", "").Replace(Constants.vbTab, "");
                    if (stringId.Replace(" ", "") != "")
                    {
                        try
                        {
                            relationships.Add(new Relationship(ulong.Parse(stringId), token));
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                }
                if (!can)
                {
                    can = true;
                }
                else
                {
                    can = false;
                }
            }
            return(relationships);
        }
Example #23
0
        static void v8()
        {
            ManualResetEvent mre = new ManualResetEvent(false);

            l = new Listener();
            SelectiveProxyGuide spg = new SelectiveProxyGuide();

            spg.DnsCache   = new DNSCache();
            spg.PacSetting = new PacSetting();
//			spg.PacSetting.AddURLPattern(@"http://.*\.baidu\.com");

            pm = new ProxyManager();
            WebPageProxyProvider wppp = new WebPageProxyProvider();

            wppp.Sources.Add(new WebPageProxySource
            {
                URL     = "http://proxy.ipcn.org/proxylist.html",
                Pattern = @"(?<ip>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\s*):(?<port>\s*\d{1,5})"
            });

            pm.ProxyProviders.Add(wppp);

            ProxyValidator         pv = new ProxyValidator();
            ProxyValidateCondition vc = new ProxyValidateCondition();

            vc.Url = "http://www.baidu.com";
            vc.Keywords.Add("百度");
            vc.Keywords.Add("html");
            pv.ValidateConditions.Add(vc);

            pm.ProxyValidator = pv;

            spg.ProxyManager       = pm;
            l.TargetConnctionGuide = spg;

            pm.StartDownloadProxies(false);

            l.StartListener();
            mre.WaitOne();
        }
Example #24
0
        public Instance()
        {
            workerManager = new WorkerManager();

            sqlServerTaskPool = new SQLServerTaskPool();
//			sqlServerTaskPool.ConnectionString = dbConnectionString;
            sqlServerTaskPool.InitTable();
            sqlServerTaskPool.DaemonRestTime = 2000;
            sqlServerTaskPool.MaxDaemonEnqueueThreadCount = 2;


            taobaoTaskGuide = new TaobaoTaskGuide();
            taobaoTaskGuide.GlobalTimeout = 60000;
            taobaoTaskGuide.MaxWorkers    = 1;

            proxyManager = new ProxyManager();
            proxyManager.DaemonRestTime = 1000;
            proxyManager.LoadProxyProviders(ProxyProviderParser.ReadConfig("config/proxyprovider.xml"));
            proxyManager.ProxyValidator = new ProxyValidator();
            proxyManager.ProxyValidator.LoadProxyValidations(ProxyValidateConditionParser.ReadConfig("config/proxyvalidate.xml"));
            proxyManager.MaxValidateThreadCount = 20;



            proxyPool = new TaobaoSelectiveIntervalProxyPool();
            proxyPool.LocalRestTime       = new TimeSpan(0, 0, 5);
            proxyPool.MaxLocalConnections = 1;
            proxyPool.ProxyManager        = proxyManager;
            proxyPool.DaemonRestTime      = new TimeSpan(0, 0, 1);
            proxyPool.ProxyRestTime       = new TimeSpan(0, 0, 5);

            workerManager.ProxyPool = proxyPool;
            workerManager.TaskPool  = sqlServerTaskPool;
            workerManager.TaskGuide = taobaoTaskGuide;

//			directProxyPool.ProxyManager = proxyManager;
//			directProxyPool.DaemonRestTime = 1000;
//			directProxyPool.ProxyRestTime = new TimeSpan(0, 0, 20);
        }
Example #25
0
        public Memento HSM_GetMementoForUser()
        {
            DocsPaWR.InfoUtente infoUt = SAAdminTool.UserManager.getInfoUtente();
            SAAdminTool.DocsPaWR.DocsPaWebService ws = ProxyManager.getWS();
            try
            {
                Memento  retval = new Memento();
                string[] resp   = ws.HSM_GetMementoForUser(infoUt);

                if (resp.Length == 2)
                {
                    retval.Dominio = resp[0];
                    retval.Alias   = resp[1];
                }
                return(retval);
            }
            catch (System.Exception ex)
            {
                //UIManager.AdministrationManager.DiagnosticError(ex);
                return(null);
            }
        }
Example #26
0
            public DocsPAWA.DocsPaWR.Corrispondente[] ConvertToCorrispondente(string codice)
            {
                DocsPaWR.ElementoRubrica er = Get(codice);
                if (er != null)
                {
                    if (er.tipo == "L")
                    {
                        if (!corrConversionTable.ContainsKey(codice))
                        {
                            string idAmm = UserManager.getInfoUtente().idAmministrazione;
                            DocsPaWR.DocsPaWebService DocsPaWS = ProxyManager.getWS();
                            ArrayList aux = new ArrayList(DocsPaWS.getCorrispondentiByCodLista(er.codice, idAmm, UserManager.getInfoUtente()));
                            DocsPaWR.Corrispondente[] lista = new DocsPAWA.DocsPaWR.Corrispondente[aux.Count];
                            aux.CopyTo(lista);
                            corrConversionTable.Add(er.codice, lista);
                        }
                        return((DocsPAWA.DocsPaWR.Corrispondente[])corrConversionTable[codice]);
                    }
                    else
                    {
                        if (!corrConversionTable.ContainsKey(codice))
                        {
                            DocsPaWR.DocsPaWebService      DocsPaWS = ProxyManager.getWS();
                            DocsPaWR.Corrispondente[]      lista    = new DocsPAWA.DocsPaWR.Corrispondente[1];
                            DocsPaWR.AddressbookTipoUtente tipo     = (er.interno ? DocsPAWA.DocsPaWR.AddressbookTipoUtente.INTERNO : DocsPAWA.DocsPaWR.AddressbookTipoUtente.ESTERNO);
                            DocsPaWR.Corrispondente        corr     = DocsPaWS.AddressbookGetCorrispondenteByCodRubricaIE(er.codice, tipo, UserManager.getInfoUtente());
                            if (corr != null)
                            {
                                corr.tipoCorrispondente = er.tipo;
                                lista[0] = corr;
                                corrConversionTable.Add(er.codice, lista);
                            }
                        }
                        return((DocsPAWA.DocsPaWR.Corrispondente[])corrConversionTable[codice]);
                    }
                }

                return(new DocsPAWA.DocsPaWR.Corrispondente[0]);
            }
        protected override void OnUsed(ProxyManager ma, dynamic options)
        {
            if (options.ExcuteFilePath == null)
            {
                Assembly     assembly     = this.GetType().GetTypeInfo().Assembly;
                AssemblyName assemblyName = assembly.GetName();
                excuteFilePath = System.AppContext.BaseDirectory;
            }
            else
            {
                excuteFilePath = ComFunc.nvl(options.ExcuteFilePath);
            }
            GlobalCommon.Logger.WriteLog(Base.Constants.LoggerLevel.INFO, string.Format("Razor引擎ExcuteFilePath={0}", excuteFilePath));

            var services = new ServiceCollection();

            ConfigureDefaultServices(services);
            var provider = services.BuildServiceProvider();
            var mp       = provider.GetRequiredService <IViewBufferScope>();

            renderer = provider.GetRequiredService <RazorViewToStringRenderer>();
        }
    static int _CreateProxyManager(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                ProxyManager obj = new ProxyManager();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: ProxyManager.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #29
0
        public bool HSM_Sign(FileRequest fr, bool cofirma, bool timestamp, tipoFirma TipoFirma, String AliasCertificato, String DominioCertificato, String OtpFirma, String PinCertificato, bool ConvertPdf)
        {
            bool retval = false;

            InfoUtente infoUt = SAAdminTool.UserManager.getInfoUtente();

            DocsPaWR.DocsPaWebService docsPaWS = ProxyManager.getWS();
            try
            {
                string tipoFirmaSTR = TipoFirma.ToString();
                retval = docsPaWS.HSM_Sign(infoUt, fr, cofirma, timestamp, tipoFirmaSTR, AliasCertificato, DominioCertificato, OtpFirma, PinCertificato, ConvertPdf);
            }
            catch (System.Exception ex)
            {
                //UIManager.AdministrationManager.DiagnosticError(ex);
                //return false;

                logger.Debug("Errore: " + ex.Message);
            }

            return(retval);
        }
Example #30
0
 protected void StartPoxy()
 {
     AppendLog("Starting proxy..." + Environment.NewLine);
     try
     {
         proxy = new ProxyManager(txtPort.Text, cbListen.ActiveText, cbLoginURL.ActiveText);
         proxy.Start();
         btnLoadPlugin.Sensitive = true;
         ApplyProxyFilters();
     }
     catch (Exception ex)
     {
         Logger.Log("Failed to start proxy: " + ex.Message, OpenMetaverse.Helpers.LogLevel.Error);
         try
         {
             proxy.Stop();
         }
         catch { }
         btnStart.Label = "Start Proxy";
         proxy          = null;
     }
 }
Example #31
0
        private void UpdateRights(DocsPaWR.ModificaAclDocumentoStatoFinale[] infoModifiche)
        {
            try
            {
                bool success = false;
                if (infoModifiche.Length > 0)
                {
                    AdminTool.Manager.SessionManager sessionManager = new AdminTool.Manager.SessionManager();

                    success = ProxyManager.getWS().ModificaDocumentoStatoFinale(sessionManager.getUserAmmSession(), infoModifiche);
                }

                if (success)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ok", "javascript:alert('Operazione effettuata con successo');Closewindow('true');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected override void OnUsed(ProxyManager ma, dynamic options)
        {
            BeforeOnUsed(ma, options);
            if (options != null)
            {
                if (ComFunc.nvl(options.StartPage) != null)
                {
                    Settings.StartPage = options.StartPage;
                }
                if (ComFunc.nvl(options.RootHome) != "")
                {
                    Settings.RootHome = options.RootHome;
                }
            }

            GlobalCommon.Logger.WriteLog(LoggerLevel.INFO,
                                         string.Format("{1}起始页StartPage设定为{0},如要调整,请在ProxyManager.UseProxy中的options参数设定StartPage的值", Settings.StartPage, this.GetType().Name));
            GlobalCommon.Logger.WriteLog(LoggerLevel.INFO,
                                         string.Format("{1}中RootHome设定为{0},如要调整,请在ProxyManager.UseProxy中的options参数设定RootHome的值", Settings.RootHome, this.GetType().Name));
            //加载模块内需要的代理器
            DoAddProxy(ma, options);
        }
Example #33
0
        private void loadProxiesButton_Click(object sender, EventArgs e)
        {
            Log.WriteLog("Loading Proxies.. please wait while I check for banned ones");
            if(loadProxiesCheckBox.Checked)
            {

            }
            else
            {
                loadProxiesCheckBox.Checked = true;
            }
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "Text Files (.txt)|*.txt";
            ofd.FilterIndex = 1;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                proxyManager = new ProxyManager(File.ReadAllLines(ofd.FileName));
            }
        }
Example #34
0
        private void SetRamblerWordsWeight()
        {
            ProxyManager pm = new ProxyManager();

            string errorPattern = "<td class=\"error\">[^</td>]*</td></td>";
            Regex rx = new Regex(errorPattern);

            string req = GetRamblerAdStatReq();

            Uri ramblerUri = new Uri(req);
            DownloaderObj obj = new DownloaderObj(ramblerUri, null, true);
            Downloader.DownloadSync(obj);
            if (obj.DataStr == null) return;

            while (rx.IsMatch(obj.DataStr)) //write another method.....
            {
                //content = Content.DownloadString(req, pm.GetProxy());
            }

            if (!rx.IsMatch(obj.DataStr))
            {
                foreach (string[] theme in allThemes)
                {
                    string pattern = @"<tr>\s*<tr>\s*<td class=hd_gray><a href=[^>]*>" +
                        theme[0] +
                        @"</a>[^<]</td>\s*<td class=hd_gray[^>]*>([^<]*)</td>\s*" +
                        @"<td class=hd_gray[^>]*>[^<]*</td>\s*</tr>";

                    theme[2] = (Int32.Parse(new Regex(pattern).Match(obj.DataStr).Groups[1].Value.Replace("&nbsp;", "")) + Int32.Parse(theme[2])).ToString();
                }
            }
            else
            {
                //parse new proxies, and rerun method();
                //ProxyManager.
                GlobalLog.Write("Expired proxyes on SetRamblerWordsWeight() method, need to rerun method or get fresh proxies");
            }
        }
Example #35
0
 protected void StartPoxy()
 {
     AppendLog("Starting proxy..." + Environment.NewLine);
     try
     {
         proxy = new ProxyManager(txtPort.Text, cbListen.ActiveText, cbLoginURL.ActiveText);
         proxy.Start();
         btnLoadPlugin.Sensitive = true;
         ApplyProxyFilters();
     }
     catch (Exception ex)
     {
         Logger.Log("Failed to start proxy: " + ex.Message, OpenMetaverse.Helpers.LogLevel.Error);
         try
         {
             proxy.Stop();
         }
         catch { }
         btnStart.Label = "Start Proxy";
         proxy = null;
     }
 }
Example #36
0
 protected void StopProxy()
 {
     AppendLog("Proxy stopped" + Environment.NewLine);
     if (proxy != null) proxy.Stop();
     proxy = null;
     plugins.Store.Clear();
     btnLoadPlugin.Sensitive = false;
 }