예제 #1
2
		protected virtual string FormatCommentOn(string sql)
		{
			StringBuilder result = new StringBuilder(60).Append(Indent1);
			IEnumerator<string> tokens = (new StringTokenizer(sql, " '[]\"", true)).GetEnumerator();

			bool quoted = false;
			while (tokens.MoveNext())
			{
				string token = tokens.Current;
				result.Append(token);
				if (IsQuote(token))
				{
					quoted = !quoted;
				}
				else if (!quoted)
				{
					if ("is".Equals(token))
					{
						result.Append(Indent2);
					}
				}
			}

			return result.ToString();
		}
예제 #2
1
    protected void Page_Load(object sender, EventArgs e)
    {
        ReciboBE reciboBE;

        //if (Session["ReciboBE"] != null)
        //{
        reciboBE = Session["ReciboBE"] as ReciboBE;
        //}

        CarregaProfissional(Convert.ToInt32(reciboBE.RefProfissionalBE.id));
        lblReciboNumero.Text = Convert.ToString(reciboBE.id);
        lblValorTotalCabecalho.Text = String.Format("{0:C2}", reciboBE.ValorTotal);
        lblValorTotal.Text = String.Format("{0:C2}", reciboBE.ValorTotal);
        lblSessoesQtd.Text = Convert.ToString(reciboBE.RefReciboAgendamentoSessoesBE.Count.ToString("00"));
        lblPacienteNome.Text = Convert.ToString(reciboBE.PacienteNome);
        //Pego a possicao zero da lista de sessooes
        lblValorSessao.Text = String.Format("{0:C2}", reciboBE.RefReciboAgendamentoSessoesBE[0].Valor);

        StringBuilder sb = new System.Text.StringBuilder();
        for (int i = 0; i < reciboBE.RefReciboAgendamentoSessoesBE.Count; i++)
        {
            if (i > 0)
                sb.Append(", ");

            sb.Append(reciboBE.RefReciboAgendamentoSessoesBE[i].Data.ToString("dd/MM/yyyy"));
        }

        lblDatas.Text = Convert.ToString(sb);

        DataExtenso();
    }
        public string Visit(string text)
        {
            text = text.Trim();

            var lines = new List<string>();
            using (var stringReader = new StringReader(text))
            {
                string line;
                while ((line = stringReader.ReadLine()) != null)
                {
                    line = line.Trim();
                    lines.Add(line);
                }
            }

            lines.Sort();

            var stringBuilder = new StringBuilder();
            foreach (var line in lines)
            {
                stringBuilder.AppendLine(line);
            }

            return stringBuilder.ToString();
        }
예제 #4
1
 public static object MediaHelper(string image)
 {
     var sb = new StringBuilder();
     sb.Append(ConfigurationManager.AppSettings["MediaPath"]);
     sb.Append(image);
     return new MvcHtmlString(sb.ToString());
 }
        /// <summary> Renders the HTML for this element </summary>
        /// <param name="Output"> Textwriter to write the HTML for this element </param>
        /// <param name="Bib"> Object to populate this element from </param>
        /// <param name="Skin_Code"> Code for the current skin </param>
        /// <param name="isMozilla"> Flag indicates if the current browse is Mozilla Firefox (different css choices for some elements)</param>
        /// <param name="popup_form_builder"> Builder for any related popup forms for this element </param>
        /// <param name="Current_User"> Current user, who's rights may impact the way an element is rendered </param>
        /// <param name="CurrentLanguage"> Current user-interface language </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="Base_URL"> Base URL for the current request </param>
        /// <remarks> This simple element does not append any popup form to the popup_form_builder</remarks>
        public override void Render_Template_HTML(TextWriter Output, SobekCM_Item Bib, string Skin_Code, bool isMozilla, StringBuilder popup_form_builder, User_Object Current_User, Web_Language_Enum CurrentLanguage, Language_Support_Info Translator, string Base_URL )
        {
            // Check that an acronym exists
            if (Acronym.Length == 0)
            {
                const string defaultAcronym = "Enter the name(s) of the publisher(s) of the larger body of work. If your work is currently unpublished, you may enter your name as the publisher or leave the field blank. If you are adding administrative material (newsletters, handbooks, etc.) on behalf of a department within the university, enter the name of your department as the publisher.";
                switch (CurrentLanguage)
                {
                    case Web_Language_Enum.English:
                        Acronym = defaultAcronym;
                        break;

                    case Web_Language_Enum.Spanish:
                        Acronym = defaultAcronym;
                        break;

                    case Web_Language_Enum.French:
                        Acronym = defaultAcronym;
                        break;

                    default:
                        Acronym = defaultAcronym;
                        break;
                }
            }

            List<string> instanceValues = new List<string>();
            if (Bib.Bib_Info.Publishers_Count > 0)
            {
                instanceValues.AddRange(Bib.Bib_Info.Publishers.Select(thisName => thisName.Name));
            }

            render_helper(Output, instanceValues, Skin_Code, Current_User, CurrentLanguage, Translator, Base_URL);
        }
예제 #6
1
		/// <summary>
		/// 	Concatenates any given IEnumerable to joined string, null-ignorance
		/// </summary>
		/// <param name="objects"> any set of objects of any type </param>
		/// <param name="delimiter"> delimiter between strings </param>
		/// <param name="empties"> true - empties included in result </param>
		/// <param name="nullstring"> null replacer (null by default) </param>
		/// <param name="useTrailDelimiters"> if true - trail delimiters will be generated </param>
		/// <returns> </returns>
		public string ConcatString(IEnumerable objects, string delimiter, bool empties = true,
		                           string nullstring = null,
		                           bool useTrailDelimiters = false) {
			if (null == objects) {
				return string.Empty;
			}
			if (null == delimiter) {
				delimiter = string.Empty;
			}
			var result = new StringBuilder();
			if (useTrailDelimiters) {
				result.Append(delimiter);
			}
			var first = true;
			foreach (var obj in objects) {
				var val = obj.ToStr();
				if (val.IsEmpty() && !empties) {
					continue;
				}
				if (null == obj && null != nullstring) {
					val = nullstring;
				}
				if (!first) {
					result.Append(delimiter);
				}
				if (first) {
					first = false;
				}
				result.Append(val);
			}
			if (useTrailDelimiters) {
				result.Append(delimiter);
			}
			return result.ToString();
		}
예제 #7
1
 public static IEnumerable<string> GetHelp(ScriptSession session, string command)
 {
     Collection<PSParseError> errors;
     var tokens = PSParser.Tokenize(command, out errors);
     var lastPsToken = tokens.LastOrDefault(t => t.Type == PSTokenType.Command);
     if (lastPsToken != null)
     {
         session.Output.Clear();
         var lastToken = lastPsToken.Content;
         session.SetVariable("helpFor", lastToken);
         var platformmodule = ModuleManager.GetModule("Platform");
         var scriptItem = Database.GetDatabase(platformmodule.Database)
             .GetItem(platformmodule.Path + "/Internal/Context Help/Command Help");
         if (scriptItem == null)
         {
             scriptItem = Factory.GetDatabase(ApplicationSettings.ScriptLibraryDb)
                 .GetItem(ApplicationSettings.ScriptLibraryPath + "Internal/Context Help/Command Help");
         }
         session.ExecuteScriptPart(scriptItem[ScriptItemFieldNames.Script], true, true);
         var sb = new StringBuilder("<div id=\"HelpClose\">X</div>");
         if (session.Output.Count == 0 || session.Output[0].LineType == OutputLineType.Error)
         {
             return new[]
             {
                 "<div class='ps-help-command-name'>&nbsp;</div><div class='ps-help-header' align='center'>No Command in line or help information found</div><div class='ps-help-parameter' align='center'>Cannot provide help in this context.</div>"
             };
         }
         session.Output.ForEach(l => sb.Append(l.Text));
         session.Output.Clear();
         var result = new[] {sb.ToString()};
         return result;
     }
     return new[] {"No Command in line found - cannot provide help in this context."};
 }
예제 #8
1
		public string Replace (string str)
		{
			if (string.IsNullOrEmpty (str)) {
				return str;
			}

			System.Text.StringBuilder formatted = new System.Text.StringBuilder ();

			int lastMatch = 0;

			string variable;
			string replacement;
			foreach (System.Text.RegularExpressions.Match m in re.Matches(str)) {

				formatted.Append (str.Substring (lastMatch, m.Index - lastMatch));

				variable = m.Groups [1].Value;
				if (vars.TryGetValue (variable, out replacement))
					formatted.Append (this.Replace (replacement));
				else
                    throw new ObfuscarException("Unable to replace variable:  " + variable);

				lastMatch = m.Index + m.Length;
			}

			formatted.Append (str.Substring (lastMatch));

			return formatted.ToString ();
		}
예제 #9
1
        /// <summary/>
        protected CodeFormat()
        {
            //generate the keyword and preprocessor regexes from the keyword lists
            var r = new Regex(@"\w+|-\w+|#\w+|@@\w+|#(?:\\(?:s|w)(?:\*|\+)?\w+)+|@\\w\*+");
            string regKeyword = r.Replace(Keywords, @"(?<=^|\W)$0(?=\W)");
            string regPreproc = r.Replace(Preprocessors, @"(?<=^|\s)$0(?=\s|$)");
            r = new Regex(@" +");
            regKeyword = r.Replace(regKeyword, @"|");
            regPreproc = r.Replace(regPreproc, @"|");

            if (regPreproc.Length == 0)
            {
                regPreproc = "(?!.*)_{37}(?<!.*)"; //use something quite impossible...
            }

            //build a master regex with capturing groups
            var regAll = new StringBuilder();
            regAll.Append("(");
            regAll.Append(CommentRegex);
            regAll.Append(")|(");
            regAll.Append(StringRegex);
            if (regPreproc.Length > 0)
            {
                regAll.Append(")|(");
                regAll.Append(regPreproc);
            }
            regAll.Append(")|(");
            regAll.Append(regKeyword);
            regAll.Append(")");

            RegexOptions caseInsensitive = CaseSensitive ? 0 : RegexOptions.IgnoreCase;
            CodeRegex = new Regex(regAll.ToString(), RegexOptions.Singleline | caseInsensitive);
        }
예제 #10
1
    void GenerateCode(string name)
    {
        System.Text.StringBuilder builder = new System.Text.StringBuilder ();
        builder.AppendLine ("using UnityEngine;");
        builder.AppendLine ("using System.Collections;");
        builder.AppendLine ("");
        builder.AppendLine ("public class " + name + " : State {");
        builder.AppendLine ("");
        builder.AppendLine ("public override void StateStart ()");
        builder.AppendLine ("{");
        builder.AppendLine ("	Debug.Log (this.ToString() + \" Start!\");");
        builder.AppendLine ("");
        builder.AppendLine ("}");
        builder.AppendLine ("");
        builder.AppendLine ("public override void StateUpdate ()");
        builder.AppendLine ("{");
        builder.AppendLine ("");
        builder.AppendLine ("	if(Input.GetKeyDown(KeyCode.A)){");
        builder.AppendLine ("		this.EndState();");
        builder.AppendLine ("	}");
        builder.AppendLine ("	");
        builder.AppendLine ("}");
        builder.AppendLine ("");
        builder.AppendLine ("public override void StateDestroy ()");
        builder.AppendLine ("{");
        builder.AppendLine ("	Debug.Log (this.ToString() + \" Destroy!\");");
        builder.AppendLine ("}");
        builder.AppendLine ("");
        builder.AppendLine ("}");

        System.IO.File.WriteAllText (ScriptsPath + "/" + name + ".cs", builder.ToString (), System.Text.Encoding.UTF8);
        AssetDatabase.Refresh (ImportAssetOptions.ImportRecursive);
    }
예제 #11
1
 /// <summary>
 /// 分配角色模块菜单权限
 /// </summary>
 /// <param name="KeyValue">主键值</param>
 /// <param name="RoleId">角色主键</param>
 /// <param name="CreateUserId">操作用户主键</param>
 /// <param name="CreateUserName">操作用户</param>
 /// <returns></returns>
 public bool AddModulePermission(string[] KeyValue, string RoleId, string CreateUserId, string CreateUserName)
 {
     //return dal.AddModulePermission(KeyValue, RoleId, CreateUserId, CreateUserName) >= 0 ? true : false;
     StringBuilder[] sqls = new StringBuilder[KeyValue.Length + 1];
     object[] objs = new object[KeyValue.Length + 1];
     sqls[0] = SqlParamHelper.DeleteSql("AMS_RoleMenu", "RoleId");
     objs[0] = new SqlParam[] { new SqlParam("@RoleId", RoleId) };
     int index = 1;
     foreach (string item in KeyValue)
     {
         if (item.Length > 0)
         {
             AMS_RoleMenu entity = new AMS_RoleMenu();
             entity.RoleMenuId = CommonHelper.GetGuid;
             entity.RoleId = RoleId;
             entity.MenuId = item;
             entity.CreateUserId = CreateUserId;
             entity.CreateUserName = CreateUserName;
             sqls[index] = SqlParamHelper.InsertSql(entity);
             objs[index] = SqlParamHelper.GetParameter(entity);
             index++;
         }
     }
     int IsOK = DbHelper.BatchExecuteBySql(sqls, objs);
     return IsOK >= 0 ? true : false;
 }
