Ejemplo n.º 1
0
 public void GetHelp( HelpItem item )
 {
     if( item == HelpItem.Backend )
         Console.WriteLine( "Backend is for DB Communication" );
     else
         successor.GetHelp( item );
 }
Ejemplo n.º 2
0
            internal static Control Read(BinaryReaderEx br, Dictionary <int, string> strings, long ctprStart)
            {
                int    typeOffset = br.ReadInt32();
                int    ctprOffset = br.ReadInt32();
                string type       = strings[typeOffset];

                Control result;

                br.StepIn(ctprStart + ctprOffset);
                {
                    if (type == "DmeCtrlScrollText")
                    {
                        result = new ScrollTextDummy(br);
                    }
                    else if (type == "FrpgMenuDlgObjContentsHelpItem")
                    {
                        result = new HelpItem(br);
                    }
                    else if (type == "Static")
                    {
                        result = new Static(br);
                    }
                    else
                    {
                        throw new InvalidDataException($"Unknown control type: {type}");
                    }
                }
                br.StepOut();
                return(result);
            }
 public void GetHelp( HelpItem item )
 {
     if( item == HelpItem.IntermediateLayer )
         Console.WriteLine( "IntermediateLayer is for Business Logic" );
     else
         successor.GetHelp( item );
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds columnar content for a <see cref="HelpItem"/> using the current indentation
        /// for the line, and adding the appropriate padding between the columns
        /// </summary>
        /// <param name="helpItem">
        /// Current <see cref="HelpItem" /> to write to the console
        /// </param>
        /// <param name="maxInvocationWidth">
        /// Maximum number of characters accross all <see cref="HelpItem">help items</see>
        /// occupied by the invocation text
        /// </param>
        protected void AppendHelpItem(HelpItem helpItem, int maxInvocationWidth)
        {
            if (helpItem == null)
            {
                throw new ArgumentNullException(nameof(helpItem));
            }

            AppendText(helpItem.Invocation, CurrentIndentation);

            var offset              = maxInvocationWidth + ColumnGutter - helpItem.Invocation.Length;
            var availableWidth      = GetAvailableWidth();
            var maxDescriptionWidth = availableWidth - maxInvocationWidth - ColumnGutter;

            var descriptionLines = SplitText(helpItem.Description, maxDescriptionWidth);
            var lineCount        = descriptionLines.Count;

            AppendLine(descriptionLines.FirstOrDefault(), offset);

            if (lineCount == 1)
            {
                return;
            }

            offset = CurrentIndentation + maxInvocationWidth + ColumnGutter;

            foreach (var descriptionLine in descriptionLines.Skip(1))
            {
                AppendLine(descriptionLine, offset);
            }
        }
Ejemplo n.º 5
0
 private void OpenHelpLink(HelpItem item)
 {
     if (item != null)
     {
         ShareService.OpenUri(new Uri(item.Link));
     }
 }
Ejemplo n.º 6
0
 public void GetHelp( HelpItem item )
 {
     if( item == HelpItem.FrontEnd )
         Console.WriteLine( "Front end is for UI" );
     else
         successor.GetHelp( item );
 }
Ejemplo n.º 7
0
        protected override void WriteTextLine(HelpItem helpItem)
        {
            string value = helpItem.Text;

            if (Filter != null)
            {
                Match match = Filter.Match(value);

                if (match != null)
                {
                    int prevIndex = 0;

                    do
                    {
                        ConsoleOut.Write(value.Substring(prevIndex, match.Index - prevIndex));
                        ConsoleOut.Write(match.Value, new ConsoleColors(ConsoleColor.Black, ConsoleColor.Green));

                        prevIndex = match.Index + match.Length;

                        match = match.NextMatch();
                    } while (match.Success);

                    ConsoleOut.Write(value.Substring(prevIndex));
                    ConsoleOut.WriteLine();

                    return;
                }
            }

            ConsoleOut.WriteLine(value);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Add list
        /// </summary>
        /// <param name="ctl">Control</param>
        /// <param name="msg">Message</param>
        internal void AddList(Control ctl, string msg)
        {
            HelpItem hi = new HelpItem();

            hi.ctl = ctl;
            hi.msg = msg;
            _helpList.Add(hi);
        }
Ejemplo n.º 9
0
        public ActionResult Media(string ID, string ID2)
        {
            var bytes = HelpItem.LoadMedia(ID2, ID);

            if (bytes == null || bytes.Length == 0)
            {
                return(new HttpNotFoundResult());
            }
            return(base.File(bytes, "application/octet-stream"));
        }
Ejemplo n.º 10
0
        void PrintHelp(HelpItem helpItems = HelpItem.All)
        {
            string LibTesterName =
#if TSS_MIN_API
                "TpmTest.exe";
#else
                Environment.GetCommandLineArgs()[0];
#endif
            if (helpItems.HasFlag(HelpItem.Usage))
            {
                Console.WriteLine("\nUsage:\n");
                Console.WriteLine(LibTesterName +
                                  " [-opt1 [param1] [-opt2 [param2] [...] [TestProfile | TestList]]]]\n\n" +
                                  "- Option qualifiers, test and test profile names are case-insensitive.\n" +
                                  "- Prefix 'Test' present in many test names may be dropped.\n" +
                                  "- A test or test profile name do not require a preceding option.\n" +
                                  "- A test or test profile name may be prepended with an exclusion\n" +
                                  "    modifier '!' or '~' (similar to C/C++ logical and bitwise negation\n" +
                                  "    operators correspondingly) to exclude the test or profile from\n" +
                                  "    execution, or with a dash (which is ignored).\n" +
                                  "- Any number of option qualifiers with their corresponding values,\n" +
                                  "    test and profile namess with or without exclusion modifier may\n" +
                                  "    be simultaneously specified on the same command line in any order.\n" +
                                  "\n");
            }

            if (helpItems.HasFlag(HelpItem.Options))
            {
                Console.WriteLine("Supported options:");
                foreach (Option opt in DefinedOptions)
                {
                    Console.WriteLine("  " + opt.Tag.PadRight(8) + "\t" + opt.Comment);
                }
                Console.WriteLine("\nSupported devices:\n" + GetSupportedDeviceNamesList());
            }

            if (helpItems == HelpItem.All)
            {
                Console.WriteLine("\nTest profiles:");
            }
            if (helpItems.HasFlag(HelpItem.Profiles))
            {
                Console.WriteLine(GetDefinedProfileNamesList());
            }

            if (helpItems == HelpItem.All)
            {
                Console.WriteLine("\nTest cases:");
            }
            if (helpItems.HasFlag(HelpItem.Tests))
            {
                Console.WriteLine(ListToString(Target.AllTestNames.OrderBy(sel => sel)));
            }
        }
Ejemplo n.º 11
0
 public void GetHelp(HelpItem item)
 {
     if (item == HelpItem.Backend)
     {
         Console.WriteLine("Backend is for DB Communication");
     }
     else
     {
         successor.GetHelp(item);
     }
 }
Ejemplo n.º 12
0
    private void SetRightPanel()
    {
        var curDataList = dataList.FindAll(p => p.type == CurBtn._str);

        for (int i = 0; i < curDataList.Count; i++)
        {
            HelpItem item = Instantiate(rightBtn, rightContent);
            item.Init(curDataList[i]);
            itemList.Add(item);
        }
    }
Ejemplo n.º 13
0
 public void GetHelp(HelpItem item)
 {
     if (item == HelpItem.FrontEnd)
     {
         Console.WriteLine("Front end is for UI");
     }
     else
     {
         successor.GetHelp(item);
     }
 }
Ejemplo n.º 14
0
        private string GetLocalizedHelpResource(bool _manual)
        {
            // Find the local file path of a help resource (manual or help video) according to what is saved in the help index.

            string resourceUri = "";

            // Load the help file system.
            HelpIndex hiLocal = new HelpIndex(Application.StartupPath + "\\" + PreferencesManager.ResourceManager.GetString("URILocalHelpIndex"));

            if (hiLocal.LoadSuccess)
            {
                // Loop into the file to find the required resource in the matching locale, or fallback to english.
                string EnglishUri    = "";
                bool   bLocaleFound  = false;
                bool   bEnglishFound = false;
                int    i             = 0;

                CultureInfo ci      = PreferencesManager.Instance().GetSupportedCulture();
                string      neutral = ci.IsNeutralCulture ? ci.Name : ci.Parent.Name;

                // Look for a matching locale, or English.
                int iTotalResource = _manual ? hiLocal.UserGuides.Count : hiLocal.HelpVideos.Count;
                while (!bLocaleFound && i < iTotalResource)
                {
                    HelpItem hi = _manual ? hiLocal.UserGuides[i] : hiLocal.HelpVideos[i];

                    if (hi.Language == neutral)
                    {
                        bLocaleFound = true;
                        resourceUri  = hi.FileLocation;
                        break;
                    }

                    if (hi.Language == "en")
                    {
                        bEnglishFound = true;
                        EnglishUri    = hi.FileLocation;
                    }

                    i++;
                }

                if (!bLocaleFound && bEnglishFound)
                {
                    resourceUri = EnglishUri;
                }
            }
            else
            {
                log.Error("Cannot find the xml help index.");
            }

            return(resourceUri);
        }
Ejemplo n.º 15
0
 public void GetHelp(HelpItem item)
 {
     if (item == HelpItem.IntermediateLayer)
     {
         Console.WriteLine("IntermediateLayer is for Business Logic");
     }
     else
     {
         successor.GetHelp(item);
     }
 }
Ejemplo n.º 16
0
        private string GetLocalizedHelpResource(bool manual)
        {
            // Find the local file path of a help resource (manual or help video) according to what is saved in the help index.

            string resourceUri = "";

            // Load the help file system.
            HelpIndex hiLocal = new HelpIndex(Software.LocalHelpIndex);

            if (!hiLocal.LoadSuccess)
            {
                log.Error("Cannot find the xml help index.");
                return("");
            }

            // Loop into the file to find the required resource in the matching locale, or fallback to english.
            string englishUri   = "";
            bool   localeFound  = false;
            bool   englishFound = false;
            int    i            = 0;

            string cultureName = LanguageManager.GetCurrentCultureName();

            // Look for a matching locale, or English.
            int totalResource = manual ? hiLocal.UserGuides.Count : hiLocal.HelpVideos.Count;

            while (!localeFound && i < totalResource)
            {
                HelpItem hi = manual ? hiLocal.UserGuides[i] : hiLocal.HelpVideos[i];

                if (hi.Language == cultureName)
                {
                    localeFound = true;
                    resourceUri = hi.FileLocation;
                    break;
                }

                if (hi.Language == "en")
                {
                    englishFound = true;
                    englishUri   = hi.FileLocation;
                }

                i++;
            }

            if (!localeFound && englishFound)
            {
                resourceUri = englishUri;
            }

            return(resourceUri);
        }
Ejemplo n.º 17
0
 private void lv_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.OriginalSource == lv && !skipSelectionHandler)
     {
         e.Handled = true;
         HelpItem item = lv.SelectedItem as HelpItem;
         if (item != null)
         {
             ViewModel.GoTo(item);
         }
     }
 }
