Esempio n. 1
0
        public Form1()
        {
            this.Text = "DroppedBoxx";

            Settings.Instance = new Settings();

            //bust a theme
            Settings.Instance.ReloadTheme();

            Instance = this;
            InitializeComponent();

            Host.Bounds    = Host.ClientBounds;
            Host.BackColor = Color.Empty;

            DropBox = new DropBox();

            //Login should always be open coz scrolling fails with nothing behind the panel... :S
            OpenLogin();

            if (Settings.Instance.RememberMe)
            {
                DropBox.UserLogin = new DroppedBoxx.Code.Responses.UserLogin {
                    Token = Settings.Instance.UserToken, Secret = Settings.Instance.UserSecret
                };
                //auto Login
                OpenFoldersPanel();
            }
        }
Esempio n. 2
0
        //  Main Methode in .Net Core akzeptiert noch kein async
        private static async Task MainAsync(string[] args)
        {
            Console.WriteLine("AZURE WORKSHOP");

            var waitingForCommand = true;

            while (waitingForCommand)
            {
                // Demo auswählen
                var arguments = (Console.ReadLine() ?? string.Empty)
                                .ToLower()
                                .Split((char[])null, StringSplitOptions.RemoveEmptyEntries);

                if (arguments.Length == 0)
                {
                    arguments = new[] { string.Empty }
                }
                ;

                // Demo starten
                switch (arguments[0])
                {
                case "messenger":
                    var messenger = new Messenger(account: arguments.Length > 1 ? arguments[1] : "anonym");
                    await messenger.Start();

                    waitingForCommand = false;
                    break;

                case "dropbox":
                    var dropBox = new DropBox(
                        account: arguments.Length > 1 ? arguments[1] : "anonym",
                        folder: arguments.Length > 2 ? arguments[2] : @"d:\ma-workshop\dropbox\");
                    await dropBox.StartAsync();

                    return;

                case "bibliothek":
                    var bibliothek = new Bibliothek();
                    await bibliothek.StartAsync();

                    return;

                case "exit":
                    waitingForCommand = false;
                    break;

                default:
                    Console.WriteLine("Usage: messenger <account> | dropbox <account> <folder>| elastic | exit");
                    break;
                }
            }

            Console.WriteLine("Ciao");
            Console.ReadLine();
        }
    }
Esempio n. 3
0
    public static string Get_DropBox_Files_Folder()
    {
        string str = File.ReadAllText(DropBox.Get_DropBox_Inastal_Folder() + "\\info.json");

        if (str == "error_1" || str == "error_2")
        {
            return("DropBox not install");
        }
        return(str.Split('"')[5]);
    }
Esempio n. 4
0
        public ActionResult Callback(string state, string code)
        {
            DropBox dropbox = TempData["oauth"] as DropBox;

            dropbox.AccessToken(code);

            byte[] accountInfo =
                dropbox.ConsumeService(new Uri("https://api.dropbox.com/1/account/info"), "POST", null);

            return(Content(Encoding.UTF8.GetString(accountInfo), "text/plain"));
        }
Esempio n. 5
0
 static List<Page> GetPageList()
 {
     using (var dropbox = new DropBox())
     {
         return dropbox["/Archives"]
             .Where(_ => _ is ICloudFileSystemEntry)
             .OrderByDescending(_ => _.Modified)
             .Select(_ => new Page(_))
             .ToList();
     }
 }
 bool IsDropBoxOpen(BasePlayer player, BaseEntity entity)
 {
     if (entity is DropBox)
     {
         DropBox dropboxFront = entity as DropBox;
         if (dropboxFront.PlayerInfront(player))
         {
             return(true);
         }
         return(false);
     }
     return(false);
 }
Esempio n. 7
0
    // Use this for initialization
    void Start()
    {
        Events[] eventDecks = GameObject.FindObjectsOfType <Events>();

        cardDeck = GameObject.FindObjectOfType <Deck>();

        hand = GameObject.FindObjectOfType <Hand>();

        shower = FindObjectOfType <ContentController>();

        dropBox = FindObjectOfType <DropBox>();

        button = FindObjectOfType <AdvanceButton>();

        lifeSegmentBar = FindObjectOfType <LifeSegmentManager>();

        foreach (Events eventDeck in eventDecks)
        {
            switch (eventDeck.DeckMood)
            {
            case eMood.Optimisism:
                optimismEvents = eventDeck;
                break;

            case eMood.Pessismism:
                pessimismEvents = eventDeck;
                break;

            case eMood.Anger:
                angerEvents = eventDeck;
                break;

            case eMood.Chilled:
                chilledEvents = eventDeck;
                break;

            case eMood.eMoodCount:
                throw new UnityException("Invalid deck type");

            default:
                throw new UnityException("Invalid deck type");
            }
        }

        ResetValues();

        gameState = GameState.Begin;
    }
        }                                                               // 边框图片

        /// <summary>
        /// 将方块添加进游戏舞台
        /// </summary>
        /// <param name="dropBox"></param>
        public void AddDropBox(DropBox dropBox)
        {
            int[,] boxData = dropBox.boxData;
            for (int i = 0; i < boxData.GetLength(0); i++)
            {
                for (int j = 0; j < boxData.GetLength(1); j++)
                {
                    if (boxData[i, j] == 1)
                    {
                        DropedBox db = new DropedBox(game);
                        db.color      = dropBox.color;
                        db.Background = dropBox.Background;
                        db.position   = new Vector2(dropBox.position.X + j * DropBox.size,
                                                    dropBox.position.Y + i * DropBox.size);
                        stageBoxs[(int)dropBox.position.Y / DropBox.size + i,
                                  (int)dropBox.position.X / DropBox.size + j] = db;
                    }
                }
            }
        }