예제 #12
1
        // Create an md5 sum string of this string
        public static string GetMd5Sum(this string str)
        {
            // First we need to convert the string into bytes, which
            // means using a text encoder.
            Encoder enc = System.Text.Encoding.Unicode.GetEncoder();

            // Create a buffer large enough to hold the string
            byte[] unicodeText = new byte[str.Length * 2];
            enc.GetBytes(str.ToCharArray(), 0, str.Length, unicodeText, 0, true);

            // Now that we have a byte array we can ask the CSP to hash it
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] result = md5.ComputeHash(unicodeText);

            // Build the final string by converting each byte
            // into hex and appending it to a StringBuilder
            var sb = new StringBuilder();
            for (int i = 0; i < result.Length; i++)
            {
                sb.Append(result[i].ToString("X2"));
            }

            // And return it
            return sb.ToString();
        }
예제 #13
1
 public string ReadNext(bool peek = false)
 {
     var isInQuote = false;
     var curToken = new StringBuilder();
     int i;
     for (i = 0; i < _cmd.Length; i++)
     {
         if (isInQuote && _cmd[i] == '"' && i < _cmd.Length - 1 && _cmd[i + 1] == '"')
         {
             curToken.Append('"');
             i++;
             continue;
         }
         if (isInQuote == false && _cmd[i] == '"')
             isInQuote = true;
         else if (isInQuote && _cmd[i] == '"')
         {
             i++;
             break;
         }
         else if (_cmd[i] == ' ' && isInQuote == false)
             break;
         else
             curToken.Append(_cmd[i]);
     }
     if (peek == false)
     {
         _cmd = _cmd.Substring(i);
         _cmd = _cmd.TrimStart();
     }
     return curToken.ToString();
 }
예제 #14
1
 public string GetDetails()
 {
     StringBuilder sb = new StringBuilder();
     sb.AppendLine("This demo shows how to setup complex collision scenerios.");
     sb.AppendLine("In this demo:");
     sb.AppendLine("  - Circles and rectangles are set to only collide with themselves.");
     sb.AppendLine("  - Stars are set to collide with gears.");
     sb.AppendLine("  - Gears are set to collide with stars.");
     sb.AppendLine("  - The agent is set to collide with everything but stars");
     sb.AppendLine(string.Empty);
     sb.AppendLine("GamePad:");
     sb.AppendLine("  - Rotate agent: left and right triggers");
     sb.AppendLine("  - Move agent: right thumbstick");
     sb.AppendLine("  - Move cursor: left thumbstick");
     sb.AppendLine("  - Grab object (beneath cursor): A button");
     sb.AppendLine("  - Drag grabbed object: left thumbstick");
     sb.AppendLine("  - Exit to menu: Back button");
     sb.AppendLine(string.Empty);
     sb.AppendLine("Keyboard:");
     sb.AppendLine("  - Rotate agent: left and right arrows");
     sb.AppendLine("  - Move agent: A,S,D,W");
     sb.AppendLine("  - Exit to menu: Escape");
     sb.AppendLine(string.Empty);
     sb.AppendLine("Mouse / Touchscreen");
     sb.AppendLine("  - Grab object (beneath cursor): Left click");
     sb.AppendLine("  - Drag grabbed object: move mouse / finger");
     return sb.ToString();
 }
 public static string CloneCmd(string fromSvn, string toPath, string username, 
     string authorsFile, int fromRevision, 
     string trunk, string tags, string branches)
 {
     toPath = GitCommandHelpers.FixPath(toPath);
     StringBuilder sb = new StringBuilder();
     sb.AppendFormat("{0} clone \"{1}\" \"{2}\"", SvnPrefix, fromSvn, toPath);
     if (!string.IsNullOrEmpty(username))
     {
         sb.AppendFormat(" --username=\"{0}\"", username);
     }
     if (!string.IsNullOrEmpty(authorsFile))
     {
         sb.AppendFormat(" --authors-file=\"{0}\"", authorsFile);
     }
     if (fromRevision != 0)
     {
         sb.AppendFormat(" -r \"{0}\"", fromRevision);
     }
     if (!string.IsNullOrEmpty(trunk))
     {
         sb.AppendFormat(" --trunk=\"{0}\"", trunk);
     }
     if (!string.IsNullOrEmpty(tags))
     {
         sb.AppendFormat(" --tags=\"{0}\"", tags);
     }
     if (!string.IsNullOrEmpty(branches))
     {
         sb.AppendFormat(" --branches=\"{0}\"", branches);
     }
     return sb.ToString();
 }
예제 #16
1
        internal override StringBuilder AsEsql(StringBuilder builder, bool isTopLevel, int indentLevel)
        {
            // The SELECT/DISTINCT part.
            StringUtil.IndentNewLine(builder, indentLevel);
            builder.Append("SELECT ");
            if (m_selectDistinct == CellQuery.SelectDistinct.Yes)
            {
                builder.Append("DISTINCT ");
            }
            GenerateProjectionEsql(builder, m_nodeTableAlias, true, indentLevel, isTopLevel);

            // Get the FROM part.
            builder.Append("FROM ");
            CqlWriter.AppendEscapedQualifiedName(builder, m_extent.EntityContainer.Name, m_extent.Name);
            builder.Append(" AS ").Append(m_nodeTableAlias);

            // Get the WHERE part only when the expression is not simply TRUE.
            if (!BoolExpression.EqualityComparer.Equals(WhereClause, BoolExpression.True))
            {
                StringUtil.IndentNewLine(builder, indentLevel);
                builder.Append("WHERE ");
                WhereClause.AsEsql(builder, m_nodeTableAlias);
            }

            return builder;
        }
        public override string ToString()
        {
            if (PageCount == 1)
                return "";

            var sb = new StringBuilder(512);

            sb.Append(@"<div class=""");
            sb.Append(CssClass);
            sb.Append(@""">");

            foreach (int pageSize in PageSizes)
            {
                sb.Append(@"<a href=""");
                sb.Append(HRef.Replace("pagesize=-1", "pagesize=" + pageSize));
                sb.Append(@""" title=""");
                sb.Append("show ");
                sb.Append(pageSize);
                sb.Append(@" items per page""");
                if (pageSize == CurrentPageSize)
                    sb.Append(@" class=""current page-numbers""");
                else
                    sb.Append(@" class=""page-numbers""");
                sb.Append(">");
                sb.Append(pageSize);
                sb.AppendLine("</a>");
            }
            sb.AppendLine(@"<span class=""page-numbers desc"">per page</span>");
            sb.Append("</div>");

            return sb.ToString();
        }
예제 #18
1
 public override void AsText(StringBuilder b, int pad)
 {
     b.Append(' ', pad);
     b.AppendLine("JewelerDataInitialMessage:");
     b.Append(' ', pad++);
     b.Append(CrafterData.ToString());
 }
예제 #19
1
		protected virtual string FormatAlterTable(string sql)
		{
			StringBuilder result = new StringBuilder(60).Append(Indent1);
			IEnumerator<string> tokens = (new StringTokenizer(sql, " (,)'[]\"", true)).GetEnumerator();

			bool quoted = false;
			while (tokens.MoveNext())
			{
				string token = tokens.Current;
				if (IsQuote(token))
				{
					quoted = !quoted;
				}
				else if (!quoted)
				{
					if (IsBreak(token))
					{
						result.Append(Indent3);
					}
				}
				result.Append(token);
			}

			return result.ToString();
		}
예제 #20
1
 internal override StringBuilder AsNegatedUserString(StringBuilder builder, string blockAlias, bool skipIsNotNull)
 {
     builder.Append("NOT(");
     builder = AsUserString(builder, blockAlias, skipIsNotNull);
     builder.Append(")");
     return builder;
 }
        public string GetRouteDescriptorKey(HttpContextBase httpContext, RouteBase routeBase) {
            var route = routeBase as Route;
            var dataTokens = new RouteValueDictionary();

            if (route != null) {
                dataTokens = route.DataTokens;
            }
            else {
            var routeData = routeBase.GetRouteData(httpContext);

                if (routeData != null) {
                    dataTokens = routeData.DataTokens;
                }
            }

            var keyBuilder = new StringBuilder();

            if (route != null) {
                keyBuilder.AppendFormat("url={0};", route.Url);
            }

            // the data tokens are used in case the same url is used by several features, like *{path} (Rewrite Rules and Home Page Provider)
            if (dataTokens != null) {
                foreach (var key in dataTokens.Keys) {
                    keyBuilder.AppendFormat("{0}={1};", key, dataTokens[key]);
                }
            }

            return keyBuilder.ToString().ToLowerInvariant();
        }
예제 #22
1
        /// <summary>
        /// 生成DAL带命名空间
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="dt"></param>
        /// <param name="strNamespace"></param>
        /// <returns></returns>
        public StringBuilder CreateDALCode(string tableName, DataTable dt, string strNamespace)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("using "+ strNamespace + ".IDAL.Bases;");
            sb.AppendLine("using " + strNamespace + ".DAL.Bases;");
            sb.AppendLine("using "+ strNamespace + ".Models;");
            sb.AppendLine("using System.Collections.Generic;");
            sb.AppendLine("using System;");
            sb.AppendLine("using System.Data;");
            string sqluse = sqltype == 2 ? "using MySql.Data.MySqlClient;" : "using System.Data.SqlClient;";
            sb.AppendLine(sqluse);
            sb.AppendLine("");
            sb.AppendLine("namespace " + strNamespace + ".DAL {");
            string cName = ":MsSqlDALConf";
            if (sqltype == (int)SQLType.MySql)
            {
                cName = ":MySqlDALConf";
            }
            sb.AppendLine("public  class  " + tableName + "DAL " + cName + ", I"+ tableName + "DAL{");
            sb.AppendLine("");
            sb.AppendLine("        public "+ tableName + "DAL() : base() { }");
            sb.AppendLine("        public " + tableName + "DAL(string name) : base(name) { }");

            GetAllDAL(tableName, dt, sb, "    ");
            sb.AppendLine("    }");
            sb.AppendLine("}");
            return sb;
        }
 private void AddLifecycleHandlers(StringBuilder stringBuilder)
 {
     AppendHandler(stringBuilder, "SetUp", "base.BeforeEach();");
     AppendHandler(stringBuilder, "TestFixtureSetUp", "SetListener(new StorEvil.CodeGeneration.NUnitListener()); base.BeforeAll();");
     AppendHandler(stringBuilder, "TearDown", "base.AfterEach();");
     AppendHandler(stringBuilder, "TestFixtureTearDown", "base.AfterAll();");
 }
예제 #24
0
 private string Postfix(string prefix)
 {
     var result = new StringBuilder(prefix);
     result.Append(TileDirectionUtil.GetChar(Direction));
     result.Append(TurnDirectionUtil.GetChar(Turn));
     return result.ToString();
 }
        public string CreateReference(int size)
        {
            const int byteSize = 0x100;
            var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".ToCharArray();
            var allowedCharSet = new HashSet<char>(chars).ToArray();

            using (var cryptoProvider = new RNGCryptoServiceProvider())
            {
                var result = new StringBuilder();
                var buffer = new byte[128];

                while (result.Length < size)
                {
                    cryptoProvider.GetBytes(buffer);

                    for (var i = 0; i < buffer.Length && result.Length < size; ++i)
                    {
                        var outOfRangeStart = byteSize - (byteSize % allowedCharSet.Length);

                        if (outOfRangeStart <= buffer[i])
                        {
                            continue;
                        }

                        result.Append(allowedCharSet[buffer[i] % allowedCharSet.Length]);
                    }
                }
                return result.ToString();
            }
        }
예제 #26
0
 public void AsText(StringBuilder b, int pad)
 {
     b.Append(' ', pad);
     b.AppendLine("LearnedLore:");
     b.Append(' ', pad++);
     b.AppendLine("{");
     b.Append(' ', pad);
     b.AppendLine("Count: 0x" + Count.ToString("X8") + " (" + Count + ")");
     b.Append(' ', pad);
     b.AppendLine("m_snoLoreLearned:");
     b.Append(' ', pad);
     b.AppendLine("{");
     for (int i = 0; i < m_snoLoreLearned.Length;)
     {
         b.Append(' ', pad + 1);
         for (int j = 0; j < 8 && i < m_snoLoreLearned.Length; j++, i++)
         {
             b.Append("0x" + m_snoLoreLearned[i].ToString("X8") + ", ");
         }
         b.AppendLine();
     }
     b.Append(' ', pad);
     b.AppendLine("}");
     b.AppendLine();
     b.Append(' ', --pad);
     b.AppendLine("}");
 }
 private static string GetKeyHash(string alias, string keyStore, string password)
 {
     var proc = new Process();
     var arguments = @"""keytool -storepass {0} -keypass {1} -exportcert -alias {2} -keystore {3} | openssl sha1 -binary | openssl base64""";
     if (Application.platform == RuntimePlatform.WindowsEditor)
     {
         proc.StartInfo.FileName = "cmd";
         arguments = @"/C " + arguments;
     }
     else
     {
         proc.StartInfo.FileName = "bash";
         arguments = @"-c " + arguments;
     }
     proc.StartInfo.Arguments = string.Format(arguments, password, password, alias, keyStore);
     proc.StartInfo.UseShellExecute = false;
     proc.StartInfo.CreateNoWindow = true;
     proc.StartInfo.RedirectStandardOutput = true;
     proc.Start();
     var keyHash = new StringBuilder();
     while (!proc.HasExited)
     {
         keyHash.Append(proc.StandardOutput.ReadToEnd());
     }
     return keyHash.ToString();
 }
