예제 #1
0
    void SetVersion(CustomVersion oldVersion, CustomVersion newVersion)
    {
        var data = File.ReadAllText(VersionFile);

        data = data.Replace(VersionPrefix + oldVersion, VersionPrefix + newVersion);
        File.WriteAllText(VersionFile, data);
    }
예제 #2
0
    void k8sOverrideTemplates(CustomVersion version)
    {
        var selectedNamespace = K8sNamespace ?? Branch;

        var values = JSON.Deserialize <ValuesTemplating>(File.ReadAllText(MyK8sTemplatesValueFile));
        //values.Values["a1"]["dev"]

        var dataHash = BuildTemplateValue(values, version);
        //https://github.com/StubbleOrg/Stubble/blob/master/docs/how-to.md
        var stubble = new StubbleBuilder()
                      .Configure(settings => { })
                      .Build();

        var stubbleRenderSettings = new RenderSettings
        {
            SkipHtmlEncoding = true,
            ThrowOnDataMiss  = true,
        };

        foreach (var file in Directory.EnumerateFiles(MyK8sTemplatesDirectory, "*" + TemplateTravisFileNamePattern))
        {
            using (var streamReader = new StreamReader(file, Encoding.UTF8))
            {
                var content    = stubble.Render(streamReader.ReadToEnd(), dataHash, stubbleRenderSettings);
                var pathOutput = MyK8sDirectory / selectedNamespace /
                                 (Path.GetFileName(file).Replace(TemplateTravisFileNamePattern, ".yaml"));
                File.WriteAllText(pathOutput, content);
            }
        }
    }