Ejemplo n.º 18
0
        internal HelpContent()
        {
            string[] split = Properties.Resources.help_content.Split(new string[] { "#####" }, StringSplitOptions.RemoveEmptyEntries);
            string   key;

            for (int i = 0; i < split.Length; i++)
            {
                try {
                    StringReader sr = new StringReader(split[i].TrimStart(Environment.NewLine.ToCharArray()));
                    key = sr.ReadLine();
                    string   small = sr.ReadLine(), large = sr.ReadToEnd();
                    HelpItem h = new HelpItem(small, large);
                    helpContent.Add(key, h);
                } catch { }
            }
        }
Ejemplo n.º 19
0
        public static void Show(IWin32Window owner, HelpItem helpItem)
        {
            var stream = typeof(HelpPopup).GetManifestResourceStream(helpItem.ToString() + ".rtf");

            if (stream == null)
            {
                return;                 //should never happen
            }
            using (var dlg = new HelpPopup())
            {
                using (var sr = new StreamReader(stream))
                    dlg.m_rtfHelp.Rtf = sr.ReadToEnd();

                dlg.ShowDialog(owner);
            }
        }
Ejemplo n.º 20
0
 public async Task HelpAsync(string helpType)
 {
     if (helpType.ToLower() == "owner")
     {
         EmbedBuilder e = HelpItem.avb02(Context.Guild);
         await ReplyAsync("", false, e.Build());
     }
     else if (helpType.ToLower() == "admin")
     {
         EmbedBuilder e = HelpItem.avb03(Context.Guild);
         await ReplyAsync("", false, e.Build());
     }
     else
     {
         await ReplyAsync("I don't regognise that one, run `help` for a list of types.");
     }
 }
