Esempio n. 1
0
 private static void DoTranslation(StringTableManager.GungeonSupportedLanguages lang)
 {
     UIStrings.LanguageChanged();
     SynergyStrings.LanguageChanged();
     foreach (Translation translation in translations)
     {
         translation.UpdateLanguage(lang);
     }
 }
Esempio n. 2
0
 public string GetString(UIStrings uiString)
 {
     #if DEBUG1
     string result = _resource.GetString(uiString.ToString());
     System.Diagnostics.Debug.WriteLine(string.Format("{0} = {1}", uiString, result));
     return(result);
     #else
     return(_resource.GetString(uiString.ToString()));
     #endif
 }
Esempio n. 3
0
    static YZEventLog()
    {
        UIStrings rs = new UIStrings();
        YZEventLog.EventLogName = rs.TryGet("EventLog.Log");
        YZEventLog.EventSourceName = rs.TryGet("EventLog.Source.BPM");

        if (String.IsNullOrEmpty(YZEventLog.EventLogName))
            YZEventLog.EventLogName = "YZSoft";

        if (String.IsNullOrEmpty(YZEventLog.EventSourceName))
            YZEventLog.EventSourceName = "BPM";
    }
Esempio n. 4
0
    static YZEventLog()
    {
        UIStrings rs = new UIStrings();

        YZEventLog.EventLogName    = rs.TryGet("EventLog.Log");
        YZEventLog.EventSourceName = rs.TryGet("EventLog.Source.BPM");

        if (String.IsNullOrEmpty(YZEventLog.EventLogName))
        {
            YZEventLog.EventLogName = "YZSoft";
        }

        if (String.IsNullOrEmpty(YZEventLog.EventSourceName))
        {
            YZEventLog.EventSourceName = "BPM";
        }
    }
