Commit 797370de authored by shRabbit's avatar shRabbit
Browse files

损坏

parent 1d304897
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="UserContentModel">
    <attachedFolders />
    <explicitIncludes />
    <explicitExcludes />
  </component>
</project>
 No newline at end of file
+7 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="RiderProjectSettingsUpdater">
    <option name="singleClickDiffPreview" value="1" />
    <option name="vcsConfiguration" value="3" />
  </component>
</project>
 No newline at end of file
+6 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="VcsDirectoryMappings">
    <mapping directory="" vcs="Git" />
  </component>
</project>
 No newline at end of file
+89 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="AutoGeneratedRunConfigurationManager">
    <projectFile pubXmlPath="CountDownList/Properties/PublishProfiles/FolderProfile.pubxml">CountDownList/CountDownList.csproj</projectFile>
    <projectFile>CountdownList2/CountdownList2.csproj</projectFile>
  </component>
  <component name="AutoImportSettings">
    <option name="autoReloadType" value="SELECTIVE" />
  </component>
  <component name="ChangeListManager">
    <list default="true" id="bc7eda96-874d-4b0a-99bc-cf2658be2b07" name="更改" comment="">
      <change beforePath="$PROJECT_DIR$/CountdownList2/MainWindow.axaml" beforeDir="false" afterPath="$PROJECT_DIR$/CountdownList2/MainWindow.axaml" afterDir="false" />
    </list>
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="Git.Settings">
    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
  </component>
  <component name="KubernetesApiPersistence"><![CDATA[{}]]></component>
  <component name="KubernetesApiProvider"><![CDATA[{
  "isMigrated": true
}]]></component>
  <component name="ProjectColorInfo"><![CDATA[{
  "associatedIndex": 7
}]]></component>
  <component name="ProjectId" id="2v82vcBd3tdBRUdafC8pr8pid1j" />
  <component name="ProjectViewState">
    <option name="hideEmptyMiddlePackages" value="true" />
    <option name="showLibraryContents" value="true" />
  </component>
  <component name="PropertiesComponent"><![CDATA[{
  "keyToString": {
    "RunOnceActivity.ShowReadmeOnStart": "true",
    "git-widget-placeholder": "master",
    "node.js.detected.package.eslint": "true",
    "node.js.detected.package.tslint": "true",
    "node.js.selected.package.eslint": "(autodetect)",
    "node.js.selected.package.tslint": "(autodetect)",
    "nodejs_package_manager_path": "npm",
    "vue.rearranger.settings.migration": "true"
  }
}]]></component>
  <component name="RunManager" selected=".NET 项目.CountdownList2">
    <configuration name="CountDownList: FolderProfile" type="DotNetMsBuildPublish" factoryName="Publish to IIS">
      <riderPublish publish_profile="FolderProfile.pubxml" pubxml_path="$PROJECT_DIR$/CountDownList/Properties/PublishProfiles/FolderProfile.pubxml" uuid_high="-4080435981160790816" uuid_low="-4754493111782456945" />
      <method v="2" />
    </configuration>
    <configuration name="CountdownList2" type="DotNetProject" factoryName=".NET Project">
      <option name="EXE_PATH" value="" />
      <option name="PROGRAM_PARAMETERS" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="PASS_PARENT_ENVS" value="1" />
      <option name="USE_EXTERNAL_CONSOLE" value="0" />
      <option name="USE_MONO" value="0" />
      <option name="RUNTIME_ARGUMENTS" value="" />
      <option name="PROJECT_PATH" value="$PROJECT_DIR$/CountdownList2/CountdownList2.csproj" />
      <option name="PROJECT_EXE_PATH_TRACKING" value="1" />
      <option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
      <option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
      <option name="PROJECT_KIND" value="DotNetCore" />
      <option name="PROJECT_TFM" value="" />
      <method v="2">
        <option name="Build" />
      </method>
    </configuration>
  </component>
  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
  <component name="TaskManager">
    <task active="true" id="Default" summary="默认任务">
      <changelist id="bc7eda96-874d-4b0a-99bc-cf2658be2b07" name="更改" comment="" />
      <created>1743512616327</created>
      <option name="number" value="Default" />
      <option name="presentableId" value="Default" />
      <updated>1743512616327</updated>
      <workItem from="1743512618747" duration="504000" />
    </task>
    <servers />
  </component>
  <component name="TypeScriptGeneratedFilesManager">
    <option name="version" value="3" />
  </component>
  <component name="UnityProjectConfiguration" hasMinimizedUI="false" />
  <component name="VcsManagerConfiguration">
    <option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
  </component>