Esempio n. 9
0
        public void Sync()
        {
            IsSyncing = true;

            SyncStatus = SyncStatus.Checking;

            //FilesUp = new List<SyncFile>();
            //FilesDown = new List<SyncFile>();
            //FilesNew = new List<MetaData>();
            //FilesSkipped = new List<SyncFile>();
            //FilesSkippedD = new List<MetaData>();

            DropBox           = new DropBox();
            DropBox.UserLogin = Form1.Instance.DropBox.UserLogin;

            var syncThread = new SyncThread();

            syncThreadThread = new Thread(syncThread.Go);
            syncThreadThread.Start();
        }
Esempio n. 10
0
        public ActionResult Index()
        {
            DropBox dropbox = new DropBox(
                "http://localhost:10493/DropBoxOAuth/callback",
                "ulinnbzqxokqxbc",
                "xvjv5j2lokymztr",
                "email");

            string redirectUrl = null;

            dropbox.ReadyRedirect += (s, e) =>
            {
                redirectUrl = e.RedirectUrl;
            };

            dropbox.RequestToken();

            TempData["oauth"] = dropbox;

            return(Redirect(redirectUrl));
        }
Esempio n. 11
0
        public ActionResult AuthorizationCallBack()
        {
            // 4. Get oauth token and uid from Request.Form[]
            var oauth_token = Request["oauth_token"];
            var uid = Request["uid"];

            // 5. Set auth cookie
            if (oauth_token != null && uid != null)
            {
                using (var dropbox = new DropBox())
                {
                    var info = DropBoxStorageProviderTools
                        .GetAccountInformation(dropbox.AccessToken);

                    if (info.UserId == int.Parse(uid))
                        FormsAuthentication.SetAuthCookie(info.DisplayName, true);
                }
            }

            return Redirect("/");
        }
Esempio n. 12
0
    protected override void OnMouseDrag()
    {
        if (disabled)
        {
            return;
        }
        transform.position = cursorOnTransform + dragRelative;
        DropBox nextBox = RaycastMaster.ComponentUnderCursor <DropBox>(collidr);

        if (nextBox)
        {
            dropBox = nextBox;
            dropBox.canAccept(transform);
        }
        else
        {
            if (dropBox)
            {
                dropBox.cancel();
                dropBox = null;
            }
        }
    }
        public ResourcesLIB lib;                                // 资源库

        /// <summary>
        /// 初始化对象
        /// </summary>
        public void InitObjects()
        {
            Rectangle clientBounds = tetris.Window.ClientBounds;

            BigStage.AlphaChange = AlphaChange;
            bigStage             = new BigStage(tetris);

            /* 在整个场景的中间绘制游戏场景 */
            DropBox.size = boxSize;
            gameStage    = new GameStage(new Rectangle((clientBounds.Width - gameStageWidth) / 2,
                                                       (clientBounds.Height - gameStageHeight) / 2, gameStageWidth, gameStageHeight), tetris);

            pointStage = new PointStage(tetris);

            dropBox = new DropBox(tetris);

            input = new InputState();

            table = new Hashtable();

            DropBoxThread = new Thread(new ThreadStart(dropBox.AutoDrop));

            lib = new ResourcesLIB(tetris.Content);
        }
Esempio n. 14
0
    /// <summary>
    /// 随机生成掉落道具ID。可以直接调该方法,在掉落包内随机掉落道具,不需要在掉落包间随机。
    /// </summary>
    /// <param name="dropboxId">dropbox.txt的Id</param>
    /// <param name="droplist">输出生成的DropItem列表</param>
    /// <param name="dropnum">需要生成几个道具,-1表示不限制个数,按表规则掉落</param>
    /// <returns></returns>
    public bool GenerateDropBox(int dropboxId, out ArrayList droplist, int dropnum = -1)
    {
        droplist = null;

        if (!mDropBoxes.ContainsKey(dropboxId) || !DataManager.DropBoxTable.ContainsKey(dropboxId))
        {
            return(false);
        }

        DropBoxTableItem res = DataManager.DropBoxTable[dropboxId] as DropBoxTableItem;

        DropBox box = mDropBoxes[dropboxId] as DropBox;

        if (box == null)
        {
            return(false);
        }

        droplist = new ArrayList();

        if (dropnum > 0)
        {        // 在dropnum次随机中 不允许重复掉落 在掉落组中整体随机
            while (droplist.Count < dropnum)
            {
                int rand   = Random.Range(0, MAX_WEIGHT);
                int weight = 0;
                for (int i = 0; i < box.items.Count; ++i)
                {
                    DropBoxItem item = box.items[i] as DropBoxItem;

                    if ((item.itemweight + weight) > rand)
                    {
                        if (!droplist.Contains(item))
                        {
                            droplist.Add(item);
                        }

                        break;
                    }

                    weight += item.itemweight;
                }
            }
        }
        else
        {        // 未指定掉落个数 不允许重复掉落 每个道具单独随机
            int maxnum = res.maxnum;
            if (maxnum > box.items.Count)
            {
                maxnum = box.items.Count;
            }

            for (int i = 0; i < box.items.Count; ++i)
            {
                int         rand = Random.Range(0, MAX_WEIGHT);
                DropBoxItem item = box.items[i] as DropBoxItem;
                if ((item.itemweight) > rand)
                {
                    if (!droplist.Contains(item))
                    {
                        droplist.Add(item);
                    }
                }

                if (droplist.Count >= maxnum)
                {
                    break;
                }
            }
        }

        return(true);
    }
