Changeset - d036e3a47323
[Not reviewed]
Merge default
0 5 0
Tess Snider (Malkyne) - 3 years ago 2021-07-24 10:27:30
this@malkyne.org
Merge
5 files changed with 51 insertions and 13 deletions:
0 comments (0 inline, 0 general)
.hgtags
Show inline comments
 
f419334a476f33b0b93cbd02eba7a44f08f89733 R_T10_1.0
 
99f3d61e20d74cac591cb81f69afc7be0eae0a59 R_T10_1.1
 
d7b40cfbe0f3d20f25a52944cf8c0f1ecdc81471 R_T10_1.2
 
6919080271d55f3f138660bb37dccd116249d13e R_T10_1.3
 
e7cc8ddcbf589086578134ec292ad8b7c739237c R_T10_1.4
DesertPaintCodex.csproj
Show inline comments
 
<Project Sdk="Microsoft.NET.Sdk">
 
  <PropertyGroup>
 
    <OutputType>WinExe</OutputType>
 
    <TargetFramework>net5.0</TargetFramework>
 
    <Nullable>enable</Nullable>
 
    <ApplicationIcon>Assets\desert_paint_codex_icon.ico</ApplicationIcon>
 
    <StartupObject>DesertPaintCodex.Program</StartupObject>
 
    <Platforms>AnyCPU;x64</Platforms>
 
    <Version>1.4.0</Version>
 
  </PropertyGroup>
 
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
 
    <PlatformTarget>x64</PlatformTarget>
 
  </PropertyGroup>
 
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
 
    <PlatformTarget>x64</PlatformTarget>
 
  </PropertyGroup>
 
  <ItemGroup>
Models/PlayerProfile.cs
Show inline comments
...
 
@@ -124,46 +124,79 @@ namespace DesertPaintCodex.Models
 
            writer.Write(" ");
 
            writer.WriteLine(b);
 
        }
 

	
 
        public static void ConvertFromPP(string ppFile, string dpFile)
 
        {
 
            using StreamReader reader = new(ppFile);
 
            using StreamWriter writer = new(dpFile, false);
 
            string?            line;
 
            string? line;
 
            while ((line = reader.ReadLine()) != null)
 
            {
 
                string[] tokens = line.Split('|');
 
                //if ((tokens.Length > 0) && (tokens [0] != "//"))
 
                if ((tokens.Length == 5) && (tokens[0].Trim() != "//"))
 
                {
 
                    string reagent1  = tokens[0].Trim();
 
                    string reagent2  = tokens[1].Trim();
 
                    string reagent1Name  = tokens[0].Trim();
 
                    string reagent2Name  = tokens[1].Trim();
 
                    string colorCode = tokens[2].Trim();
 
                    string change1   = tokens[3].Trim();
 
                    string change2   = tokens[4].Trim();
 

	
 
                    Reagent reagent1 = ReagentService.GetReagent(reagent1Name);
 
                    Reagent reagent2 = ReagentService.GetReagent(reagent2Name);
 

	
 
                    if (reagent1 == null || reagent2 == null) continue;
 

	
 
                    bool hasChange1 = int.TryParse(change1, out _);
 
                    bool hasChange2 = int.TryParse(change2, out _);
 

	
 
                    // Write reaction.
 
                    switch (colorCode)
 
                    {
 
                        case "W":
 
                            WriteReaction(writer, reagent1, reagent2, change1, change1, change1);
 
                            WriteReaction(writer, reagent2, reagent1, change2, change2, change2);
 
                            if (hasChange1)
 
                            {
 
                                WriteReaction(writer, reagent1Name, reagent2Name, change1, change1, change1);
 
                            }
 
                            if (hasChange2)
 
                            {
 
                                WriteReaction(writer, reagent2Name, reagent1Name, change2, change2, change2);
 
                            }
 
                            break;
 
                        case "R":
 
                            WriteReaction(writer, reagent1, reagent2, change1, "0", "0");
 
                            WriteReaction(writer, reagent2, reagent1, change2, "0", "0");
 
                            if (hasChange1)
 
                            {
 
                                WriteReaction(writer, reagent1Name, reagent2Name, change1, "0", "0");
 
                            }
 
                            if (hasChange2)
 
                            {
 
                                WriteReaction(writer, reagent2Name, reagent1Name, change2, "0", "0");
 
                            }
 
                            break;
 
                        case "G":
 
                            WriteReaction(writer, reagent1, reagent2, "0", change1, "0");
 
                            WriteReaction(writer, reagent2, reagent1, "0", change2, "0");
 
                            if (hasChange1)
 
                            {
 
                                WriteReaction(writer, reagent1Name, reagent2Name, "0", change1, "0");
 
                            }
 
                            if (hasChange2)
 
                            {
 
                                WriteReaction(writer, reagent2Name, reagent1Name, "0", change2, "0");
 
                            }
 
                            break;
 
                        case "B":
 
                            WriteReaction(writer, reagent1, reagent2, "0", "0", change1);
 
                            WriteReaction(writer, reagent2, reagent1, "0", "0", change2);
 
                            if (hasChange1)
 
                            {
 
                                WriteReaction(writer, reagent1Name, reagent2Name, "0", "0", change1);
 
                            }
 
                            if (hasChange2)
 
                            {
 
                                WriteReaction(writer, reagent2Name, reagent1Name, "0", "0", change2);
 
                            }
 
                            break;
 
                    }
 
                }
 
            }
 
        }
 

	
 
        public bool SaveToPP(string ppFile)
 
        {
Properties/PublishProfiles/Win64 Self-Contained.pubxml
Show inline comments
 
<?xml version="1.0" encoding="utf-8"?>
 
<!--
 
https://go.microsoft.com/fwlink/?LinkID=208121. 
 
-->
 
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 
  <PropertyGroup>
 
    <Configuration>Release</Configuration>
 
    <Platform>x64</Platform>
 
    <PublishDir>publish\win-x64</PublishDir>
 
    <PublishDir>publish\win-x64\DesertPaintCodex</PublishDir>
 
    <PublishProtocol>FileSystem</PublishProtocol>
 
    <TargetFramework>net5.0</TargetFramework>
 
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
 
    <SelfContained>true</SelfContained>
 
    <PublishSingleFile>True</PublishSingleFile>
 
    <PublishReadyToRun>False</PublishReadyToRun>
 
    <PublishTrimmed>False</PublishTrimmed>
 
  </PropertyGroup>
ViewModels/ExperimentLogViewModel.cs
Show inline comments
...
 
@@ -130,17 +130,20 @@ namespace DesertPaintCodex.ViewModels
 
        }
 
        
 
        #endregion
 

	
 
        private static int ResortTestInList(ReactionTest test, IList<ReactionTest> list)
 
        {
 
            int oldPos = list.IndexOf(test);
 

	
 
            if (((oldPos > 0) || (test.CompareTo(list[oldPos - 1]) > 0))
 
            // If the item is first in the list or the previous item is valued < the test
 
            // And either the item is last in the list or the next item in the list is valued > than the item
 
            // Don't move it
 
            if (((oldPos == 0) || (test.CompareTo(list[oldPos - 1]) > 0))
 
                && ((oldPos == list.Count - 1) || (test.CompareTo(list[oldPos + 1]) < 0))) return oldPos; // No need to move.
 

	
 
            list.RemoveAt(oldPos);
 
            return InsertTestIntoList(test, list);
 
        }
 
        
 
        private static int InsertTestIntoList(ReactionTest test, IList<ReactionTest> list)
 
        {
0 comments (0 inline, 0 general)