</project>
 No newline at end of file
+5 −58
Original line number Diff line number Diff line
#pragma warning disable CA1416, CS8602
#pragma warning disable CA1416
using System;
using System.Collections;
using System.Collections.Generic;
@@ -14,7 +14,6 @@ using System.Windows.Automation.Peers;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Xml.Linq;
using CountDownList.Controls;
using CountDownList.UI.Window;
using HandyControl.Controls;
@@ -25,7 +24,7 @@ namespace CountDownList.Class
    /// <summary>
    /// 次类提供了CountDownList的基本操作,如创建、修改、删除、查找、分享等功能
    /// </summary>
    public class ListCore : ClassName
    public class ListCore
    {
        public StackPanel 
            DoingPanel, 
@@ -53,7 +52,6 @@ namespace CountDownList.Class
            FrameworkElement Window
        )
        {
            App.logFile.Info("开始初始化", className);
            DoingPanel = doingPanel;
            WcPanel = wcPanel;
            CountPanel = countPanel;
@@ -63,7 +61,6 @@ namespace CountDownList.Class
            RootWindow = Window;

            RefreshNumber();
            App.logFile.Info("初始化结束", className);
        }

        /// <summary>
@@ -73,6 +70,7 @@ namespace CountDownList.Class
        {
            while (true)
            {

                DoingE.Header = $"进行中({DoingPanel.Children.Count})";
                WcE.Header = $"已完成({WcPanel.Children.Count})";
                CountE.Header = $"正计时({CountPanel.Children.Count})";
@@ -105,8 +103,6 @@ namespace CountDownList.Class
                lb.OnDelete += CountDown_OnDelete;
                lb.OnShare += CountDown_OnShare;

                App.logFile.Info($"成功添加倒计时Label ({t})", className);

                if (InsertIndex != null)
                {
                    try
@@ -155,8 +151,6 @@ namespace CountDownList.Class
                            {
                                await Task.Delay(250);
                            }

                            App.logFile.Info($"Label {t} 已移入“已完成”区域", className);
                        }

                        if (WcE.IsExpanded && IsOpen && IsUserVisible(lb, RootWindow))
@@ -207,8 +201,6 @@ namespace CountDownList.Class
                lb.OnDelete += CountDown_OnDelete;
                lb.OnShare += CountDown_OnShare;

                App.logFile.Info($"成功添加倒计时Label ({label.Title})", className);

                if (InsertIndex != null)
                {
                    try
@@ -260,7 +252,6 @@ namespace CountDownList.Class
                                    await Task.Delay(250);
                                }
                            }
                            App.logFile.Info($"Label {label.Title} 已移入“已完成”区域", className);
                        }

                        if (WcE.IsExpanded && IsOpen && IsUserVisible(lb, RootWindow))
@@ -303,7 +294,6 @@ namespace CountDownList.Class
        private void CountDown_OnShare(object? sender, EventArgs e)
        {
            new Share((ListLabel)sender, DateTime.Now).ShowDialog();
            App.logFile.Info($"打开分享({((ListLabel)sender).Title})", className);
        }

        /// <summary>
@@ -318,12 +308,10 @@ namespace CountDownList.Class
                if (((Controls.ListLabel)sender).IsReadOnly == false)
                {
                    DeleteForElement((Controls.ListLabel)sender);
                    App.logFile.Info($"已删除({((ListLabel)sender).Title})", className);
                }
                else
                {
                    HandyControl.Controls.MessageBox.Show("删除失败,此标签禁止删除\n须将该标签的xml属性IsReadOnly设为false", $"删除 {((Controls.ListLabel)sender).Title}", button: MessageBoxButton.OK, icon: MessageBoxImage.Error);
                    App.logFile.Warn($"删除失败,标签为只读({((ListLabel)sender).Title})", className);
                }
            }
        }
