mengxiangge 5 лет назад
Родитель
Сommit
135f916546

+ 63 - 0
.gitattributes

@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs     diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following 
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln       merge=binary
+#*.csproj    merge=binary
+#*.vbproj    merge=binary
+#*.vcxproj   merge=binary
+#*.vcproj    merge=binary
+#*.dbproj    merge=binary
+#*.fsproj    merge=binary
+#*.lsproj    merge=binary
+#*.wixproj   merge=binary
+#*.modelproj merge=binary
+#*.sqlproj   merge=binary
+#*.wwaproj   merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg   binary
+#*.png   binary
+#*.gif   binary
+
+###############################################################################
+# diff behavior for common document formats
+# 
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the 
+# entries below.
+###############################################################################
+#*.doc   diff=astextplain
+#*.DOC   diff=astextplain
+#*.docx  diff=astextplain
+#*.DOCX  diff=astextplain
+#*.dot   diff=astextplain
+#*.DOT   diff=astextplain
+#*.pdf   diff=astextplain
+#*.PDF   diff=astextplain
+#*.rtf   diff=astextplain
+#*.RTF   diff=astextplain

+ 262 - 0
.gitignore

@@ -0,0 +1,262 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+#*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+/PackageUpdater/_Output

+ 2 - 2
PackageUpdater/Update/Core/Entities/Packages.cs

@@ -79,7 +79,7 @@ namespace Update.Core.Entities
         public bool HasAvailable(Version current)
         {
             //MessageBox.Show(FullPackages[0].To + "_" + current);
-            return this.FullPackages.Any(package => package.To > current) || this.DiffPackages.Contains(current);
+            return this.FullPackages.Any(package => package.To != current) || this.DiffPackages.Contains(current);
         }
 
         /// <summary>