Ejemplo n.º 21
0
 private void LaunchVideo(HelpItem _Video)
 {
     if (File.Exists(_Video.FileLocation))
     {
         //--------------------------------------------------------------------------
         // CommandLoadMovieInScreen est une commande du ScreenManager.
         // elle gère la création du screen si besoin, et demande
         // si on veut charger surplace ou dans un nouveau en fonction de l'existant.
         //--------------------------------------------------------------------------
         IUndoableCommand clmis = new CommandLoadMovieInScreen(m_ScreenManagerKernel, _Video.FileLocation, -1, true);
         CommandManager   cm    = CommandManager.Instance();
         cm.LaunchUndoableCommand(clmis);
     }
     else
     {
         log.Error(String.Format("Cannot find the video tutorial file. ({0}).", _Video.FileLocation));
     }
 }
Ejemplo n.º 22
0
    static string ComposeHTMLTree(ArrayList items)
    {
        string htmlItemLink = "\t<img src=\"treenodeplus.gif\" class=\"treeLinkImage\" onclick=\"expandCollapse(this.parentNode)\" />" +
                              "\t<a href=\"HHP2HTML_FILE\" target=\"main\" class=\"treeUnselected\" onclick=\"clickAnchor(this)\">HHP2HTML_NAME</a>\n";
        string htmlItem = "\t<img src=\"treenodedot.gif\" class=\"treeNoLinkImage\" />" +
                          "<a href=\"HHP2HTML_FILE\" target=\"main\" class=\"treeUnselected\" onclick=\"clickAnchor(this)\">HHP2HTML_NAME</a>\n";
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < items.Count; i++)
        {
            HelpItem item = (HelpItem)items[i];

            sb.Append(Multiply("\t", item.depth) + "<div class=\"treeNode\">\n");
            if (items.Count > (i + 1))           //therea are some more items
            {
                HelpItem nextItem = (HelpItem)items[i + 1];
                if (nextItem.depth > item.depth)                 //has a child
                {
                    sb.Append(Multiply("\t", item.depth) + htmlItemLink.Replace("HHP2HTML_NAME", item.name).Replace("HHP2HTML_FILE", item.file));
                    sb.Append(Multiply("\t", item.depth) + "\t<div class=\"treeSubnodesHidden\">\n");
                }
                else
                {
                    sb.Append(Multiply("\t", item.depth) + htmlItem.Replace("HHP2HTML_NAME", item.name).Replace("HHP2HTML_FILE", item.file));
                    sb.Append(Multiply("\t", item.depth) + "</div>\n");
                }

                if (nextItem.depth < item.depth)                 //is a last child
                {
                    sb.Append(Multiply("\t", item.depth - 1) + "</div>\n");
                    sb.Append(Multiply("\t", item.depth - 1) + "</div>\n");
                }
            }
            else
            {
                sb.Append(Multiply("\t", item.depth) + htmlItem.Replace("HHP2HTML_NAME", item.name).Replace("HHP2HTML_FILE", item.file));
                sb.Append(Multiply("\t", item.depth) + "</div>\n");
                sb.Append(Multiply("\t", item.depth - 1) + "</div>\n");
                sb.Append(Multiply("\t", item.depth - 1) + "</div>\n");
            }
        }
        return(sb.ToString());
    }
