예제 #1
0
        public string NewRegistration(string organization)
        {
            Log.Information("VersionRepo:NewRegistration:Beginning");
            Log.Information("1. Check if the organization already exists");
            if (_context.Version.Any(e => e.Organization == organization))
            {
                Log.Error($"{organization} already exists in the database.");
                return("Sorry, This Organizaition already exits");
            }

            Log.Information("2. Create a new guid");
            var guid = Guid.NewGuid();

            Log.Information("3. Save to the db.Table");
            MyVersion registration = new MyVersion();

            registration.Key          = guid.ToString();
            registration.Organization = organization;
            _context.Add(registration);
            _context.SaveChanges();

            Log.Information("4. Return the guid");
            Log.Information("VersionRepo:NewRegistration:Completed");
            return(guid.ToString());
        }
예제 #2
0
 public SdSubP(ushort id, string name, MyVersion v = null, string info = NA) : base(name, v, info)
 {
     ID   = id;
     ST   = DateTime.Now;
     EAct = delegate { };
     Acts = new Dictionary <uint, Dictionary <uint, Act> >();
     DefA = new Dictionary <uint, Act>();
     AK   = 1;
     AA   = new Dictionary <uint, Ad>();
 }
예제 #3
0
        static void Test()
        {
            string?value = "not null";
            var    flag  = MyString.IsNullOrEmpty(value);
            string?input = "1.0.0.0";
            var    flag1 = MyVersion.TryParse(input, out Version? version);
            var    queue = new MyQueue <string>();

            queue.Enqueue(value);
            var flag2 = queue.TryDequeue(out value);

            flag2 = queue.TryDequeue(out value);
        }
예제 #4
0
        public int CompareTo(CustomDataDirectoryInfo other)
        {
            int intReturn = string.Compare(Name, other.Name, StringComparison.OrdinalIgnoreCase);

            if (intReturn == 0)
            {
                intReturn = string.Compare(DirectoryPath, other.DirectoryPath, StringComparison.OrdinalIgnoreCase);
                //Should basically never happen, because paths are supposed to be unique. But this "future proofs" it.
                if (intReturn == 0)
                {
                    intReturn = MyVersion.CompareTo(other.MyVersion);
                }
            }

            return(intReturn);
        }
예제 #5
0
        static void Test_MaybeNullWhen_NotNullWhen(string?s)
        {
            if (MyString.IsNullOrEmpty(s))
            {
                //这会生成一个警告
                //Console.WriteLine(s.Length);
                return;
            }
            Console.WriteLine(s.Length); //安全

            if (!MyVersion.TryParse(s, out var version))
            {
                //这里有一个警告
                //Console.WriteLine(version.Major);
                return;
            }
            Console.WriteLine(version.Major);
        }
예제 #6
0
        /// <inheritdoc />
        public virtual void Init()
        {
            Debug.Assert(!_init, "Torch instance is already initialized.");
            SpaceEngineersGame.SetupBasicGameInfo();
            SpaceEngineersGame.SetupPerGameSettings();
            ObjectFactoryInitPatch.ForceRegisterAssemblies();

            Debug.Assert(MyPerGameSettings.BasicGameInfo.GameVersion != null, "MyPerGameSettings.BasicGameInfo.GameVersion != null");
            GameVersion = new MyVersion(MyPerGameSettings.BasicGameInfo.GameVersion.Value);

            try
            {
                Console.Title = $"{Config.InstanceName} - Torch {TorchVersion}, SE {GameVersion}";
            }
            catch
            {
                // Running without a console
            }

#if DEBUG
            Log.Info("DEBUG");
#else
            Log.Info("RELEASE");
#endif
            Log.Info($"Torch Version: {TorchVersion}");
            Log.Info($"Game Version: {GameVersion}");
            Log.Info($"Executing assembly: {Assembly.GetEntryAssembly().FullName}");
            Log.Info($"Executing directory: {AppDomain.CurrentDomain.BaseDirectory}");

            Managers.GetManager <PluginManager>().LoadPlugins();
            Game = new VRageGame(this, TweakGameSettings, SteamAppName, SteamAppId, Config.InstancePath, RunArgs);
            if (!Game.WaitFor(VRageGame.GameState.Stopped))
            {
                Log.Warn("Failed to wait for game to be initialized");
            }
            Managers.Attach();
            _init = true;

            if (GameState >= TorchGameState.Created && GameState < TorchGameState.Unloading)
            {
                // safe to commit here; all important static ctors have run
                PatchManager.CommitInternal();
            }
        }