Esempio n. 15
0
        public Player Simulate5()
        {
            Log.worldId           = WorldId;
            Log.stageId           = StageId;
            Log.waveCount         = _waves.Count;
            Log.clearedWaveNumber = 0;
            Log.newlyCleared      = false;
            Player.SpawnV2();
            TurnNumber = 0;
            for (var i = 0; i < _waves.Count; i++)
            {
                Characters = new SimplePriorityQueue <CharacterBase, decimal>();
                Characters.Enqueue(Player, TurnPriority / Player.SPD);

                WaveNumber = i + 1;
                WaveTurn   = 1;
                _waves[i].SpawnV2(this);
                while (true)
                {
                    // 제한 턴을 넘어서는 경우 break.
                    if (TurnNumber > TurnLimit)
                    {
                        if (i == 0)
                        {
                            Result = BattleLog.Result.Lose;
                            if (StageId < GameConfig.MimisbrunnrStartStageId)
                            {
                                Player.GetExp((int)(Exp * 0.3m), true);
                            }
                        }
                        else
                        {
                            Result = BattleLog.Result.TimeOver;
                        }
                        break;
                    }

                    // 캐릭터 큐가 비어 있는 경우 break.
                    if (!Characters.TryDequeue(out var character))
                    {
                        break;
                    }

                    character.Tick();

                    // 플레이어가 죽은 경우 break;
                    if (Player.IsDead)
                    {
                        if (i == 0)
                        {
                            Result = BattleLog.Result.Lose;
                            if (StageId < GameConfig.MimisbrunnrStartStageId)
                            {
                                Player.GetExp((int)(Exp * 0.3m), true);
                            }
                        }
                        else
                        {
                            Result = BattleLog.Result.Win;
                        }
                        break;
                    }

                    // 플레이어의 타겟(적)이 없는 경우 break.
                    if (!Player.Targets.Any())
                    {
                        Result = BattleLog.Result.Win;
                        Log.clearedWaveNumber = WaveNumber;

                        switch (WaveNumber)
                        {
                        case 1:
                            if (StageId < GameConfig.MimisbrunnrStartStageId)
                            {
                                Player.GetExp(Exp, true);
                            }

                            break;

                        case 2:
                        {
                            ItemMap = Player.GetRewards(_waveRewards);
                            var dropBox = new DropBox(null, _waveRewards);
                            Log.Add(dropBox);
                            var getReward = new GetReward(null, _waveRewards);
                            Log.Add(getReward);
                            break;
                        }

                        default:
                            if (WaveNumber == _waves.Count)
                            {
                                if (!IsCleared)
                                {
                                    Log.newlyCleared = true;
                                }
                            }

                            break;
                        }

                        break;
                    }

                    foreach (var other in Characters)
                    {
                        var current = Characters.GetPriority(other);
                        var speed   = current * 0.6m;
                        Characters.UpdatePriority(other, speed);
                    }

                    Characters.Enqueue(character, TurnPriority / character.SPD);
                }

                // 제한 턴을 넘거나 플레이어가 죽은 경우 break;
                if (TurnNumber > TurnLimit ||
                    Player.IsDead)
                {
                    break;
                }
            }

            Log.result = Result;
            return(Player);
        }