예제 #28
0
 public override string ToString()
 {
     var settings = new XmlWriterSettings
     {
         Indent = false,
         Encoding = new UTF8Encoding(false),
         NamespaceHandling = NamespaceHandling.OmitDuplicates,
         OmitXmlDeclaration = true,
         NewLineOnAttributes = false,
         DoNotEscapeUriAttributes = true
     };
     var sb = new StringBuilder();
     using (var xw = XmlWriter.Create(sb, settings))
     {
         xw.WriteStartElement("Role", Xmlnamespace);
         xw.WriteAttributeString("xmlns", "xsi", null, Xsinamespace);
         xw.WriteAttributeString("xsi", "type", Xsinamespace, Type);
         xw.WriteAttributeString("code", Code);
         xw.WriteAttributeString("codeSystem", CodeSystem);
         xw.WriteAttributeString("codeSystemName", CodeSystemName);
         xw.WriteAttributeString("displayName", DisplayName);
         xw.WriteEndElement();
         xw.Flush();
         return sb.ToString();
     }
 }
예제 #29
0
 internal override StringBuilder AsEsql(StringBuilder builder, string blockAlias, bool skipIsNotNull)
 {
     // Get e.g., T2._from1 using the table alias
     string qualifiedName = CqlWriter.GetQualifiedName(blockAlias, SlotName);
     builder.Append(qualifiedName);
     return builder;
 }
예제 #30
0
 public static object MediaHelper(string image, int width, int height, bool forceFit)
 {
     var sb = new StringBuilder();
     sb.Append(MediaHelper(image));
     sb.Append(string.Format("?width={0}&height={1}&force={2}", width, height,forceFit));
     return sb.ToString();
 }
예제 #31
0
    protected void ibtnChange_Click(object sender, ImageClickEventArgs e)
    {
        bool isLockedUser        = false;
        bool releaseLock         = true;
        long userId              = 0;
        var  userLoginRepository = IoC.Resolve <IUserLoginRepository>();

        if (Request.QueryString["UserEmail"] != null)
        {
            if (Request.QueryString["UserID"] != null)
            {
                userId = Convert.ToInt32(Request.QueryString["UserID"]);
            }

            var userlogin      = userLoginRepository.GetByUserId(userId);
            var sessionContext = IoC.Resolve <ISessionContext>();
            if (userlogin != null && userlogin.IsActive)
            {
                var passwordChangeLogService       = IoC.Resolve <IPasswordChangelogService>();
                var configurationSettingRepository = IoC.Resolve <IConfigurationSettingRepository>();
                var nonRepeatCount = configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.PreviousPasswordNonRepetitionCount);

                if (userlogin.Locked)
                {
                    isLockedUser = true;
                }

                var currentRole    = sessionContext.UserSession.CurrentOrganizationRole.GetSystemRoleId;
                var isSamePassword = currentRole == (long)Roles.Customer && passwordChangeLogService.IsPasswordRepeated(userId, txtPassword.Text);

                if (isSamePassword)
                {
                    var strJsCloseWindow = new System.Text.StringBuilder();
                    strJsCloseWindow.Append("<script language = 'Javascript'>alert('New password can not be same as last " + nonRepeatCount + " password(s). Please enter a different password.'); </script>");
                    ClientScript.RegisterStartupScript(typeof(string), "JSCode", strJsCloseWindow.ToString());
                    return;
                }
            }
        }
        if (Request.QueryString["UserID"] != null)
        {
            var sessionContext   = IoC.Resolve <ISessionContext>();
            var userLoginService = IoC.Resolve <IUserLoginService>();

            var currentRole     = sessionContext.UserSession.CurrentOrganizationRole.GetSystemRoleId;
            var passwordUpdated = currentRole == (long)Roles.Customer ? userLoginService.ForceChangePassword(userId, txtPassword.Text, false, sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId, true) : userLoginService.ForceChangePassword(userId, txtPassword.Text, true, sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId, false);

            var customerRepository = IoC.Resolve <ICustomerRepository>();
            var customer           = customerRepository.GetCustomerByUserId(userId);

            if (!string.IsNullOrEmpty(customer.Tag))
            {
                var corporateAccountRepository = IoC.Resolve <ICorporateAccountRepository>();
                var account = corporateAccountRepository.GetByTag(customer.Tag);
                if (account != null)
                {
                    releaseLock = account.AllowCustomerPortalLogin;
                }
            }
            // UnLock User
            if (isLockedUser && releaseLock)
            {
                ReleaseUserLoginLock(userId);
            }

            if (passwordUpdated)
            {
                var strJsCloseWindow = new System.Text.StringBuilder();
                strJsCloseWindow.Append("<script language = 'Javascript'>alert('Password updated successfully.'); window.close(); </script>");
                ClientScript.RegisterStartupScript(typeof(string), "JSCode", strJsCloseWindow.ToString());
            }
            else
            {
                var strJsCloseWindow = new System.Text.StringBuilder();
                strJsCloseWindow.Append("<script language = 'Javascript'>alert('Error in updating password. Please try again later.'); </script>");
                ClientScript.RegisterStartupScript(typeof(string), "JSCode", strJsCloseWindow.ToString());
            }
        }
    }
    IEnumerator SetModelAsync(string renderModelName)
    {
        if (string.IsNullOrEmpty(renderModelName))
        {
            yield break;
        }

        // Preload all render models before asking for the data to create meshes.
        using (var holder = new RenderModelInterfaceHolder())
        {
            var renderModels = holder.instance;
            if (renderModels == null)
            {
                yield break;
            }

            // Gather names of render models to preload.
            string[] renderModelNames;

            var count = renderModels.GetComponentCount(renderModelName);
            if (count > 0)
            {
                renderModelNames = new string[count];

                for (int i = 0; i < count; i++)
                {
                    var capacity = renderModels.GetComponentName(renderModelName, (uint)i, null, 0);
                    if (capacity == 0)
                    {
                        continue;
                    }

                    var componentName = new System.Text.StringBuilder((int)capacity);
                    if (renderModels.GetComponentName(renderModelName, (uint)i, componentName, capacity) == 0)
                    {
                        continue;
                    }

                    capacity = renderModels.GetComponentRenderModelName(renderModelName, componentName.ToString(), null, 0);
                    if (capacity == 0)
                    {
                        continue;
                    }

                    var name = new System.Text.StringBuilder((int)capacity);
                    if (renderModels.GetComponentRenderModelName(renderModelName, componentName.ToString(), name, capacity) == 0)
                    {
                        continue;
                    }

                    var s = name.ToString();

                    // Only need to preload if not already cached.
                    var model = models[s] as RenderModel;
                    if (model == null || model.mesh == null)
                    {
                        renderModelNames[i] = s;
                    }
                }
            }
            else
            {
                // Only need to preload if not already cached.
                var model = models[renderModelName] as RenderModel;
                if (model == null || model.mesh == null)
                {
                    renderModelNames = new string[] { renderModelName };
                }
                else
                {
                    renderModelNames = new string[0];
                }
            }

            // Keep trying every 100ms until all components finish loading.
            while (true)
            {
                var loading = false;
                foreach (var name in renderModelNames)
                {
                    if (string.IsNullOrEmpty(name))
                    {
                        continue;
                    }

                    var pRenderModel = System.IntPtr.Zero;

                    var error = renderModels.LoadRenderModel_Async(name, ref pRenderModel);
                    if (error == EVRRenderModelError.Loading)
                    {
                        loading = true;
                    }
                    else if (error == EVRRenderModelError.None)
                    {
                        // Preload textures as well.
                        var renderModel = (RenderModel_t)Marshal.PtrToStructure(pRenderModel, typeof(RenderModel_t));

                        // Check the cache first.
                        var material = materials[renderModel.diffuseTextureId] as Material;
                        if (material == null || material.mainTexture == null)
                        {
                            var pDiffuseTexture = System.IntPtr.Zero;

                            error = renderModels.LoadTexture_Async(renderModel.diffuseTextureId, ref pDiffuseTexture);
                            if (error == EVRRenderModelError.Loading)
                            {
                                loading = true;
                            }
                        }
                    }
                }

                if (loading)
                {
#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
                    yield return(new WaitForSeconds(0.1f));
#else
                    yield return(new WaitForSecondsRealtime(0.1f));
#endif
                }
                else
                {
                    break;
                }
            }
        }

        bool success = SetModel(renderModelName);
        SteamVR_Events.RenderModelLoaded.Send(this, success);
    }
예제 #33
0
 public void GetPieColorMap(System.Text.StringBuilder map) {
   HCSMVOPINVOKE.HPieChart_GetPieColorMap(swigCPtr, map);
 }
예제 #34
0
파일: HCSP.cs 프로젝트: hupech/MyBMConvert
    public static int Compute_Geometry_Key_Count(int arg0, System.Text.StringBuilder arg1)
    {
        int ret = HCSPPINVOKE.Compute_Geometry_Key_Count(arg0, arg1);

        return(ret);
    }
예제 #35
0
    public static string UnEscapeJavascriptString(string jsonString)
    {
        if (String.IsNullOrEmpty(jsonString))
        {
            return(jsonString);
        }

        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        char c;

        for (int i = 0; i < jsonString.Length;)
        {
            c = jsonString[i++];

            if (c == '\\')
            {
                int remainingLength = jsonString.Length - i;
                if (remainingLength >= 2)
                {
                    char lookahead = jsonString[i];
                    if (lookahead == '\\')
                    {
                        sb.Append('\\');
                        ++i;
                    }
                    else if (lookahead == '"')
                    {
                        sb.Append("\"");
                        ++i;
                    }
                    else if (lookahead == 't')
                    {
                        sb.Append('\t');
                        ++i;
                    }
                    else if (lookahead == 'b')
                    {
                        sb.Append('\b');
                        ++i;
                    }
                    else if (lookahead == 'n')
                    {
                        sb.Append('\n');
                        ++i;
                    }
                    else if (lookahead == 'r')
                    {
                        sb.Append('\r');
                        ++i;
                    }
                    else if (lookahead == 'u')
                    {
                        char[] hex = new char[4];

                        for (int m = 0; m < 4; m++)
                        {
                            hex[m] = jsonString[i + m + 1];
                        }

                        sb.Append((char)Convert.ToInt32(new string(hex), 16));
                        i++;
                        i += 4;
                    }
                }
            }
            else
            {
                sb.Append(c);
            }
        }
        return(sb.ToString());
    }
예제 #36
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        // Generate Logic for Summary Report
        System.Text.StringBuilder sb = new System.Text.StringBuilder(string.Empty);
        sb.Append("<html><head>");
        // fix for QC 2356 - Prabhu
        sb.Append("<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>");
        sb.Append("</head><body>");
        sb.Append("<table border = '1'>");
        sb.Append("SummaryReport<br>");
        sb.Append("Selected Culture: " + CultureCode + "<br>");
        if (IsRoll)
        {
            sb.Append(Label2.Text + "<br>");
        }
        sb.Append(("Exported On:" + SessionState.User.FormatUtcDate(DateTime.UtcNow, true, "MM/dd/yyyy:HH:mm:ss") + "<br>"));
        sb.Append("Legends :<br>");
        sb.Append("    M Mandatory<br>");
        sb.Append("    S Status<br>");
        sb.Append("</tr><tr>");
        //DataColumnCollection tableColumns_ItemName = objDT_ItemName.Columns;
        DataColumnCollection tableColumns = objDT.Columns;

        //DataRowCollection tableRows = ds3.Tables[0].Rows;

        sb.Append("<th rowspan='2'>ContainerName</th>");
        foreach (DataRow r in objDT_ItemName.Rows)
        {
            sb.Append("<th colspan = '4'>" + r["ItemName"].ToString() + "</th>");
        }
        sb.Append("</tr><tr>");
        foreach (DataColumn c in tableColumns)
        {
            if (!c.ColumnName.ToString().Equals("ContainerName"))
            {
                sb.Append("<th>" + c.ColumnName.ToString().Split('~')[1] + "</th>");
            }
        }
        sb.Append("</tr>");
        foreach (DataRow dr in objDT.Rows)
        {
            sb.Append("<tr>");
            foreach (DataColumn dc in objDT.Columns)
            {
                if (dc.ColumnName.Contains("ChunkValue"))
                {
                    if (dr[dc].ToString().Split(new char[] { '~' }, 2)[0].Equals("True"))
                    {
                        sb.Append("<td bgcolor = 'Gainsboro'><I>" + dr[dc].ToString().Split(new char[] { '~' }, 2)[1] + "</I></td>");
                    }
                    else
                    {
                        sb.Append("<td>" + dr[dc].ToString().Split(new char[] { '~' }, 2)[1] + "</td>");
                    }
                }
                else
                {
                    sb.Append("<td>" + dr[dc].ToString() + "</td>");
                }
            }
            sb.Append("</tr>");
        }

        sb.Append("</table>");
        sb.Append("</body></html>");
        string fileName = string.Empty;

        fileName += "SummaryReport.xls";

        string exportContent = sb.ToString();

        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.AddHeader("content-disposition", "attachment;filename=" + fileName);
        Response.ContentType = "application/vnd.ms-excel";
        //Fix for CR 5109 - Prabhu R S
        Response.ContentEncoding = System.Text.Encoding.UTF8;
        Response.AppendHeader("Content-Length", System.Text.Encoding.UTF8.GetByteCount(exportContent).ToString());
        EnableViewState = false;
        Response.Write(exportContent);
        Response.End();
    }