예제 #3
0
 public void DisplayMembers(Identifier modelId, CustomVersion versionId, CustomEntity entity, string searchTerm)
 {
     try
     {
         if (modelId == null || versionId == null || entity == null)
         {
             return;
         }
         List <Member> members = MDSWrapper.GetMembers(modelId, versionId.Identifier, entity, searchTerm);
         this.lstMembers.Items.Clear();
         (this.FindForm() as Form1).ProgressBar.Maximum = members.Count;
         foreach (Member m in members)
         {
             ((ListBox.ObjectCollection) this.lstMembers.Items).Add((object)new CustomMember(m));
             (this.FindForm() as Form1).ProgressBar.PerformStep();
         }
         this.lstMembers.DisplayMember = this.rbNameCode.Checked ? "NameCode" : "CodeName";
         (this.FindForm() as Form1).ProgressBar.Value = 0;
         //this.lblCntMembers.Text = this.lstMembers.Items.Count.ToString();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
            static GvasFormat.SaveGameHeader SaveGameHeader(JsonReader reader)
            {
                var _R = new GvasFormat.SaveGameHeader();

                reader.AssertReadToken(JsonToken.StartObject);
                _R.FileTypeTag           = reader.AssertReadPropertyNameValue <int>(JsonNaming.SaveGameHeader.FileTypeTag);
                _R.SaveGameFileVersion   = reader.AssertReadPropertyNameValue <int>(JsonNaming.SaveGameHeader.SaveGameFileVersion);
                _R.PackageFileUE4Version = reader.AssertReadPropertyNameValue <int>(JsonNaming.SaveGameHeader.PackageFileUE4Version);
                reader.AssertReadPropertyName(JsonNaming.SaveGameHeader.SavedEngineVersion);
                {
                    _R.SavedEngineVersion = new EngineVersion();
                    reader.AssertReadToken(JsonToken.StartObject);
                    _R.SavedEngineVersion.Major      = reader.AssertReadPropertyNameValue <UInt16>(JsonNaming.SaveGameHeader.EngineVersion.Major);
                    _R.SavedEngineVersion.Minor      = reader.AssertReadPropertyNameValue <UInt16>(JsonNaming.SaveGameHeader.EngineVersion.Minor);
                    _R.SavedEngineVersion.Patch      = reader.AssertReadPropertyNameValue <UInt16>(JsonNaming.SaveGameHeader.EngineVersion.Patch);
                    _R.SavedEngineVersion.ChangeList = reader.AssertReadPropertyNameValue <UInt32>(JsonNaming.SaveGameHeader.EngineVersion.ChangeList);
                    _R.SavedEngineVersion.Branch     = reader.AssertReadPropertyNameValue <string>(JsonNaming.SaveGameHeader.EngineVersion.Branch);
                    reader.AssertReadToken(JsonToken.EndObject);
                }
                _R.CustomVersionFormat = reader.AssertReadPropertyNameValue <int>(JsonNaming.SaveGameHeader.CustomVersionFormat);
                reader.AssertReadPropertyName(JsonNaming.SaveGameHeader.CustomVersions);
                {
                    reader.AssertReadToken(JsonToken.StartObject);
                    reader.AssertReadPropertyNameValue <int>(JsonNaming.SaveGameHeader.CustomVersionContainer.Count);
                    reader.AssertReadPropertyName(JsonNaming.SaveGameHeader.CustomVersionContainer.Versions);
                    var version_list = new List <CustomVersion>();
                    reader.AssertReadToken(JsonToken.StartArray);
                    while (true)
                    {
                        var token = reader.AssertRead();
                        if (token == JsonToken.StartObject)
                        {
                            string key_string = reader.AssertReadPropertyNameValue <string>(JsonNaming.SaveGameHeader.CustomVersion.Key);
                            Guid   key        = Guid.Parse(key_string);
                            int    version    = reader.AssertReadPropertyNameValue <int>(JsonNaming.SaveGameHeader.CustomVersion.Version);
                            reader.AssertReadToken(JsonToken.EndObject);
                            var _ver = new CustomVersion();
                            _ver.Key     = key;
                            _ver.Version = version;
                            version_list.Add(_ver);
                        }
                        else if (token == JsonToken.EndArray)
                        {
                            break;
                        }
                        else
                        {
                            throw new FormatException();
                        }
                    }
                    reader.AssertReadToken(JsonToken.EndObject);
                    _R.CustomVersions          = new CustomVersionContainer();
                    _R.CustomVersions.Count    = version_list.Count;
                    _R.CustomVersions.Versions = version_list.ToArray();
                }
                _R.SaveGameClassName = reader.AssertReadPropertyNameValue <string>(JsonNaming.SaveGameHeader.SaveGameClassName);
                reader.AssertReadToken(JsonToken.EndObject);
                return(_R);
            }
예제 #5
0
    Dictionary <string, object> BuildTemplateValue(ValuesTemplating values,
                                                   CustomVersion version, string selectedNamespace = null)
    {
        if (selectedNamespace == null)
        {
            selectedNamespace = K8sNamespace ?? Branch;
        }

        var rnd      = new Random();
        var dataHash = new Dictionary <string, object>()
        {
            { "docker-ver", selectedNamespace == "dev" ? "dev" : version.ToDockerTag() },
예제 #6
0
        internal static GvasFormat.SaveGameHeader Read(UE_BinaryReader reader)
        {
            var result = new GvasFormat.SaveGameHeader();

            result.FileTypeTag = GvasFormat.SaveGameHeader.UE4_SAVEGAME_FILE_TYPE_TAG;
            {
                result.SaveGameFileVersion   = reader.ReadInt32();
                result.PackageFileUE4Version = reader.ReadInt32();
            }
            //
            var engine_version = new EngineVersion();

            {
                engine_version.Major      = reader.ReadUInt16();
                engine_version.Minor      = reader.ReadUInt16();
                engine_version.Patch      = reader.ReadUInt16();
                engine_version.ChangeList = reader.ReadUInt32();
                engine_version.Branch     = reader.ReadString();
            }
            result.SavedEngineVersion = engine_version;
            //
            result.CustomVersionFormat = reader.ReadInt32();
            //
            var version_container = new CustomVersionContainer();

            {
                version_container.Count    = reader.ReadInt32();
                version_container.Versions = new CustomVersion[version_container.Count];
                for (var i = 0; i < version_container.Count; i++)
                {
                    var version = new CustomVersion();
                    {
                        version.Key     = new Guid(reader.ReadBytes(16));
                        version.Version = reader.ReadInt32();
                    }
                    version_container.Versions[i] = version;
                }
            }
            result.CustomVersions = version_container;
            //
            result.SaveGameClassName = reader.ReadString();
            return(result);
        }
예제 #7
0
    void travisOverrideTemplates(CustomVersion version, string selectedNamespace = null)
    {
        if (selectedNamespace == null)
        {
            selectedNamespace = K8sNamespace ?? Branch;
        }

        var dataHash = new Dictionary <string, object>()
        {
            { "dockerVer", version.ToDockerTag() },
            { "namespace", selectedNamespace },
        };
        var stubble = new StubbleBuilder().Build();

        using (var streamReader = new StreamReader(TravisTemplateFile, Encoding.UTF8))
        {
            var content = stubble.Render(streamReader.ReadToEnd(), dataHash);
            File.WriteAllText(TravisFile, content);
        }
    }
예제 #8
0
 void CommitGit(CustomVersion newVersion, CustomVersion oldVersion)
 {
     GitTasks.Git($"commit -a -m \"Change version from {oldVersion} to {newVersion}\"");
     GitTasks.Git($"tag v{newVersion.ToGitTag()}");
 }
예제 #9
0
    public static void Main()
    {
        Matrix <int> m1 = new Matrix <int> (3, 2);

        m1 [0, 0] = 1;
        m1 [0, 1] = 2;
        m1 [1, 0] = 3;
        m1 [1, 1] = 4;
        m1 [2, 0] = 5;
        m1 [2, 1] = 6;

        Matrix <int> m2 = new Matrix <int> (3, 2);

        m2 [0, 0] = 1;
        m2 [0, 1] = 2;
        m2 [1, 0] = 3;
        m2 [1, 1] = 4;
        m2 [2, 0] = 5;
        m2 [2, 1] = 6;

        Matrix <int> m3 = new Matrix <int> (2, 3);

        m3 [0, 0] = 1;
        m3 [0, 1] = 2;
        m3 [0, 2] = 3;
        m3 [1, 0] = 4;
        m3 [1, 1] = 5;
        m3 [1, 2] = 6;

        Console.WriteLine("Matrix 1:");
        Console.WriteLine(m1.ToString());
        Console.WriteLine("Matrix 2:");
        Console.WriteLine(m2.ToString());
        Console.WriteLine("Matrix 3:");
        Console.WriteLine(m3.ToString());

        Console.WriteLine("m1 * m3 = ");
        Console.WriteLine((m1 * m3).ToString());

        Console.WriteLine("m1 * m2 = (m1.rows != m2.columns) -> incompatible");
        //Console.WriteLine((m1 * m2).ToString()); // will throw exception

        Console.WriteLine("m1 + m2 = ");
        Console.WriteLine((m1 + m2).ToString());

        Console.WriteLine("m1 - m2 = ");
        Console.WriteLine((m1 - m2).ToString());

        if (m1)
        {
            Console.WriteLine("m1 is true.");
        }

        if (m1 - m2)
        {
            Console.WriteLine("m1 - m2 is true.");
        }
        else
        {
            Console.WriteLine("m1 - m2 is not true.");
        }

        Console.WriteLine("\nVersion Attribute: ");
        CustomVersion versionAttr = (CustomVersion)Attribute.GetCustomAttribute(typeof(GenericMatrixTest), typeof(CustomVersion));

        Console.WriteLine(versionAttr.version);
    }