예제 #7
0
    private MyVersion GetVersionNumber()
    {
        var myVersion = new MyVersion(GitVersion);

        return(myVersion);
    }
예제 #8
0
 public InitSubP(string name, MyVersion v = null, string info = "Description " + NA + ".") : base(name, v, info)
 {
     OS.ISP(this);
 }
예제 #9
0
        static void Main(string[] args)
        {
            try
            {
                Settings settings = Settings.Load();
                settings.LogSettings();

                MyVersion myVersion = new MyVersion();

                Console.WriteLine("(1) Do nothing, stay at version {0}", myVersion.Get());
                myVersion.IncreaseBuild();
                Console.WriteLine(String.Format("(2) Increase build version to {0}", myVersion.Get()));
                myVersion.IncreaseMinor();
                Console.WriteLine(String.Format("(3) Increase minor version to {0}", myVersion.Get()));
                myVersion.IncreaseMajor();
                Console.WriteLine(String.Format("(4) Increase major version to {0}", myVersion.Get()));

                Console.WriteLine("---------------------------------------------------------------------------------------------------");
                Console.Write("-> ");

                ConsoleKey response = Console.ReadKey(false).Key;

                switch (response)
                {
                case ConsoleKey.D1:
                    myVersion.Load();
                    break;

                case ConsoleKey.D2:
                    myVersion.Load();
                    myVersion.IncreaseBuild();
                    myVersion.Save();
                    break;

                case ConsoleKey.D3:
                    myVersion.Load();
                    myVersion.IncreaseMinor();
                    myVersion.Save();
                    break;

                case ConsoleKey.D4:
                    myVersion.Load();
                    myVersion.IncreaseMajor();
                    myVersion.Save();
                    break;
                }

                Console.WriteLine();
                Console.WriteLine();

                Console.WriteLine(String.Format("Building version: {0}....", myVersion.Get()));
                Console.WriteLine();

                if (settings.IsSkin)
                {
                    ScreenMerger.Run(false, false, false);
                }


                string libPath  = settings.BuildPath + libPathPrefix;
                string skinPath = settings.BuildPath + skinPathPrefix;

                ClearFolder(libPath);

                if (settings.IsSkin)
                {
                    ClearFolder(skinPath);
                }

                Functions.CopyAll(settings.LibPath, libPath, true);

                if (settings.IsSkin)
                {
                    Functions.CopyAll(settings.SkinPath, skinPath, true);
                }

                Console.WriteLine();

                IpkControlFile ipkControlFile = new IpkControlFile(settings.BuildPath, myVersion.Get());
                ipkControlFile.Generate();
                Console.WriteLine("Ipk control file created");

                //myVersion.Save(settings.ProjectPath + "version.released");

                Console.WriteLine();
                Console.WriteLine("successful finished!");

                Thread.Sleep(5000);
            }
            catch (Exception ex)
            {
                Console.WriteLine();
                Console.WriteLine();
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("Error: {0}\n", ex.Message);
                Console.Write("Error: {0}\n", ex.StackTrace);
                Console.WriteLine();
                Console.Write("Press any key to exit");
                Console.ReadKey();
            }
        }
예제 #10
0
 public SdSubPCmd(ushort id, string name, MyVersion v = null, string info = NA) : base(id, name, v, info)
 {
     CmdR = new Dictionary <string, Cmd> {
         { "help", new Cmd(CmdHelp, "View commands help.", "/help - show available commands;\n/help <command> - show command information.") }
     };
 }
예제 #11
0
 public SubP(string name, string description)
 {
     I.Name        = name;
     V             = null;
     I.Description = description;
 }
예제 #12
0
 public SubP(string name, MyVersion v = null, string description = "Description " + NA + ".")
 {
     I.Name        = name;
     V             = v;
     I.Description = description;
 }
예제 #13
0
 public EchoController(string n, MyVersion v = null, string i = NA) : base(1, n, v, i)
 {
 }