Esempio n. 16
0
        public Player Simulate3()
        {
#if TEST_LOG
            var sb = new System.Text.StringBuilder();
#endif
            Log.worldId           = WorldId;
            Log.stageId           = StageId;
            Log.waveCount         = _waves.Count;
            Log.clearedWaveNumber = 0;
            Log.newlyCleared      = false;
            Player.SpawnV2();
            TurnNumber = 0;
            for (var i = 0; i < _waves.Count; i++)
            {
                Characters = new SimplePriorityQueue <CharacterBase, decimal>();
                Characters.Enqueue(Player, TurnPriority / Player.SPD);

                WaveNumber = i + 1;
                WaveTurn   = 1;
                _waves[i].SpawnV2(this);
#if TEST_LOG
                sb.Clear();
                sb.Append($"{nameof(TurnNumber)}: {TurnNumber}");
                sb.Append($" / {nameof(WaveNumber)}: {WaveNumber}");
                sb.Append($" / {nameof(WaveTurn)}: {WaveTurn}");
                sb.Append(" / Wave Start");
                UnityEngine.Debug.LogWarning(sb.ToString());
#endif
                while (true)
                {
                    // 제한 턴을 넘어서는 경우 break.
                    if (TurnNumber > TurnLimit)
                    {
                        if (i == 0)
                        {
                            Result = BattleLog.Result.Lose;
                            if (StageId < GameConfig.MimisbrunnrStartStageId)
                            {
                                Player.GetExp3((int)(Exp * 0.3m), true);
                            }
                        }
                        else
                        {
                            Result = BattleLog.Result.TimeOver;
                        }
#if TEST_LOG
                        sb.Clear();
                        sb.Append($"{nameof(TurnNumber)}: {TurnNumber}");
                        sb.Append($" / {nameof(WaveNumber)}: {WaveNumber}");
                        sb.Append($" / {nameof(WaveTurn)}: {WaveTurn}");
                        sb.Append($" / {nameof(TurnLimit)}: {TurnLimit}");
                        sb.Append($" / {nameof(Result)}: {Result.ToString()}");
                        UnityEngine.Debug.LogWarning(sb.ToString());
#endif
                        break;
                    }

                    // 캐릭터 큐가 비어 있는 경우 break.
                    if (!Characters.TryDequeue(out var character))
                    {
                        break;
                    }
#if TEST_LOG
                    var turnBefore = TurnNumber;
#endif
                    character.Tick();
#if TEST_LOG
                    var turnAfter = TurnNumber;
                    if (turnBefore != turnAfter)
                    {
                        sb.Clear();
                        sb.Append($"{nameof(TurnNumber)}: {TurnNumber}");
                        sb.Append($" / {nameof(WaveNumber)}: {WaveNumber}");
                        sb.Append($" / {nameof(WaveTurn)}: {WaveTurn}");
                        sb.Append(" / Turn End");
                        UnityEngine.Debug.LogWarning(sb.ToString());
                    }
#endif

                    // 플레이어가 죽은 경우 break;
                    if (Player.IsDead)
                    {
                        if (i == 0)
                        {
                            Result = BattleLog.Result.Lose;
                            if (StageId < GameConfig.MimisbrunnrStartStageId)
                            {
                                Player.GetExp3((int)(Exp * 0.3m), true);
                            }
                        }
                        else
                        {
                            Result = BattleLog.Result.Win;
                        }
#if TEST_LOG
                        sb.Clear();
                        sb.Append($"{nameof(TurnNumber)}: {TurnNumber}");
                        sb.Append($" / {nameof(WaveNumber)}: {WaveNumber}");
                        sb.Append($" / {nameof(WaveTurn)}: {WaveTurn}");
                        sb.Append($" / {nameof(Player)} Dead");
                        sb.Append($" / {nameof(Result)}: {Result.ToString()}");
                        UnityEngine.Debug.LogWarning(sb.ToString());
#endif
                        break;
                    }

                    // 플레이어의 타겟(적)이 없는 경우 break.
                    if (!Player.Targets.Any())
                    {
                        Result = BattleLog.Result.Win;
                        Log.clearedWaveNumber = WaveNumber;

                        switch (WaveNumber)
                        {
                        case 1:
                            if (StageId < GameConfig.MimisbrunnrStartStageId)
                            {
                                Player.GetExp3(Exp, true);
                            }

                            break;

                        case 2:
                        {
                            ItemMap = Player.GetRewards2(_waveRewards);
                            var dropBox = new DropBox(null, _waveRewards);
                            Log.Add(dropBox);
                            var getReward = new GetReward(null, _waveRewards);
                            Log.Add(getReward);
                            break;
                        }

                        default:
                            if (WaveNumber == _waves.Count)
                            {
                                if (!IsCleared)
                                {
                                    Log.newlyCleared = true;
                                }
                            }

                            break;
                        }

                        break;
                    }

                    foreach (var other in Characters)
                    {
                        var current = Characters.GetPriority(other);
                        var speed   = current * 0.6m;
                        Characters.UpdatePriority(other, speed);
                    }

                    Characters.Enqueue(character, TurnPriority / character.SPD);
                }

                // 제한 턴을 넘거나 플레이어가 죽은 경우 break;
                if (TurnNumber > TurnLimit ||
                    Player.IsDead)
                {
                    break;
                }
            }

            Log.result = Result;
#if TEST_LOG
            sb.Clear();
            sb.Append($"{nameof(TurnNumber)}: {TurnNumber}");
            sb.Append($" / {nameof(WaveNumber)}: {WaveNumber}");
            sb.Append($" / {nameof(WaveTurn)}: {WaveTurn}");
            sb.Append($" / {nameof(Simulate)} End");
            sb.Append($" / {nameof(Result)}: {Result.ToString()}");
            UnityEngine.Debug.LogWarning(sb.ToString());
#endif
            return(Player);
        }
Esempio n. 17
0
        /********/

        public void SetDBB(DropBox _DBB)
        {
            DBB = _DBB;
        }