Ejemplo n.º 23
0
        private void Navigate_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if (HelpWindow.Current == null)
            {
                HelpWindow.Current = new HelpWindow()
                {
                    Owner = this
                }
            }
            ;

            HelpItem item = HelpWindow.Current.ViewModel.Items.FirstOrDefault(i => i.Key == (string)e.Parameter);

            if (item == null)
            {
                item = HelpWindow.Current.ViewModel.Items[0];
            }
            HelpWindow.Current.ViewModel.GoTo(item);
            HelpWindow.Current.Show();
        }
Ejemplo n.º 24
0
        protected override void OnFreshView()
        {
            base.OnFreshView();
            cards = App.GetGameData <Mahjong2DGameData>().TypeList;
            List <Transform> childList = _grid.GetChildList();

            for (int i = 0, max = childList.Count; i < max; i++)
            {
                MahjongItem item     = childList[i].GetComponent <MahjongItem>();
                HelpItem    HelpItem = item.gameObject.GetComponent <HelpItem>();
                if (i >= cards.Count)
                {
                    item.gameObject.SetActive(false);
                }
                else
                {
                    item.Value = cards[i];
                    item.SelfData.MahjongLayer = 100;
                    HelpItem.MahjongValueName  = (EnumMahjongValue)item.Value;
                }
            }
        }