예제 #37
0
    //[MenuItem("Hugula/export lua [Assets\\Lua]", false, 12)]
    public static void exportLua()
    {
        checkLuaExportPath();

        string path = Application.dataPath + "/Lua";  //AssetDatabase.GetAssetPath(obj).Replace("Assets","");

        List <string> files = getAllChildFiles(path); // Directory.GetFiles(Application.dataPath + path);

        IList <string> childrens = new List <string>();

        foreach (string file in files)
        {
            if (file.EndsWith("lua"))
            {
                childrens.Add(file);
            }
        }
        Debug.Log("luajit path = " + luacPath);
        string crypName = "", fileName = "", outfilePath = "", arg = "";

        System.Text.StringBuilder sb = new System.Text.StringBuilder();

        DirectoryDelete(Application.dataPath + OutLuaPath);

        foreach (string filePath in childrens)
        {
            fileName = CUtils.GetURLFileName(filePath);
            //crypName=CryptographHelper.CrypfString(fileName);
            crypName    = filePath.Replace(path, "").Replace(".lua", "." + Common.LUA_LC_SUFFIX).Replace("\\", "/");
            outfilePath = Application.dataPath + OutLuaPath + crypName;
            checkLuaChildDirectory(outfilePath);

            sb.Append(fileName);
            sb.Append("=");
            sb.Append(crypName);
            sb.Append("\n");

#if Nlua || UNITY_IPHONE
            arg = "-o " + outfilePath + " " + filePath;
            File.Copy(filePath, outfilePath, true);
#else
            arg = "-b " + filePath + " " + outfilePath;             //for jit
            Debug.Log(arg);

            System.Diagnostics.Process.Start(luacPath, arg);//arg -b hello1.lua hello1.out
#endif
        }
        Debug.Log(sb.ToString());
        Debug.Log("lua:" + path + "files=" + files.Count + " completed");

        System.Threading.Thread.Sleep(1000);
        AssetDatabase.Refresh();

        //打包成assetbundle
        string luaOut = Application.dataPath + OutLuaPath;
        Debug.Log(luaOut);
        List <string>             luafiles       = getAllChildFiles(luaOut + "/", Common.LUA_LC_SUFFIX);
        string                    assetPath      = "Assets" + OutLuaPath;
        List <UnityEngine.Object> res            = new List <Object>();
        string                    relatePathName = "";
        foreach (string name in luafiles)
        {
            relatePathName = name.Replace(luaOut, "");
            string abPath = assetPath + relatePathName;
            Debug.Log(abPath);
            Debug.Log(relatePathName);
            Object txt = AssetDatabase.LoadAssetAtPath(abPath, typeof(TextAsset));
            txt.name = relatePathName.Replace(@"\", @".").Replace("/", "").Replace("." + Common.LUA_LC_SUFFIX, "");
            Debug.Log(txt.name);
            res.Add(txt);
        }

        string   cname   = "/luaout.bytes";
        string   outPath = luaOut;        //ExportAssetBundles.GetOutPath();
        string   tarName = outPath + cname;
        Object[] ress    = res.ToArray();
        Debug.Log(ress.Length);
        ExportAssetBundles.BuildAB(null, ress, tarName, BuildAssetBundleOptions.CompleteAssets);
//         Debug.Log(tarName + " export");
        AssetDatabase.Refresh();

        //Directory.CreateDirectory(luaOut);
        string realOutPath = ExportAssetBundles.GetOutPath() + "/font.u3d";
        byte[] by          = File.ReadAllBytes(tarName);
        Debug.Log(by);
        byte[] Encrypt = CryptographHelper.Encrypt(by, GetKey(), GetIV());

        File.WriteAllBytes(realOutPath, Encrypt);
        Debug.Log(realOutPath + " export");
    }
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_SteamInventoryResult: " + m_SteamInventoryResult);
        GUILayout.Label("m_SteamItemDetails: " + m_SteamItemDetails);
        GUILayout.Label("m_SteamItemDef: " + m_SteamItemDef);
        GUILayout.Label("m_SerializedBuffer: " + m_SerializedBuffer);
        GUILayout.EndArea();

        GUILayout.BeginVertical("box");
        m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33));

        // INVENTORY ASYNC RESULT MANAGEMENT

        GUILayout.Label("GetResultStatus(m_SteamInventoryResult) : " + SteamInventory.GetResultStatus(m_SteamInventoryResult));

        if (GUILayout.Button("GetResultItems(m_SteamInventoryResult, m_SteamItemDetails, ref OutItemsArraySize)"))
        {
            uint OutItemsArraySize = 0;
            bool ret = SteamInventory.GetResultItems(m_SteamInventoryResult, null, ref OutItemsArraySize);
            if (ret && OutItemsArraySize > 0)
            {
                m_SteamItemDetails = new SteamItemDetails_t[OutItemsArraySize];
                ret = SteamInventory.GetResultItems(m_SteamInventoryResult, m_SteamItemDetails, ref OutItemsArraySize);
                print("SteamInventory.GetResultItems(" + m_SteamInventoryResult + ", m_SteamItemDetails, out OutItemsArraySize) - " + ret + " -- " + OutItemsArraySize);

                System.Text.StringBuilder test = new System.Text.StringBuilder();
                for (int i = 0; i < OutItemsArraySize; ++i)
                {
                    test.AppendFormat("{0} - {1} - {2} - {3} - {4}\n", i, m_SteamItemDetails[i].m_itemId, m_SteamItemDetails[i].m_iDefinition, m_SteamItemDetails[i].m_unQuantity, m_SteamItemDetails[i].m_unFlags);
                }
                print(test);
            }
            else
            {
                print("SteamInventory.GetResultItems(" + m_SteamInventoryResult + ", null, out OutItemsArraySize) - " + ret + " -- " + OutItemsArraySize);
            }
        }

        if (GUILayout.Button("GetResultItemProperty(m_SteamInventoryResult, 0, null, out ValueBuffer, ref ValueBufferSize)"))
        {
            string ValueBuffer;
            uint   ValueBufferSize = 0;
            bool   ret             = SteamInventory.GetResultItemProperty(m_SteamInventoryResult, 0, null, out ValueBuffer, ref ValueBufferSize);
            if (ret)
            {
                ret = SteamInventory.GetResultItemProperty(m_SteamInventoryResult, 0, null, out ValueBuffer, ref ValueBufferSize);
            }
            print("SteamInventory.GetResultItemProperty(" + m_SteamInventoryResult + ", " + 0 + ", " + null + ", " + "out ValueBuffer" + ", " + "ref ValueBufferSize" + ") : " + ret + " -- " + ValueBuffer + " -- " + ValueBufferSize);
        }

        if (GUILayout.Button("GetResultTimestamp(m_SteamInventoryResult)"))
        {
            uint ret = SteamInventory.GetResultTimestamp(m_SteamInventoryResult);
            print("SteamInventory.GetResultTimestamp(" + m_SteamInventoryResult + ") : " + ret);
        }

        if (GUILayout.Button("CheckResultSteamID(m_SteamInventoryResult, SteamUser.GetSteamID())"))
        {
            bool ret = SteamInventory.CheckResultSteamID(m_SteamInventoryResult, SteamUser.GetSteamID());
            print("SteamInventory.CheckResultSteamID(" + m_SteamInventoryResult + ", " + SteamUser.GetSteamID() + ") : " + ret);
        }

        if (GUILayout.Button("DestroyResult(m_SteamInventoryResult)"))
        {
            DestroyResult();
        }

        // INVENTORY ASYNC QUERY

        if (GUILayout.Button("GetAllItems(out m_SteamInventoryResult)"))
        {
            bool ret = SteamInventory.GetAllItems(out m_SteamInventoryResult);
            print("SteamInventory.GetAllItems(" + "out m_SteamInventoryResult" + ") : " + ret + " -- " + m_SteamInventoryResult);
        }

        if (GUILayout.Button("GetItemsByID(out m_SteamInventoryResult, InstanceIDs, (uint)InstanceIDs.Length)"))
        {
            SteamItemInstanceID_t[] InstanceIDs = { (SteamItemInstanceID_t)0, (SteamItemInstanceID_t)1, };
            bool ret = SteamInventory.GetItemsByID(out m_SteamInventoryResult, InstanceIDs, (uint)InstanceIDs.Length);
            print("SteamInventory.GetItemsByID(" + "out m_SteamInventoryResult" + ", " + InstanceIDs + ", " + (uint)InstanceIDs.Length + ") : " + ret + " -- " + m_SteamInventoryResult);
        }

        // RESULT SERIALIZATION AND AUTHENTICATION

        if (GUILayout.Button("SerializeResult(m_SteamInventoryResult, m_SerializedBuffer, out OutBufferSize)"))
        {
            uint OutBufferSize;
            bool ret = SteamInventory.SerializeResult(m_SteamInventoryResult, null, out OutBufferSize);
            if (ret)
            {
                m_SerializedBuffer = new byte[OutBufferSize];
                ret = SteamInventory.SerializeResult(m_SteamInventoryResult, m_SerializedBuffer, out OutBufferSize);
                print("SteamInventory.SerializeResult(m_SteamInventoryResult, m_SerializedBuffer, out OutBufferSize) - " + ret + " -- " + OutBufferSize + " -- " + System.Text.Encoding.UTF8.GetString(m_SerializedBuffer, 0, m_SerializedBuffer.Length));
            }
            else
            {
                print("SteamInventory.SerializeResult(m_SteamInventoryResult, null, out OutBufferSize) - " + ret + " -- " + OutBufferSize);
            }
        }

        if (GUILayout.Button("DeserializeResult(out m_SteamInventoryResult, m_SerializedBuffer, (uint)m_SerializedBuffer.Length)"))
        {
            bool ret = SteamInventory.DeserializeResult(out m_SteamInventoryResult, m_SerializedBuffer, (uint)m_SerializedBuffer.Length);
            print("SteamInventory.DeserializeResult(" + "out m_SteamInventoryResult" + ", " + m_SerializedBuffer + ", " + (uint)m_SerializedBuffer.Length + ") : " + ret + " -- " + m_SteamInventoryResult);
        }

        // INVENTORY ASYNC MODIFICATION

        if (GUILayout.Button("GenerateItems(out m_SteamInventoryResult, ArrayItemDefs, null, (uint)ArrayItemDefs.Length)"))
        {
            SteamItemDef_t[] ArrayItemDefs = { ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration1, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration2 };
            bool             ret           = SteamInventory.GenerateItems(out m_SteamInventoryResult, ArrayItemDefs, null, (uint)ArrayItemDefs.Length);
            print("SteamInventory.GenerateItems(" + "out m_SteamInventoryResult" + ", " + ArrayItemDefs + ", " + null + ", " + (uint)ArrayItemDefs.Length + ") : " + ret + " -- " + m_SteamInventoryResult);
        }

        if (GUILayout.Button("GrantPromoItems(out m_SteamInventoryResult)"))
        {
            bool ret = SteamInventory.GrantPromoItems(out m_SteamInventoryResult);
            print("SteamInventory.GrantPromoItems(" + "out m_SteamInventoryResult" + ") : " + ret + " -- " + m_SteamInventoryResult);
        }

        if (GUILayout.Button("AddPromoItem(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1)"))
        {
            bool ret = SteamInventory.AddPromoItem(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1);
            print("SteamInventory.AddPromoItem(" + "out m_SteamInventoryResult" + ", " + ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1 + ") : " + ret + " -- " + m_SteamInventoryResult);
        }

        if (GUILayout.Button("AddPromoItems(out m_SteamInventoryResult, ArrayItemDefs, (uint)ArrayItemDefs.Length)"))
        {
            SteamItemDef_t[] ArrayItemDefs = { ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon2 };
            bool             ret           = SteamInventory.AddPromoItems(out m_SteamInventoryResult, ArrayItemDefs, (uint)ArrayItemDefs.Length);
            print("SteamInventory.AddPromoItems(" + "out m_SteamInventoryResult" + ", " + ArrayItemDefs + ", " + (uint)ArrayItemDefs.Length + ") : " + ret + " -- " + m_SteamInventoryResult);
        }

        if (GUILayout.Button("ConsumeItem(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1)"))
        {
            if (m_SteamItemDetails != null)
            {
                bool ret = SteamInventory.ConsumeItem(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1);
                print("SteamInventory.ConsumeItem(out m_SteamInventoryResult, " + m_SteamItemDetails[0].m_itemId + ", 1) - " + ret + " -- " + m_SteamInventoryResult);
            }
        }

        if (GUILayout.Button("ExchangeItems(TODO)"))
        {
            if (m_SteamItemDetails != null)
            {
                bool ret = SteamInventory.ExchangeItems(out m_SteamInventoryResult, null, null, 0, null, null, 0);                 // TODO
                print("SteamInventory.ExchangeItems(TODO) - " + ret + " -- " + m_SteamInventoryResult);
            }
        }

        if (GUILayout.Button("TransferItemQuantity(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1, SteamItemInstanceID_t.Invalid)"))
        {
            if (m_SteamItemDetails != null)
            {
                bool ret = SteamInventory.TransferItemQuantity(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1, SteamItemInstanceID_t.Invalid);
                print("SteamInventory.TransferItemQuantity(out m_SteamInventoryResult, " + m_SteamItemDetails[0].m_itemId + ", 1, SteamItemInstanceID_t.Invalid) - " + ret + " -- " + m_SteamInventoryResult);
            }
        }

        // TIMED DROPS AND PLAYTIME CREDIT

        if (GUILayout.Button("SendItemDropHeartbeat()"))
        {
            SteamInventory.SendItemDropHeartbeat();
            print("SteamInventory.SendItemDropHeartbeat()");
        }

        if (GUILayout.Button("TriggerItemDrop(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_TimedDropList)"))
        {
            bool ret = SteamInventory.TriggerItemDrop(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_TimedDropList);
            print("SteamInventory.TriggerItemDrop(" + "out m_SteamInventoryResult" + ", " + ESpaceWarItemDefIDs.k_SpaceWarItem_TimedDropList + ") : " + ret + " -- " + m_SteamInventoryResult);
        }

        // IN-GAME TRADING

        if (GUILayout.Button("TradeItems(TODO)"))
        {
            if (m_SteamItemDetails != null)
            {
                bool ret = SteamInventory.TradeItems(out m_SteamInventoryResult, SteamUser.GetSteamID(), null, null, 0, null, null, 0);                 // TODO... Difficult
                print("SteamInventory.TradeItems(TODO) - " + ret + " -- " + m_SteamInventoryResult);
            }
        }

        // ITEM DEFINITIONS

        if (GUILayout.Button("LoadItemDefinitions()"))
        {
            bool ret = SteamInventory.LoadItemDefinitions();
            print("SteamInventory.LoadItemDefinitions() : " + ret);
        }

        if (GUILayout.Button("GetItemDefinitionIDs(ItemDefIDs, ref length)"))
        {
            uint length;
            bool ret = SteamInventory.GetItemDefinitionIDs(null, out length);
            if (ret)
            {
                m_SteamItemDef = new SteamItemDef_t[length];
                ret            = SteamInventory.GetItemDefinitionIDs(m_SteamItemDef, out length);
                print("SteamInventory.GetItemDefinitionIDs(m_SteamItemDef, out length) - " + ret + " -- " + length);
            }
            else
            {
                print("SteamInventory.GetItemDefinitionIDs(null, out length) - " + ret + " -- " + length);
            }
        }

        if (GUILayout.Button("GetItemDefinitionProperty(ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration1, null, out ValueBuffer, ref length)"))
        {
            uint   length = 2048;
            string ValueBuffer;
            bool   ret = SteamInventory.GetItemDefinitionProperty(ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration1, null, out ValueBuffer, ref length);
            print("SteamInventory.GetItemDefinitionProperty(" + ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration1 + ", " + null + ", " + "out ValueBuffer" + ", " + "ref length" + ") : " + ret + " -- " + ValueBuffer + " -- " + length);
        }

        if (GUILayout.Button("RequestEligiblePromoItemDefinitionsIDs(SteamUser.GetSteamID())"))
        {
            SteamAPICall_t handle = SteamInventory.RequestEligiblePromoItemDefinitionsIDs(SteamUser.GetSteamID());
            OnSteamInventoryEligiblePromoItemDefIDsCallResult.Set(handle);
            print("SteamInventory.RequestEligiblePromoItemDefinitionsIDs(" + SteamUser.GetSteamID() + ") : " + handle);
        }

        //SteamInventory.GetEligiblePromoItemDefinitionIDs() // Should be handled within the SteamInventoryEligiblePromoItemDefIDs_t CallResult!

        //SteamInventory.StartPurchase() // TODO

        //SteamInventory.RequestPrices() // TODO

        //SteamInventory.GetNumItemsWithPrices() // TODO

        //SteamInventory.GetItemsWithPrices() // TODO

        //SteamInventory.GetItemPrice() // TODO

        //SteamInventory.StartUpdateProperties() // TODO

        //SteamInventory.RemoveProperty() // TODO

        //SteamInventory.SetProperty() // TODO

        //SteamInventory.SetProperty() // TODO

        //SteamInventory.SetProperty() // TODO

        //SteamInventory.SetProperty() // TODO

        //SteamInventory.SubmitUpdateProperties() // TODO

        GUILayout.EndScrollView();
        GUILayout.EndVertical();
    }
    static void OnImportXmls(string[] importedAssets, string[] deletedAssets)
    {
        bool is_xmls = false;

        string[] assets;

        if (((assets = importedAssets) != null) && (assets.Length > 0))
        {
            for (int i = 0; i < assets.Length; i++)
            {
                string path_name = Path.GetDirectoryName(assets[i]);
                if (path_name.Contains("Assets/Resources/Xmls") == false)
                {
                    continue;
                }
                is_xmls = true;
            }
        }

        if ((is_xmls == false) && ((assets = deletedAssets) != null) && (assets.Length > 0))
        {
            for (int i = 0; i < assets.Length; i++)
            {
                string path_name = Path.GetDirectoryName(assets[i]);
                if (path_name.Contains("Assets/Resources/Xmls") == false)
                {
                    continue;
                }
                is_xmls = true;
            }
        }

        if (is_xmls == true)
        {
            _FileList.Clear();
            jUtil.GetFiles(_FileList, "Assets/Resources/Xmls", "*.xml");

            Dictionary <string, List <string> > dic = new Dictionary <string, List <string> >();

            string [] strs;
            for (int i = 0; i < _FileList.Count; i++)
            {
                strs = _FileList[i].Split('/');
                if ((strs != null) && (strs.Length == 3))
                {
                    if (dic.ContainsKey(strs[1]) == false)
                    {
                        dic.Add(strs[1], new List <string>());
                    }
                    if (dic[strs[1]].Contains(strs[2]) == false)
                    {
                        dic[strs[1]].Add(strs[2]);
                    }
                }
            }

            List <string> strlist = new List <string>();

            strlist.Add("public class XmlList {");

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            foreach (KeyValuePair <string, List <string> > each in dic)
            {
                sb.Append("\tpublic static string [] _");
                sb.Append(each.Key);
                sb.Append(" = { ");

                List <string> list = each.Value;
                for (int i = 0; i < list.Count; i++)
                {
                    if (i > 0)
                    {
                        sb.Append(",\r\n\t\t\t\t\t\t\t\t\t\t");
                    }
                    sb.Append("\"");
                    sb.Append(list[i]);
                    sb.Append("\"");
                }

                sb.Append(" };");

                strlist.Add(sb.ToString());
                sb.Remove(0, sb.Length);

                strlist.Add("");
            }

            strlist.Add("}");

            CreateFile("Assets/Scripts/XmlList.cs", strlist);
        }
    }