Esempio n. 18
0
    public static void Main()
    {
        int minLength = int.MaxValue;
        int maxLength = 0;
        int minWidth = int.MaxValue;
        int maxWidth = 0;

        FileStream inputStream = new FileStream("Tests/test_2d_binpacking.in", FileMode.Open, FileAccess.Read);
        StreamReader sr = new StreamReader(inputStream);
        int n = int.Parse(sr.ReadLine());
        Tuple<int, int>[] files = new Tuple<int, int>[n];
        //create a tuple of length&width representing all files.
        for (int i = 0; i < n; i++)
        {
            string[] inputs = sr.ReadLine().Split(' ');
            int templength = int.Parse(inputs[0]);
            int tempwidth = int.Parse(inputs[1]);
            int length = Math.Max(templength, tempwidth);
            int width = Math.Min(templength, tempwidth);
            files[i] = new Tuple<int, int>(length, width);
            maxLength += length;
            maxWidth += width;
            minLength = Math.Min(minLength, length);
            minWidth = Math.Min(minWidth, width);
        }

        int dropBoxLength = minLength;
        int dropBoxWidth = maxWidth;
        int bestArea = maxWidth * maxLength;
        int bestWidth = maxWidth;
        int bestLength = maxLength;
        string treeDump = string.Empty;
        //heuristics as described in summary at top
        while (dropBoxLength <= maxLength && dropBoxWidth >= minWidth)
        {
            if (dropBoxLength * dropBoxWidth < bestArea)
            {
                DropBox dp = new DropBox(files, dropBoxLength, dropBoxWidth);
                if (dp.IsStable)
                {
                    bestArea = dropBoxLength * dropBoxWidth;
                    bestWidth = dropBoxWidth;
                    bestLength = dropBoxLength;
                    dropBoxWidth--;
                    treeDump = dp.Dump();
                    continue;
                }
                else
                {
                    dropBoxLength++;
                    continue;
                }
            }
            dropBoxWidth--;
        }
        //Console.WriteLine ("({1},{2}),{0}", bestArea, bestLength, bestWidth);
        Console.WriteLine("{0}", bestArea);
        Console.Error.WriteLine(treeDump);
    }
Esempio n. 19
0
        private Content BuildContentCache()
        {
            using (var dropbox = new DropBox())
            {
                var remote_file = string.Format("/Archives/{0}", Name);

                var local_dir = Path.GetTempPath();
                dropbox.Storage.DownloadFile(remote_file, local_dir);

                var local_file = Path.Combine(local_dir, Name);
                var text = File.ReadAllText(local_file);

                string body = null;
                string side_bar = null;

                switch (PageType)
                {
                    case PageType.Markdown:
                        var content = text.Split(
                            new string[] { "\r\n---\r\n" },
                            StringSplitOptions.RemoveEmptyEntries
                        );

                        /* SideBar */
                        if (content.Length > 1)
                        {
                            side_bar = content[1];
                            side_bar = ProcessBlocks(side_bar);
                            side_bar = markdown.Transform(side_bar);
                        }

                        /* Body */
                        {
                            body = content[0];
                            body = ProcessFootnotes(body);
                            body = ProcessBlocks(body);
                            body = markdown.Transform(body);
                        }

                        return new Content(body, side_bar);

                    case PageType.Html:
                        body = text;
                        body = ProcessBlocks(body);

                        return new Content(body, side_bar);

                    default:
                        throw new Exception("コンテンツタイプが不明です。");
                }
            }
        }
