Ejemplo n.º 1
1
        /// <summary>
        /// Sends an error message by opening the user's mail client.
        /// </summary>
        /// <param name="recipient"></param>
        /// <param name="subject"></param>
        /// <param name="ex"></param>
        /// <param name="assembly">The assembly where the error originated. This will 
        /// be used to extract version information.</param>
        public static void SendByMail(string recipient, string subject, Exception ex,
            Assembly assembly, StringDictionary additionalInfo)
        {
            string attributes = GetAttributes(additionalInfo);

            StringBuilder msg = new StringBuilder();

            msg.AppendLine("[ Please send this as plain text to allow automatic pre-processing ]");
            msg.AppendLine();
            msg.AppendLine(GetMessage(ex));
            msg.AppendLine();
            msg.AppendLine(GetAttributes(additionalInfo));
            msg.AppendLine();
            msg.AppendLine("[ Please send this as plain text to allow automatic pre-processing ]");
            msg.AppendLine();

            string command = string.Format("mailto:{0}?subject={1}&body={2}",
                recipient,
                Uri.EscapeDataString(subject),
                Uri.EscapeDataString(msg.ToString()));

            Debug.WriteLine(command);
            Process p = new Process();
            p.StartInfo.FileName = command;
            p.StartInfo.UseShellExecute = true;

            p.Start();
        }