@@ -91,7 +91,7 @@ namespace Update.Core.Entities
         {
             PackageCollection packages = new PackageCollection();
             FullPackage maxFullPackage = this.FullPackages.Max();
-            if (maxFullPackage != null && maxFullPackage.To > current)
+            if (maxFullPackage != null && maxFullPackage.To != current)
             {
                 packages.Add(maxFullPackage);
                 current = maxFullPackage.To;

+ 2 - 2
PackageUpdater/Update/Update.csproj

@@ -23,7 +23,7 @@
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
     <DebugSymbols>true</DebugSymbols>
-    <OutputPath>..\_Output\</OutputPath>
+    <OutputPath>..\OutputDll\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DebugType>full</DebugType>
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -39,7 +39,7 @@
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
-    <OutputPath>..\_Output\</OutputPath>
+    <OutputPath>..\OutputDll\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <Optimize>true</Optimize>
     <DebugType>pdbonly</DebugType>

BIN
PackageUpdater/WPFTestUpdate/Dlls/SAGA.DotNetUtils.dll


+ 3 - 3
PackageUpdater/WPFTestUpdate/MainWindow.xaml

@@ -5,7 +5,6 @@
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:dotuntils="clr-namespace:SAGA.DotNetUtils.WPF.UserControl;assembly=SAGA.DotNetUtils"
         xmlns:dotconverter="clr-namespace:SAGA.DotNetUtils.WPF.Converter;assembly=SAGA.DotNetUtils"
-        xmlns:local="clr-namespace:WPFTestUpdate"
         mc:Ignorable="d"
         Title="MainWindow" Height="350" Width="1025">
     <Window.Resources>
@@ -19,7 +18,7 @@
             <RowDefinition Height="30"/>
         </Grid.RowDefinitions>
         <StackPanel Grid.Row="0">
-            <dotuntils:SelectPath_Start Name="txtBasePath" Height="25" Text="D:\Revit\saga\MBI"
+            <dotuntils:SelectPath_Start Name="txtBasePath" Height="25" Text="{Binding Path=BasePath,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                         BtnImage="/WPFTestUpdate;Component/Image/folder.png"></dotuntils:SelectPath_Start>
             <Grid Height="25">
                 <Grid.ColumnDefinitions>
@@ -27,7 +26,8 @@
                     <ColumnDefinition/>
                 </Grid.ColumnDefinitions>
                 <CheckBox x:Name="chk" HorizontalAlignment="Center" VerticalAlignment="Center" IsChecked="True"></CheckBox>
-                <TextBox x:Name="txtDirs" Grid.Column="1" Text="MBIResource;Menu;OutputDll;RibbonImage" VerticalContentAlignment="Center"
+                <TextBox x:Name="txtDirs" Grid.Column="1" Text="{Binding Path=Dirs,UpdateSourceTrigger=PropertyChanged}"
+                         VerticalContentAlignment="Center"
                          IsEnabled="{Binding ElementName=chk,Path=IsChecked,Converter={StaticResource BoolToInverserConverter},UpdateSourceTrigger=PropertyChanged}"></TextBox>
             </Grid>
             <TextBlock Name="txtVersion" Text="Hello Packages Vision:3.0.0.0" FontSize="20" Height="25"></TextBlock>

+ 74 - 18
PackageUpdater/WPFTestUpdate/MainWindow.xaml.cs

@@ -1,33 +1,89 @@
-using System;
+using SAGA.DotNetUtils.Extend;
+using System;
 using System.Collections.Generic;
-using System.Diagnostics;
+using System.ComponentModel;
+using System.IO;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Threading;
 using System.Windows;
 using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.IO;
-using System.Threading;
 using System.Windows.Threading;
+using WPFTestUpdate.Utils;
 
 namespace WPFTestUpdate
 {
     /// <summary>
     /// MainWindow.xaml 的交互逻辑
     /// </summary>
-    public partial class MainWindow : Window
+    public partial class MainWindow : INotifyPropertyChanged
     {
+        public event PropertyChangedEventHandler PropertyChanged;
+
         public MainWindow()
         {
             InitializeComponent();
+            LoadSetting();
+            this.DataContext = this;
+        }
+
+
+
+        #region SavePath LoadPath
+
+        private string m_BasePath;
+
+        public string BasePath
+        {
+            get { return m_BasePath; }
+            set
+            {
+                m_BasePath = value;
+                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(m_BasePathKey));
+
+                FileStoreHandler.SaveData(m_BasePathKey, value);
+            }
+        }
+
+        private string m_Dirs;
+
+        public string Dirs
+        {
+            get { return m_Dirs; }
+            set
+            {
+                m_Dirs = value;
+                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(m_DirNameKey));
+
+                FileStoreHandler.SaveData(m_DirNameKey, value);
+            }
+        }
+
+
+        private void SaveBasePath(Control uc, string path)
+        {
+        }
+
+        private string m_BasePathKey = nameof(BasePath);
+        private string m_DirNameKey = nameof(Dirs);
+        private void LoadSetting()
+        {
+            string value = FileStoreHandler.GetData(m_BasePathKey);
+            if (value.IsNullOrEmpty())
+            {
+                value = @"D:\Revit\saga\MBI";
+            }
+            BasePath = value;
+
+            value = FileStoreHandler.GetData(m_DirNameKey);
+            if (value.IsNullOrEmpty())
+            {
+                value = @"MBIResource;Menu;OutputDll;RibbonImage";
+            }
+            Dirs = value;
         }
 
+        #endregion
+
         private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
         {
             string exeBasePath = txtBasePath.Text;
@@ -56,7 +112,7 @@ namespace WPFTestUpdate
                 () =>
                 {
                     RefrushState("准备");
-                    string exePath =Path.Combine(exeBasePath,@"OutputDll\SAGA.MBI.exe");
+                    string exePath = Path.Combine(exeBasePath, @"OutputDll\SAGA.MBI.exe");
                     if (!File.Exists(exePath))
                     {
                         RefrushState("可执行的Exe文件不存在,请检查");
@@ -75,16 +131,16 @@ namespace WPFTestUpdate
                     try
                     {
                         string package = $"{Const.Key}";
-                        string compressName =Untility.GetFileVersion(exePath).ToString().ToCompressKey();
+                        string compressName = Untility.GetFileVersion(exePath).ToString().ToCompressKey();
                         RefrushState("正在进行压缩");
                         string compressPath = @"C:\VersionsTest";
                         string compressFullPath = Path.Combine(compressPath, compressName);
-                        
+
                         Untility.CompressDir(compressFullPath, dirList.ToArray(), RefrushState);
                         RefrushState("删除旧的安装包");
                         Untility.DeleteCompress();
                         RefrushState("正在进行上传");
-                        Untility.UploadCompress(compressFullPath,RefrushState);
+                        Untility.UploadCompress(compressFullPath, RefrushState);
 
                         Untility.SaveVision(package, compressName);
                         RefrushState("删除压缩");
@@ -111,7 +167,7 @@ namespace WPFTestUpdate
 
         private void RefrushState(string str)
         {
-            this.Dispatcher.Invoke(() => { txtDiscription.Text = str ; }, DispatcherPriority.Send);
+            this.Dispatcher.Invoke(() => { txtDiscription.Text = str; }, DispatcherPriority.Send);
         }
     }
 }

+ 36 - 0
PackageUpdater/WPFTestUpdate/Utils/FileStoreHandler.cs

@@ -0,0 +1,36 @@
+/* ==============================================================================
+ * 功能描述:FileStoreHandler  
+ * 创 建 者:Garrett
+ * 创建日期:2019/5/29 9:44:16
+ * ==============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Utilities;
+
+namespace WPFTestUpdate.Utils
+{
+    /// <summary>
+    /// FileStoreHandler
+    /// </summary>
+    class FileStoreHandler
+    {
+        private static string m_SettingPath=Path.Combine(AppBaseInfo.AppTempFilePath,"Upload\\Setting.ini");
+        private static string m_Section = "Configure";
+
+        public static void SaveData(string key,string value)
+        {
+            IniOperator.Instance(m_SettingPath).SetData(m_Section, key,value);
+        }
+
+        public static string GetData(string key)
+        {
+            return IniOperator.Instance(m_SettingPath).GetData(m_Section, key);
+        }
+
+    }
+}

+ 6 - 2
PackageUpdater/WPFTestUpdate/WPFUploadPackage.csproj

@@ -19,7 +19,7 @@
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
-    <OutputPath>..\_Output\</OutputPath>
+    <OutputPath>..\OutputDll\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
@@ -28,7 +28,7 @@
     <PlatformTarget>AnyCPU</PlatformTarget>
     <DebugType>pdbonly</DebugType>
     <Optimize>true</Optimize>
-    <OutputPath>..\Output\</OutputPath>
+    <OutputPath>..\OutputDll\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
@@ -40,6 +40,9 @@
     <Reference Include="ICSharpCode.SharpZipLib, Version=1.1.0.145, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
       <HintPath>..\packages\SharpZipLib.1.1.0\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
     </Reference>
+    <Reference Include="INIFileParser, Version=2.5.2.0, Culture=neutral, PublicKeyToken=79af7b307b65cf3c, processorArchitecture=MSIL">
+      <HintPath>..\packages\ini-parser.2.5.2\lib\net20\INIFileParser.dll</HintPath>
+    </Reference>
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
       <HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
@@ -72,6 +75,7 @@
     <Compile Include="Const.cs" />
     <Compile Include="Untility.cs" />
     <Compile Include="Extend.cs" />
+    <Compile Include="Utils\FileStoreHandler.cs" />
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>

+ 1 - 0
PackageUpdater/WPFTestUpdate/packages.config

@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
   <package id="Aliyun.OSS.SDK" version="2.9.0" targetFramework="net461" />
+  <package id="ini-parser" version="2.5.2" targetFramework="net461" />
   <package id="Newtonsoft.Json" version="12.0.1" targetFramework="net461" />
   <package id="SharpZipLib" version="1.1.0" targetFramework="net461" />
 </packages>