Beispiel #1
0
        public static void Initialize(AppendString appendString)
        {
            // Floder Check
            if (!Directory.Exists(BASE_PATH + @"\Config"))
            {
                // First start alterful
                ASettings.DisplayRightMenu  = true;
                ASettings.AutoRunWithSystem = true;
                CreateShortcut(APATH_PATH + @"\alterful" + AFile.LNK_EXTENTION, BASE_PATH + @"\Alterful.exe");
                CreateShortcut(APATH_PATH + @"\atemp" + AFile.LNK_EXTENTION, ATEMP_PATH);
                CreateShortcut(APATH_PATH + @"\desktop" + AFile.LNK_EXTENTION, Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
                IS_FIRST_START = true;
            }

            // Old version auto startup alterful.exe but new version startup AlterfulPiple.exe,
            // so over execute to overwrite the old auto startup register configurate.
            if (ASettings.AutoRunWithSystem)
            {
                ASettings.AutoRunWithSystem = true;
            }

            Directory.CreateDirectory(BASE_PATH + @"\APath");
            Directory.CreateDirectory(BASE_PATH + @"\ATemp");
            Directory.CreateDirectory(BASE_PATH + @"\Config");
            Directory.CreateDirectory(CONST_INSTRUCTION_PATH);

            // File Check
            AConstQuote.CreateConstQuoteFile();
            ATheme.CreateThemeConfigFile();

            // Config Check
            AConstQuote.ReadAllConfig();
            ATheme.ReadAllConfig();

            // Enviroment Check
            SysEnviroment.SetPathAfter(APATH_PATH);

            // Regedit Check

            // Others
            System.IO.File.Delete(@".\restart.bat");
            ShowANew(appendString);
            ShowANotification("Alterful 正在后台运行", "Press Alt+A to active Alterful");
        }
Beispiel #2
0
        private static void ShowANew(AppendString appendString)
        {
            string ANewPath = @".\ANew.ini";

            if (System.IO.File.Exists(ANewPath))
            {
                HAS_ANEW = true;
                using (StreamReader reader = new StreamReader(ANewPath))
                {
                    appendString("在新版本 " + Properties.Settings.Default.localVersion + " 中有以下更新: ", AInstruction.ReportType.OK);
                    //appendString("What's new in version " + Properties.Settings.Default.localVersion + ":", AInstruction.ReportType.OK);
                    foreach (string line in reader.ReadToEnd().Split('\n'))
                    {
                        if (0 == line.Length)
                        {
                            continue;
                        }
                        if ('*' != line[0])
                        {
                            appendString(line.Trim(), AInstruction.ReportType.NONE);
                        }
                        else if (0 == line.IndexOf("***"))
                        {
                            appendString(line.Trim().Substring(3), AInstruction.ReportType.ERROR);
                        }
                        else if (0 == line.IndexOf("**"))
                        {
                            appendString(line.Trim().Substring(2), AInstruction.ReportType.WARNING);
                        }
                        else if (0 == line.IndexOf("*"))
                        {
                            appendString(line.Trim().Substring(1), AInstruction.ReportType.OK);
                        }
                    }
                }
                System.IO.File.Delete(ANewPath);
            }
        }
Beispiel #3
0
 /// <inheritdoc />
 protected override void CommitLog(LogRecord record)
 {
     AppendString?.Invoke(BuildEvent(record, true));
 }