예제 #40
0
    private string next()
    {
        //
        // Eat any whitespace.
        //
        char c;

        try
        {
            do
            {
                c = @get();
            }while(char.IsWhiteSpace(c) && c != '\n');
        }
        catch (EndOfInput)
        {
            return(null);
        }

        System.Text.StringBuilder buf = new System.Text.StringBuilder();

        if (c == ';' || c == '\n')
        {
            buf.Append(';');
        }
        else if (c == '\'')
        {
            try
            {
                while (true)
                {
                    c = @get();
                    if (c == '\'')
                    {
                        break;
                    }
                    else
                    {
                        buf.Append(c);
                    }
                }
            }
            catch (EndOfInput)
            {
                _parser.warning("EOF in string");
            }
        }
        else if (c == '\"')
        {
            try
            {
                while (true)
                {
                    c = @get();
                    if (c == '\"')
                    {
                        break;
                    }
                    else if (c == '\\')
                    {
                        try
                        {
                            char next = @get();
                            switch (next)
                            {
                            case '\\':
                            case '"':
                            {
                                buf.Append(next);
                                break;
                            }

                            case 'n':
                            {
                                buf.Append('\n');
                                break;
                            }

                            case 'r':
                            {
                                buf.Append('\r');
                                break;
                            }

                            case 't':
                            {
                                buf.Append('\t');
                                break;
                            }


                            case 'f':
                            {
                                buf.Append('\f');
                                break;
                            }

                            default:
                            {
                                buf.Append(c);
                                unget(next);
                            }
                            break;
                            }
                        }
                        catch (EndOfInput)
                        {
                            buf.Append(c);
                        }
                    }
                    else
                    {
                        buf.Append(c);
                    }
                }
            }
            catch (EndOfInput)
            {
                _parser.warning("EOF in string");
            }
        }
        else
        {
            //
            // Otherwise it's a string.
            //
            try
            {
                do
                {
                    buf.Append(c);
                    c = @get();
                }while(!char.IsWhiteSpace(c) && c != ';' && c != '\n');

                unget(c);
            }
            catch (EndOfInput)
            {
            }
        }

        return(buf.ToString());
    }
예제 #41
0
 public void GetPieSliceLabelContents(int slice_id, System.Text.StringBuilder str) {
   HCSMVOPINVOKE.HPieChart_GetPieSliceLabelContents(swigCPtr, slice_id, str);
 }
예제 #42
0
 public void GetPieSliceLabelTextFont(int slice_id, System.Text.StringBuilder font) {
   HCSMVOPINVOKE.HPieChart_GetPieSliceLabelTextFont(swigCPtr, slice_id, font);
 }