Esempio n. 20
0
        private void showState1()
        {
            #region stat1
            goButton = new Button
            {
                VerticalAlignment   = VerticalAlignment.Center,             // Vertical alignment within the parent control
                HorizontalAlignment = HorizontalAlignment.Center,           // Horizontal alignment within the parent control
                Background          = new SolidColorBrush(Colors.Gray),     // Color of button
                Foreground          = new SolidColorBrush(Colors.Black),    // Color of text written on button
                Padding             = new Thickness(Screen.NormalFontSize), // Padding is using predefined constant NormalFontSize that depends
                // on client device screen size
                WrapContent = true,                                         // The button "wraps" its text with given padding
                Font        = new Font(new FontFamily("Arial"),             // Font for drawing text
                                       0.5 * Screen.LargeFontSize),         // LargeFontSize is a predefined constant that depends on client device screen size
                Text = "Показать расписание",
            };

            source = new TextBlock
            {
                VerticalAlignment   = VerticalAlignment.Center,                 // Vertical alignment within the parent control
                HorizontalAlignment = HorizontalAlignment.Center,               // Horizontal alignment within the parent control
                WrapContent         = true,                                     // If we don't set WrapContent attribute, the text block will
                Font = new Font(new FontFamily("Arial"), Screen.LargeFontSize), // Font for drawing text. LargeFontSize is a predefined constant
                Text = "Откуда",
            };

            target = new TextBlock
            {
                VerticalAlignment   = VerticalAlignment.Center,                 // Vertical alignment within the parent control
                HorizontalAlignment = HorizontalAlignment.Center,               // Horizontal alignment within the parent control
                WrapContent         = true,                                     // If we don't set WrapContent attribute, the text block will
                Font = new Font(new FontFamily("Arial"), Screen.LargeFontSize), // Font for drawing text. LargeFontSize is a predefined constant
                Text = "Куда",
            };
            dropBox1 = new DropBox
            {
                VerticalAlignment   = VerticalAlignment.Center,         // Vertical alignment within the parent control
                HorizontalAlignment = HorizontalAlignment.Center,       // Horizontal alignment within the parent control
                //Background = new SolidColorBrush(Colors.White),         // Color of button
                //Foreground = new SolidColorBrush(Colors.White),        // Color of text written on button
                Padding = new Thickness(Screen.NormalFontSize),        // Padding is using predefined constant NormalFontSize that depends
                // on client device screen size
                WrapContent = true,                                    // The button "wraps" its text with given padding
                Font        = new Font(new FontFamily("Arial"),        // Font for drawing text
                                       0.5 * Screen.LargeFontSize),    // LargeFontSize is a predefined constant that depends on client device screen size
                ItemList = new List <string>(new string[] { "Мартышкино", "Университет", "Старый Петергоф", "Новый Петергоф",
                                                            "Стрельна", "Сергиево", "Сосновая Полняна", "Лигово", "Ульянка", "Дачное", "Ленинский Проспект", "Санкт-Петербург" }),
            };

            dropBox2 = new DropBox
            {
                VerticalAlignment   = VerticalAlignment.Center,         // Vertical alignment within the parent control
                HorizontalAlignment = HorizontalAlignment.Center,       // Horizontal alignment within the parent control
                //Background = new SolidColorBrush(Colors.White),         // Color of button
                //Foreground = new SolidColorBrush(Colors.White),        // Color of text written on button
                Padding = new Thickness(Screen.NormalFontSize),        // Padding is using predefined constant NormalFontSize that depends
                // on client device screen size
                WrapContent = true,                                    // The button "wraps" its text with given padding
                Font        = new Font(new FontFamily("Arial"),        // Font for drawing text
                                       0.5 * Screen.LargeFontSize),    // LargeFontSize is a predefined constant that depends on client device screen size
                ItemList = new List <string>(new string[] { "Мартышкино", "Университет", "Старый Петергоф", "Новый Петергоф",
                                                            "Стрельна", "Сергиево", "Сосновая Полняна", "Лигово", "Ульянка", "Дачное", "Ленинский Проспект", "Санкт-Петербург" }),
            };
            #endregion
            goButton.Pressed += (s, e) => SwitchState();
            DropBox dropBox = new DropBox {
            };

            var panel = new StackPanel
            {
                Children =
                {
                    new Cell               {
                        Content =
                            new StackPanel {
                            Orientation = Orientation.Horizontal,
                            Children    =
                            {
                                new Cell   {
                                    Content = new StackPanel{
                                        Children ={ new Cell         {
                                                 Content = source
                                             }, new Cell {
                                                 Content = dropBox1,
                                             } }, Orientation = Orientation.Vertical
                                    }
                                },
                                new Cell   {
                                    Content = new StackPanel{
                                        Children ={ new Cell         {
                                                 Content = target
                                             }, new Cell {
                                                 Content = dropBox2
                                             } }, Orientation = Orientation.Vertical
                                    }
                                },
                            }
                        }
                    },
                    new Cell               {
                        Content = goButton
                    },
                },
            };
            Screen.Content = panel;
        }
Esempio n. 21
0
 public void Start()
 {
     ParentScript = GetComponentInParent <DropBox>();
 }