Ejemplo n.º 2
0
        // Extract command line parameters and values stored in a string array
        void Extract(string[] Args)
        {
            Parameters = new StringDictionary();
            Regex Spliter = new Regex(@"^([/-]|--){1}(?<name>\w+)([:=])?(?<value>.+)?$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
            char[] TrimChars = { '"', '\'' };
            string Parameter = null;
            Match Part;
            // Valid parameters forms:
            // {-,/,--}param{ ,=,:}((",')value(",'))
            // Examples: -param1 value1 --param2 /param3:"Test-:-work" /param4=happy -param5 '--=nice=--'

            foreach (string Arg in Args)
            {
                Part = Spliter.Match(Arg);
                if (!Part.Success)
                {
                    // Found a value (for the last parameter found (space separator))
                    if (Parameter != null) Parameters[Parameter] = Arg.Trim(TrimChars);
                }
                else
                {
                    // Matched a name, optionally with inline value
                    Parameter = Part.Groups["name"].Value;
                    Parameters.Add(Parameter, Part.Groups["value"].Value.Trim(TrimChars));
                }
            }
        }
Ejemplo n.º 3
0
 public GoodProcessThread(string path, string arguments, Action <GoodProcessThread> completeCallback, System.Collections.Specialized.StringDictionary env)
 {
     Path             = path;
     Arguments        = arguments;
     CompleteCallback = completeCallback;
     Env = env;
 }
        /// <summary>
        /// Runs the specified command.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="keyValues">The key values.</param>
        /// <param name="output">The output.</param>
        /// <returns></returns>
        public override int Execute(string command, StringDictionary keyValues, out string output)
        {
            output = string.Empty;

            string url = Params["url"].Value.TrimEnd('/');

            using (SPSite site = new SPSite(url))
            {
                using (SPWeb web = site.AllWebs[Utilities.GetServerRelUrlFromFullUrl(url)])
                {

                    foreach (SPLanguage lang in web.RegionalSettings.InstalledLanguages)
                    {
                        foreach (SPWebTemplate template in site.GetWebTemplates((uint)lang.LCID))
                        {
                            output += template.Name + " = " + template.Title + " (" + lang.LCID + ")\r\n";
                        }
                        foreach (SPWebTemplate template in site.GetCustomWebTemplates((uint)lang.LCID))
                        {
                            output += template.Name + " = " + template.Title + " (Custom)(" + lang.LCID + ")\r\n";
                        }
                    }
                }
            }

            return (int)ErrorCodes.NoError;
        }
        /// <summary>
        /// Runs the specified command.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="keyValues">The key values.</param>
        /// <param name="output">The output.</param>
        /// <returns></returns>
        public override int Execute(string command, StringDictionary keyValues, out string output)
        {
            output = string.Empty;

            string url = Params["url"].Value.TrimEnd('/');
            bool force = Params["force"].UserTypedIn;
            string backupDir = Params["backupdir"].Value;

            SPList list = null;
            if (Utilities.EnsureAspx(url, false, false) && !Params["listname"].UserTypedIn)
                list = Utilities.GetListFromViewUrl(url);
            else if (Params["listname"].UserTypedIn)
            {
                using (SPSite site = new SPSite(url))
                using (SPWeb web = site.OpenWeb())
                {
                    try
                    {
                        list = web.Lists[Params["listname"].Value];
                    }
                    catch (ArgumentException)
                    {
                        throw new SPException("List not found.");
                    }
                }
            }

            if (list == null)
                throw new SPException("List not found.");

            Common.Lists.DeleteList.Delete(force, backupDir, list);

            return (int)ErrorCodes.NoError;
        }
Ejemplo n.º 6
0
        public Args(string[] args)
        {
            argDict = new StringDictionary();
            Regex regEx = new Regex(@"^-", RegexOptions.IgnoreCase | RegexOptions.Compiled);
            Regex regTrim = new Regex(@"^['""]?(.*?)['""]?$", RegexOptions.IgnoreCase | RegexOptions.Compiled);

            string arg = "";
            string[] chunks;

            foreach (string s in args)
            {
                chunks = regEx.Split(s, 3);

                if (regEx.IsMatch(s))
                {
                    arg = chunks[1];
                    argDict.Add(arg, "true");
                }
                else
                {
                if (argDict.ContainsKey(arg))
                {
                    chunks[0] = regTrim.Replace(chunks[0], "$1");
                    argDict.Remove(arg);
                    argDict.Add(arg, chunks[0]);
                    arg = "";
                }
                }
              }
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            System.Collections.Specialized.StringDictionary stringDictionary = new System.Collections.Specialized.StringDictionary();
            stringDictionary.Add("Test1", "Test@123");
            stringDictionary.Add("Admin", "Admin@123");
            stringDictionary.Add("Temp", "Temp@123");
            stringDictionary.Add("Demo", "Demo@123");
            stringDictionary.Add("Test2", "Test2@123");
            stringDictionary.Remove("Admin");
            if (stringDictionary.ContainsKey("Admin"))
            {
                Console.WriteLine("UserName already Esists");
            }
            else
            {
                stringDictionary.Add("Admin", "Admin@123");
                Console.WriteLine("User added succesfully.");
            }

            // Get a collection of the keys.
            Console.WriteLine("UserName" + ": " + "Password");
            foreach (DictionaryEntry entry in stringDictionary)
            {
                Console.WriteLine(entry.Key + ": " + entry.Value);
            }
            Console.ReadKey();
        }
Ejemplo n.º 8
0
		/// <summary>
		/// Parse a URI query string of the form ?x=y&amp;z=0
		/// into a map of name/value pairs.
		/// </summary>
		/// <param name="query">The query string to parse. This string should not contain
		/// URI escape characters.</param>
		public static StringDictionary ParseQuery(string query)
		{
			StringDictionary map = new StringDictionary();

			// strip the initial "?"
			if(query.StartsWith("?"))
				query = query.Substring(1);
			// split the query into parameters
			string[] parameters = query.Split('&');
			foreach (string pair in parameters)
			{
				if (pair.Length > 0)
				{
					string[] nameValue = pair.Split('=');
					if (nameValue.Length != 2)
					{
						throw new NMS.NMSException("Invalid URI parameter: " + query);
					}
					else
					{
						map[nameValue[0]] = nameValue[1];
					}
				}
			}
			return map;
		}
Ejemplo n.º 9
0
		/// <summary>
		/// Initializes a new instance of class MsdnXsltUtilities
		/// </summary>
		/// <param name="fileNames">A StringDictionary holding id to file name mappings.</param>
		/// <param name="elemNames">A StringDictionary holding id to element name mappings</param>
		/// <param name="linkToSdkDocVersion">Specifies the version of the SDK documentation.</param>
		/// <param name="linkToSdkDocLangauge">Specifies the version of the SDK documentation.</param>
		/// <param name="SdkLinksOnWeb">Specifies if links should be to ms online documentation.</param>
		/// <param name="fileEncoding">Specifies if links should be to ms online documentation.</param>
		public MsdnXsltUtilities(
			StringDictionary fileNames, 
			StringDictionary elemNames, 
			SdkVersion  linkToSdkDocVersion,
			string linkToSdkDocLangauge,
			bool SdkLinksOnWeb,
			System.Text.Encoding fileEncoding)
		{
			Reset();

			this.fileNames = fileNames;
			this.elemNames = elemNames;
			

			if (SdkLinksOnWeb)
			{
				sdkDocBaseUrl = msdnOnlineSdkBaseUrl;
				sdkDocExt = msdnOnlineSdkPageExt;
			}
			else
			{
				switch (linkToSdkDocVersion)
				{
					case SdkVersion.SDK_v1_0:
						sdkDocBaseUrl = GetLocalizedFrameworkURL(sdkDoc10BaseNamespace,linkToSdkDocLangauge);
						sdkDocExt = sdkDocPageExt;
						break;
					case SdkVersion.SDK_v1_1:
						sdkDocBaseUrl = GetLocalizedFrameworkURL(sdkDoc11BaseNamespace,linkToSdkDocLangauge);
						sdkDocExt = sdkDocPageExt;
						break;
				}
			}
			encodingString = "text/html; charset=" + fileEncoding.WebName; 
		}
        /// <summary>
        /// Executes the specified command.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="keyValues">The key values.</param>
        /// <param name="output">The output.</param>
        /// <returns></returns>
        public override int Execute(string command, StringDictionary keyValues, out string output)
        {
            output = string.Empty;

            #if !MOSS
            output = NOT_VALID_FOR_FOUNDATION;
            return (int)ErrorCodes.GeneralError;
            #endif

            string url = Params["url"].Value;
            if (url != null)
                url = url.TrimEnd('/');

            string pageName = Params["name"].Value;
            string title = Params["title"].Value;
            string layout = Params["layout"].Value;

            string fieldData = Params["fielddata"].Value;
            Dictionary<string, string> fieldDataCollection = new Dictionary<string, string>();
            if (!string.IsNullOrEmpty(fieldData))
            {
                fieldData = fieldData.Replace(";;", "_STSADM_CREATEPUBLISHINGPAGE_SEMICOLON_");
                foreach (string s in fieldData.Split(';'))
                {
                    string[] data = s.Split(new char[] { '=' }, 2);
                    fieldDataCollection.Add(data[0].Trim(), data[1].Trim().Replace("_STSADM_CREATEPUBLISHINGPAGE_SEMICOLON_", ";"));
                }
            }

            Common.Pages.CreatePublishingPage.CreatePage(url, pageName, title, layout, fieldDataCollection, false);

            return (int)ErrorCodes.NoError;
        }
        public void BindSettings(StringDictionary settings)
        {
            // bind servers
            try
            {
                ddlServers.DataSource = ES.Services.StatisticsServers.GetServers(PanelRequest.ServiceId);
                ddlServers.DataBind();
            }
            catch
            { /* skip */ }

            txtSmarterUrl.Text = settings["SmarterUrl"];
            txtUsername.Text = settings["Username"];
            ViewState["PWD"] = settings["Password"];
            Utils.SelectListItem(ddlServers, settings["ServerID"]);
            Utils.SelectListItem(ddlLogFormat, settings["LogFormat"]);
            txtLogWilcard.Text = settings["LogWildcard"];
            txtLogDeleteDays.Text = settings["LogDeleteDays"];
            txtSmarterLogs.Text = settings["SmarterLogsPath"];
            txtSmarterLogDeleteMonths.Text = settings["SmarterLogDeleteMonths"];
			chkBuildUncLogsPath.Checked = Utils.ParseBool(settings["BuildUncLogsPath"], false);

            if (settings["TimeZoneId"] != null)
                timeZone.TimeZoneId = Utils.ParseInt(settings["TimeZoneId"], 1);

            txtStatsUrl.Text = settings["StatisticsURL"];

        }
Ejemplo n.º 12
0
// <snippet5>
    public static void RequestResource(Uri resource)
    {
        // Set policy to send credentials when using HTTPS and basic authentication.

        // Create a new HttpWebRequest object for the specified resource.
        WebRequest request = (WebRequest)WebRequest.Create(resource);

        // Supply client credentials for basic authentication.
        request.UseDefaultCredentials = true;
        request.AuthenticationLevel   = AuthenticationLevel.MutualAuthRequired;
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();

        // Determine mutual authentication was used.
        Console.WriteLine("Is mutually authenticated? {0}", response.IsMutuallyAuthenticated);

        System.Collections.Specialized.StringDictionary spnDictionary = AuthenticationManager.CustomTargetNameDictionary;
        foreach (System.Collections.DictionaryEntry e in spnDictionary)
        {
            Console.WriteLine("Key: {0}  - {1}", e.Key as string, e.Value as string);
        }
        // Read and display the response.
        System.IO.Stream       streamResponse = response.GetResponseStream();
        System.IO.StreamReader streamRead     = new System.IO.StreamReader(streamResponse);
        string responseString = streamRead.ReadToEnd();

        Console.WriteLine(responseString);
        // Close the stream objects.
        streamResponse.Close();
        streamRead.Close();
        // Release the HttpWebResponse.
        response.Close();
    }
        private static void InstallCertificate(StringDictionary parametrs)
        {
            try
            {
                string[] param = parametrs["assemblypath"].Split('\\');
                string certPath = String.Empty;

                for (int i = 0; i < param.Length - 1; i++)
                {
                    certPath += param[i] + '\\';
                }
                certPath += "certificate.pfx";

                var cert = new X509Certificate2(certPath, "",
                  X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet);

                var store = new X509Store(StoreName.AuthRoot, StoreLocation.LocalMachine);
                store.Open(OpenFlags.ReadWrite);
                store.Add(cert);
                store.Close();
            }
            catch (Exception ex)
            {
                throw new Exception("Certificate appeared to load successfully but also seems to be null.", ex);
            }
        }
Ejemplo n.º 14
0
		/// <summary>
		/// Parses the parameters.
		/// </summary>
		/// <param name="uri">The URI.</param>
		/// <returns></returns>
		private static StringDictionary ParseParameters(
			Uri uri )
		{
			StringDictionary result = new StringDictionary();

			if ( !string.IsNullOrEmpty( uri.Query ) )
			{
				string query = uri.Query.Trim( '&', '?' );
				string[] pairs = query.Split( '&' );

				foreach ( string pair in pairs )
				{
					if ( pair.Contains( @"=" ) )
					{
						string[] ab = pair.Split( '=' );
						result[ab[0]] = ab[1];
					}
					else
					{
						result[pair] = pair;
					}
				}
			}

			return result;
		}
Ejemplo n.º 15
0
        public void OnDownload(Series series, EpisodeFile episodeFile, string sourcePath, CustomScriptSettings settings)
        {
            var environmentVariables = new StringDictionary();

            environmentVariables.Add("Sonarr_EventType", "Download");
            environmentVariables.Add("Sonarr_Series_Id", series.Id.ToString());
            environmentVariables.Add("Sonarr_Series_Title", series.Title);
            environmentVariables.Add("Sonarr_Series_Path", series.Path);
            environmentVariables.Add("Sonarr_Series_TvdbId", series.TvdbId.ToString());
            environmentVariables.Add("Sonarr_EpisodeFile_Id", episodeFile.Id.ToString());
            environmentVariables.Add("Sonarr_EpisodeFile_RelativePath", episodeFile.RelativePath);
            environmentVariables.Add("Sonarr_EpisodeFile_Path", Path.Combine(series.Path, episodeFile.RelativePath));
            environmentVariables.Add("Sonarr_EpisodeFile_SeasonNumber", episodeFile.SeasonNumber.ToString());
            environmentVariables.Add("Sonarr_EpisodeFile_EpisodeNumbers", string.Join(",", episodeFile.Episodes.Value.Select(e => e.EpisodeNumber)));
            environmentVariables.Add("Sonarr_EpisodeFile_EpisodeAirDates", string.Join(",", episodeFile.Episodes.Value.Select(e => e.AirDate)));
            environmentVariables.Add("Sonarr_EpisodeFile_EpisodeAirDatesUtc", string.Join(",", episodeFile.Episodes.Value.Select(e => e.AirDateUtc)));
            environmentVariables.Add("Sonarr_EpisodeFile_Quality", episodeFile.Quality.Quality.Name);
            environmentVariables.Add("Sonarr_EpisodeFile_QualityVersion", episodeFile.Quality.Revision.Version.ToString());
            environmentVariables.Add("Sonarr_EpisodeFile_ReleaseGroup", episodeFile.ReleaseGroup ?? string.Empty);
            environmentVariables.Add("Sonarr_EpisodeFile_SceneName", episodeFile.SceneName ?? string.Empty);
            environmentVariables.Add("Sonarr_EpisodeFile_SourcePath", sourcePath);
            environmentVariables.Add("Sonarr_EpisodeFile_SourceFolder", Path.GetDirectoryName(sourcePath));
            
            ExecuteScript(environmentVariables, settings);
        }
        /// <summary>
        /// Executes the specified command.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="keyValues">The key values.</param>
        /// <param name="output">The output.</param>
        /// <returns></returns>
        public override int Execute(string command, StringDictionary keyValues, out string output)
        {
            output = string.Empty;

            #if !MOSS
            output = NOT_VALID_FOR_FOUNDATION;
            return (int)ErrorCodes.GeneralError;
            #endif

            SPServiceContext context = null;
            if (Params["serviceappname"].UserTypedIn)
            {
                SPSiteSubscriptionIdentifier subId = Utilities.GetSiteSubscriptionId(new Guid(Params["sitesubscriptionid"].Value));
                SPServiceApplication svcApp = Utilities.GetUserProfileServiceApplication(Params["serviceappname"].Value);
                Utilities.GetServiceContext(svcApp, subId);
            }
            else
            {
                using (SPSite site = new SPSite(Params["contextsite"].Value))
                    context = SPServiceContext.GetContext(site);
            }

            Common.Audiences.DeleteAudience.Delete(context,
                   Params["name"].Value,
                   Params["rulesonly"].UserTypedIn);

            return (int)ErrorCodes.NoError;
        }
Ejemplo n.º 17
0
 public LinkMessage(StringDictionary attributes, NodeInfo local, NodeInfo remote, string token)
 {
   _attributes = attributes;
   _local_ni = local;
   _remote_ni = remote;
   _token = token;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SandcastleToolBase"/> class.
        /// </summary>
        public SandcastleToolBase()
        {
            EnviromentVariables = new StringDictionary();
            SandcastleEnviroment = new SandcastleEnviroment();

            EnviromentVariables["DXROOT"] = SandcastleEnviroment.SandcastleRoot;
        }
Ejemplo n.º 19
0
		public static async Task<string> access_token(TwitterContext twitterContext, string oauth_verifier)
		{
			StringDictionary query = new StringDictionary();
			query["oauth_verifier"] = oauth_verifier;

            return await new TwitterRequest(twitterContext, API.Methods.POST, new Uri(API.Urls.Oauth_AccessToken), query).Request();
		}
        public static ElasticsearchConnection BuildElsticSearchConnection(string connectionString)
        {
            try
            {
                var builder = new System.Data.Common.DbConnectionStringBuilder();
                builder.ConnectionString = connectionString.Replace("{", "\"").Replace("}", "\"");

                var lookup = new StringDictionary();
                foreach (string key in builder.Keys)
                {
                    lookup[key] = Convert.ToString(builder[key]);
                }

                var index = lookup["Index"];

                // If the user asked for rolling logs, setup the index by day
                if (!string.IsNullOrEmpty(lookup["rolling"]))
                    if (lookup["rolling"] == "true")
                        index = string.Format("{0}-{1}", index, DateTime.Now.ToString("yyyy.MM.dd"));

                return
                    new ElasticsearchConnection
                    {
                        Server = lookup["Server"],
                        Port = lookup["Port"],
                        Index = index
                    };
            }
            catch
            {
                throw new InvalidOperationException("Not a valid connection string");
            }
        }
        protected override bool OnParse(string action, StringDictionary arguments)
        {
            string sFromDate = arguments[Arguments.FromDate];
            if (sFromDate != null)
            {
                m_tFromDate = SwiftDate.Parse(sFromDate, SwiftDateFormat.StandardDate);
            }

            string sFormat = arguments[Arguments.Format];
            switch (sFormat)
            {
            case "csv":
                m_nFormat = OutputFormat.CSV;
                break;
            case "mt940":
                m_nFormat = OutputFormat.MT940;
                break;
            case "mt942":
                m_nFormat = OutputFormat.MT942;
                break;
            case "csv942":
                m_nFormat = OutputFormat.CSV942;
                break;
            case null:
                break;
            default:
                return false;
            }

            return true;
        }
Ejemplo n.º 22
0
 internal ModerationTool()
 {
     Tickets = new List<SupportTicket>();
     UserMessagePresets = new List<string>();
     RoomMessagePresets = new List<string>();
     SupportTicketHints = new StringDictionary();
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Saves the settings to the provider.
        /// </summary>
        /// <param name="settings">
        /// The settings.
        /// </param>
        public override void SaveSettings(StringDictionary settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            var filename = string.Format("{0}settings.xml", this.Folder);
            var writerSettings = new XmlWriterSettings { Indent = true };

            // ------------------------------------------------------------
            // Create XML writer against file path
            // ------------------------------------------------------------
            using (var writer = XmlWriter.Create(filename, writerSettings))
            {
                writer.WriteStartElement("settings");

                foreach (string key in settings.Keys)
                {
                    writer.WriteElementString(key, settings[key]);
                }

                writer.WriteEndElement();
            }
        }
Ejemplo n.º 24
0
 public SimpleElement(String tagName)
 {
     this.tagName = tagName;
     attrib = new StringDictionary();
     childElems = new SimpleElements();
     this.text = "";
 }
    /// <summary>
    /// Calls the remote Viddler API method: viddler.users.getProfile
    /// </summary>
    public Data.User GetProfile(string userName)
    {
      StringDictionary parameters = new StringDictionary();
      parameters.Add("user", userName);

      return this.Service.ExecuteHttpRequest<Users.GetProfile, Data.User>(parameters);
    }
Ejemplo n.º 26
0
        /// <summary>
        /// シグネチャ文字列を生成します。
        /// </summary>
        /// <param name="context">リクエストに使用されるトークンセット。</param>
        /// <param name="method">リクエストのメソッド。</param>
        /// <param name="url">リクエストのURL。</param>
        /// <param name="nonce">ランダムな文字列。</param>
        /// <param name="signatureMethod">シグネチャ メソッド。</param>
        /// <param name="timeStamp">現在の時刻のタイムスタンプ。</param>
        /// <param name="oAuthVersion">OAuthのバージョン文字列。</param>
        /// <param name="QueryDictionary">リクエストのパラメータ。</param>
        /// <returns></returns>
        public static string GenerateSignature(TwitterContext context, string method, string url, string nonce, string signatureMethod, string timeStamp, string oAuthVersion, StringDictionary QueryDictionary = null)
        {
            Debug.WriteLine("-\t-\t## シグネチャを生成します");

            var parameters = new SortedDictionary<string, string>();
            parameters.Add("oauth_consumer_key", context.ConsumerKey);
            parameters.Add("oauth_nonce", nonce);
            parameters.Add("oauth_signature_method", signatureMethod);
            parameters.Add("oauth_timestamp", timeStamp);
            parameters.Add("oauth_token", context.AccessToken != null ? context.AccessToken : null);
            parameters.Add("oauth_version", oAuthVersion);

            // Add parameters to request parameter
            if (QueryDictionary != null)
            {
                foreach (DictionaryEntry k in QueryDictionary)
                {
                    if (k.Value != null)
                        parameters.Add((string)k.Key, (string)k.Value);
                }
            }

            #if DEBUG
            foreach (KeyValuePair<string, string> p in parameters)
            {
                if (p.Value != null)
                    Debug.WriteLine(p.Value.Length > 1000 ? "-\t-\t-\t## [" + p.Key + "] : (1000文字以上)" : "-\t-\t-\t## [" + p.Key + "] : " + p.Value);
            }
            #endif

            string stringParameter = String.Empty;

            foreach (var kvp in parameters)
            {
                if (kvp.Value != null)
                    stringParameter +=
                        (stringParameter.Length > 0 ? "&" : String.Empty) +
                        UrlEncode(kvp.Key, Encoding.UTF8) +
                        "=" + UrlEncode(kvp.Value, Encoding.UTF8);
            }

            Debug.WriteLine(stringParameter.Length > 1000 ? "-\t-\t-\t## パラメータ生成完了: (1000文字以上)" : "-\t-\t-\t## パラメータ生成完了: " + stringParameter);

            // Generate signature base string
            string signatureBaseString = UrlEncode(method, Encoding.UTF8) + "&"
                + UrlEncode(url, Encoding.UTF8) + "&"
                + UrlEncode(stringParameter, Encoding.UTF8);

            Debug.WriteLine(signatureBaseString.Length > 1000 ? "-\t-\t-\t## シグネチャ ベース ストリング生成完了: (1000文字以上)" : "-\t-\t-\t## シグネチャ ベース ストリング生成完了: " + signatureBaseString);

            var hmacsha1 = new HMACSHA1(Encoding.ASCII.GetBytes(
                UrlEncode(context.ConsumerSecret, Encoding.UTF8) +
                "&" + (!String.IsNullOrEmpty(context.AccessTokenSecret) ? UrlEncode(context.AccessTokenSecret, Encoding.UTF8) : String.Empty)));

            // Convert to Base64
            string signature = Convert.ToBase64String(hmacsha1.ComputeHash(Encoding.ASCII.GetBytes(signatureBaseString)));

            Debug.WriteLine("-\t-\t## シグネチャ生成完了: " + signature);
            return signature;
        }
Ejemplo n.º 27
0
        void StartWorkflowButton1_Executed(object sender, EventArgs e)
        {
            List<string> mailList = new List<string>();
            List<SPUser> users = WorkFlowUtil.GetSPUsersInGroup("wf_EquApp");
            List<SPUser> usersReception = WorkFlowUtil.GetSPUsersInGroup("wf_Reception");
            foreach (SPUser user in users)
            {
                mailList.Add(user.Email);
            }
            foreach (SPUser user in usersReception)
            {
                string sMai=user.Email;
                if (!mailList.Contains(sMai))
                {
                    mailList.Add(sMai);
                }
            }
            string EmployeeName=((TextBox)DataForm1.FindControl("txtEmployeeName")).Text;
            StringDictionary dict = new StringDictionary();
            dict.Add("to", string.Join(";", mailList.ToArray()));
            dict.Add("subject",EmployeeName+"'s new employee equipment request" );

            string mcontent = EmployeeName + "'s new employee equipment request has been submitted. Workflow number is "
                + SPContext.Current.ListItem["WorkflowNumber"] + ".<br/><br/>" + @" Please view the detail by clicking <a href='"
                + SPContext.Current.Web.Url
                + "/_layouts/CA/WorkFlows/Equipment2/DisplayForm.aspx?List="
                + SPContext.Current.ListId.ToString()
                + "&ID="
                + SPContext.Current.ListItem.ID
                + "'>here</a>.";

            SPUtility.SendEmail(SPContext.Current.Web, dict, mcontent);
        }
 void IAttributesConfigurable.Configure(StringDictionary attributes)
 {
     if (attributes["RecipeArgument"] != null)
     {
         RecipeArgument = attributes["RecipeArgument"];
     }
 }
        /// <summary>
        /// Retreaves StringDictionary object from database or file system
        /// </summary>
        /// <param name="extensionType">
        /// Extension Type
        /// </param>
        /// <param name="extensionId">
        /// Extension Id
        /// </param>
        /// <returns>
        /// StringDictionary object as Stream
        /// </returns>
        public object GetSettings(ExtensionType extensionType, string extensionId)
        {
            SerializableStringDictionary ssd;
            var sd = new StringDictionary();
            var serializer = new XmlSerializer(typeof(SerializableStringDictionary));

            if (Section.DefaultProvider == "XmlBlogProvider")
            {
                var stm = (Stream)BlogService.LoadFromDataStore(extensionType, extensionId);
                if (stm != null)
                {
                    ssd = (SerializableStringDictionary)serializer.Deserialize(stm);
                    stm.Close();
                    sd = ssd;
                }
            }
            else
            {
                var o = BlogService.LoadFromDataStore(extensionType, extensionId);
                if (!string.IsNullOrEmpty((string)o))
                {
                    using (var reader = new StringReader((string)o))
                    {
                        ssd = (SerializableStringDictionary)serializer.Deserialize(reader);
                    }

                    sd = ssd;
                }
            }

            return sd;
        }
Ejemplo n.º 30
0
		public XmlTestInfo(bool bReset)
		{
            m_listParameters = new StringDictionary();

            if (bReset)
                Reset();
		}
Ejemplo n.º 31
0
        /// <summary>
        /// リクエスト ヘッダー文字列を生成します。
        /// </summary>
        /// <param name="context">リクエストに使用されるトークンセット。</param>
        /// <param name="method"></param>
        /// <param name="requestUrl"></param>
        /// <param name="queryDictionary"></param>
        /// <returns></returns>
        public static string GenerateRequestHeader(TwitterContext context, string method, string requestUrl, StringDictionary queryDictionary = null)
        {
            Debug.WriteLine("-\t## リクエスト ヘッダーを構築します");

            string header = String.Empty;
            string headerParams = String.Empty;

            var oauth = new OAuthBase();
            string nonce = oauth.GenerateNonce();
            string timeStamp = oauth.GenerateTimeStamp();

            var paramDictionary = new SortedDictionary<string, string>();
            AddPercentEncodedItem(paramDictionary, "oauth_consumer_key", context.ConsumerKey);
            AddPercentEncodedItem(paramDictionary, "oauth_nonce", nonce);
            AddPercentEncodedItem(paramDictionary, "oauth_signature", GenerateSignature(context, method, requestUrl, nonce, "HMAC-SHA1", timeStamp, "1.0", queryDictionary));
            AddPercentEncodedItem(paramDictionary, "oauth_signature_method", "HMAC-SHA1");
            AddPercentEncodedItem(paramDictionary, "oauth_timestamp", timeStamp);
            AddPercentEncodedItem(paramDictionary, "oauth_token", context.AccessToken != null ? context.AccessToken : null);
            AddPercentEncodedItem(paramDictionary, "oauth_version", "1.0");

            foreach (var kvp in paramDictionary)
            {
                if (kvp.Value != null)
                    headerParams += (headerParams.Length > 0 ? ", " : String.Empty) + kvp.Key + "=\"" + kvp.Value + "\"";
            }

            header = "OAuth " + headerParams;

            Debug.WriteLine("-\t## リクエスト ヘッダー構築完了: [Authorization] " + header);
            return header;
        }
 public void SaveSettings(StringDictionary settings)
 {
     settings[Constants.UtilityPath] = txtPath.Text;            
     settings[Constants.EnterpriseServer] = txtEnterpriseServer.Text;
     settings[Constants.Password] = (txtPassword.Text.Length > 0) ? txtPassword.Text : (string)ViewState["PWD"];
     settings[Constants.AdministrationToolService] = txtBesAdminServiceHost.Text;
 }
Ejemplo n.º 33
0
        public void SaveSettings(StringDictionary settings)
        {
            settings["SiteId"] = ddlFtpSite.SelectedValue;
            settings["FtpGroupName"] = txtFtpGroupName.Text.Trim();
			settings["BuildUncFilesPath"] = chkBuildUncFilesPath.Checked.ToString();
            ActiveDirectoryIntegration.SaveSettings(settings);
        }
Ejemplo n.º 34
0
        private System.Collections.Specialized.StringDictionary GetProperties4(string item)
        {
            string statisticsFile = this.StatisticsFile;
            string text           = item + ": ";

            System.Collections.Specialized.StringDictionary result;
            using (StreamReader streamReader = new StreamReader(statisticsFile, Encoding.ASCII))
            {
                string[] array  = null;
                string[] array2 = null;
                string   text2  = string.Empty;
                for (;;)
                {
                    text2 = streamReader.ReadLine();
                    if (!string.IsNullOrEmpty(text2))
                    {
                        if (text2.Length > text.Length && string.CompareOrdinal(text2, 0, text, 0, text.Length) == 0)
                        {
                            if (array != null)
                            {
                                break;
                            }
                            array = text2.Substring(text.Length).Split(new char[]
                            {
                                ' '
                            });
                        }
                    }
                    if (streamReader.EndOfStream)
                    {
                        goto IL_E2;
                    }
                }
                if (array2 != null)
                {
                    throw this.CreateException(statisticsFile, string.Format("Found duplicate line for values for the same item '{0}'", item));
                }
                array2 = text2.Substring(text.Length).Split(new char[]
                {
                    ' '
                });
IL_E2:
                if (array2 == null)
                {
                    throw this.CreateException(statisticsFile, string.Format("No corresponding line was not found for '{0}'", item));
                }
                if (array.Length != array2.Length)
                {
                    throw this.CreateException(statisticsFile, string.Format("The counts in the header line and the value line do not match for '{0}'", item));
                }
                System.Collections.Specialized.StringDictionary stringDictionary = new System.Collections.Specialized.StringDictionary();
                for (int i = 0; i < array.Length; i++)
                {
                    stringDictionary[array[i]] = array2[i];
                }
                result = stringDictionary;
            }
            return(result);
        }
Ejemplo n.º 35
0
    public ExpressionOwner()
    {
        this.InstanceB         = new ArrayList();
        this.InstanceA         = this.InstanceB;
        this.NullField         = null;
        this.DecimalA          = 100;
        this.DecimalB          = 0.25m;
        this.KeyboardA         = new Keyboard();
        this.KeyboardA.StructA = new Mouse("mouse", 123);
        this.KeyboardA.ClassA  = new Monitor();
        this.EncodingA         = System.Text.Encoding.ASCII;
        //this.DelegateA = DoAction;
        this.ICloneableArray   = new string[] { };
        this.ArrayA            = new string[] { };
        this.DelegateANull     = null;
        this.IComparableNull   = null;
        this.IComparableString = "string";
        this.ExceptionA        = new ArgumentException();
        this.ExceptionNull     = null;
        this.ValueTypeStructA  = new TestStruct();
        this.ObjectStringA     = "string";
        this.ObjectIntA        = 100;
        this.IComparableA      = 100.25;
        this.StructA           = new TestStruct();
        this.VersionA          = new System.Version(1, 1, 1, 1);
        this.ICloneableA       = "abc";
        this.GuidA             = Guid.NewGuid();
        this.List = new ArrayList();
        this.List.Add("a");
        this.List.Add(100);
        this.StringDict = new StringDictionary();
        this.StringDict.Add("key", "value");
        this.DoubleA     = 100.25;
        this.SingleA     = 100.25F;
        this.Int32A      = 100000;
        this.StringA     = "string";
        this.BoolA       = true;
        this.TypeA       = typeof(string);
        this.ByteA       = 50;
        this.ByteB       = 2;
        this.SByteA      = -10;
        this.Int16A      = -10;
        this.UInt16A     = 100;
        this.DateTimeA   = new DateTime(2007, 7, 1);
        this.GenericDict = new Dictionary <string, int>();
        this.GenericDict.Add("a", 100);
        this.GenericDict.Add("b", 100);

        this.Dict = new Hashtable();
        this.Dict.Add(100, null /* TODO Change to default(_) if this is not a reference type */);
        this.Dict.Add("abc", null /* TODO Change to default(_) if this is not a reference type */);

        DataTable dt = new DataTable();

        dt.Columns.Add("ColumnA", typeof(int));
        dt.Rows.Add(100);
        this.Row = dt.Rows[0];
    }
Ejemplo n.º 36
0
        private string DictionaryToString(System.Collections.Specialized.StringDictionary dictionary)
        {
            String search = String.Empty;

            foreach (System.Collections.DictionaryEntry entry in dictionary)
            {
                search += "_" + entry.Key + ":" + entry.Value.ToString().Trim();
            }
            return(search);
        }
Ejemplo n.º 37
0
        public static void LearnStringDictionary()
        {
            Console.WriteLine("From LearnStringDictionary Method");
            System.Collections.Specialized.StringDictionary strDict = new System.Collections.Specialized.StringDictionary();
            strDict.Add("Title Case", "Atul");
            strDict.Add("Lower Case", "atul");
            strDict.Add(string.Empty, "ATUL");

            foreach (System.Collections.DictionaryEntry item in strDict)
            {
                Console.WriteLine("   {0,-25} {1}", item.Key, item.Value);
            }
        }
Ejemplo n.º 38
0
        public LoginForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            m_dctDisplayServers = new System.Collections.Specialized.StringDictionary();

            // ADD LOGIN CLUSTERS HERE
            addDisplayServer("TC2", "sdkswg-16-01.starwarsgalaxies.net");
            addDisplayServer("Test", "sdkswg-12-01.starwarsgalaxies.net");
            addDisplayServer("TC5", "ablswg-12-01.starwarsgalaxies.net");
            addDisplayServer("Live", "sdkswg-01-01.starwarsgalaxies.net");
        }
Ejemplo n.º 39
0
    public static void GetArticleParams(GmConnection conn, int articleId, System.Collections.Specialized.StringDictionary sd)
    {
        GmCommand cmd = conn.CreateCommand("select [Key], [Value] from ArticleParams where ArticleId=@ArticleId");

        cmd.AddInt("ArticleId", articleId);
        using (GmDataReader dr = cmd.ExecuteReader())
        {
            while (dr.Read())
            {
                var key = dr.GetString();
                var val = dr.GetString();
                sd[key] = val;
            }
        }
    }
Ejemplo n.º 40
0
 static System.Collections.Specialized.StringDictionary find_device(System.Collections.Specialized.StringDictionary[] vdata, string last_4_imei)
 {
     System.Collections.Specialized.StringDictionary ret = null;
     foreach (System.Collections.Specialized.StringDictionary sd in vdata)
     {
         if (sd.ContainsKey("imei"))
         {
             string s = sd["imei"];
             if (s.Length > 4 && string.Compare(last_4_imei, s.Substring(s.Length - 4)) == 0)
             {
                 ret = sd;
                 break;
             }
         }
     }
     return(ret);
 }
Ejemplo n.º 41
0
        static void start_server(System.Threading.EventWaitHandle quit, System.Collections.Specialized.StringDictionary args)
        {
            int port = getFreePort();

            try
            {
                Uri            baseAddress = new Uri(string.Format("http://localhost:{0}/", port));
                WebServiceHost svcHost     = new WebServiceHost(typeof(Program), baseAddress);
                WebHttpBinding b           = new WebHttpBinding();
                b.Name = "FDRedis";
                b.HostNameComparisonMode = HostNameComparisonMode.Exact;
                svcHost.AddServiceEndpoint(typeof(IFDRedis), b, "");
                svcHost.Open();
                logIt($"WebService is running at http://localhost:{port}/");
                System.Console.WriteLine($"WebService is running at http://localhost:{port}/");
                quit.WaitOne();
                logIt("Service is going to terminated.");
                svcHost.Close();
            }
            catch (Exception) {  }
        }
Ejemplo n.º 42
0
        private System.Collections.Specialized.StringDictionary GetProperties6(string item)
        {
            if (!File.Exists(this.StatisticsFileIPv6))
            {
                throw new NetworkInformationException();
            }
            string statisticsFileIPv = this.StatisticsFileIPv6;

            System.Collections.Specialized.StringDictionary result;
            using (StreamReader streamReader = new StreamReader(statisticsFileIPv, Encoding.ASCII))
            {
                System.Collections.Specialized.StringDictionary stringDictionary = new System.Collections.Specialized.StringDictionary();
                string text = string.Empty;
                for (;;)
                {
                    text = streamReader.ReadLine();
                    if (!string.IsNullOrEmpty(text))
                    {
                        if (text.Length > item.Length && string.CompareOrdinal(text, 0, item, 0, item.Length) == 0)
                        {
                            int num = text.IndexOfAny(MibIPGlobalProperties.wsChars, item.Length);
                            if (num < 0)
                            {
                                break;
                            }
                            stringDictionary[text.Substring(item.Length, num - item.Length)] = text.Substring(num + 1).Trim(MibIPGlobalProperties.wsChars);
                        }
                    }
                    if (streamReader.EndOfStream)
                    {
                        goto Block_7;
                    }
                }
                throw this.CreateException(statisticsFileIPv, null);
Block_7:
                result = stringDictionary;
            }
            return(result);
        }
Ejemplo n.º 43
0
 void IAttributesConfigurable.Configure(System.Collections.Specialized.StringDictionary attributes)
 {
     if (attributes.ContainsKey(BrowseRootAttribute))
     {
         root = (BrowseRoot)Enum.Parse(typeof(BrowseRoot), attributes[BrowseRootAttribute]);
     }
     if (attributes.ContainsKey(BrowseKindAttribute))
     {
         kind = (BrowseKind)Enum.Parse(typeof(BrowseKind), attributes[BrowseKindAttribute]);
     }
     if (attributes.ContainsKey(FilterAttribute))
     {
         filterTypeName = attributes[FilterAttribute];
     }
     if (attributes.ContainsKey(RootAttribute))
     {
         customRootEntryName = attributes[RootAttribute];
     }
     if (attributes.ContainsKey(UserCodeAttribute))
     {
         onlyUserCode = Boolean.Parse(attributes[UserCodeAttribute]);
     }
     this.attributes = attributes;
 }
Ejemplo n.º 44
0
        protected override bool TryBasicResponse(NetContext context, StringDictionary requestHeaders, string requestLine, System.Collections.Specialized.StringDictionary responseHeaders, out HttpStatusCode code, out string body)
        {
            var match = GetRequestRegex.Match(requestLine);

            if (match.Success && Uri.TryCreate(match.Groups[1].Value.Trim(), UriKind.RelativeOrAbsolute, out Uri uri))
            {
                switch (uri.OriginalString)
                {
                case "/ping":
                    code = HttpStatusCode.OK;
                    body = "Ping response from custom factory";
                    return(true);
                }
            }
            return(base.TryBasicResponse(context, requestHeaders, requestLine, responseHeaders, out code, out body));
        }
Ejemplo n.º 45
0
    public static System.Diagnostics.Process RunProcess(string path, string arguments, System.Collections.Specialized.StringDictionary env)
    {
        System.Diagnostics.Process process = CreateProcess(path, arguments, env);

        if (DebugProcesses)
        {
            Debug.Log(string.Format("[Run Process] filename={0} arguments={1}", process.StartInfo.FileName, process.StartInfo.Arguments));
        }

        DateTime startTime = DateTime.Now;

        process.Start();

        if (DebugProcesses)
        {
            Debug.Log(string.Format("[Results] PID:{0} elapsed:{1}", process.Id, (DateTime.Now - startTime).TotalSeconds));
        }

        return(process);
    }
Ejemplo n.º 46
0
    // saves the food calculations to session
    public void saveCalcToSession(int gender)
    {
        System.Collections.Generic.Dictionary <string, double> foo = new System.Collections.Generic.Dictionary <string, double>();
        foo["sugar"]   = 0;
        foo["fruits"]  = 0;
        foo["calcium"] = 0;
        foo["iron"]    = 0;
        foo["carbo"]   = 0;
        foo["protein"] = 0;
        foo["alcohol"] = 0;
        foo["gFat"]    = 0;
        foo["fat"]     = 0;
        foo["habits"]  = 0;

        if (HttpContext.Current.Session["habits"] != null)
        {
            string[] bar = (string[])HttpContext.Current.Session["habits"];

            for (int i = 0; i < 5; i++)
            {
                foo["habits"] += Convert.ToInt32(bar[i]);
            }
        }

        if (HttpContext.Current.Session["foodVars"] != null)
        {
            DataSet fds = (DataSet)HttpContext.Current.Session["foodVars"];

            // add up all the food values
            foreach (DataRow dr in fds.Tables[0].Rows)
            {
                int    foodid = (int)dr["foodid"];
                double qt     = (double)dr["Quantity"];

                // get the food statistics from db
                dops.ResetDops();
                dops.Sproc = "usp_getFoodPropertiesByID";
                dops.SetParameter("foodid", foodid, "input");

                DataRow result = dops.get_dataset().Tables[0].Rows[0];
                foo["sugar"]   += (double)result["sothersugar"] * qt;
                foo["fruits"]  += ((double)result["sfruit"] * qt) + ((double)result["sveg"] * qt);
                foo["calcium"] += (double)result["mgca"] * qt;
                foo["iron"]    += (double)result["mgiron"] * qt;
                foo["carbo"]   += (double)result["gcarbo"] * qt;
                foo["protein"] += (double)result["gprotein"] * qt;
                foo["alcohol"] += (double)result["galcohol"] * qt;
                foo["gFat"]    += (double)result["gfat"] * qt;

                foo["fat"] += PercentFat(foo["carbo"], foo["gFat"], foo["protein"], foo["alcohol"]);
            }

            // compare them against the goals table
            dops.ResetDops();
            dops.Sproc = "usp_GetOptimalGoalsByGender";
            dops.SetParameter("gender", gender, "input");

            DataTable myresult = dops.get_dataset().Tables[0];
            //System.Collections.Generic.Dictionary<int, int> vscore = new System.Collections.Generic.Dictionary<int,int>();
            System.Collections.Specialized.StringDictionary[] vscore = new System.Collections.Specialized.StringDictionary[6];

            // apparently this really helps
            for (int i = 0; i < 6; i++)
            {
                vscore[i] = new System.Collections.Specialized.StringDictionary();
            }

            string[] keys = { "fat", "sugar", "fruits", "iron", "calcium", "habits" };

            foreach (DataRow dr in myresult.Rows)
            {
                int i = 0;

                foreach (string k in keys)
                {
                    if (foo[k] >= (double)dr[string.Format("{0}min", k)] && foo[k] <= (double)dr[String.Format("{0}max", k)])
                    {
                        vscore[i][k] = dr["score"].ToString();
                    }

                    i++;
                }
            }

            // now save vscore to session
            HttpContext.Current.Session["vScore"] = vscore;
        }
    }
Ejemplo n.º 47
0
        /**
         * This starts a linking operation on the given edge
         */
        public IDictionary Start(IDictionary link_message, ISender edge)
        {
            if (ProtocolLog.LinkDebug.Enabled)
            {
                ProtocolLog.Write(ProtocolLog.LinkDebug, String.Format(
                                      "{0} -start- sys:link.Start", _node.Address));
            }

            Edge        from = GetEdge(edge);
            LinkMessage lm   = new LinkMessage(link_message);

            if (ProtocolLog.LinkDebug.Enabled)
            {
                ProtocolLog.Write(ProtocolLog.LinkDebug, String.Format(
                                      "{0} -args- sys:link.Start({1},{2})", _node.Address, lm, from));
            }

            CphState cph = new CphState(from, lm);

            lock ( _sync ) {
                if (!_edge_to_cphstate.ContainsKey(from))
                {
                    _edge_to_cphstate[from] = cph;
                }
                else
                {
                    throw new AdrException((int)ErrorMessage.ErrorCode.InProgress,
                                           "Already have a link in progress on this edge");
                }
            }
            ErrorMessage err = null;

            if (CanConnect(cph, out err))
            {
                try {
                    //If the CloseEvent was already called, this throws an exception
                    from.CloseEvent += this.CloseHandler;
                }
                catch {
                    CloseHandler(from, null);
                    throw new AdrException((int)ErrorMessage.ErrorCode.EdgeClosed,
                                           "Edge Closed after receiving message");
                }
            }
            else
            {
                lock ( _sync ) {
                    _edge_to_cphstate.Remove(from);
                }
            }
            //Now we prepare our response
            LinkMessage lm_resp = null;

            if (err == null)
            {
                //We send a response:
                NodeInfo n_info      = NodeInfo.CreateInstance(_node.Address, from.LocalTA);
                NodeInfo remote_info = NodeInfo.CreateInstance(null, from.RemoteTA);
                System.Collections.Specialized.StringDictionary attrs =
                    new System.Collections.Specialized.StringDictionary();
                attrs["type"]  = String.Intern(lm.ConTypeString);
                attrs["realm"] = String.Intern(_node.Realm);
                lm_resp        = new LinkMessage(attrs, n_info, remote_info, lm.Token);
            }
            else
            {
                if (err.Ec == ErrorMessage.ErrorCode.AlreadyConnected)
                {
                    /**
                     * When we send the ErrorCode.AlreadyConnected,
                     * we could have a stale connection, lets try pinging
                     * the other node, if they are there, but have lost
                     * the Edge, this may trigger the edge to close, causing
                     * us to remove the Connection.
                     * @todo consider putting this address on a "fast track"
                     * to removal if we don't hear from it soon
                     */
                    ConnectionTable tab = _node.ConnectionTable;
                    Connection      c   = tab.GetConnection(lm.ConnectionType,
                                                            lm.Local.Address);
                    if (c != null)
                    {
                        RpcManager rpc = _node.Rpc;
                        rpc.Invoke(c.Edge, null, "sys:link.Ping", String.Empty);
                    }
                }
            }
            if (err != null)
            {
                throw new AdrException((int)err.Ec, err.Message);
            }
            if (ProtocolLog.LinkDebug.Enabled)
            {
                ProtocolLog.Write(ProtocolLog.LinkDebug, String.Format(
                                      "{0} -end- sys:link.Start()->{1}", _node.Address, lm_resp));
            }
            return(lm_resp.ToDictionary());
        }
Ejemplo n.º 48
0
 public IAsyncResult BeginScheduleProcess(string replyUri, int processId, string commandLine, System.Collections.Specialized.StringDictionary environment, AsyncCallback callback, object state)
 {
     return(base.Channel.BeginScheduleProcess(replyUri, processId, commandLine, environment, callback, state));
 }
Ejemplo n.º 49
0
 public bool ScheduleProcess(string replyUri, int processId, string commandLine, System.Collections.Specialized.StringDictionary environment)
 {
     return(base.Channel.ScheduleProcess(replyUri, processId, commandLine, environment));
 }
Ejemplo n.º 50
0
 public MibIPGlobalStatistics(System.Collections.Specialized.StringDictionary dic)
 {
     this.dic = dic;
 }
Ejemplo n.º 51
0
    ///////////////////////////////////////////////////////////////////
    protected void get_settings()
    {
        write_line("get_settings");

        websites = new ArrayList();
        StringDictionary settings = null;

        string        filename = config_file;
        XmlTextReader tr       = null;

        try
        {
            tr = new XmlTextReader(filename);
            while (tr.Read())
            {
                //continue;
                if (tr.Name == "add")
                {
                    string key = tr["key"];

                    if (key == "FetchIntervalInMinutes")
                    {
                        write_line(key + "=" + tr["value"]);
                        FetchIntervalInMinutes = Convert.ToInt32(tr["value"]);
                    }
                    else if (key == "TotalErrorsAllowed")
                    {
                        write_line(key + "=" + tr["value"]);
                        TotalErrorsAllowed = Convert.ToInt32(tr["value"]);
                    }
                    else if (key == "ReadInputStreamCharByChar")
                    {
                        write_line(key + "=" + tr["value"]);
                        ReadInputStreamCharByChar = Convert.ToInt32(tr["value"]);
                    }
                    else if (key == "LogFileFolder")
                    {
                        write_line(key + "=" + tr["value"]);
                        LogFileFolder = Convert.ToString(tr["value"]);
                    }
                    else if (key == "LogEnabled")
                    {
                        write_line(key + "=" + tr["value"]);
                        LogEnabled = Convert.ToInt32(tr["value"]);
                    }
                    else if (key == "EnableWatchdogThread")
                    {
                        write_line(key + "=" + tr["value"]);
                        EnableWatchdogThread = Convert.ToInt32(tr["value"]);
                    }
                    else if (key == "RespawnFetchingThreadAfterNSecondsOfInactivity")
                    {
                        write_line(key + "=" + tr["value"]);
                        RespawnFetchingThreadAfterNSecondsOfInactivity = Convert.ToInt32(tr["value"]);
                    }
                    else
                    {
                        if (key == "ConnectionString" ||
                            key == "Pop3Server" ||
                            key == "Pop3Port" ||
                            key == "Pop3UseSSL" ||
                            key == "SubjectMustContain" ||
                            key == "SubjectCannotContain" ||
                            key == "FromMustContain" ||
                            key == "FromCannotContain" ||
                            key == "DeleteMessagesOnServer" ||
                            key == "FetchIntervalInMinutes" ||
                            key == "InsertBugUrl" ||
                            key == "ServiceUsername" ||
                            key == "ServicePassword" ||
                            key == "TrackingIdString" ||
                            key == "MessageInputFile" ||
                            key == "MessageOutputFile")
                        {
                            write_line(key + "=" + tr["value"]);
                            if (settings != null)
                            {
                                settings[key] = tr["value"];
                            }
                        }
                    }
                    // else an uninteresting setting
                }
                else
                {
                    // create a new dictionary of settings each time we encounter a new Website section
                    if (tr.Name.ToLower() == "website" && tr.NodeType == XmlNodeType.Element)
                    {
                        settings = new System.Collections.Specialized.StringDictionary();
                        settings["MessageInputFile"]       = "";
                        settings["MessageOutputFile"]      = "";
                        settings["ConnectionString"]       = "";
                        settings["Pop3Server"]             = "";
                        settings["Pop3Port"]               = "";
                        settings["Pop3UseSSL"]             = "";
                        settings["SubjectMustContain"]     = "";
                        settings["SubjectCannotContain"]   = "";
                        settings["FromMustContain"]        = "";
                        settings["FromCannotContain"]      = "";
                        settings["DeleteMessagesOnServer"] = "";
                        settings["InsertBugUrl"]           = "";
                        settings["ServiceUsername"]        = "";
                        settings["ServicePassword"]        = "";
                        settings["TrackingIdString"]       = "";
                        websites.Add(settings);
                        write_line("*** loading settings for website " + Convert.ToString(websites.Count));
                    }
                }
            }
        }
        catch (Exception e)
        {
            write_line("Error trying to read file: " + filename);
            write_line(e);
        }

        tr.Close();
    }
Ejemplo n.º 52
0
 /// <summary>
 /// Save the settings to the current provider.
 /// </summary>
 public static void SaveSettings(System.Collections.Specialized.StringDictionary settings)
 {
     LoadProviders();
     _provider.SaveSettings(settings);
 }
Ejemplo n.º 53
0
    public static GoodProcessThread RunProcessThread(string path, string arguments, Action <GoodProcessThread> completeCallback, System.Collections.Specialized.StringDictionary env)
    {
        GoodProcessThread worker = new GoodProcessThread(path, arguments, completeCallback, env);

        worker.Thread = new Thread(worker.Work)
        {
            IsBackground = true,
            Priority     = ThreadPriority
        };
        worker.Thread.Start();

        return(worker);
    }
Ejemplo n.º 54
0
    public static System.Diagnostics.Process CreateProcess(string path, string arguments, System.Collections.Specialized.StringDictionary env)
    {
        System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(path, arguments)
        {
            WindowStyle            = System.Diagnostics.ProcessWindowStyle.Hidden,
            UseShellExecute        = false,
            ErrorDialog            = false,
            CreateNoWindow         = true,
            RedirectStandardError  = true,
            RedirectStandardInput  = true,
            RedirectStandardOutput = true,
            LoadUserProfile        = true
        };

        if (null != env)
        {
            foreach (System.Collections.DictionaryEntry kvp in env)
            {
                string key = (string)kvp.Key;
                string val = (string)kvp.Value;

                //Debug.Log(string.Format("key={0} val={1}", key, val));
                startInfo.EnvironmentVariables[key] = val;
            }
        }

        return(new System.Diagnostics.Process()
        {
            StartInfo = startInfo
        });
    }