@@ -346,7 +334,6 @@ namespace CountDownList.Class
                    HandyControl.Controls.MessageBox.Show("编辑失败,此标签禁止编辑\n须将该标签的xml属性IsReadOnly设为false", $"编辑 {((Controls.ListLabel)sender).Title}", button: MessageBoxButton.OK, icon: MessageBoxImage.Error);
                }
            }
            App.logFile.Info($"编辑标签({((ListLabel)sender).Title})", className);
        }

        /// <summary>
@@ -369,8 +356,6 @@ namespace CountDownList.Class
                lb.OnDelete += CountDown_OnDelete;
                lb.OnShare += CountDown_OnShare;

                App.logFile.Info($"成功添加正计时Label ({t})", className);

                if (InsertIndex != null)
                {
                    try
@@ -430,8 +415,6 @@ namespace CountDownList.Class
                lb.OnDelete += CountDown_OnDelete;
                lb.OnShare += CountDown_OnShare;

                App.logFile.Info($"成功添加正计时Label ({label.Title})", className);

                if (InsertIndex != null)
                {
                    try
@@ -523,7 +506,6 @@ namespace CountDownList.Class
            DoingPanel.Children.Remove(element);
            WcPanel.Children.Remove(element);
            CountPanel.Children.Remove(element);
            App.logFile.Info($"已删除“{element.Title}”", className);
        }

        public List<ListLabel> ScanToCollection()
@@ -555,7 +537,6 @@ namespace CountDownList.Class
        {
            List<ListP> l = new();

            App.logFile.Info($"开始收集Labels信息并转成列表", className);
            //扫描进行中
            foreach (Controls.ListLabel item in DoingPanel.Children)
            {
@@ -596,14 +577,9 @@ namespace CountDownList.Class
                        DarkText = d,
                        Own = item
                    });

                    App.logFile.Info($"(倒计时容器)标题:{t}\n开始时间:{st}\n结束时间:{et}\n背景资源:{bg}\n深色文本{d}", className);

                }
                catch (Exception)
                {
                    App.logFile.Error($"Label资源损坏,正在重启并删除CountDownList.xml", className);

                    System.Diagnostics.Process p = new System.Diagnostics.Process();
                    p.StartInfo.FileName = "cmd.exe";
                    p.StartInfo.UseShellExecute = false;    //是否使用操作系统shell启动
@@ -664,7 +640,6 @@ namespace CountDownList.Class
                    DarkText = d,
                    Own = item
                });
                App.logFile.Info($"(正计时容器)标题:{t}\n开始时间:{st}\n结束时间:{et}\n背景资源:{bg}\n深色文本{d}", className);
            }

            //扫描已完成
@@ -705,7 +680,6 @@ namespace CountDownList.Class
                    DarkText = d,
                    Own = item
                });
                App.logFile.Info($"(已完成容器)标题:{t}\n开始时间:{st}\n结束时间:{et}\n背景资源:{bg}\n深色文本{d}", className);
            }
            return l;
        }
@@ -717,7 +691,6 @@ namespace CountDownList.Class
        public void OpenMainWindow()
        {
            Home home = new(ScanToListP());
            App.logFile.Info($"绑定主页操作事件", className);
            home.OnAdd += Home_OnAdd;
            home.OnEdit += Home_OnEdit;
            home.OnDelete += Home_OnDelete;
@@ -739,7 +712,6 @@ namespace CountDownList.Class
                if ((ListP)((Home)sender).listView.SelectedItem != null)
                {
                    shareElement = ((ListP)((Home)sender).listView.SelectedItem).Own;
                    App.logFile.Info($"在主页触发分享({shareElement.Title})", className);
                    Share share = new(shareElement, DateTime.Now);
                    share.ShowDialog();
                }
@@ -747,6 +719,7 @@ namespace CountDownList.Class
            catch
            {
            }

        }

        /// <summary>
