Ejemplo n.º 1
0
        public HelpItem FindHelpItemByDescDice(string text, HelpType type, float confidence = 0.5f)
        {
            List <KeyValuePair <float, HelpItem> > datas = new List <KeyValuePair <float, HelpItem> >();
            string preparedText = EventManager.PrepareText(text);

            foreach (var item in TazunaHelpData)
            {
                if (item.Type != type)
                {
                    continue;
                }
                float c = (float)item.OriginalToCheck.DiceCoefficient(preparedText);
                if (c >= confidence)
                {
                    datas.Add(new KeyValuePair <float, HelpItem>(c, item));
                }
            }

            if (datas.Count > 1)
            {
                return(GetHelpTypeWithMaxConfidence(datas));
            }
            else if (datas.Count == 1)
            {
                return(datas[0].Value);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        void UpdateHelpText(HelpType helpType)
        {
            if (_isUpdatingHelpText)
            {
                return;
            }
            _isUpdatingHelpText = true;
            try
            {
                switch (helpType)
                {
                case HelpType.Server:
                    IsResourceHelpVisible = false;
                    HelpText = Help.HelpTextResources.SettingsSecurityServerHelpWindowsGroup;
                    break;

                case HelpType.Resource:
                    IsServerHelpVisible = false;
                    HelpText            = Help.HelpTextResources.SettingsSecurityResourceHelpResource;
                    break;
                }
            }
            finally
            {
                _isUpdatingHelpText = false;
            }
        }
Ejemplo n.º 3
0
 public HelpAttribute(string methodName, HelpType type, HelpPosition position, string message)
 {
     this.methodName = methodName;
     this.type = type;
     this.position = position;
     this.message = message;
 }
Ejemplo n.º 4
0
 public void SetupHelpPanel(HelpType helpType, Action clbk)
 {
     gameObject.SetActive(true);
     callback = clbk;
     foreach (var help in helpList)
     {
         if (help.type == helpType)
         {
             if (help.image != null)
             {
                 image.gameObject.SetActive(true);
                 image.texture = help.image;
             }
             else
             {
                 image.gameObject.SetActive(false);
             }
             title.text = help.title;
             info.text  = help.info;
             return;
         }
     }
     Debug.LogError("Haven't set up help for: " + helpType);
     ClosePanel();
 }
Ejemplo n.º 5
0
    public void ShowHelp(HelpType helpType)
    {
        switch (helpType)
        {
        case HelpType.EKey:
            eKey.color = new Color(1, 1, 1, 1);
            gKey.color = new Color(1, 1, 1, 0);
            fKey.color = new Color(1, 1, 1, 0);
            Invoke("HideHelp", 4);
            return;

        case HelpType.GKey:
            eKey.color = new Color(1, 1, 1, 0);
            gKey.color = new Color(1, 1, 1, 1);
            fKey.color = new Color(1, 1, 1, 0);
            Invoke("HideHelp", 4);
            return;

        case HelpType.FKey:
            eKey.color = new Color(1, 1, 1, 0);
            gKey.color = new Color(1, 1, 1, 0);
            fKey.color = new Color(1, 1, 1, 1);
            Invoke("HideHelp", 4);
            return;
        }
    }
Ejemplo n.º 6
0
        public EvalReturn Eval(string input)
        {
            try
            {
                EvalReturn retVal = new EvalReturn(Response.Ok, string.Empty, typeof(Types.EmptyType));
                string[]   parts  = input.Split(' ');
                foreach (string i in parts)
                {
                    Types.ICalculonType val = Parse(i);
                    retVal = val.Eval(ref state);
                    if (retVal.Response == Response.Help)
                    {
                        return(HelpType.ExtendedHelp(ref state, parts));
                    }
                    if (retVal.Response != Response.Ok)
                    {
                        return(retVal); // Something went wrong, bail here
                    }
                }

                return(retVal);
            }
            catch (System.FormatException)  //Parser didn't understand input
            {
                Types.ErrorType err = new Types.ErrorType(
                    String.Format(GetString("ParseErr"), input));
                return(err.Eval(ref state));
            }
        }
Ejemplo n.º 7
0
 public HelpAttribute(string methodName, HelpType type, HelpPosition position, string message)
 {
     this.methodName = methodName;
     this.type       = type;
     this.position   = position;
     this.message    = message;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// TODO: Shows help for using eBook Readers with Voracious EBOOK Reader
        /// </summary>
        private async void OnEbookReaderHelp(object sender, RoutedEventArgs e)
        {
            uiHelpControl.Visibility   = ToggleVisibility(uiHelpControl.Visibility);
            uiReaderControl.Visibility = ToggleVisibility(uiReaderControl.Visibility);

            CurrHelpType = HelpType.eBookReader;
            await uiHelpControl.SetupMarkdown();
        }
Ejemplo n.º 9
0
 public static bool isHelp(string arg, out HelpType ht)
 {
     ht = HelpType.None;
     if (Enum.TryParse <HelpType>(arg, true, out ht))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 10
0
        private static void add(string name, CommandType cmdType, HelpType helpType)
        {
            CommandData cmdData = new CommandData();

            cmdData.Name     = name;
            cmdData.CmdType  = cmdType;
            cmdData.HelpType = helpType;
            Dic[name]        = cmdData;
        }
Ejemplo n.º 11
0
        // Initialization
        /// Constructor lets the caller specify the message.
        public HelpBoxScreen(HelpType type)
        {
            this.type = type;
            IsPopup   = true;

            TransitionOnTime  = TimeSpan.FromSeconds(.5);
            TransitionOffTime = TimeSpan.FromSeconds(.5);

            AudioManager.PlayCue("openWindow");
        }
Ejemplo n.º 12
0
    public static void Unselect()
    {
        if (SelectedHelp == HelpType.None)
        {
            return;
        }

        helpButtons[SelectedHelp].buttonImage.color = Color.white;
        SelectedHelp = HelpType.None;
    }
Ejemplo n.º 13
0
        private static ICollection <OfferedHelp> HasAdapter(HelpType adapterHelpType)
        {
            var result = new List <OfferedHelp>
            {
                new OfferedHelp
                {
                    HelpType = adapterHelpType
                }
            };

            return(result);
        }
Ejemplo n.º 14
0
    private void Select()
    {
        if (SelectedHelp == Type)
        {
            Unselect(); return;
        }
        if (cooldownTimer != 0)
        {
            return;
        }
        Unselect();

        SelectedHelp = Type;
    }
Ejemplo n.º 15
0
 public ActionResult addType(HelpType model)
 {
     if (ModelState.IsValid)
     {
         model = helptypeBll.Add(model);
         if (model.Id > 0)
         {
             return(RedirectToAction("list"));
         }
         else
         {
             ModelState.AddModelError("", "添加失败!");
         }
     }
     return(View());
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Determines the help CSS classes.
        /// </summary>
        /// <param name="helpType">Type of the help.</param>
        /// <returns>The CSS classes to use for help html item.</returns>
        private string DetermineHelpCssClasses(HelpType helpType)
        {
            switch (helpType)
            {
            case HelpType.Info:
                return("alert alert-info");

            case HelpType.Warning:
                return("alert alert-warning");

            case HelpType.Error:
                return("alert alert-error");

            default:
                return("alert");
            }
        }
Ejemplo n.º 17
0
        public static MessageType GetMessageType(this HelpType helpType)
        {
            switch (helpType)
            {
            case HelpType.Info:
                return(MessageType.Info);

            case HelpType.Warning:
                return(MessageType.Warning);

            case HelpType.Error:
                return(MessageType.Error);

            default:
                return(MessageType.None);
            }
        }
        /// <summary>
        /// Determines the help CSS classes.
        /// </summary>
        /// <param name="helpType">Type of the help.</param>
        /// <returns>The CSS classes to use for help html item.</returns>
        private string DetermineHelpCssClasses(HelpType helpType)
        {
            switch (helpType)
            {
                case HelpType.Info:
                    return "alert alert-info";

                case HelpType.Warning:
                    return "alert alert-warning";

                case HelpType.Error:
                    return "alert alert-error";

                default:
                    return "alert";
            }
        }
Ejemplo n.º 19
0
 public Types.ICalculonType Parse(string input)
 {
     if (Literal.IsMatch(input))
     {
         Literal l = new Literal(input);
         return(l);
     }
     else if (Real.IsMatch(input))
     {
         Real r = new Real(input);
         return(r);
     }
     else if (Rational.IsMatch(input))
     {
         Rational rat = new Rational(input);
         return(rat);
     }
     else if (Integer.IsMatch(input))
     {
         Integer i = new Integer(input);
         return(i);
     }
     else if (RealConstant.IsMatch(input))
     {
         RealConstant rc = new RealConstant(input);
         return(rc);
     }
     else if (HelpType.IsMatch(input))
     {
         HelpType ht = new HelpType();
         return(ht);
     }
     else
     {
         FunctionInstance fi = FunctionFactory.Instance[input];
         if (fi.IsError)
         {
             return(new ErrorType(String.Format(GetString("NotNumNotString"), input)));
         }
         return(fi);
     }
 }
Ejemplo n.º 20
0
    public void AddHelp(HelpType helpType)
    {
        switch (helpType)
        {
        case HelpType.Cheatmode:
            Cheatmode.SetActive(true);
            break;

        case HelpType.Enable:
            Enable.SetActive(true);
            break;

        case HelpType.Disable:

            Disable.SetActive(true);
            break;

        case HelpType.Kill:
            Kill.SetActive(true);
            break;

        case HelpType.Activate:
            Activate.SetActive(true);
            break;

        case HelpType.FastTypes:
            EnableFast.SetActive(true);
            DisableFast.SetActive(true);
            KillFast.SetActive(true);
            ActivateFast.SetActive(true);
            SpeedFast.SetActive(true);
            break;

        case HelpType.Speed:
            Speed.SetActive(true);
            break;

        default:
            break;
        }
    }
Ejemplo n.º 21
0
    private void UpdateList(HelpType type)
    {
        if (_type == type)
        {
            return;
        }
        _type = type;

        UpdateCellList();
        foreach (CheatsData x in CheatsData.GetData().Values)
        {
            if (x.type_ == type)
            {
                GameObject objCell = null;
                if (cellPool.Count > 0)
                {
                    objCell = cellPool[0];
                    cellPool.Remove(objCell);
                    UIManager.RemoveButtonAllEventHandler(objCell);
                }
                else
                {
                    objCell = Object.Instantiate(cell) as GameObject;
                }


                HelpBookCellUI cellUI = objCell.GetComponent <HelpBookCellUI>();
                cellUI.Cheats = x;
                //UIManager.SetButtonEventHandler (objCell, EnumButtonEvent.OnClick, OnClickSkill, 0, 0);
                objCell.transform.parent = grid.transform;
                objCell.gameObject.SetActive(true);
                objCell.transform.localScale = Vector3.one;
                cellList.Add(objCell);
            }
        }
        grid.Reposition();
    }
Ejemplo n.º 22
0
 public HelpMenuCommand(String name, CommandScope scope, bool active, HelpType comType)
     : base(name, scope, active)
 {
     commandType = comType;
 }
Ejemplo n.º 23
0
 public HelpAttribute(string methodName, HelpType type, string message)
     : this(methodName, type, HelpPosition.After, message)
 {
 }
Ejemplo n.º 24
0
    public void HelpClicked(int halp)
    {
        HelpType halpHalp = (HelpType)halp;

        ranges = GameObject.FindGameObjectsWithTag("Ranges");
        for (int i = 0; i < ranges.Length; i++)
        {
            ranges[i].SetActive(false);
        }

        Popup.SetActive(true);

        switch (halpHalp)
        {
        case HelpType.Symptoms:
            popupText.text = "The patient's symptoms include: " + manager.GetSymptoms();
            break;

        case HelpType.ChemLeuk:
            popupText.text = "There should be no Leukocytes found in the urine. Shows positive if Leukocytes are found.";
            break;

        case HelpType.ChemNitr:
            popupText.text = "There should be no Nitrites found in the urine. Shows positive if Nitrites are found.";
            break;

        case HelpType.ChemUrob:
            popupText.text = "It is normal to find a small amount of Urobilirubin within urine. The normal level is from 0.5-1 mg/dL.";
            break;

        case HelpType.ChemProt:
            popupText.text = "The normal amount of protein found in urine is typically < 150 mg/d. Large amounts of protein found in urine typically point to Proteinuria.";
            break;

        case HelpType.ChemPH:
            popupText.text = "The normal range for pH of urine is 4.5-8.";
            break;

        case HelpType.ChemHaem:
            popupText.text = "Haemoglobin found in urine points to there being blood in the urine. Blood can be there for many reasons, including Kidney Infection, Kidney Stones, and Urinary Tract Infection.";
            break;

        case HelpType.ChemSpec:
            popupText.text = "Specific gravity is a measurement of urine concentration. The typical range is 1.005-1.025.";
            break;

        case HelpType.ChemKeto:
            popupText.text = "Ketones should not be found in urine. The presence of Ketones signifies that the patient most likely has Type 1 Diabetes.";
            break;

        case HelpType.ChemBili:
            popupText.text = "There should be no Bilirubin with the urine. Shows positive if Bilirubin is found.";
            break;

        case HelpType.ChemGluc:
            popupText.text = "The normal level of Glucose is <130 mg/d. Large amounts of Glucose in urine tends to point at Type 2 Diabetes.";
            break;

        case HelpType.Diabetes1:
            popupText.text = "Type 1 Diabetes can be found by discovering high levels of Ketones within the urine. The patient can also be showing the following symptoms: Urinating Often, Very Thirsty, Unintentional Weight Loss,Increased Hunger, Blurry Vision, Fatigue, or Bedwetting";
            break;

        case HelpType.Diabetes2:
            popupText.text = "Type 2 Diabetes can be found by discovering high levels of Glucose within the urine. The patient can also be showing the following symptoms: Very Thirsty, Urinating Often, Increased Hunger, Unintentional Weight Loss, Fatigue, Blurred Vision, Slow-healing sores, Frequent Infections, Darkened Skin Areas";
            break;

        case HelpType.Proteinuria:
            popupText.text = "Proteinuria is the presence of protein in urine. Therefore, it can be found through high levels of protein found in the urine. Proteinuria typically does not have any symptoms.";
            break;

        case HelpType.KInfection:
            popupText.text = "A Kidney Infection can cause the urine to turn red, and can be discovered through a high count of red and white blood cells. Symptoms include Fever, Back Pain, Groin Pain, Abdominal Pain, Frequent Urination, Strong and Persistent Urge to Urinate, Burning Sensation When Urinating, Pus in Urine, Blood in Urine, Cloudy Urine, Strong Smelling Urine";
            break;

        case HelpType.KStones:
            popupText.text = "Kidney stones can cause the urine to turn red or brown and can be discovered by finding crystals in the urine. Symptoms include Severe Pain in Lower Side and Back, Pain That Spreads to the Lower Abdomen and Groin, Pain That Comes in Waves and Fluctuates in Intensity, Painful Urination, Discolored Urine, Cloudy Urine, Strong Smelling Urine, Nausea, Vomiting, Persistent Need to Urinate, Frequent Urination, Short Urination Duration";
            break;

        case HelpType.UTI:
            popupText.text = "A UTI can cause the urine to turn red, and can be discovered by a high level of red blood cells and bacteria being present in the urine. Symptoms include Strong and Persistent Urge to Urinate, Burining Sensation when Urinating, Frequent and Short Urination, Cloudy Urine, Discolored Urine, Strong Smelling Urine, Pelvic Pain, Rectal Pain, Fever, Nausea, Vomiting, Blood in Urine";
            break;

        case HelpType.Gout:
            popupText.text = "Gout can be discoverd by finding crystals in the urine. Symptoms include Intense Joint Pain, Lingering Discomfort, Inflammation and Redness, Limited Range of Motion";
            break;
        }
    }
Ejemplo n.º 25
0
 public HelpAttribute(HelpType type, string message)
     : this("", type, HelpPosition.After, message)
 {
 }
Ejemplo n.º 26
0
 public AssemblyProductHelpResourceAttribute(HelpType helpType, string path)
 {
     HelpType = helpType;
     Path     = path;
 }
        void UpdateHelpText(HelpType helpType)
        {
            if(_isUpdatingHelpText)
            {
                return;
            }
            _isUpdatingHelpText = true;
            try
            {
                switch(helpType)
                {
                    case HelpType.Server:
                        IsResourceHelpVisible = false;
                        HelpText = Help.HelpTextResources.SettingsSecurityServerHelpWindowsGroup;
                        break;

                    case HelpType.Resource:
                        IsServerHelpVisible = false;
                        HelpText = Help.HelpTextResources.SettingsSecurityResourceHelpResource;
                        break;
                }
            }
            finally
            {
                _isUpdatingHelpText = false;
            }
        }
Ejemplo n.º 28
0
 public HelpAttribute(HelpType type, HelpPosition position, string message)
     : this("", type, position, message)
 {
 }
Ejemplo n.º 29
0
 public static void ShowHelp(HelpType type)
 {
     Process.Start($"http://grimdawn.dreamcrash.org/ia/help.html?q={type.ToString()}&r={DateTime.UtcNow.Ticks}");
 }
Ejemplo n.º 30
0
 public static string GetUrl(HelpType type)
 {
     return($"http://grimdawn.dreamcrash.org/ia/help.html?q={type.ToString()}&r={DateTime.UtcNow.Ticks}");
 }
Ejemplo n.º 31
0
        internal static bool BuildEffectDll(string scriptText, string scriptPath, string subMenuname, string menuName, string iconPath, string author, int majorVersion, int minorVersion, string supportURL, string windowTitle, bool isAdjustment, string description, string keyWords, EffectFlags effectFlags, EffectRenderingSchedule renderingSchedule, HelpType helpType, string helpText)
        {
            string projectName = Path.GetFileNameWithoutExtension(scriptPath);

            // Generate code
            string sourceCode = ScriptWriter.FullSourceCode(scriptText, projectName, isAdjustment, subMenuname, menuName, iconPath, supportURL, effectFlags, renderingSchedule, author, majorVersion, minorVersion, description, keyWords, windowTitle, helpType, helpText);

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

            if (File.Exists(iconPath))
            {
                // If an icon is specified and exists, add it to the build as an embedded resource to the same namespace as the effect.
                resourceFiles.Add(iconPath);
            }

            string samplepath = Path.ChangeExtension(scriptPath, ".sample.png");

            if (File.Exists(samplepath))
            {
                // If an image exists in the icon directory with a ".sample.png" extension, add it to the build as an embedded resource.
                resourceFiles.Add(samplepath);
            }

            string helpPath = Path.ChangeExtension(scriptPath, ".rtz");

            if (helpType == HelpType.RichText && File.Exists(helpPath))
            {
                // If an help file exists in the source directory with a ".rtz" extension, add it to the build as an embedded resource.
                resourceFiles.Add(helpPath);
            }

            return(BuildDll(projectName, resourceFiles, sourceCode, ProjectType.Effect));
        }
Ejemplo n.º 32
0
 public static string GetUrl(HelpType type)
 {
     return($"https://grimdawn.evilsoft.net/help/?q={type.ToString()}&r={DateTime.UtcNow.Ticks}");
 }
Ejemplo n.º 33
0
        internal static bool BuildDll(string scriptText, string scriptPath, string subMenuname, string menuName, string iconPath, string author, int majorVersion, int minorVersion, string supportURL, string windowTitle, bool isAdjustment, string description, string keyWords, EffectFlags effectFlags, EffectRenderingSchedule renderingSchedule, HelpType helpType, string helpText)
        {
            string FileName = Path.GetFileNameWithoutExtension(scriptPath);

            // Calculate output path
            string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
            string dllPath     = Path.Combine(desktopPath, FileName);

            dllPath = Path.ChangeExtension(dllPath, ".dll");
            string zipPath = Path.ChangeExtension(dllPath, ".zip");
            string batPath = Path.Combine(desktopPath, "Install_" + Regex.Replace(FileName, @"[^\w]", ""));

            batPath = Path.ChangeExtension(batPath, ".bat");

            // Remove non-alpha characters from namespace
            string NameSpace = Regex.Replace(FileName, @"[^\w]", "") + "Effect";

            // Generate code
            string SourceCode = ScriptWriter.FullSourceCode(scriptText, FileName, isAdjustment, subMenuname, menuName, iconPath, supportURL, effectFlags, renderingSchedule, author, majorVersion, minorVersion, description, keyWords, windowTitle, helpType, helpText);

            exceptionMsg = null;
            // Compile code
            try
            {
                string newCompilerOptions = defaultOptions;
                if (File.Exists(iconPath))
                {
                    // If an icon is specified and exists, add it to the build as an imbedded resource to the same namespace as the effect.
                    newCompilerOptions += " /res:\"" + iconPath + "\",\"" + NameSpace + "." + Path.GetFileName(iconPath) + "\" ";

                    // If an icon exists, see if a sample image exists
                    string samplepath = Path.ChangeExtension(iconPath, ".sample.png");
                    if (File.Exists(samplepath))
                    {
                        // If an image exists in the icon directory with a ".sample.png" extension, add it to the build as an imbedded resource.
                        newCompilerOptions += " /res:\"" + samplepath + "\",\"" + NameSpace + "." + Path.GetFileName(samplepath) + "\" ";
                    }
                }
                string HelpPath = Path.ChangeExtension(scriptPath, ".rtz");
                if (helpType == HelpType.RichText && File.Exists(HelpPath))
                {
                    // If an help file exists in the source directory with a ".rtz" extension, add it to the build as an imbedded resource.
                    newCompilerOptions += " /res:\"" + HelpPath + "\",\"" + NameSpace + "." + Path.GetFileName(HelpPath) + "\" ";
                }

                newCompilerOptions += " /debug- /target:library /out:\"" + dllPath + "\"";

                param.CompilerOptions = newCompilerOptions;
                result = cscp.CompileAssemblyFromSource(param, SourceCode);
                param.CompilerOptions = defaultOptions;

                lineOffset = (SourceCode.Substring(0, SourceCode.IndexOf("#region User Entered Code", StringComparison.Ordinal)) + "\r\n").CountLines();

                if (result.Errors.HasErrors)
                {
                    return(false);
                }

                // Create install bat file
                if (File.Exists(batPath))
                {
                    File.Delete(batPath);
                }
                if (File.Exists(zipPath))
                {
                    File.Delete(zipPath);
                }

                // Try this in Russian for outputting Russian characters to the install batch file:

                //System.Text.Encoding encoding = System.Text.Encoding.GetEncoding("windows-1251");
                //var stream = new FileStream(installPath, FileMode.Create);
                //StreamWriter sw = new StreamWriter(stream, encoding);

                StreamWriter sw = new StreamWriter(batPath);

                sw.WriteLine("@echo off");
                sw.WriteLine(":: Get ADMIN Privs");
                sw.WriteLine("mkdir \"%windir%\\BatchGotAdmin\"");
                sw.WriteLine("if '%errorlevel%' == '0' (");
                sw.WriteLine("  rmdir \"%windir%\\BatchGotAdmin\" & goto gotAdmin");
                sw.WriteLine(") else ( goto UACPrompt )");
                sw.WriteLine("");
                sw.WriteLine(":UACPrompt");
                sw.WriteLine("    echo Set UAC = CreateObject^(\"Shell.Application\"^) > \"%temp%\\getadmin.vbs\"");
                sw.WriteLine("    echo UAC.ShellExecute %0, \"\", \"\", \"runas\", 1 >> \"%temp%\\getadmin.vbs\"");
                sw.WriteLine("    \"%temp%\\getadmin.vbs\"");
                sw.WriteLine("    exit /B");
                sw.WriteLine("");
                sw.WriteLine(":gotAdmin");
                sw.WriteLine("    if exist \"%temp%\\getadmin.vbs\" ( del \"%temp%\\getadmin.vbs\" )");
                sw.WriteLine("    pushd \"%CD%\"");
                sw.WriteLine("    CD /D \"%~dp0\"");
                sw.WriteLine("");
                sw.WriteLine(":: End Get ADMIN Privs");
                sw.WriteLine(":: Read registry to find Paint.NET install directory");
                sw.WriteLine("reg query HKLM\\SOFTWARE\\Paint.NET /v TARGETDIR 2>nul || (echo Sorry, I can't find Paint.NET! & goto store)");
                sw.WriteLine("set PDN_DIR=");
                sw.WriteLine("for /f \"tokens=2,*\" %%a in ('reg query HKLM\\SOFTWARE\\Paint.NET /v TARGETDIR ^| findstr TARGETDIR') do (");
                sw.WriteLine("  set PDN_DIR=%%b");
                sw.WriteLine(")");
                sw.WriteLine("if not defined PDN_DIR (echo Sorry, I can't find Paint.NET! & goto store)");
                sw.WriteLine(":: End read registry");
                sw.WriteLine(":: Now do install");
                sw.WriteLine("@echo off");
                sw.WriteLine("cls");
                sw.WriteLine("echo.");
                sw.WriteLine("echo Installing " + Path.GetFileName(dllPath) + " to %PDN_DIR%\\Effects\\");
                sw.WriteLine("echo.");
                sw.WriteLine("copy /y \"" + Path.GetFileName(dllPath) + "\" \"%PDN_DIR%\\Effects\\\"");
                sw.WriteLine("if '%errorlevel%' == '0' (");
                sw.WriteLine("goto success");
                sw.WriteLine(") else (");
                sw.WriteLine("goto fail");
                sw.WriteLine(")");
                sw.WriteLine(":store");
                sw.WriteLine("reg query \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" /v Personal 2>nul || (echo Sorry, I can't find Paint.NET! & goto fail)");
                sw.WriteLine("set PDN_DIR=");
                sw.WriteLine("for /f \"tokens=2,*\" %%a in ('reg query \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" /v Personal ^| findstr Personal') do (");
                sw.WriteLine("  set PDN_DIR=%%b");
                sw.WriteLine(")");
                sw.WriteLine("if not defined PDN_DIR (echo Sorry, I can't find Paint.NET! & goto fail)");
                sw.WriteLine("@echo off");
                sw.WriteLine("cls");
                sw.WriteLine("setlocal enabledelayedexpansion");
                sw.WriteLine("set PDN_DIR=!PDN_DIR:%%USERPROFILE%%=%USERPROFILE%!");
                sw.WriteLine("setlocal disabledelayedexpansion");
                sw.WriteLine("echo.");
                sw.WriteLine("echo I could not find the standard installation of Paint.NET.");
                sw.WriteLine("echo I will install this effect in your Documents folder instead");
                sw.WriteLine("echo in case you are using the store version.");
                sw.WriteLine("echo.");
                sw.WriteLine("echo Installing " + Path.GetFileName(dllPath) + " to %PDN_DIR%\\paint.net App Files\\Effects\\");
                sw.WriteLine("echo.");
                sw.WriteLine("mkdir \"%PDN_DIR%\\paint.net App Files\\Effects\\\" 2>nul");
                sw.WriteLine("copy /y \"" + Path.GetFileName(dllPath) + "\" \"%PDN_DIR%\\paint.net App Files\\Effects\\\"");
                sw.WriteLine("if '%errorlevel%' == '0' (");
                sw.WriteLine("goto success");
                sw.WriteLine(") else (");
                sw.WriteLine("goto fail");
                sw.WriteLine(")");
                sw.WriteLine(":success");
                sw.WriteLine("echo.");

                sw.WriteLine(@"echo    _____ _    _  _____ _____ ______  _____ _____  _ ");
                sw.WriteLine(@"echo   / ____) !  ! !/  ___)  ___)  ____)/ ____) ____)! !");
                sw.WriteLine(@"echo  ( (___ ! !  ! !  /  /  /   ! (__  ( (___( (___  ! !");
                sw.WriteLine(@"echo   \___ \! !  ! ! (  (  (    !  __)  \___ \\___ \ ! !");
                sw.WriteLine(@"echo   ____) ) !__! !  \__\  \___! (____ ____) )___) )!_!");
                sw.WriteLine(@"echo  (_____/ \____/ \_____)_____)______)_____/_____/ (_)");
                //sw.WriteLine(@"echo  _  _  ___  _____  ____  _  _  _ ");
                //sw.WriteLine(@"echo ( \/ )/ __)(  _  )(  __)( \/ )/ \");
                //sw.WriteLine(@"echo  )  /( (__  )( )(  ) _)  )  ( \_/");
                //sw.WriteLine(@"echo (__/  \___)(_) (_)(____)(_/\_)(_)");

                sw.WriteLine("goto done");
                sw.WriteLine(":fail");
                sw.WriteLine("echo.");

                sw.WriteLine(@"echo  _____       _____ _      _ ");
                sw.WriteLine(@"echo !  ___)/\   (_   _) !    ! !");
                sw.WriteLine(@"echo ! (__ /  \    ! ! ! !    ! !");
                sw.WriteLine(@"echo !  __) /\ \   ! ! ! !    ! !");
                sw.WriteLine(@"echo ! ! / ____ \ _! !_! !___ !_!");
                sw.WriteLine(@"echo !_!/_/    \_\_____)_____)(_)");
                //sw.WriteLine(@"echo   __  ____  __ _  ___  ____   _");
                //sw.WriteLine(@"echo  /  \(_  _)!  / /(_  \( __ ) / \");
                //sw.WriteLine(@"echo (  O ) )(  !   ( / _  )(__ \ \_/");
                //sw.WriteLine(@"echo  \__/ (__) !__\_\\___/(____/ (_)");

                sw.WriteLine("echo.");
                sw.WriteLine("echo Close Paint.NET and try installing again.");
                sw.WriteLine(":done");
                sw.WriteLine("echo.");
                sw.WriteLine("pause");

                sw.Flush();
                sw.Close();

                // Create .zip file on user's desktop
                using (ZipArchive archive = ZipFile.Open(zipPath, ZipArchiveMode.Create))
                {
                    archive.CreateEntryFromFile(dllPath, Path.GetFileName(dllPath)); // add .dll file
                    archive.CreateEntryFromFile(batPath, Path.GetFileName(batPath)); // add install.bat
                }

                if (File.Exists(zipPath))
                {
                    // if the zip file was successfully built, delete temp files
                    File.Delete(dllPath);
                    File.Delete(batPath);
                }

                return(true);
            }
            catch (Exception ex)
            {
                exceptionMsg = ex.Message;
            }
            return(false);
        }
Ejemplo n.º 34
0
        public static void GetHelp(DebugDelegate d, HelpType type)
        {
            setd(d);
            const string  cmd   = "TinyAdiago";
            List <string> lines = new List <string>();

            switch (type)
            {
            case HelpType.General:
            {
                lines.Add(cmd + " Usage Help:");
                List <string> opts = new List <string>();

                foreach (var ht in InstrumentHelper.getenums <HelpType>())
                {
                    if (ht == HelpType.General)
                    {
                        continue;
                    }
                    if (ht == HelpType.None)
                    {
                        continue;
                    }
                    opts.Add(ht.ToString());
                }
                lines.Add(cmd + " " + string.Join("|", opts));
            }

            break;

            case HelpType.Instrument:
            {
                lines.Add(cmd + " Valid filename.txt instruments (instrument sound will depend onyour sound device and MIDI sound fonts):");
                foreach (var ig in GetInstrumentNames().Take(10))
                {
                    foreach (var i in GetInstrumentNames())
                    {
                        lines.Add(i);
                    }
                }
            }
            break;

            case HelpType.Filename:
            {
                lines.Add(cmd + " <PathToFilename.txt");
                lines.Add(cmd + "eg: '" + cmd + " AFS.txt'");
            }
            break;

            case HelpType.None:
                break;

            default:
            {
                lines.Add(cmd + " " + type);
            }
            break;
            }
            foreach (var line in lines)
            {
                debug(line);
            }
        }
Ejemplo n.º 35
0
 public HelpAttribute(string methodName, HelpType type, string message)
     : this(methodName, type, HelpPosition.After, message)
 {
 }
Ejemplo n.º 36
0
 public HelpAttribute(HelpType type, string message)
     : this("", type, HelpPosition.After, message)
 {
 }
Ejemplo n.º 37
0
 public HelpAttribute(HelpType type, HelpPosition position, string message)
     : this("", type, position, message)
 {
 }