Ejemplo n.º 25
0
    static public ArrayList ParseHHC(string file)
    {
        string text = "";

        using (StreamReader sr = new StreamReader(file))
        {
            text = sr.ReadToEnd();
        }

        string startTag = "<OBJECT type=\"text/sitemap\">";
        string endTag   = "</OBJECT>";

        int itemStart = -1, itemEnd = -1, currentSearchPos = text.IndexOf(startTag), currDepth = 0;


        ArrayList items = new ArrayList();

        while (true)
        {
            itemStart = text.IndexOf(startTag, currentSearchPos);
            if (itemStart == -1)
            {
                break;
            }
            itemEnd = text.IndexOf(endTag, currentSearchPos);

            string itemData      = text.Substring(itemStart + startTag.Length, itemEnd - (itemStart + startTag.Length));
            string interItemData = text.Substring(currentSearchPos, itemStart - currentSearchPos);

            if (interItemData.IndexOf("<UL>") != -1)
            {
                currDepth++;
            }
            if (interItemData.IndexOf("</UL>") != -1)
            {
                currDepth--;
            }

            HelpItem item = ParseHHCItem(itemData, currDepth);

            if (item.file == @"..\CSScript.html")
            {
                currentSearchPos = itemEnd + endTag.Length;
                continue;
            }

            if (firstTopicFile == "")
            {
                firstTopicFile = item.file;
            }
            items.Add(item);

            for (int i = 0; i < currDepth; i++)
            {
                Console.Write("\t");
            }
            Console.WriteLine(item.name);

            currentSearchPos = itemEnd + endTag.Length;
        }
        return(items);
    }
Ejemplo n.º 26
0
        private void button8_Click(object sender, EventArgs e)
        {
            HelpItem hi = new HelpItem();

            hi.Show();
        }
Ejemplo n.º 27
0
 public void GetHelp( HelpItem item )
 {
     Console.WriteLine( "Database is for Model & Storage" );
 }