Esempio n. 22
0
    // 初始化
    public void InitDataStruct()
    {
        mDropGroups = new Dictionary <int, DropGroup>();
        System.Type           grouptype = typeof(DropGroupTableItem);
        IDictionaryEnumerator itr       = DataManager.DropGroupTable.GetEnumerator();

        while (itr.MoveNext())
        {
            DropGroupTableItem res       = itr.Value as DropGroupTableItem;
            DropGroup          dropgroup = new DropGroup();
            dropgroup.items = new ArrayList();
            dropgroup.id    = res.id;

            for (int i = 0; i < DropGroupTableItem.MAX_ITEM_NUM; ++i)
            {
                System.Reflection.FieldInfo fieldid = grouptype.GetField("dropBoxId" + i.ToString());
                int dropboxid = (int)fieldid.GetValue(res);

                System.Reflection.FieldInfo fieldweight = grouptype.GetField("dropBoxWeight" + i.ToString());
                int dropboxweight = (int)fieldweight.GetValue(res);

                if (dropboxid < 0 || dropboxweight < 1)
                {
                    break;
                }

                DropGroupItem item = new DropGroupItem();
                item.dropboxid     = dropboxid;
                item.dropboxweight = dropboxweight;

                dropgroup.items.Add(item);
            }

            mDropGroups.Add(res.id, dropgroup);
        }
//      foreach (DropGroupTableItem res in DataManager.DropGroupTable.Values)
//      {
//          DropGroup dropgroup = new DropGroup();
//          dropgroup.items = new ArrayList();
//          dropgroup.id = res.id;
//
//          for (int i = 0; i < DropGroupTableItem.MAX_ITEM_NUM; ++i)
//          {
//              System.Reflection.FieldInfo fieldid = grouptype.GetField("dropBoxId" + i.ToString());
//              int dropboxid = (int)fieldid.GetValue(res);
//
//              System.Reflection.FieldInfo fieldweight = grouptype.GetField("dropBoxWeight" + i.ToString());
//              int dropboxweight = (int)fieldweight.GetValue(res);
//
//              if (dropboxid < 0 || dropboxweight < 1)
//              {
//                  break;
//              }
//
//              DropGroupItem item = new DropGroupItem();
//              item.dropboxid = dropboxid;
//              item.dropboxweight = dropboxweight;
//
//              dropgroup.items.Add(item);
//          }
//
//          mDropGroups.Add(res.id, dropgroup);
//      }

        mDropBoxes = new Dictionary <int, DropBox>();

        System.Type type = typeof(DropBoxTableItem);
        itr = DataManager.DropBoxTable.GetEnumerator();
        while (itr.MoveNext())
        {
            DropBoxTableItem res     = itr.Value as DropBoxTableItem;
            DropBox          dropbox = new DropBox();
            dropbox.items = new ArrayList();
            dropbox.id    = res.id;
            dropbox.desc  = res.desc;

            for (int i = 0; i < DropBoxTableItem.MAX_ITEM_NUM; ++i)
            {
                System.Reflection.FieldInfo fieldid = type.GetField("itemid" + i.ToString());
                int itemid = (int)fieldid.GetValue(res);

                System.Reflection.FieldInfo fieldnum = type.GetField("itemnum" + i.ToString());
                int itemnum = (int)fieldnum.GetValue(res);

                System.Reflection.FieldInfo fieldweight = type.GetField("itemweight" + i.ToString());
                int itemweight = (int)fieldweight.GetValue(res);

                if (itemid < 0 || itemnum < 1 || itemweight < 1)
                {
                    break;
                }

                DropBoxItem item = new DropBoxItem();
                item.itemid            = itemid;
                item.itemnum           = itemnum;
                item.itemweight        = itemweight;
                item.isItemOrCondition = res.isItemId > 0;

                dropbox.items.Add(item);
            }

            mDropBoxes.Add(res.id, dropbox);
        }
//      foreach(DropBoxTableItem res in DataManager.DropBoxTable.Values)
//      {
//
//      }
    }