@@ -762,7 +735,6 @@ namespace CountDownList.Class
                if ((ListP)((Home)sender).listView.SelectedItem != null)
                {
                    delElememt = ((ListP)((Home)sender).listView.SelectedItem).Own;
                    App.logFile.Info($"在主页触发编辑({delElememt.Title})", className);

                    if (delElememt.IsReadOnly == false)
                    {
@@ -796,8 +768,6 @@ namespace CountDownList.Class
                if ((ListP)((Home)sender).listView.SelectedItem != null)
                {
                    editElement = ((ListP)((Home)sender).listView.SelectedItem).Own;
                    App.logFile.Info($"在主页触发删除({editElement.Title})", className);

                    if (editElement.IsReadOnly == false)
                    {
                        EditAndChange(editElement);
@@ -941,23 +911,7 @@ namespace CountDownList.Class
        /// <param name="element">要判定的元素</param>
        /// <param name="container">父元素</param>
        /// <returns>如果控件被父元素遮住,返回false</returns>
        private bool IsUserVisible(FrameworkElement element, FrameworkElement container)
        {
            if (!element.IsVisible)
                return false;

            Rect bounds = element.TransformToAncestor(container).TransformBounds(new Rect(0.0, 0.0, element.ActualWidth, element.ActualHeight));
            Rect rect = new Rect(0.0, 0.0, container.ActualWidth, container.ActualHeight);
            return rect.Contains(bounds.TopLeft) || rect.Contains(bounds.BottomRight);
        }

        /// <summary>
        /// 控件是否在窗口上显示,代码来自 https://cloud.tencent.com/developer/ask/sof/116724
        /// </summary>
        /// <param name="element">要判定的元素</param>
        /// <param name="container">父元素</param>
        /// <returns>如果控件被父元素遮住,返回false</returns>
        public static bool IsUserVisibleS(FrameworkElement element, FrameworkElement container)
        public static bool IsUserVisible(FrameworkElement element, FrameworkElement container)
        {
            if (!element.IsVisible)
                return false;
@@ -977,15 +931,12 @@ namespace CountDownList.Class
        {
            try
            {
                App.logFile.Info($"调用GenerateRandomImage", className);

                switch (ExtraMode)
                {
                    case ExtraMode.MinecraftOnly:
                        ImageBrush mcO = new();
                        mcO.ImageSource = new BitmapImage(new Uri($@"UI\test.png", UriKind.Relative));
                        mcO.Stretch = Stretch.UniformToFill;
                        App.logFile.Info($"随机背景图返回结果:MinecraftOnly -> {mcO.ImageSource}", "CountDownList.ListCore");

                        return mcO;
                    case ExtraMode.Minecraft:
@@ -1003,7 +954,6 @@ namespace CountDownList.Class
                        ImageBrush mc = new();
                        mc.ImageSource = new BitmapImage(new Uri(file, UriKind.Relative));
                        mc.Stretch = Stretch.UniformToFill;
                        App.logFile.Info($"随机背景图返回结果:Minecraft -> {mc.ImageSource}", "CountDownList.ListCore");

                        return mc;
                    case ExtraMode.GenshinExtra:
@@ -1021,7 +971,6 @@ namespace CountDownList.Class
                        ImageBrush mcYsE = new();
                        mcYsE.ImageSource = new BitmapImage(new Uri(fileYsE, UriKind.Relative));
                        mcYsE.Stretch = Stretch.UniformToFill;
                        App.logFile.Info($"随机背景图返回结果:GenshinExtra -> {mcYsE.ImageSource}", "CountDownList.ListCore");

                        return mcYsE;
                    case ExtraMode.GenshinNormal:
@@ -1039,7 +988,6 @@ namespace CountDownList.Class
                        ImageBrush mcYs = new();
                        mcYs.ImageSource = new BitmapImage(new Uri(fileYs, UriKind.Relative));
                        mcYs.Stretch = Stretch.UniformToFill;
                        App.logFile.Info($"随机背景图返回结果:GenshinNormal -> {mcYs.ImageSource}", "CountDownList.ListCore");

                        return mcYs;
                    case ExtraMode.Custom:
@@ -1057,7 +1005,6 @@ namespace CountDownList.Class
                        ImageBrush mcc = new();
                        mcc.ImageSource = new BitmapImage(new Uri(filec, UriKind.Relative));
                        mcc.Stretch = Stretch.UniformToFill;
                        App.logFile.Info($"随机背景图返回结果:Custom -> {mcc.ImageSource}", "CountDownList.ListCore");

                        return mcc;
                    default:
Loading