Esempio n. 5
0
        /// <summary>
        /// Adds a new translation for an individual string.
        /// </summary>
        /// <param name="language">The language to which the translation will be applied.</param>
        /// <param name="key">The string's key</param>
        /// <param name="value">The string</param>
        /// <param name="tableType">Type of the table in which <paramref name="value"/> is in.</param>
        public static void AddTranslation(StringTableManager.GungeonSupportedLanguages language, string key, string value, StringTableType tableType)
        {
            if (translations == null)
            {
                Init();
            }
            if (language == StringTableManager.GungeonSupportedLanguages.ENGLISH)
            {
                switch (tableType)
                {
                case StringTableType.Core:
                    ETGMod.Databases.Strings.Core.Set(key, value);
                    break;

                case StringTableType.Items:
                    ETGMod.Databases.Strings.Items.Set(key, value);
                    break;

                case StringTableType.Enemies:
                    ETGMod.Databases.Strings.Enemies.Set(key, value);
                    break;

                case StringTableType.UI:
                    UIStrings.Set(key, value);
                    break;

                case StringTableType.Intro:
                    ETGMod.Databases.Strings.Intro.Set(key, value);
                    break;

                case StringTableType.Synergy:
                    SynergyStrings.Set(key, value);
                    break;
                }
                return;
            }
            foreach (Translation translation in translations)
            {
                if (translation.language == language && translation.type == tableType)
                {
                    translation.AddStringTranslation(key, value);
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Takes a list of SharedCacheEntry
        /// and recursively parse it into a tree
        /// of SharedCacheNodes for displaying in
        /// TreeView.
        /// </summary>
        /// <param name="entries">A list of SharedCacheEntry to be parsed.</param>
        /// <returns>A hierarchical list of SharedCacheNode.</returns>
        public async static Task <List <SharedCacheNode> > PopulateItemTree(List <SharedCacheEntry> entries)
        {
            return(await await Task.Factory.StartNew(async() =>
            {
                var nodes = new List <SharedCacheNode>();

                // group up nodes by their directories
                var tree =
                    from entry in entries
                    group entry by entry.NextPath into newTree
                    orderby newTree.Key
                    select newTree;

                foreach (var branch in tree)     // every subnode is a group of files sharing a same path
                {
                    if (branch.ElementAt(0).IsPathTraversed)
                    {
                        nodes.Add(new SharedCacheFile()      // path traversed - we've reached a file node
                        {
                            DisplayName = branch.Key,
                            Info = branch.ElementAt(0)
                        });
                        UIStrings.GetInstance().LoadingProgValue++;
                    }
                    else
                    {
                        nodes.Add(new SharedCacheDirectory()      // path to be traversed - we're still in directories
                        {
                            DisplayName = branch.Key,
                            Files = await PopulateItemTree(branch.ToList())     // recursively parse directory contents
                        });
                    }
                }

                return nodes;
            }));
        }
Esempio n. 7
0
        public void ProcessRequest(HttpContext context)
        {
            YZAuthHelper.OAuth();

            //YZAuthHelper.AshxAuthCheck();

            try
            {
                UIStrings rs     = new UIStrings();
                int       taskid = Int32.Parse(context.Request.Params["tid"]);

                JsonItem rv = new JsonItem();
                using (BPMConnection cn = new BPMConnection())
                {
                    cn.WebOpen();

                    BPMStepCollection steps = BPMTask.GetAllSteps(cn, taskid);
                    BPMTask           task  = BPMTask.Load(cn, taskid);

                    rv.Attributes.Add("sn", task.SerialNum);
                    rv.Attributes.Add("pn", task.ProcessName);

                    //将数据转化为Json集合
                    JsonItemCollection children = new JsonItemCollection();
                    rv.Attributes.Add("children", children);

                    foreach (BPMProcStep step in steps)
                    {
                        //不是有效的步骤
                        if (!step.IsHumanStep)
                        {
                            continue;
                        }

                        //跳过 - 无处理人的非共享任务
                        if (String.IsNullOrEmpty(step.OwnerAccount) && !step.Share)
                        {
                            continue;
                        }

                        JsonItem item = new JsonItem();
                        children.Add(item);

                        item.Attributes.Add("StepDisplayName", step.StepDisplayName);

                        string recpAccount;
                        string recpDisplayName;
                        if (step.Finished)
                        {
                            recpAccount     = step.HandlerAccount;
                            recpDisplayName = YZStringHelper.GetUserShortName(step.HandlerAccount, step.HandlerFullName);
                        }
                        else
                        {
                            recpAccount     = step.RecipientAccount;
                            recpDisplayName = YZStringHelper.GetUserShortName(step.RecipientAccount, step.RecipientFullName);
                        }

                        if (!step.IsConsignStep && recpAccount != step.OwnerAccount)
                        {
                            recpDisplayName = String.Format(rs["XFormDesigner.XSignTrace.OwnerFmt"], recpDisplayName, YZStringHelper.GetUserShortName(step.OwnerAccount, step.OwnerDisplayName));
                        }
                        item.Attributes.Add("Recipient", recpDisplayName);

                        item.Attributes.Add("OwnerAccount", step.OwnerAccount);
                        item.Attributes.Add("OwnerFullName", step.OwnerFullName);
                        item.Attributes.Add("OwnerDisplayName", step.OwnerDisplayName);

                        item.Attributes.Add("Finished", step.Finished);
                        item.Attributes.Add("FinishAt", YZStringHelper.DateToStringM(step.FinishAt, ""));
                        item.Attributes.Add("ReceiveAt", YZStringHelper.DateToStringM(step.ReceiveAt, ""));

                        item.Attributes.Add("SelActionDisplayString", step.SelActionDisplayString);
                        item.Attributes.Add("Comments", HttpUtility.HtmlEncode(step.Comments));
                    }
                }

                //System.Threading.Thread.Sleep(500);
                //输出数据
                context.Response.Write(rv.ToString());
            }
            catch (Exception e)
            {
                JsonItem rv = new JsonItem();
                rv.Attributes.Add("success", false);
                rv.Attributes.Add("errorMessage", e.Message);
                context.Response.Write(rv.ToString());
            }


            context.Response.AppendHeader("Access-Control-Allow-Origin", "*");      // 响应类型
            context.Response.AppendHeader("Access-Control-Allow-Methods", "POST");  // 响应头设置
            context.Response.AppendHeader("Access-Control-Allow-Headers", "x-requested-with,content-type");

            context.Response.Charset         = "gb2312"; //设置字符集类型
            context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
            context.Response.ContentType     = "application/json;charset=gb2312";
        }