Esempio n. 23
0
        static void Main(string[] args)
        {
            Console.WriteLine("Application start");
            try
            {
                LogUtils.Log("*********** APP STARTED **********");
                LogUtils.Log("Step # 1 : Unmapping previous drive.");

                string UserLinks = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Links\\Cloud Drive.lnk");

                MirrorUtils.UnmapDrive(ApplicationSettings.MappedDriveLetter);

                if (!Directory.Exists(ApplicationSettings.MappedFolder))
                {
                    Directory.CreateDirectory(ApplicationSettings.MappedFolder);
                }

                ResourceUtils.SetFolderIcon(ApplicationSettings.MappedFolder, "Cloude Plus Drive");

                LogUtils.Log("Removing favoriates....");
                if (File.Exists(UserLinks))
                {
                    File.Delete(UserLinks);
                }

                LogUtils.Log("Adding folder into favoriates");

                try
                {
                    MirrorUtils.CreateShortcut(ApplicationSettings.MappedFolder, UserLinks, "", "", "", Path.GetDirectoryName(UserLinks));
                }
                catch
                {
                }

                // this is comment by masroor
                LogUtils.Log(string.Format("Mapping drive {0} at {1}", ApplicationSettings.MappedDriveLetter, ApplicationSettings.MappedFolder));
                MirrorUtils.MapDrive(ApplicationSettings.MappedDriveLetter, ApplicationSettings.MappedFolder);
                MirrorUtils.SetDriveIcon(ApplicationSettings.MappedDriveLetter);

                LogUtils.Log("drive mapped");
                MirrorUtils.DisplayDriveInfo();
                ResourceUtils.RecreateAllExecutableResources();

                ICloudService dropbox     = new DropBox();
                ICloudService googledrive = new GoogleDrive();
                ICloudService copydrive   = new CopyDrive();
                ICloudService onedrive    = new OneDrive();
                ICloudService amazon      = new AmazonDrive();

                dropbox.AvaiableMemoryInBytes     = DirectoryUtils.SizeInBytes(0, 2, 512, 0, 0);
                googledrive.AvaiableMemoryInBytes = DirectoryUtils.SizeInBytes(0, 15, 0, 0, 0);
                copydrive.AvaiableMemoryInBytes   = DirectoryUtils.SizeInBytes(0, 15, 0, 0, 0);
                onedrive.AvaiableMemoryInBytes    = DirectoryUtils.SizeInBytes(0, 7, 0, 0, 0);
                amazon.AvaiableMemoryInBytes      = DirectoryUtils.SizeInBytes(0, 5, 0, 0, 0);

                LogUtils.Log("Unmapping drives...");
                LogUtils.Log(string.Format("Unmapping Dropbox: {0}", MirrorUtils.UnmapFolder(dropbox.ApplicationName)));
                LogUtils.Log(string.Format("Unmapping Google Drive: {0}", MirrorUtils.UnmapFolder(googledrive.ApplicationName)));
                LogUtils.Log(string.Format("Unmapping Copy Drive: {0}", MirrorUtils.UnmapFolder(copydrive.ApplicationName)));
                LogUtils.Log(string.Format("Unmapping One Drive: {0}", MirrorUtils.UnmapFolder(onedrive.ApplicationName)));
                LogUtils.Log(string.Format("Unmapping Amazon: {0}", MirrorUtils.UnmapFolder(amazon.ApplicationName)));

                LogUtils.Log(string.Format("Dropbox installed status: {0}", dropbox.IsInstalled));
                LogUtils.Log(string.Format("Dropbox client folder: {0}", dropbox.ClientFolder));
                LogUtils.Log(string.Format("Dropbox folder status: {0}", dropbox.ClientFolderExists ? "Exists" : "Not Exists"));
                LogUtils.Log(string.Format("Dropbox Drive Available Space: {0}", DirectoryUtils.PretifyBytes(dropbox.AvaiableMemoryInBytes)));
                LogUtils.Log(string.Format("Dropbox Drive Used Space: {0}", DirectoryUtils.PretifyBytes(dropbox.UsedMemoryInBytes)));
                LogUtils.Log(string.Format("Dropbox Drive mapping : {0}", MirrorUtils.MapFolder(dropbox)));
                LogUtils.Log("---------------------------------------------------------------");

                LogUtils.Log(string.Format("Amazon Drive installed status: {0}", amazon.IsInstalled));
                LogUtils.Log(string.Format("Amazon client folder: {0}", amazon.ClientFolder));
                LogUtils.Log(string.Format("Amazon folder status: {0}", amazon.ClientFolderExists ? "Exists" : "Not Exists"));
                LogUtils.Log(string.Format("Amazon Drive Available Space: {0}", DirectoryUtils.PretifyBytes(amazon.AvaiableMemoryInBytes)));
                LogUtils.Log(string.Format("Amazon Drive Used Space: {0}", DirectoryUtils.PretifyBytes(amazon.UsedMemoryInBytes)));
                LogUtils.Log(string.Format("Amazon Drive mapping : {0}", MirrorUtils.MapFolder(amazon)));
                LogUtils.Log("---------------------------------------------------------------");

                LogUtils.Log(string.Format("One Drive installed status: {0}", onedrive.IsInstalled));
                LogUtils.Log(string.Format("One Drive Client Folder: {0}", onedrive.ClientFolder));
                LogUtils.Log(string.Format("One Drive folder status: {0}", onedrive.ClientFolderExists ? "Exists" : "Not Exists"));
                LogUtils.Log(string.Format("One Drive Available Size: {0}", DirectoryUtils.PretifyBytes(onedrive.AvaiableMemoryInBytes)));
                LogUtils.Log(string.Format("One Drive Used Size: {0}", DirectoryUtils.PretifyBytes(onedrive.UsedMemoryInBytes)));
                LogUtils.Log(string.Format("One Drive mapping : {0}", MirrorUtils.MapFolder(onedrive)));
                LogUtils.Log("---------------------------------------------------------------");

                LogUtils.Log(string.Format("Copy Drive installed status: {0}", copydrive.IsInstalled));
                LogUtils.Log(string.Format("Copy Drive Client Folder: {0}", copydrive.ClientFolder));
                LogUtils.Log(string.Format("Copy Drive folder status: {0}", copydrive.ClientFolderExists ? "Exists" : "Not Exists"));
                LogUtils.Log(string.Format("Copy Drive Available Size: {0}", DirectoryUtils.PretifyBytes(copydrive.AvaiableMemoryInBytes)));
                LogUtils.Log(string.Format("Copy Drive Used Size: {0}", DirectoryUtils.PretifyBytes(copydrive.UsedMemoryInBytes)));
                LogUtils.Log(string.Format("Copy Drive mapping : {0}", MirrorUtils.MapFolder(copydrive)));
                LogUtils.Log("---------------------------------------------------------------");

                LogUtils.Log(string.Format("Google Drive installed status: {0}", googledrive.IsInstalled));
                LogUtils.Log(string.Format("Google Drive Client Folder: {0}", googledrive.ClientFolder));
                LogUtils.Log(string.Format("Google Drive folder status: {0}", googledrive.ClientFolderExists ? "Exists" : "Not Exists"));
                LogUtils.Log(string.Format("Google Drive Available Size: {0}", DirectoryUtils.PretifyBytes(googledrive.AvaiableMemoryInBytes)));
                LogUtils.Log(string.Format("Google Drive Used Size: {0}", DirectoryUtils.PretifyBytes(googledrive.UsedMemoryInBytes)));
                LogUtils.Log(string.Format("Google Drive mapping : {0}", MirrorUtils.MapFolder(googledrive)));
            }
            catch (Exception ex)
            {
                LogUtils.LogE(ex);
            }
            Console.WriteLine("Press any key to end");
            Console.Read();
        }
Esempio n. 24
0
    public void InstantiateDropBox(Vector3 pos)
    {
        DropBox dB = Instantiate(dropBox, pos, Quaternion.identity).GetComponent <DropBox>();

        dB.Init_DropBox();
    }