예제 #43
0
        /// <summary>
        /// Log a message to our logging system
        /// </summary>
        /// <param name="level">log level</param>
        /// <param name="message">message to log</param>
        /// <param name="t">throwable object</param>
        private void OurLog(Level level, string message, Exception t)
        {
            ts = DateTime.Now;
            string stamp = ts.ToString(format, CultureInfo.CurrentCulture.DateTimeFormat);

            System.Text.StringBuilder buf = new System.Text.StringBuilder(level.ToString());
            if (showClassNames)
            {
                buf.Append(" [");
                buf.Append(clazz);
                buf.Append("]");
            }
            if (showTimestamp)
            {
                buf.Append(" ");
                buf.Append(stamp);
            }
            buf.Append(" : ");
            buf.Append(GetTag());
            string prefix = buf.ToString();

            if (message != null)
            {
                buf.Append(message);
            }
            if (t != null)
            {
                buf.Append(" : ").Append(t.GetType().FullName).Append(": ").Append(t.Message);
            }
            if (appenders.Count == 0)
            {
                // by default to stdout
                System.Console.Out.WriteLine(buf.ToString());
                if (t != null)
                {
                    if (t.StackTrace != null)
                    {
                        foreach (string line in t.StackTrace.Replace("\r", "").Split('\n'))
                        {
                            OurLog(level, prefix + line, null);
                        }
                    }
                    if (t.InnerException != null)
                    {
                        System.Console.Out.WriteLine(
                            string.Format("{0}CAUSED BY - {1}: {2}",
                                          prefix,
                                          t.InnerException.GetType().FullName,
                                          t.InnerException.Message));
                        if (t.InnerException.StackTrace != null)
                        {
                            foreach (string line in t.InnerException.StackTrace.Replace("\r", "").Split('\n'))
                            {
                                OurLog(level, prefix + line, null);
                            }
                        }
                    }
                }
            }
            else
            {
                bool appendToAll = globalLevel.IsGreaterOrEqual(level);
                lock (appenders.SyncRoot)
                {
                    for (int i = 0; i < appenders.Count; i++)
                    {
                        Appender a = (Appender)appenders[i];
                        bool     appendToCustom = false;
                        if (a is CustomLogLevelAppender)
                        {
                            CustomLogLevelAppender appender = (CustomLogLevelAppender)a;
                            appendToCustom = appender.CurrentLevel.IsGreaterOrEqual(level);
                        }
                        if (appendToAll || appendToCustom)
                        {
                            if (message != null)
                            {
                                a.Log(prefix + message);
                            }
                            if (t != null)
                            {
                                a.Log(prefix + t.GetType().FullName + ": " + t.Message);
                                if (t.StackTrace != null)
                                {
                                    foreach (string line in t.StackTrace.Replace("\r", "").Split('\n'))
                                    {
                                        a.Log(prefix + line);
                                    }
                                }
                                if (t.InnerException != null)
                                {
                                    a.Log(prefix + "CAUSED BY - " + t.InnerException.GetType().FullName + ": " + t.Message);
                                    if (t.InnerException.StackTrace != null)
                                    {
                                        foreach (string line in t.InnerException.StackTrace.Replace("\r", "").Split('\n'))
                                        {
                                            a.Log(prefix + line);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #44
0
    private string GetCsText()
    {
        var namespaceString = GetNamespaceString();
        var className       = GetClassNameString();
        var hasCodeBehind   = className != null && namespaceString != null;

        if (hasCodeBehind == false)
        {
            return(null);
        }

        var inheritsClassName  = GetBaseClassName();
        var includedNamespaces = GetXamlIncludedNamespaces().ToArray();
        var events             = GetEvents().ToArray();
        var elements           = GetNamedElements()
                                 .Select(p => new XamlElement {
            Name = p.Name,
            Type = ReplaceXamlNamespace(p.Type, includedNamespaces)
        })
                                 .ToArray();

        var hasNamedElements = elements.Any();
        var hasEvents        = events.Any();

        var stringBuilder = new System.Text.StringBuilder();

        stringBuilder.AppendLine("/* This file has been generated automatically. All user changes will be overwritten if the XAML is changed. */");
        stringBuilder.AppendLine("using Noesis;");
        stringBuilder.AppendLine();
        stringBuilder.Append("namespace ").Append(namespaceString).AppendLine(" {");
        stringBuilder.AppendLine("\t" + DummyAttribute);
        stringBuilder.Append("\tpublic partial class ").Append(className).Append(" : ").Append(inheritsClassName).AppendLine(" {");

        {
            if (hasNamedElements)
            {
                stringBuilder.AppendLine();
            }
            foreach (var item in elements)
            {
                stringBuilder
                .Append("\t\tinternal ")
                .Append(item.Type)
                .Append(" ")
                .Append(item.Name)
                .AppendLine(";");
            }

            stringBuilder.AppendLine();
            stringBuilder.AppendLine("\t\tprivate void InitializeComponent() {");
            stringBuilder.Append("\t\t\tGUI.LoadComponent(this, \"").Append(XamlAsset.source).AppendLine("\");");

            if (hasNamedElements)
            {
                stringBuilder.AppendLine();
            }
            foreach (var item in elements)
            {
                stringBuilder
                .Append("\t\t\tthis.")
                .Append(item.Name)
                .Append(" = (")
                .Append(item.Type)
                .Append(")FindName(\"")
                .Append(item.Name)
                .AppendLine("\");");
            }

            stringBuilder.AppendLine("\t\t}");
        }

        if (hasEvents)
        {
            stringBuilder.AppendLine();
            stringBuilder.AppendLine("\t\tprotected override bool ConnectEvent(object s, string e, string h) {");
            foreach (var evt in GetEvents())
            {
                stringBuilder
                .Append("\t\t\tif(s is ")
                .Append(evt.Type)
                .Append(" && e==\"")
                .Append(evt.EventName)
                .Append("\" && h==\"")
                .Append(evt.HandlerName)
                .AppendLine("\") {");

                stringBuilder
                .Append("\t\t\t\t((")
                .Append(evt.Type)
                .Append(")s).")
                .Append(evt.EventName)
                .Append("+=")
                .Append(evt.HandlerName)
                .AppendLine(";");

                stringBuilder.AppendLine("\t\t\t\treturn true;");
                stringBuilder.AppendLine("\t\t\t}");
            }
            stringBuilder.AppendLine("\t\t\treturn false;");
            stringBuilder.AppendLine("\t\t}");
        }

        stringBuilder.AppendLine("\t}");
        stringBuilder.AppendLine("}");

        return(stringBuilder.ToString());
    }
예제 #45
0
 public abstract void renewalInfoText(System.Text.StringBuilder infoString);
예제 #46
0
    //    long previousEchoMilliSec = 0;
    private void OnTransformed(object sender, System.EventArgs e)
    {
        if (movingEnable)
        {
            //LoginMenu.SetActive(false);

            var g = GetComponent <TransformGesture>();

            var sb = new System.Text.StringBuilder();
            sb.AppendLine("変形中");
            sb.AppendLine("Position : " + g.ScreenPosition);
            sb.AppendLine("DeltaPosition : " + g.DeltaPosition);
            sb.AppendLine("DeltaRotation: " + g.DeltaRotation);
            sb.AppendLine("DeltaScale: " + g.DeltaScale);
            sb.AppendLine("RotationAxis: " + g.RotationAxis);
            Debug.Log(sb);

            //       float times=(def_orthographicSize)/primaryCamera.orthographicSize;
            float times = 1;
            zoomGesture(g.DeltaScale);

            float x = LoopValue(transform.localPosition.x, -g.DeltaPosition.x / times, 0, groundTilemap.size.x);
            float y = LoopValue(transform.localPosition.y, -g.DeltaPosition.y / times, 0, groundTilemap.size.y);

            transform.localPosition = new Vector3(x, y, -10);

            Vector2 v = new Vector3(groundTilemap.size.x, groundTilemap.size.y, 0.0f);
            if (transform.localPosition.x < (groundTilemap.size.x / 2.0f))
            {
                secondaryCameraX.transform.localPosition = new Vector3(groundTilemap.size.x, 0.0f, 0.0f);
                v.x = groundTilemap.size.x;
            }
            if (transform.localPosition.x > (groundTilemap.size.x / 2.0f))
            {
                secondaryCameraX.transform.localPosition = new Vector3(-groundTilemap.size.x, 0.0f, 0.0f);
                v.x = -groundTilemap.size.x;
            }

            if (transform.localPosition.y < (groundTilemap.size.y / 2.0f))
            {
                secondaryCameraY.transform.localPosition = new Vector3(0.0f, groundTilemap.size.y, 0.0f);
                v.y = groundTilemap.size.y;
            }
            if (transform.localPosition.y > (groundTilemap.size.y / 2.0f))
            {
                secondaryCameraY.transform.localPosition = new Vector3(0.0f, -groundTilemap.size.y, 0.0f);
                v.y = -groundTilemap.size.y;
            }
            secondaryCameraXY.transform.localPosition = v;

            if ((previousPos.x != x) || (previousPos.y != y))
            {
                DateTime now = DateTime.Now;

                if ((now - previousEchoTime).TotalMilliseconds > 100)
                {
                    if (ctr != null)
                    {
                        ctr.sendCameraPosition();
                    }
                    previousPos.x    = x;
                    previousPos.y    = y;
                    previousEchoTime = now;
                }
            }
        }
    }
예제 #47
0
    public static void ClientsHistoryTrigger()
    {
        // Replace with your own code
        SqlContext.Pipe.Send("Trigger FIRED");
        var TableName  = "Clients";
        var UpdateDate = DateTime.Now;
        SqlTriggerContext triggContext = SqlContext.TriggerContext;

        if (triggContext.TriggerAction == TriggerAction.Update)
        {
            using (SqlConnection conn = new SqlConnection("context connection=true"))
            {
                conn.Open();
                SqlPipe sqlP        = SqlContext.Pipe;
                var     schemaTable = GetSchema(conn);


                using (var auditAdapter = new SqlDataAdapter("select top 0 * from History", conn))
                {
                    var auditTable = new DataTable();
                    auditAdapter.Fill(auditTable);

                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append("Select inserted.Id,");
                    for (int i = 0; i < triggContext.ColumnCount; i++)
                    {
                        if (triggContext.IsUpdatedColumn(i))
                        {
                            var name = schemaTable.Columns[i].ColumnName;
                            if (!ignoreColumn(name))
                            {
                                sb.Append("Inserted.").Append(name)
                                .Append(" as Inserted_").Append(name).Append(",");
                                sb.Append("Deleted.").Append(name)
                                .Append(" as Deleted_").Append(name).Append(",");
                            }
                        }
                    }

                    sb.Append("inserted.UpdatedAt, inserted.UpdatedById as UpdatedBy ");
                    sb.Append("from Inserted join Deleted on inserted.id = deleted.id");

                    var changeSql = new SqlCommand();
                    changeSql.CommandText = sb.ToString();
                    changeSql.Connection  = conn;
                    using (var reader = changeSql.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            for (int i = 0; i < triggContext.ColumnCount; i++)
                            {
                                if (triggContext.IsUpdatedColumn(i))
                                {
                                    string colName = schemaTable.Columns[i].ColumnName;

                                    if (!ignoreColumn(colName))
                                    {
                                        var row      = auditTable.NewRow();
                                        var oldValue = reader.GetValue(reader.GetOrdinal("Deleted_" + colName));
                                        var newValue = reader.GetValue(reader.GetOrdinal("Inserted_" + colName));

                                        var changed = Changed(oldValue, newValue, schemaTable.Columns[i].DataType);

                                        if (changed)
                                        {
                                            row["OldValue"]    = oldValue;
                                            row["NewValue"]    = newValue;
                                            row["ReferenceId"] = reader.GetValue(reader.GetOrdinal("Id"));
                                            row["UpdateDate"]  = UpdateDate;
                                            row["UpdatedBy"]   = reader.GetValue(reader.GetOrdinal("UpdatedBy"));
                                            row["TableName"]   = TableName;
                                            row["FieldName"]   = colName;

                                            auditTable.Rows.Add(row);
                                        }
                                    }
                                }
                            }
                        }
                        if (!reader.IsClosed)
                        {
                            reader.Close();
                        }
                    }


                    var commandBuilder = new SqlCommandBuilder(auditAdapter);
                    auditAdapter.Update(auditTable);
                }

                sqlP.Send("exiting trigger");
            }
        }
    }
예제 #48
0
파일: HCSP.cs 프로젝트: hupech/MyBMConvert
 public static void Show_One_Rendering_Option(string arg0, System.Text.StringBuilder arg1)
 {
     HCSPPINVOKE.Show_One_Rendering_Option(arg0, arg1);
 }
예제 #49
0
파일: HCSP.cs 프로젝트: hupech/MyBMConvert
 public static void Show_Rendering_Options(System.Text.StringBuilder arg0)
 {
     HCSPPINVOKE.Show_Rendering_Options(arg0);
 }
예제 #50
0
    private static void StartImport(DataTable DTable, OleDbConnection xlConn)
    {
        Int64 rowNo = 0, xlSheetIndex = 2, TotalNoOfRecords = 0;

        System.String             NewXLSheetName = "Sheet";
        System.Text.StringBuilder strInsert      = new System.Text.StringBuilder();
        TotalNoOfRecords = DTable.Rows.Count;
        OleDbCommand cmdXl = new OleDbCommand();

        cmdXl.Connection = xlConn;
        if (mPredefineFile)
        {
            xlSheetIndex = 1;
        }
        for (int count = 0; count < DTable.Rows.Count; count++)
        {
            strInsert.Length = 0;

            if (rowNo == 0 && !mPredefineFile)
            {
                CreateXLSheets(DTable, xlConn, NewXLSheetName + xlSheetIndex);
            }
            rowNo += 1;

            // TotalNoOfRecords : Total no of records return by Sql Query, ideally should be set to 65535
            //rowNo : current Row no in the loop
            if (TotalNoOfRecords > 5000 && rowNo > 5000)
            {
                xlSheetIndex += 1;
                if (!mPredefineFile)
                {
                    CreateXLSheets(DTable, xlConn, NewXLSheetName + xlSheetIndex);
                }
                rowNo = 1;
            }
            strInsert.Append("Insert Into [" + NewXLSheetName + xlSheetIndex.ToString() + "$](" + SqlInsert.ToString() + ") Values (");
            foreach (DataColumn dCol in DTable.Columns)
            {
                if (dCol.DataType.ToString().ToLower().Contains("int"))
                {
                    if (DTable.Rows[count][dCol.Ordinal].ToString() == "")
                    {
                        strInsert.Append("NULL");
                    }
                    else
                    {
                        strInsert.Append(DTable.Rows[count][dCol.Ordinal]);
                    }
                }
                else if (dCol.DataType.ToString().ToLower().ToLower().Contains("decimal"))
                {
                    if (DTable.Rows[count][dCol.Ordinal].ToString() == "")
                    {
                        strInsert.Append("NULL");
                    }
                    else
                    {
                        strInsert.Append(DTable.Rows[count][dCol.Ordinal]);
                    }
                }
                else
                {
                    strInsert.Append("\"" + DTable.Rows[count][dCol.Ordinal].ToString().Replace("'", "''") + "\"");
                }

                strInsert.Append(",");
            }
            strInsert.Remove(strInsert.Length - 1, 1);
            strInsert.Append(");");
            cmdXl.CommandText = strInsert.ToString();
            cmdXl.ExecuteNonQuery();
        }
    }
예제 #51
0
    void RefrehFashionDes()
    {
        // Debug.Log("刷新说明!!!!");
        if (GameCenter.fashionMng.CurTargetFashion == null)
        {
            return;
        }
        if (clothesFashionTitle != null)
        {
            clothesFashionTitle.SetActive(GameCenter.fashionMng.CurTargetFashion.FashionType != 1);
        }
        if (weaponFashionTitle != null)
        {
            weaponFashionTitle.SetActive(GameCenter.fashionMng.CurTargetFashion.FashionType == 1);
        }
        if (clothesFashionGet != null)
        {
            clothesFashionGet.SetActive(GameCenter.fashionMng.CurTargetFashion.FashionType != 1);
        }
        if (weaponFashionGet != null)
        {
            weaponFashionGet.SetActive(GameCenter.fashionMng.CurTargetFashion.FashionType == 1);
        }
        if (foreverClothesFashion != null)
        {
            foreverClothesFashion.SetActive(GameCenter.fashionMng.CurTargetFashion.FashionType != 1 && GameCenter.fashionMng.CurTargetFashion.Time == 0);
        }
        if (foreverWeaponFashion != null)
        {
            foreverWeaponFashion.SetActive(GameCenter.fashionMng.CurTargetFashion.FashionType == 1 && GameCenter.fashionMng.CurTargetFashion.Time == 0);
        }
        if (limitClothesFashion != null)
        {
            limitClothesFashion.SetActive(GameCenter.fashionMng.CurTargetFashion.FashionType != 1 && GameCenter.fashionMng.CurTargetFashion.Time != 0);
        }
        if (limitWeaponFashion != null)
        {
            limitWeaponFashion.SetActive(GameCenter.fashionMng.CurTargetFashion.FashionType == 1 && GameCenter.fashionMng.CurTargetFashion.Time != 0);
        }
        if (fashionDes != null)
        {
            System.Text.StringBuilder builder = new System.Text.StringBuilder();
            //for (int i = 0; i < GameCenter.fashionMng.CurTargetFashion.Attribute.Count; i++)
            //{
            //    string n = ConfigMng.Instance.GetAttributeTypeName((ActorPropertyTag)GameCenter.fashionMng.CurTargetFashion.Attribute[i].eid);
            //    builder.Append(n + ":" + GameCenter.fashionMng.CurTargetFashion.Attribute[i].count + "\n");
            //}
            EquipmentInfo info = GameCenter.fashionMng.CurTargetFashion.ItemInfo;

            builder.Append(info.Description.Replace("\\n", "\n")).Append("\n");

            fashionDes.text = builder.ToString();
        }
        if (GameCenter.fashionMng.CurTargetFashion.IsOwn)
        {
            if (getFashion != null)
            {
                getFashion.text = ConfigMng.Instance.GetUItext(102);
            }
            if (goGetFashionBtn != null)
            {
                BoxCollider box = goGetFashionBtn.transform.GetComponent <BoxCollider>();
                if (box != null)
                {
                    box.enabled = false;
                }
            }
        }
        else
        {
            if (GameCenter.fashionMng.CurTargetFashion.Type == 1)
            {
                if (getFashion != null)
                {
                    getFashion.text = ConfigMng.Instance.GetUItext(100);
                }
                if (goGetFashionBtn != null)
                {
                    UIEventListener.Get(goGetFashionBtn.gameObject).onClick = GoMallWnd;
                    BoxCollider box = goGetFashionBtn.transform.GetComponent <BoxCollider>();
                    if (box != null)
                    {
                        box.enabled = true;
                    }
                }
            }
            else
            {
                if (getFashion != null)
                {
                    getFashion.text = ConfigMng.Instance.GetUItext(103);
                }
                if (goGetFashionBtn != null)
                {
                    BoxCollider box = goGetFashionBtn.transform.GetComponent <BoxCollider>();
                    if (box != null)
                    {
                        box.enabled = false;
                    }
                }
            }
        }
        if (GameCenter.fashionMng.CurTargetFashion.RemainTime != null)
        {
            if (getFashion != null)
            {
                getFashion.text = ConfigMng.Instance.GetUItext(101);
            }
            if (goGetFashionBtn != null)
            {
                UIEventListener.Get(goGetFashionBtn.gameObject).onClick = ToForever;
                BoxCollider box = goGetFashionBtn.transform.GetComponent <BoxCollider>();
                if (box != null)
                {
                    box.enabled = true;
                }
            }
        }

        RefreshTexture();
    }
    private bool LoadComponents(RenderModelInterfaceHolder holder, string renderModelName)
    {
        // Disable existing components (we will re-enable them if referenced by this new model).
        // Also strip mesh filter and renderer since these will get re-added if the new component needs them.
        var t = transform;

        for (int i = 0; i < t.childCount; i++)
        {
            var child = t.GetChild(i);
            child.gameObject.SetActive(false);
            StripMesh(child.gameObject);
        }

        // If no model specified, we're done; return success.
        if (string.IsNullOrEmpty(renderModelName))
        {
            return(true);
        }

        var renderModels = holder.instance;

        if (renderModels == null)
        {
            return(false);
        }

        var count = renderModels.GetComponentCount(renderModelName);

        if (count == 0)
        {
            return(false);
        }

        for (int i = 0; i < count; i++)
        {
            var capacity = renderModels.GetComponentName(renderModelName, (uint)i, null, 0);
            if (capacity == 0)
            {
                continue;
            }

            var componentName = new System.Text.StringBuilder((int)capacity);
            if (renderModels.GetComponentName(renderModelName, (uint)i, componentName, capacity) == 0)
            {
                continue;
            }

            // Create (or reuse) a child object for this component (some components are dynamic and don't have meshes).
            t = FindComponent(componentName.ToString());
            if (t != null)
            {
                t.gameObject.SetActive(true);
            }
            else
            {
                t                  = new GameObject(componentName.ToString()).transform;
                t.parent           = transform;
                t.gameObject.layer = gameObject.layer;

                // Also create a child 'attach' object for attaching things.
                var attach = new GameObject(k_localTransformName).transform;
                attach.parent           = t;
                attach.localPosition    = Vector3.zero;
                attach.localRotation    = Quaternion.identity;
                attach.localScale       = Vector3.one;
                attach.gameObject.layer = gameObject.layer;
            }

            // Reset transform.
            t.localPosition = Vector3.zero;
            t.localRotation = Quaternion.identity;
            t.localScale    = Vector3.one;

            capacity = renderModels.GetComponentRenderModelName(renderModelName, componentName.ToString(), null, 0);
            if (capacity == 0)
            {
                continue;
            }

            var componentRenderModelName = new System.Text.StringBuilder((int)capacity);
            if (renderModels.GetComponentRenderModelName(renderModelName, componentName.ToString(), componentRenderModelName, capacity) == 0)
            {
                continue;
            }

            // Check the cache or load into memory.
            var model = models[componentRenderModelName] as RenderModel;
            if (model == null || model.mesh == null)
            {
                if (verbose)
                {
                    Debug.Log("Loading render model " + componentRenderModelName);
                }

                model = LoadRenderModel(renderModels, componentRenderModelName.ToString(), renderModelName);
                if (model == null)
                {
                    continue;
                }

                models[componentRenderModelName] = model;
            }

            t.gameObject.AddComponent <MeshFilter>().mesh             = model.mesh;
            t.gameObject.AddComponent <MeshRenderer>().sharedMaterial = model.material;
        }

        return(true);
    }
예제 #53
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string codbus = lblCodBus.Text;

        string        estado    = "P";
        int           resultado = 0;
        IBL_Filmacion carga     = new BL_Filmacion();



        if (DropDownList1.SelectedValue.Equals("0"))
        {
            string message = "Ingrese una Hora Inicio de Grabacion.";
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("<script type = 'text/javascript'>");
            sb.Append("window.onload=function(){");
            sb.Append("alert('");
            sb.Append(message);
            sb.Append("')};");
            sb.Append("</script>");
            ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
        }
        else if (DropDownList2.SelectedValue.Equals("0"))
        {
            string message = "Ingrese un Hora fin de Grabacion.";
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("<script type = 'text/javascript'>");
            sb.Append("window.onload=function(){");
            sb.Append("alert('");
            sb.Append(message);
            sb.Append("')};");
            sb.Append("</script>");
            ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
        }
        else if (DropDownList1.SelectedValue.Equals(DropDownList2.SelectedValue))
        {
            string message = "La Hora de inicio y Fin no puede ser la misma.";
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("<script type = 'text/javascript'>");
            sb.Append("window.onload=function(){");
            sb.Append("alert('");
            sb.Append(message);
            sb.Append("')};");
            sb.Append("</script>");
            ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
        }
        else if (int.Parse(DropDownList1.SelectedValue) > int.Parse(DropDownList2.SelectedValue))
        {
            string message = "La hora Inicio no puede ser mayor a la de Fin de Grabación.";
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("<script type = 'text/javascript'>");
            sb.Append("window.onload=function(){");
            sb.Append("alert('");
            sb.Append(message);
            sb.Append("')};");
            sb.Append("</script>");
            ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
        }
        else
        {
            string ruta  = "Videos/" + "Bus_" + codbus + "_" + DropDownList1.SelectedValue;
            string hora1 = ViewState["horaSalida"].ToString().Substring(0, 2) + ":" + DropDownList1.SelectedItem.Text + ":00";

            string hora2 = ViewState["horaSalida"].ToString().Substring(0, 2) + ":" + DropDownList2.SelectedItem.Text + ":00";
            // DateTime a= DateTime.Parse(dt1);
            resultado = carga.f_RegistrarFilmacion(codbus, hora1, hora2, ruta, estado);
            if (resultado > 0)
            {
                btnGrabar.Enabled = false;
                lblMensaje.Text   = "Registro Exitoso";
                lblRuta.Text      = ruta;
            }
        }
    }
예제 #54
0
 internal static extern int SearchPath(string lpPath,
                                       string lpFileName, string lpExtension, int nBufferLength,
                                       [Out] System.Text.StringBuilder lpBuffer, out IntPtr lpFilePart);
예제 #55
0
    /// <summary>
    /// 显示时装属性加成
    /// </summary>
    /// <param name="go">Go.</param>
    void ShowInfo(GameObject go)
    {
        int a = 0;

        for (int i = 0; i < toggles.Length; i++)
        {
            if (toggles[i].value)
            {
                a = i;
                i = toggles.Length;
            }
        }
        if (a == 0 || a == 1)
        {
            if (allAttTitle != null)
            {
                allAttTitle.text = ConfigMng.Instance.GetUItext(276);
            }
            System.Text.StringBuilder builder = new System.Text.StringBuilder();
            allAttDic.Clear();
            for (int j = 0; j < GameCenter.fashionMng.AllAttrNum.Count; j++)
            {
                string n = ConfigMng.Instance.GetAttributeTypeName(GameCenter.fashionMng.AllAttrNum[j].tag);
                if (!allAttDic.ContainsKey(n))
                {
                    allAttDic[n] = GameCenter.fashionMng.AllAttrNum[j].value;
                }
                else
                {
                    allAttDic[n] = allAttDic[n] + GameCenter.fashionMng.AllAttrNum[j].value;
                }
            }
            using (var e = allAttDic.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    builder.Append(e.Current.Key + ":" + e.Current.Value + "\n");
                }
            }
            if (allAttNum != null)
            {
                allAttNum.text = builder.ToString();
            }
        }
        if (a == 2)
        {
            if (allAttTitle != null)
            {
                allAttTitle.text = ConfigMng.Instance.GetUItext(276);
            }
            System.Text.StringBuilder builder = new System.Text.StringBuilder();
            allAttDic.Clear();


            for (int j = 0; j < GameCenter.titleMng.AllAttrNum.Count; j++)
            {
                string n = ConfigMng.Instance.GetAttributeTypeName(GameCenter.titleMng.AllAttrNum[j].tag);
                if (!allAttDic.ContainsKey(n))
                {
                    allAttDic[n] = GameCenter.titleMng.AllAttrNum[j].value;
                }
                else
                {
                    allAttDic[n] = allAttDic[n] + GameCenter.titleMng.AllAttrNum[j].value;
                }
            }
            using (var e = allAttDic.GetEnumerator())
            {
                while (e.MoveNext())
                {
                    builder.Append(e.Current.Key + ":" + e.Current.Value + "\n");
                }
            }
            if (allAttNum != null)
            {
                allAttNum.text = builder.ToString();
            }
        }

        infoObj.SetActive(true);
        backBtn.gameObject.SetActive(true);
    }
예제 #56
0
 public void GetPieColorMapByValue(int[] count, float[] values, System.Text.StringBuilder color_space) {
   HCSMVOPINVOKE.HPieChart_GetPieColorMapByValue(swigCPtr, count, values, color_space);
 }
예제 #57
0
    // Generate landscape's texture using atlas texture
    // Pre : mesh already generated
    public void GenerateTexture()
    {
        if (pixels != null || atlasPixels != null)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            float atlasCellWidth  = atlasWidth / (float)LandscapeConstants.ATLAS_COLUMNS;
            float atlasCellHeight = atlasHeight / (float)LandscapeConstants.ATLAS_LINES;

            for (int i = 0; i < LandscapeConstants.TEXTURE_RESOLUTION; i++)
            {
                for (int j = 0; j < LandscapeConstants.TEXTURE_RESOLUTION; j++)
                {
                    float x        = j / (float)(LandscapeConstants.TEXTURE_RESOLUTION - 1) * LandscapeConstants.LANDSCAPE_SIZE;
                    float y        = i / (float)(LandscapeConstants.TEXTURE_RESOLUTION - 1) * LandscapeConstants.LANDSCAPE_SIZE;
                    float altitude = LandscapeConstants.HEIGHT_INTERVAL.Lerp(LandscapeConstants.NOISE.GetNoise(position.x - LandscapeConstants.LANDSCAPE_SIZE / 2.0f + x, position.z - LandscapeConstants.LANDSCAPE_SIZE / 2.0f + y));

                    for (int index = 0; index < LandscapeConstants.BIOMES_HEIGHT.Length; index++)
                    {
                        Interval interval = LandscapeConstants.BIOMES_HEIGHT[index];

                        if (interval.Contains(altitude))
                        {
                            int column = index % LandscapeConstants.ATLAS_COLUMNS;
                            int line   = Mathf.FloorToInt(index / (float)(LandscapeConstants.ATLAS_LINES + 1));

                            float cellX = atlasCellWidth * j / (float)(LandscapeConstants.TEXTURE_RESOLUTION - 1);
                            float cellY = atlasCellHeight * i / (float)(LandscapeConstants.TEXTURE_RESOLUTION - 1);

                            int pixX = (int)(column * atlasCellWidth + cellX);
                            int pixY = (int)(line * atlasCellHeight + cellY);
                            if (pixY * atlasWidth + pixX >= atlasPixels.Length)
                            {
                                sb.AppendLine("TOO HIGH : trying to get pixel "
                                              + pixY + " * " + atlasWidth + " + " + pixX + " = "
                                              + (pixY * atlasWidth + pixX)
                                              + " but atlas size is " + atlasPixels.Length);
                                break;
                            }

                            Color pixel = atlasPixels[pixY * atlasWidth + pixX];

                            if (i * LandscapeConstants.TEXTURE_RESOLUTION + j >= pixels.Length)
                            {
                                sb.AppendLine("TOO HIGH : trying to set pixel "
                                              + i + " * " + LandscapeConstants.TEXTURE_RESOLUTION + " + " + j + " = "
                                              + (i * LandscapeConstants.TEXTURE_RESOLUTION + j)
                                              + " but array size is " + pixels.Length);
                                break;
                            }

                            if (index < LandscapeConstants.BIOMES_HEIGHT.Length - 1 && interval.max - altitude < LandscapeConstants.BLEND_RANGE)
                            {
                                // Blend with superior
                                int nextColumn = (index + 1) % LandscapeConstants.ATLAS_COLUMNS;
                                int nextLine   = Mathf.FloorToInt((index + 1) / (float)(LandscapeConstants.ATLAS_LINES + 1));

                                int nextPixX = (int)(nextColumn * atlasCellWidth + cellX);
                                int nextPixY = (int)(nextLine * atlasCellHeight + cellY);
                                if (nextPixY * atlasWidth + nextPixX >= atlasPixels.Length)
                                {
                                    sb.AppendLine("TOO HIGH : trying to get pixel "
                                                  + nextPixY + " * " + atlasWidth + " + " + nextPixX + " = "
                                                  + (nextPixY * atlasWidth + nextPixX)
                                                  + " but atlas size is " + atlasPixels.Length);
                                    break;
                                }

                                Color nextPixel = atlasPixels[nextPixY * atlasWidth + nextPixX];

                                float diff = (interval.max - altitude) / LandscapeConstants.BLEND_RANGE;
                                pixel = Blend(pixel, nextPixel, (diff + 1) / 2.0f);
                            }
                            else if (index > 0 && altitude - interval.min < LandscapeConstants.BLEND_RANGE)
                            {
                                // Blend with superior
                                int prevColumn = (index - 1) % LandscapeConstants.ATLAS_COLUMNS;
                                int prevLine   = Mathf.FloorToInt((index - 1) / (float)(LandscapeConstants.ATLAS_LINES + 1));

                                int prevPixX = (int)(prevColumn * atlasCellWidth + cellX);
                                int prevPixY = (int)(prevLine * atlasCellHeight + cellY);
                                if (prevPixY * atlasWidth + prevPixX >= atlasPixels.Length)
                                {
                                    sb.AppendLine("TOO HIGH : trying to get pixel "
                                                  + prevPixY + " * " + atlasWidth + " + " + prevPixX + " = "
                                                  + (prevPixY * atlasWidth + prevPixX)
                                                  + " but atlas size is " + atlasPixels.Length);
                                    break;
                                }

                                Color prevPixel = atlasPixels[prevPixY * atlasWidth + prevPixX];

                                float diff = (altitude - interval.min) / LandscapeConstants.BLEND_RANGE;
                                pixel = Blend(pixel, prevPixel, (diff + 1) / 2.0f);
                            }
                            else
                            {
                                // Don't blend
                            }

                            pixels[i * LandscapeConstants.TEXTURE_RESOLUTION + j] = pixel;
                            break;
                        }
                    }
                }
            }
            if (sb.Length > 0)
            {
                Debug.LogError(sb);
            }
        }
        else
        {
            if (pixels == null)
            {
                Debug.LogError("Pixels is null for landscape at " + position);
            }
            if (atlasPixels == null)
            {
                Debug.LogError("AtlasPixels is null for landscape at " + position);
            }
        }
    }
    protected void CreateLogin(string email)
    {
        email = email.Replace("'", "''");

        //string curDbName = Session["DB"].ToString();

        try
        {
            List <Tuple <string, Patient, bool> > list = new List <Tuple <string, Patient, bool> >();


            System.Data.DataTable tbl = DBBase.ExecuteQuery("EXEC sp_databases;", "master").Tables[0];
            for (int i = 0; i < tbl.Rows.Count; i++)
            {
                string databaseName = tbl.Rows[i][0].ToString();

                if (!Regex.IsMatch(databaseName, @"Mediclinic_\d{4}"))
                {
                    continue;
                }
                //if (databaseName == "Mediclinic_0001")
                //    continue;

                System.Text.StringBuilder output = new System.Text.StringBuilder();

                Session["DB"] = databaseName;
                Session["SystemVariables"] = SystemVariableDB.GetAll();


                bool allowPatientLogins            = ((SystemVariables)Session["SystemVariables"])["AllowPatientLogins"].Value == "1";
                bool allowPatientsToCreateOwnLogin = ((SystemVariables)Session["SystemVariables"])["AllowPatientsToCreateOwnLogin"].Value == "1";

                if (!allowPatientLogins || !allowPatientsToCreateOwnLogin)
                {
                    continue;
                }


                int[] entityIDs;
                if (Utilities.GetAddressType().ToString() == "Contact")
                {
                    entityIDs = ContactDB.GetByAddrLine1(null, email, 27).Select(r => r.EntityID).ToArray();
                }
                else if (Utilities.GetAddressType().ToString() == "ContactAus")
                {
                    entityIDs = ContactAusDB.GetByAddrLine1(null, email, 27).Select(r => r.EntityID).ToArray();
                }
                else
                {
                    throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString());
                }


                foreach (int entityID in entityIDs)
                {
                    Patient patient = PatientDB.GetByEntityID(entityID);
                    if (patient == null || patient.IsDeceased || patient.IsDeleted)
                    {
                        continue;
                    }

                    bool hasLoginDetails = patient.Login.Length > 0;
                    if (!hasLoginDetails)
                    {
                        string login    = Regex.Replace(patient.Person.Firstname, @"[^A-Za-z]+", "").ToLower() + Regex.Replace(patient.Person.Surname, @"[^A-Za-z]+", "").ToLower();
                        string loginTry = login;

                        Random rnd = new Random();
                        int    nbr = rnd.Next(11, 999);

                        do
                        {
                            bool loginUsed = (!Convert.ToBoolean(ConfigurationManager.AppSettings["UseConfigDB"]) && UserDatabaseMapperDB.UsernameExists(loginTry)) ||
                                             (PatientDB.LoginExists(loginTry));

                            if (!loginUsed)
                            {
                                patient.Login = loginTry;
                                patient.Pwd   = loginTry == login ? login + nbr : loginTry;

                                PatientDB.UpdateLoginPwd(patient.PatientID, patient.Login, patient.Pwd);
                                if (!Convert.ToBoolean(ConfigurationManager.AppSettings["UseConfigDB"]))
                                {
                                    UserDatabaseMapperDB.Insert(loginTry, Session["DB"].ToString());
                                }

                                break;
                            }

                            nbr++;
                            loginTry = login + nbr;
                        } while (true);
                    }

                    SendPasswordRetrievalEmail(patient.Login, patient.Pwd, email);
                    list.Add(new Tuple <string, Patient, bool>(databaseName, patient, hasLoginDetails));
                }

                Session.Remove("DB");
                Session.Remove("SystemVariables");
            }


            System.Text.StringBuilder finalOutput = new System.Text.StringBuilder();
            foreach (Tuple <string, Patient, bool> item in list)
            {
                finalOutput.Append("<tr><td>" + item.Item1 + "</td><td>" + item.Item2.Person.FullnameWithoutMiddlename + "</td><td>" + item.Item3 + "</td><td>" + item.Item2.Login + " | " + item.Item2.Pwd + "</td></tr>");
            }


            //FailureText.Text = "Count: " + list.Count + "<br /><table border=\"1\" class=\"block_center padded-table-2px\">" + finalOutput.ToString() + "</table>";


            if (list.Count == 0)
            {
                throw new CustomMessageException("No patients found with this email");
            }

            this.FailureText.Text = "An email has been sent with new login details";
        }
        catch (CustomMessageException cmEx)
        {
            this.FailureText.Text = cmEx.Message;
        }
        finally
        {
            //Session["DB"] = curDbName;
            //Session["SystemVariables"] = SystemVariableDB.GetAll();
            Session.Remove("DB");
            Session.Remove("SystemVariables");
        }
    }
예제 #59
0
        /// <summary>
        /// Parses an OrgURI to determine what the supporting discovery server is.
        /// </summary>
        /// <param name="serviceUri">Service Uri to parse</param>
        /// <param name="Geo">Geo Code for region (Optional)</param>
        /// <param name="isOnPrem">if OnPrem, will be set to true, else false.</param>
        public static DiscoveryServer DeterminDiscoveryDataFromOrgDetail(Uri serviceUri, out bool isOnPrem, string Geo = null)
        {
            isOnPrem = false;
            //support for detecting a Live/Online URI in the path and rerouting to use that..
            if (IsValidOnlineHost(serviceUri))
            {
                // Check for Geo code and to make sure that the region is not on our internal list.
                if (!string.IsNullOrEmpty(Geo) &&
                    !(serviceUri.Host.ToUpperInvariant().Contains("CRMLIVETIE.COM") ||
                      serviceUri.Host.ToUpperInvariant().Contains("CRMLIVETODAY.COM"))
                    )
                {
                    using (DiscoveryServers discoSvcs = new DiscoveryServers())
                    {
                        // Find by Geo, if null fall though to next check
                        var locatedDiscoServer = discoSvcs.OSDPServers.Where(w => !string.IsNullOrEmpty(w.GeoCode) && w.GeoCode == Geo).FirstOrDefault();
                        if (locatedDiscoServer != null && !string.IsNullOrEmpty(locatedDiscoServer.ShortName))
                        {
                            return(locatedDiscoServer);
                        }
                    }
                }

                try
                {
                    isOnPrem = false;

                    // Determine deployment region from Uri
                    List <string> elements = new List <string>(serviceUri.Host.Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries));
                    elements.RemoveAt(0); // remove the first ( org name ) from the Uri.


                    // construct Prospective Dataverse Online path.
                    System.Text.StringBuilder buildPath = new System.Text.StringBuilder();
                    foreach (var item in elements)
                    {
                        if (item.Equals("api"))
                        {
                            continue; // Skip the .api. when running via this path.
                        }
                        buildPath.AppendFormat("{0}.", item);
                    }
                    string crmKey = buildPath.ToString().TrimEnd('.').TrimEnd('/');
                    buildPath.Clear();
                    if (!string.IsNullOrEmpty(crmKey))
                    {
                        using (DiscoveryServers discoSvcs = new DiscoveryServers())
                        {
                            // drop in the discovery region if it can be determined.  if not, default to scanning.
                            var locatedDiscoServer = discoSvcs.OSDPServers.Where(w => w.DiscoveryServerUri != null && w.DiscoveryServerUri.Host.Contains(crmKey)).FirstOrDefault();
                            if (locatedDiscoServer != null && !string.IsNullOrEmpty(locatedDiscoServer.ShortName))
                            {
                                return(locatedDiscoServer);
                            }
                        }
                    }
                }
                finally
                { }
            }
            else
            {
                isOnPrem = true;
                return(null);
            }
            return(null);
        }
예제 #60
0
 public void GetPieEdgeColor(System.Text.StringBuilder color) {
   HCSMVOPINVOKE.HPieChart_GetPieEdgeColor(swigCPtr, color);
 }