Ejemplo n.º 28
0
		private static void AddHelpItem(string name, string desc)
		{
			Items[name] = new HelpItem(name, desc);
		}
Ejemplo n.º 29
0
 public void GetHelp(HelpItem item)
 {
     Console.WriteLine("Database is for Model & Storage");
 }
Ejemplo n.º 30
0
 public HelpViewModel()
 {
     this.HelpItem = new HelpItem(false);
 }
Ejemplo n.º 31
0
 private static void AddHelpItem(string name, string desc)
 {
     Items[name] = new HelpItem(name, desc);
 }
Ejemplo n.º 32
0
 protected bool Equals(HelpItem other) =>
 (Invocation, Description) == (other.Invocation, other.Description);
Ejemplo n.º 33
0
        public async Task HelpAsync()
        {
            EmbedBuilder e = HelpItem.avb01(Context.Guild);

            await ReplyAsync("", false, e.Build());
        }
Ejemplo n.º 34
0
    public void OnHelpSelection()
    {
        HelpItem hi = (HelpItem)CtxPopup.current.selectedItem;

        Debug.Log("ButtonHandler.OnHelpSelection() " + hi.ToString());
    }
Ejemplo n.º 35
0
 private void OnGUI()
 {
     if (help == null)
     {
         help           = new HelpItem();
         help.itemValue = new List <string>();
         help.itemValue.Add("");
         fileTitle = "";
         page      = 0;
     }
     EditorGUILayout.BeginHorizontal();
     if (GUILayout.Button("セーブ", GUILayout.Height(30)))
     {
         if (!Directory.Exists(savePath))
         {
             Directory.CreateDirectory(savePath);
         }
         string path = EditorUtility.SaveFilePanel("セーブ", savePath, (fileTitle != "" ? fileTitle: "New Help"), "json");
         if (!string.IsNullOrEmpty(path))
         {
             string json = JsonUtility.ToJson(help);
             File.WriteAllText(path, json);
             AssetDatabase.Refresh();
         }
         else
         {
             Debug.LogWarning("セーブパスが空です。");
         }
     }
     if (GUILayout.Button("ロード", GUILayout.Height(30)))
     {
         string path = EditorUtility.OpenFilePanel("ロード", "Assets/Resource/Help", "json");
         if (!string.IsNullOrEmpty(path))
         {
             string json = File.ReadAllText(path);
             fileTitle = Path.GetFileName(path);
             help      = JsonUtility.FromJson <HelpItem>(json);
         }
         else
         {
             Debug.LogWarning("ロードパスが空です。");
         }
     }
     EditorGUILayout.EndHorizontal();
     if (GUILayout.Button("リセット", GUILayout.Height(20)))
     {
         help           = new HelpItem();
         help.itemValue = new List <string>();
         help.itemValue.Add("");
         fileTitle = "";
         page      = 0;
     }
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.LabelField("名前", GUILayout.Width(50));
     help.itemName = EditorGUILayout.TextField(help.itemName);
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.BeginHorizontal();
     if (GUILayout.Button("<"))
     {
         GUI.FocusControl("");
         if (page - 1 != -1)
         {
             page--;
         }
     }
     if (GUILayout.Button("×"))
     {
         if (help.itemValue.Count != 1)
         {
             help.itemValue.Remove(help.itemValue[page]);
             if (page != 0)
             {
                 page--;
             }
         }
     }
     if (GUILayout.Button("+"))
     {
         help.itemValue.Add("");
     }
     if (GUILayout.Button(">"))
     {
         GUI.FocusControl("");
         if (page + 1 != help.itemValue.Count)
         {
             page++;
         }
     }
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.LabelField("項目");
     EditorGUILayout.LabelField((page + 1) + "/" + help.itemValue.Count + "ページ");
     help.itemValue[page] = EditorGUILayout.TextArea(help.itemValue[page], GUILayout.Height(175));
 }